authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-26 07:03:38+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-26 07:03:38+02:00
loga83aad152b502ab205f4f6f6c4f70a25b2fa955d
tree6e073a56aa5955e5da24ade26508fa60a3a4f78a
parentf0a7e3ccae45ce7d09038204c16155d5b98ad560
parent8443e2ab43000a4b196d3a6014655c77f054d893

Merge pull request 'LLVM 22' (#32013) from llvm22 into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32013

730 files changed, 34010 insertions(+), 24951 deletions(-)

CMakeLists.txt+3-3
......@@ -133,9 +133,9 @@ else()
133133 set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig")
134134endif()
135135
136find_package(llvm 21)
137find_package(clang 21)
138find_package(lld 21)
136find_package(llvm 22)
137find_package(clang 22)
138find_package(lld 22)
139139
140140if(ZIG_STATIC_ZLIB)
141141 if (MSVC)
build.zig+14-6
......@@ -1206,13 +1206,16 @@ const zig_cpp_sources = [_][]const u8{
12061206const clang_libs = [_][]const u8{
12071207 "clangFrontendTool",
12081208 "clangCodeGen",
1209 "clangStaticAnalyzerFrontend",
1210 "clangStaticAnalyzerCheckers",
1211 "clangStaticAnalyzerCore",
1212 "clangCrossTU",
12091213 "clangFrontend",
12101214 "clangDriver",
1215 "clangOptions",
12111216 "clangSerialization",
12121217 "clangSema",
1213 "clangStaticAnalyzerFrontend",
1214 "clangStaticAnalyzerCheckers",
1215 "clangStaticAnalyzerCore",
1218 "clangAnalysisLifetimeSafety",
12161219 "clangAnalysis",
12171220 "clangASTMatchers",
12181221 "clangAST",
......@@ -1224,8 +1227,9 @@ const clang_libs = [_][]const u8{
12241227 "clangLex",
12251228 "clangRewriteFrontend",
12261229 "clangRewrite",
1227 "clangCrossTU",
12281230 "clangIndex",
1231 "clangFormat",
1232 "clangToolingInclusions",
12291233 "clangToolingCore",
12301234 "clangExtractAPI",
12311235 "clangSupport",
......@@ -1373,11 +1377,12 @@ const llvm_libs = [_][]const u8{
13731377 "LLVMObjCopy",
13741378 "LLVMMCA",
13751379 "LLVMMCDisassembler",
1380 "LLVMDTLTO",
13761381 "LLVMLTO",
13771382 "LLVMFrontendOpenACC",
1378 "LLVMFrontendHLSL",
13791383 "LLVMFrontendDriver",
13801384 "LLVMExtensions",
1385 "LLVMPlugins",
13811386 "LLVMPasses",
13821387 "LLVMHipStdPar",
13831388 "LLVMCoroutines",
......@@ -1404,6 +1409,7 @@ const llvm_libs = [_][]const u8{
14041409 "LLVMObjCARCOpts",
14051410 "LLVMCodeGenTypes",
14061411 "LLVMCGData",
1412 "LLVMCAS",
14071413 "LLVMIRPrinter",
14081414 "LLVMInterfaceStub",
14091415 "LLVMFileCheck",
......@@ -1422,15 +1428,17 @@ const llvm_libs = [_][]const u8{
14221428 "LLVMDebugInfoCodeView",
14231429 "LLVMDebugInfoGSYM",
14241430 "LLVMDebugInfoDWARF",
1425 "LLVMDebugInfoDWARFLowLevel",
14261431 "LLVMObject",
14271432 "LLVMTextAPI",
14281433 "LLVMMCParser",
14291434 "LLVMIRReader",
14301435 "LLVMAsmParser",
14311436 "LLVMMC",
1437 "LLVMDebugInfoDWARFLowLevel",
14321438 "LLVMBitReader",
1439 "LLVMFrontendHLSL",
14331440 "LLVMFuzzerCLI",
1441 "LLVMABI",
14341442 "LLVMCore",
14351443 "LLVMRemarks",
14361444 "LLVMBitstreamReader",
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.16.0-dev.2287+eb3f16db5"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.2287+eb3f16db5"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-macos-debug.sh+1-1
......@@ -8,7 +8,7 @@ set -e
88ZIGDIR="$PWD"
99TARGET="aarch64-macos-none"
1010MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
1212PREFIX="$HOME/$CACHE_BASENAME"
1313ZIG="$PREFIX/bin/zig"
1414
ci/aarch64-macos-release.sh+1-1
......@@ -8,7 +8,7 @@ set -e
88ZIGDIR="$PWD"
99TARGET="aarch64-macos-none"
1010MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
1212PREFIX="$HOME/$CACHE_BASENAME"
1313ZIG="$PREFIX/bin/zig"
1414
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.16.0-dev.2287+eb3f16db5"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.2287+eb3f16db5"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-windows.ps1+1-1
......@@ -1,5 +1,5 @@
11$TARGET = "aarch64-windows-gnu"
2$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.16.0-dev.104+689461e31"
2$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
33$MCPU = "baseline"
44$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
55$PREFIX_PATH = "$(Get-Location)\..\$ZIG_LLVM_CLANG_LLD_NAME"
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.16.0-dev.157+7fdd60df1"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.157+7fdd60df1"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.1594+9fa433d71"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.1594+9fa433d71"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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-riscv64-linux-musl-0.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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-riscv64-linux-musl-0.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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="z15"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1354+94e98bfe8"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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="z15"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1354+94e98bfe8"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.312+164c598cd"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.312+164c598cd"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.104+689461e31"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.2287+eb3f16db5"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.2287+eb3f16db5"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.2051+28b83e3b0"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.2051+28b83e3b0"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
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.16.0-dev.104+689461e31"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
44$ZIG = "$PREFIX_PATH\bin\zig.exe"
55$ZIG_LIB_DIR = "$(Get-Location)\lib"
66$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
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.16.0-dev.104+689461e31"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
44$ZIG = "$PREFIX_PATH\bin\zig.exe"
55$ZIG_LIB_DIR = "$(Get-Location)\lib"
66$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
cmake/Findclang.cmake+12-8
......@@ -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.21
21 libclang-cpp.so.21.1
22 clang-cpp-21.0
23 clang-cpp210
20 libclang-cpp.so.22
21 libclang-cpp.so.22.1
22 clang-cpp-22.0
23 clang-cpp220
2424 clang-cpp
2525 NAMES_PER_DIR
2626 HINTS "${LLVM_LIBDIRS}"
......@@ -44,13 +44,16 @@ else()
4444
4545 FIND_AND_ADD_CLANG_LIB(clangFrontendTool)
4646 FIND_AND_ADD_CLANG_LIB(clangCodeGen)
47 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerFrontend)
48 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCheckers)
49 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCore)
50 FIND_AND_ADD_CLANG_LIB(clangCrossTU)
4751 FIND_AND_ADD_CLANG_LIB(clangFrontend)
4852 FIND_AND_ADD_CLANG_LIB(clangDriver)
53 FIND_AND_ADD_CLANG_LIB(clangOptions)
4954 FIND_AND_ADD_CLANG_LIB(clangSerialization)
5055 FIND_AND_ADD_CLANG_LIB(clangSema)
51 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerFrontend)
52 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCheckers)
53 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCore)
56 FIND_AND_ADD_CLANG_LIB(clangAnalysisLifetimeSafety)
5457 FIND_AND_ADD_CLANG_LIB(clangAnalysis)
5558 FIND_AND_ADD_CLANG_LIB(clangASTMatchers)
5659 FIND_AND_ADD_CLANG_LIB(clangAST)
......@@ -62,8 +65,9 @@ else()
6265 FIND_AND_ADD_CLANG_LIB(clangLex)
6366 FIND_AND_ADD_CLANG_LIB(clangRewriteFrontend)
6467 FIND_AND_ADD_CLANG_LIB(clangRewrite)
65 FIND_AND_ADD_CLANG_LIB(clangCrossTU)
6668 FIND_AND_ADD_CLANG_LIB(clangIndex)
69 FIND_AND_ADD_CLANG_LIB(clangFormat)
70 FIND_AND_ADD_CLANG_LIB(clangToolingInclusions)
6771 FIND_AND_ADD_CLANG_LIB(clangToolingCore)
6872 FIND_AND_ADD_CLANG_LIB(clangExtractAPI)
6973 FIND_AND_ADD_CLANG_LIB(clangSupport)
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-21/include
13 /usr/local/llvm210/include
14 /usr/local/llvm21/include
15 /usr/local/opt/lld@21/include
16 /opt/homebrew/opt/lld@21/include
17 /home/linuxbrew/.linuxbrew/opt/lld@21/include
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
1818 /mingw64/include)
1919
20find_library(LLD_LIBRARY NAMES lld-21.0 lld210 lld NAMES_PER_DIR
20find_library(LLD_LIBRARY NAMES lld-22.0 lld220 lld NAMES_PER_DIR
2121 HINTS ${LLVM_LIBDIRS}
2222 PATHS
23 /usr/lib/llvm-21/lib
24 /usr/local/llvm210/lib
25 /usr/local/llvm21/lib
26 /usr/local/opt/lld@21/lib
27 /opt/homebrew/opt/lld@21/lib
28 /home/linuxbrew/.linuxbrew/opt/lld@21/lib
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
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-21/lib
40 /usr/local/llvm210/lib
41 /usr/local/llvm21/lib
42 /usr/local/opt/lld@21/lib
43 /opt/homebrew/opt/lld@21/lib
44 /home/linuxbrew/.linuxbrew/opt/lld@21/lib
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
4545 /mingw64/lib
4646 /c/msys64/mingw64/lib
4747 c:/msys64/mingw64/lib)
cmake/Findllvm.cmake+12-8
......@@ -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-21 llvm-config-21.0 llvm-config210 llvm-config21 llvm-config NAMES_PER_DIR
20 NAMES llvm-config-22 llvm-config-22.0 llvm-config220 llvm-config22 llvm-config NAMES_PER_DIR
2121 PATHS
2222 "/mingw64/bin"
2323 "/c/msys64/mingw64/bin"
2424 "c:/msys64/mingw64/bin"
25 "C:/Libraries/llvm-21.0.0/bin")
25 "C:/Libraries/llvm-22.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 21 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 22 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 22)
43 if("${LLVM_CONFIG_VERSION}" VERSION_LESS 22 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 23 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 23)
4444 # Save the error message, in case this is the last llvm-config we find
45 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 21.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
45 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 22.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 21.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
69 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 22.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
7070 else()
71 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 21.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
71 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 22.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
......@@ -321,11 +321,12 @@ else()
321321 FIND_AND_ADD_LLVM_LIB(LLVMObjCopy)
322322 FIND_AND_ADD_LLVM_LIB(LLVMMCA)
323323 FIND_AND_ADD_LLVM_LIB(LLVMMCDisassembler)
324 FIND_AND_ADD_LLVM_LIB(LLVMDTLTO)
324325 FIND_AND_ADD_LLVM_LIB(LLVMLTO)
325326 FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenACC)
326 FIND_AND_ADD_LLVM_LIB(LLVMFrontendHLSL)
327327 FIND_AND_ADD_LLVM_LIB(LLVMFrontendDriver)
328328 FIND_AND_ADD_LLVM_LIB(LLVMExtensions)
329 FIND_AND_ADD_LLVM_LIB(LLVMPlugins)
329330 FIND_AND_ADD_LLVM_LIB(LLVMPasses)
330331 FIND_AND_ADD_LLVM_LIB(LLVMHipStdPar)
331332 FIND_AND_ADD_LLVM_LIB(LLVMCoroutines)
......@@ -352,6 +353,7 @@ else()
352353 FIND_AND_ADD_LLVM_LIB(LLVMObjCARCOpts)
353354 FIND_AND_ADD_LLVM_LIB(LLVMCodeGenTypes)
354355 FIND_AND_ADD_LLVM_LIB(LLVMCGData)
356 FIND_AND_ADD_LLVM_LIB(LLVMCAS)
355357 FIND_AND_ADD_LLVM_LIB(LLVMIRPrinter)
356358 FIND_AND_ADD_LLVM_LIB(LLVMInterfaceStub)
357359 FIND_AND_ADD_LLVM_LIB(LLVMFileCheck)
......@@ -370,15 +372,17 @@ else()
370372 FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoCodeView)
371373 FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoGSYM)
372374 FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARF)
373 FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARFLowLevel)
374375 FIND_AND_ADD_LLVM_LIB(LLVMObject)
375376 FIND_AND_ADD_LLVM_LIB(LLVMTextAPI)
376377 FIND_AND_ADD_LLVM_LIB(LLVMMCParser)
377378 FIND_AND_ADD_LLVM_LIB(LLVMIRReader)
378379 FIND_AND_ADD_LLVM_LIB(LLVMAsmParser)
379380 FIND_AND_ADD_LLVM_LIB(LLVMMC)
381 FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARFLowLevel)
380382 FIND_AND_ADD_LLVM_LIB(LLVMBitReader)
383 FIND_AND_ADD_LLVM_LIB(LLVMFrontendHLSL)
381384 FIND_AND_ADD_LLVM_LIB(LLVMFuzzerCLI)
385 FIND_AND_ADD_LLVM_LIB(LLVMABI)
382386 FIND_AND_ADD_LLVM_LIB(LLVMCore)
383387 FIND_AND_ADD_LLVM_LIB(LLVMRemarks)
384388 FIND_AND_ADD_LLVM_LIB(LLVMBitstreamReader)
lib/compiler/aro/aro/Compilation.zig-3
......@@ -498,7 +498,6 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
498498 .{ .fma, "__FMA__" },
499499 .{ .f16c, "__F16C__" },
500500 .{ .gfni, "__GFNI__" },
501 .{ .evex512, "__EVEX512__" },
502501
503502 .{ .avx10_1, "__AVX10_1__" },
504503 .{ .avx10_1, "__AVX10_1_512__" },
......@@ -560,7 +559,6 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
560559 .{ .amx_complex, "__AMX_COMPLEX__" },
561560 .{ .amx_fp8, "__AMX_FP8__" },
562561 .{ .amx_movrs, "__AMX_MOVRS__" },
563 .{ .amx_transpose, "__AMX_TRANSPOSE__" },
564562 .{ .amx_avx512, "__AMX_AVX512__" },
565563 .{ .amx_tf32, "__AMX_TF32__" },
566564 .{ .cmpccxadd, "__CMPCCXADD__" },
......@@ -798,7 +796,6 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
798796 .{ .fullfp16, "FP16_SCALAR_ARITHMETIC" },
799797 .{ .dotprod, "DOTPROD" },
800798 .{ .mte, "MEMORY_TAGGING" },
801 .{ .tme, "TME" },
802799 .{ .i8mm, "MATMUL_INT8" },
803800 .{ .lse, "ATOMICS" },
804801 .{ .f64mm, "SVE_MATMUL_FP64" },
lib/compiler_rt.zig+1-22
......@@ -447,29 +447,8 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) {
447447
448448pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
449449
450/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
451450pub fn F16T(comptime OtherType: type) type {
452451 return switch (builtin.cpu.arch) {
453 .amdgcn,
454 .arm,
455 .armeb,
456 .thumb,
457 .thumbeb,
458 .aarch64,
459 .aarch64_be,
460 .hexagon,
461 .loongarch32,
462 .loongarch64,
463 .nvptx,
464 .nvptx64,
465 .riscv32,
466 .riscv32be,
467 .riscv64,
468 .riscv64be,
469 .s390x,
470 .spirv32,
471 .spirv64,
472 => f16,
473452 .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
474453 // Starting with LLVM 16, Darwin uses different abi for f16
475454 // depending on the type of the other return/argument..???
......@@ -477,7 +456,7 @@ pub fn F16T(comptime OtherType: type) type {
477456 f80, f128 => f16,
478457 else => unreachable,
479458 } else f16,
480 else => u16,
459 else => f16,
481460 };
482461}
483462
lib/compiler_rt/trunctfhf2.zig+3
......@@ -4,6 +4,9 @@ const truncf = @import("./truncf.zig").truncf;
44
55comptime {
66 symbol(&__trunctfhf2, "__trunctfhf2");
7 if (compiler_rt.want_ppc_abi) {
8 symbol(&__trunctfhf2, "__trunckfhf2");
9 }
710}
811
912pub fn __trunctfhf2(a: f128) callconv(.c) compiler_rt.F16T(f128) {
lib/include/__clang_spirv_builtins.h+12-12
......@@ -52,30 +52,30 @@
5252// Builtin IDs and sizes
5353
5454extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_num_workgroups) __size_t
55 __spirv_NumWorkgroups(int);
55 __spirv_BuiltInNumWorkgroups(int);
5656extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_workgroup_size) __size_t
57 __spirv_WorkgroupSize(int);
57 __spirv_BuiltInWorkgroupSize(int);
5858extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_workgroup_id) __size_t
59 __spirv_WorkgroupId(int);
59 __spirv_BuiltInWorkgroupId(int);
6060extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_local_invocation_id) __size_t
61 __spirv_LocalInvocationId(int);
61 __spirv_BuiltInLocalInvocationId(int);
6262extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_global_invocation_id) __size_t
63 __spirv_GlobalInvocationId(int);
63 __spirv_BuiltInGlobalInvocationId(int);
6464
6565extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_global_size) __size_t
66 __spirv_GlobalSize(int);
66 __spirv_BuiltInGlobalSize(int);
6767extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_global_offset) __size_t
68 __spirv_GlobalOffset(int);
68 __spirv_BuiltInGlobalOffset(int);
6969extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_subgroup_size) __uint32_t
70 __spirv_SubgroupSize();
70 __spirv_BuiltInSubgroupSize();
7171extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_subgroup_max_size) __uint32_t
72 __spirv_SubgroupMaxSize();
72 __spirv_BuiltInSubgroupMaxSize();
7373extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_num_subgroups) __uint32_t
74 __spirv_NumSubgroups();
74 __spirv_BuiltInNumSubgroups();
7575extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_subgroup_id) __uint32_t
76 __spirv_SubgroupId();
76 __spirv_BuiltInSubgroupId();
7777extern __SPIRV_BUILTIN_ALIAS(__builtin_spirv_subgroup_local_invocation_id)
78 __uint32_t __spirv_SubgroupLocalInvocationId();
78 __uint32_t __spirv_BuiltInSubgroupLocalInvocationId();
7979
8080// OpGenericCastToPtrExplicit
8181
lib/include/__float_float.h created+176
......@@ -0,0 +1,176 @@
1/*===---- __float_float.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 __CLANG_FLOAT_FLOAT_H
11#define __CLANG_FLOAT_FLOAT_H
12
13#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(_AIX)) && \
14 __STDC_HOSTED__
15
16/* Undefine anything that we'll be redefining below. */
17# undef FLT_EVAL_METHOD
18# undef FLT_ROUNDS
19# undef FLT_RADIX
20# undef FLT_MANT_DIG
21# undef DBL_MANT_DIG
22# undef LDBL_MANT_DIG
23#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
24 !defined(__STRICT_ANSI__) || \
25 (defined(__cplusplus) && __cplusplus >= 201103L) || \
26 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
27# undef DECIMAL_DIG
28# endif
29# undef FLT_DIG
30# undef DBL_DIG
31# undef LDBL_DIG
32# undef FLT_MIN_EXP
33# undef DBL_MIN_EXP
34# undef LDBL_MIN_EXP
35# undef FLT_MIN_10_EXP
36# undef DBL_MIN_10_EXP
37# undef LDBL_MIN_10_EXP
38# undef FLT_MAX_EXP
39# undef DBL_MAX_EXP
40# undef LDBL_MAX_EXP
41# undef FLT_MAX_10_EXP
42# undef DBL_MAX_10_EXP
43# undef LDBL_MAX_10_EXP
44# undef FLT_MAX
45# undef DBL_MAX
46# undef LDBL_MAX
47# undef FLT_EPSILON
48# undef DBL_EPSILON
49# undef LDBL_EPSILON
50# undef FLT_MIN
51# undef DBL_MIN
52# undef LDBL_MIN
53#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
54 !defined(__STRICT_ANSI__) || \
55 (defined(__cplusplus) && __cplusplus >= 201703L) || \
56 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
57# undef FLT_TRUE_MIN
58# undef DBL_TRUE_MIN
59# undef LDBL_TRUE_MIN
60# undef FLT_DECIMAL_DIG
61# undef DBL_DECIMAL_DIG
62# undef LDBL_DECIMAL_DIG
63# undef FLT_HAS_SUBNORM
64# undef DBL_HAS_SUBNORM
65# undef LDBL_HAS_SUBNORM
66# endif
67#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
68 !defined(__STRICT_ANSI__)
69# undef FLT_NORM_MAX
70# undef DBL_NORM_MAX
71# undef LDBL_NORM_MAX
72#endif
73#endif
74
75#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
76 !defined(__STRICT_ANSI__)
77# undef FLT_SNAN
78# undef DBL_SNAN
79# undef LDBL_SNAN
80#endif
81
82/* Characteristics of floating point types, C99 5.2.4.2.2 */
83
84#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
85 (defined(__cplusplus) && __cplusplus >= 201103L)
86#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
87#endif
88#define FLT_ROUNDS (__builtin_flt_rounds())
89#define FLT_RADIX __FLT_RADIX__
90
91#define FLT_MANT_DIG __FLT_MANT_DIG__
92#define DBL_MANT_DIG __DBL_MANT_DIG__
93#define LDBL_MANT_DIG __LDBL_MANT_DIG__
94
95#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
96 !defined(__STRICT_ANSI__) || \
97 (defined(__cplusplus) && __cplusplus >= 201103L) || \
98 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
99# define DECIMAL_DIG __DECIMAL_DIG__
100#endif
101
102#define FLT_DIG __FLT_DIG__
103#define DBL_DIG __DBL_DIG__
104#define LDBL_DIG __LDBL_DIG__
105
106#define FLT_MIN_EXP __FLT_MIN_EXP__
107#define DBL_MIN_EXP __DBL_MIN_EXP__
108#define LDBL_MIN_EXP __LDBL_MIN_EXP__
109
110#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
111#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
112#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
113
114#define FLT_MAX_EXP __FLT_MAX_EXP__
115#define DBL_MAX_EXP __DBL_MAX_EXP__
116#define LDBL_MAX_EXP __LDBL_MAX_EXP__
117
118#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
119#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
120#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
121
122#define FLT_MAX __FLT_MAX__
123#define DBL_MAX __DBL_MAX__
124#define LDBL_MAX __LDBL_MAX__
125
126#define FLT_EPSILON __FLT_EPSILON__
127#define DBL_EPSILON __DBL_EPSILON__
128#define LDBL_EPSILON __LDBL_EPSILON__
129
130#define FLT_MIN __FLT_MIN__
131#define DBL_MIN __DBL_MIN__
132#define LDBL_MIN __LDBL_MIN__
133
134#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
135 !defined(__STRICT_ANSI__) || \
136 (defined(__cplusplus) && __cplusplus >= 201703L) || \
137 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
138# define FLT_TRUE_MIN __FLT_DENORM_MIN__
139# define DBL_TRUE_MIN __DBL_DENORM_MIN__
140# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
141# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
142# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
143# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
144# define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
145# define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
146# define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
147#endif
148
149#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
150 !defined(__STRICT_ANSI__)
151 /* C23 5.2.5.3.2p28 */
152# define FLT_SNAN (__builtin_nansf(""))
153# define DBL_SNAN (__builtin_nans(""))
154# define LDBL_SNAN (__builtin_nansl(""))
155
156 /* C23 5.2.5.3.3p32 */
157# define FLT_NORM_MAX __FLT_NORM_MAX__
158# define DBL_NORM_MAX __DBL_NORM_MAX__
159# define LDBL_NORM_MAX __LDBL_NORM_MAX__
160#endif
161
162#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
163# define FLT16_MANT_DIG __FLT16_MANT_DIG__
164# define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
165# define FLT16_DIG __FLT16_DIG__
166# define FLT16_MIN_EXP __FLT16_MIN_EXP__
167# define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
168# define FLT16_MAX_EXP __FLT16_MAX_EXP__
169# define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
170# define FLT16_MAX __FLT16_MAX__
171# define FLT16_EPSILON __FLT16_EPSILON__
172# define FLT16_MIN __FLT16_MIN__
173# define FLT16_TRUE_MIN __FLT16_TRUE_MIN__
174#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */
175
176#endif /* __CLANG_FLOAT_FLOAT_H */
lib/include/__float_header_macro.h created+12
......@@ -0,0 +1,12 @@
1/*===---- __float_header_macro.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 __CLANG_FLOAT_H
11#define __CLANG_FLOAT_H
12#endif /* __CLANG_FLOAT_H */
lib/include/__float_infinity_nan.h created+20
......@@ -0,0 +1,20 @@
1/*===---- __float_infinity_nan.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 __CLANG_FLOAT_INFINITY_NAN_H
11#define __CLANG_FLOAT_INFINITY_NAN_H
12
13/* C23 5.2.5.3.3p29-30 */
14#undef INFINITY
15#undef NAN
16
17#define INFINITY (__builtin_inff())
18#define NAN (__builtin_nanf(""))
19
20#endif /* __CLANG_FLOAT_INFINITY_NAN_H */
lib/include/amo.h created+131
......@@ -0,0 +1,131 @@
1/*===---- amo.h - PowerPC Atomic Memory Operations ------------------------===*\
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 header provides compatibility for GCC's AMO functions.
10 * The functions here call Clang's underlying AMO builtins.
11 */
12
13#ifndef _AMO_H
14#define _AMO_H
15
16#include <stdint.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/* AMO Load Operation Codes (FC values) */
23enum {
24 _AMO_LD_ADD = 0x00, /* Fetch and Add */
25 _AMO_LD_XOR = 0x01, /* Fetch and XOR */
26 _AMO_LD_IOR = 0x02, /* Fetch and OR */
27 _AMO_LD_AND = 0x03, /* Fetch and AND */
28 _AMO_LD_UMAX = 0x04, /* Fetch and Maximum Unsigned */
29 _AMO_LD_SMAX = 0x05, /* Fetch and Maximum Signed */
30 _AMO_LD_UMIN = 0x06, /* Fetch and Minimum Unsigned */
31 _AMO_LD_SMIN = 0x07, /* Fetch and Minimum Signed */
32 _AMO_LD_SWAP = 0x08 /* Swap */
33};
34
35/* 32-bit unsigned AMO load operations */
36static inline uint32_t amo_lwat_add(uint32_t *ptr, uint32_t val) {
37 return __builtin_amo_lwat(ptr, val, _AMO_LD_ADD);
38}
39
40static inline uint32_t amo_lwat_xor(uint32_t *ptr, uint32_t val) {
41 return __builtin_amo_lwat(ptr, val, _AMO_LD_XOR);
42}
43
44static inline uint32_t amo_lwat_ior(uint32_t *ptr, uint32_t val) {
45 return __builtin_amo_lwat(ptr, val, _AMO_LD_IOR);
46}
47
48static inline uint32_t amo_lwat_and(uint32_t *ptr, uint32_t val) {
49 return __builtin_amo_lwat(ptr, val, _AMO_LD_AND);
50}
51
52static inline uint32_t amo_lwat_umax(uint32_t *ptr, uint32_t val) {
53 return __builtin_amo_lwat(ptr, val, _AMO_LD_UMAX);
54}
55
56static inline uint32_t amo_lwat_umin(uint32_t *ptr, uint32_t val) {
57 return __builtin_amo_lwat(ptr, val, _AMO_LD_UMIN);
58}
59
60static inline uint32_t amo_lwat_swap(uint32_t *ptr, uint32_t val) {
61 return __builtin_amo_lwat(ptr, val, _AMO_LD_SWAP);
62}
63
64/* 32-bit signed AMO load operations */
65static inline int32_t amo_lwat_sadd(int32_t *ptr, int32_t val) {
66 return __builtin_amo_lwat_s(ptr, val, _AMO_LD_ADD);
67}
68
69static inline int32_t amo_lwat_smax(int32_t *ptr, int32_t val) {
70 return __builtin_amo_lwat_s(ptr, val, _AMO_LD_SMAX);
71}
72
73static inline int32_t amo_lwat_smin(int32_t *ptr, int32_t val) {
74 return __builtin_amo_lwat_s(ptr, val, _AMO_LD_SMIN);
75}
76
77static inline int32_t amo_lwat_sswap(int32_t *ptr, int32_t val) {
78 return __builtin_amo_lwat_s(ptr, val, _AMO_LD_SWAP);
79}
80
81/* 64-bit unsigned AMO load operations */
82static inline uint64_t amo_ldat_add(uint64_t *ptr, uint64_t val) {
83 return __builtin_amo_ldat(ptr, val, _AMO_LD_ADD);
84}
85
86static inline uint64_t amo_ldat_xor(uint64_t *ptr, uint64_t val) {
87 return __builtin_amo_ldat(ptr, val, _AMO_LD_XOR);
88}
89
90static inline uint64_t amo_ldat_ior(uint64_t *ptr, uint64_t val) {
91 return __builtin_amo_ldat(ptr, val, _AMO_LD_IOR);
92}
93
94static inline uint64_t amo_ldat_and(uint64_t *ptr, uint64_t val) {
95 return __builtin_amo_ldat(ptr, val, _AMO_LD_AND);
96}
97
98static inline uint64_t amo_ldat_umax(uint64_t *ptr, uint64_t val) {
99 return __builtin_amo_ldat(ptr, val, _AMO_LD_UMAX);
100}
101
102static inline uint64_t amo_ldat_umin(uint64_t *ptr, uint64_t val) {
103 return __builtin_amo_ldat(ptr, val, _AMO_LD_UMIN);
104}
105
106static inline uint64_t amo_ldat_swap(uint64_t *ptr, uint64_t val) {
107 return __builtin_amo_ldat(ptr, val, _AMO_LD_SWAP);
108}
109
110/* 64-bit signed AMO load operations */
111static inline int64_t amo_ldat_sadd(int64_t *ptr, int64_t val) {
112 return __builtin_amo_ldat_s(ptr, val, _AMO_LD_ADD);
113}
114
115static inline int64_t amo_ldat_smax(int64_t *ptr, int64_t val) {
116 return __builtin_amo_ldat_s(ptr, val, _AMO_LD_SMAX);
117}
118
119static inline int64_t amo_ldat_smin(int64_t *ptr, int64_t val) {
120 return __builtin_amo_ldat_s(ptr, val, _AMO_LD_SMIN);
121}
122
123static inline int64_t amo_ldat_sswap(int64_t *ptr, int64_t val) {
124 return __builtin_amo_ldat_s(ptr, val, _AMO_LD_SWAP);
125}
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif /* _AMO_H */
lib/include/amxavx512intrin.h+215-1
......@@ -16,7 +16,7 @@
1616
1717#define __DEFAULT_FN_ATTRS_AVX512 \
1818 __attribute__((__always_inline__, __nodebug__, \
19 __target__("amx-avx512,avx10.2-512")))
19 __target__("amx-avx512,avx10.2"), __min_vector_width__(512)))
2020
2121/// Moves a row from a tile register to a zmm destination register, converting
2222/// the int32 source elements to fp32. The row of the tile is selected by a
......@@ -52,6 +52,40 @@
5252/// The row of the source tile
5353#define _tile_cvtrowd2ps(tsrc, row) __builtin_ia32_tcvtrowd2ps(tsrc, row)
5454
55/// Moves a row from a tile register to a zmm destination register, converting
56/// the int32 source elements to fp32. The row of the tile is selected by a
57/// 8b immediate value.
58///
59/// \headerfile <x86intrin.h>
60///
61/// \code
62/// __m512i _tile_cvtrowd2psi(__tile tsrc, const unsigned int imm8);
63/// \endcode
64///
65/// \code{.operation}
66/// VL := 512
67/// VL_bytes := VL >> 3
68/// row_index := imm8 & 0x3f
69/// row_chunk := (imm8 >> 6) * VL_bytes
70/// FOR i := 0 TO (VL_bytes / 4) - 1
71/// IF i + row_chunk / 4 >= tsrc.colsb / 4
72/// dst.dword[i] := 0
73/// ELSE
74/// dst.f32[i] := CONVERT_INT32_TO_FP32(tsrc.row[row_index].dword[row_chunk/4+i], RNE)
75/// FI
76/// ENDFOR
77/// dst[MAX_VL-1:VL] := 0
78/// zero_tileconfig_start()
79/// \endcode
80///
81/// This intrinsic corresponds to the \c TCVTROWD2PS instruction.
82///
83/// \param tsrc
84/// The source tile. Max size is 1024 Bytes.
85/// \param imm8
86/// The row of the source tile
87#define _tile_cvtrowd2psi(tsrc, imm8) __builtin_ia32_tcvtrowd2psi(tsrc, imm8)
88
5589/// Moves a row from a tile register to a zmm destination register, converting
5690/// the fp32 source elements to bf16. It places the resulting bf16 elements
5791/// in the high 16 bits within each dword. The row of the tile is selected
......@@ -89,6 +123,43 @@
89123#define _tile_cvtrowps2bf16h(tsrc, row) \
90124 __builtin_ia32_tcvtrowps2bf16h(tsrc, row)
91125
126/// Moves a row from a tile register to a zmm destination register, converting
127/// the fp32 source elements to bf16. It places the resulting bf16 elements
128/// in the high 16 bits within each dword. The row of the tile is selected
129/// by a 8b immediate value.
130///
131/// \headerfile <x86intrin.h>
132///
133/// \code
134/// __m512i _tile_cvtrowps2bf16hi(__tile tsrc, const unsigned int imm8);
135/// \endcode
136///
137/// \code{.operation}
138/// VL := 512
139/// VL_bytes := VL >> 3
140/// row_index := imm8 & 0x3f
141/// row_chunk := (imm8 >> 6) * VL_bytes
142/// FOR i := 0 TO (VL_bytes / 4) - 1
143/// IF i + row_chunk / 4 >= tsrc.colsb / 4
144/// dst.dword[i] := 0
145/// ELSE
146/// dst.word[2*i+0] := 0
147/// dst.bf16[2*i+1] := CONVERT_FP32_TO_BF16(tsrc.row[row_index].fp32[row_chunk/4+i], RNE)
148/// FI
149/// ENDFOR
150/// dst[MAX_VL-1:VL] := 0
151/// zero_tileconfig_start()
152/// \endcode
153///
154/// This intrinsic corresponds to the \c TCVTROWPS2BF16H instruction.
155///
156/// \param tsrc
157/// The source tile. Max size is 1024 Bytes.
158/// \param imm8
159/// The the row of the source tile.
160#define _tile_cvtrowps2bf16hi(tsrc, imm8) \
161 __builtin_ia32_tcvtrowps2bf16hi(tsrc, imm8)
162
92163/// Moves a row from a tile register to a zmm destination register, converting
93164/// the fp32 source elements to bf16. It places the resulting bf16 elements
94165/// in the low 16 bits within each dword. The row of the tile is selected
......@@ -126,6 +197,43 @@
126197#define _tile_cvtrowps2bf16l(tsrc, row) \
127198 __builtin_ia32_tcvtrowps2bf16l(tsrc, row)
128199
200/// Moves a row from a tile register to a zmm destination register, converting
201/// the fp32 source elements to bf16. It places the resulting bf16 elements
202/// in the low 16 bits within each dword. The row of the tile is selected
203/// by a 8b immediate value.
204///
205/// \headerfile <x86intrin.h>
206///
207/// \code
208/// __m512i _tile_cvtrowps2bf16li(__tile tsrc, const unsigned int imm8);
209/// \endcode
210///
211/// \code{.operation}
212/// VL := 512
213/// VL_bytes := VL >> 3
214/// row_index := imm8 & 0x3f
215/// row_chunk := (imm8 >> 6) * VL_bytes
216/// FOR i := 0 TO (VL_bytes / 4) - 1
217/// IF i + row_chunk / 4 >= tsrc.colsb / 4
218/// dst.dword[i] := 0
219/// ELSE
220/// dst.word[2*i+1] := 0
221/// dst.bf16[2*i+0] := CONVERT_FP32_TO_BF16(tsrc.row[row_index].fp32[row_chunk/4+i], RNE)
222/// FI
223/// ENDFOR
224/// dst[MAX_VL-1:VL] := 0
225/// zero_tileconfig_start()
226/// \endcode
227///
228/// This intrinsic corresponds to the \c TCVTROWPS2BF16L instruction.
229///
230/// \param tsrc
231/// The source tile. Max size is 1024 Bytes.
232/// \param imm8
233/// The the row of the source tile.
234#define _tile_cvtrowps2bf16li(tsrc, imm8) \
235 __builtin_ia32_tcvtrowps2bf16li(tsrc, imm8)
236
129237/// Moves a row from a tile register to a zmm destination register, converting
130238/// the fp32 source elements to fp16. It places the resulting fp16 elements
131239/// in the high 16 bits within each dword. The row of the tile is selected
......@@ -162,6 +270,43 @@
162270/// The the row of the source tile.
163271#define _tile_cvtrowps2phh(tsrc, row) __builtin_ia32_tcvtrowps2phh(tsrc, row)
164272
273/// Moves a row from a tile register to a zmm destination register, converting
274/// the fp32 source elements to fp16. It places the resulting fp16 elements
275/// in the high 16 bits within each dword. The row of the tile is selected
276/// by a 8b immediate value.
277///
278/// \headerfile <x86intrin.h>
279///
280/// \code
281/// __m512i _tile_cvtrowps2phhi(__tile tsrc, constunsigned int imm8);
282/// \endcode
283///
284/// \code{.operation}
285/// VL := 512
286/// VL_bytes := VL >> 3
287/// row_index := imm8 & 0x3f
288/// row_chunk := (imm8 >> 6) * VL_bytes
289/// FOR i := 0 TO (VL_bytes / 4) - 1
290/// IF i + row_chunk / 4 >= tsrc.colsb / 4
291/// dst.dword[i] := 0
292/// ELSE
293/// dst.word[2*i+0] := 0
294/// dst.fp16[2*i+1] := CONVERT_FP32_TO_FP16(tsrc.row[row_index].fp32[row_chunk/4+i], RNE)
295/// FI
296/// ENDFOR
297/// dst[MAX_VL-1:VL] := 0
298/// zero_tileconfig_start()
299/// \endcode
300///
301/// This intrinsic corresponds to the \c TCVTROWPS2PHH instruction.
302///
303/// \param tsrc
304/// The source tile. Max size is 1024 Bytes.
305/// \param imm8
306/// The the row of the source tile.
307#define _tile_cvtrowps2phhi(tsrc, imm8) \
308 __builtin_ia32_tcvtrowps2phhi(tsrc, imm8)
309
165310/// Moves a row from a tile register to a zmm destination register, converting
166311/// the fp32 source elements to fp16. It places the resulting fp16 elements
167312/// in the low 16 bits within each dword. The row of the tile is selected
......@@ -198,6 +343,43 @@
198343/// The the row of the source tile.
199344#define _tile_cvtrowps2phl(tsrc, row) __builtin_ia32_tcvtrowps2phl(tsrc, row)
200345
346/// Moves a row from a tile register to a zmm destination register, converting
347/// the fp32 source elements to fp16. It places the resulting fp16 elements
348/// in the low 16 bits within each dword. The row of the tile is selected
349/// by a 8b immediate value.
350///
351/// \headerfile <x86intrin.h>
352///
353/// \code
354/// __m512i _tile_cvtrowps2phli(__tile tsrc, const unsigned int imm8);
355/// \endcode
356///
357/// \code{.operation}
358/// VL := 512
359/// VL_bytes := VL >> 3
360/// row_index := imm8 & 0x3f
361/// row_chunk := (imm8 >> 6) * VL_bytes
362/// FOR i := 0 TO (VL_bytes / 4) - 1
363/// IF i + row_chunk / 4 >= tsrc.colsb / 4
364/// dst.dword[i] := 0
365/// ELSE
366/// dst.word[2*i+1] := 0
367/// dst.fp16[2*i+0] := CONVERT_FP32_TO_FP16(tsrc.row[row_index].fp32[row_chunk/4+i], RNE)
368/// FI
369/// ENDFOR
370/// dst[MAX_VL-1:VL] := 0
371/// zero_tileconfig_start()
372/// \endcode
373///
374/// This intrinsic corresponds to the \c TCVTROWPS2PHL instruction.
375///
376/// \param tsrc
377/// The source tile. Max size is 1024 Bytes.
378/// \param imm8
379/// The the row of the source tile.
380#define _tile_cvtrowps2phli(tsrc, imm8) \
381 __builtin_ia32_tcvtrowps2phli(tsrc, imm8)
382
201383/// Move one row of a tile data to a v16f32 data.
202384/// The row of the tile is selected by a 32b GPR.
203385///
......@@ -230,6 +412,38 @@
230412/// \endcode
231413#define _tile_movrow(a, b) ((__m512i)__builtin_ia32_tilemovrow(a, b))
232414
415/// Move one row of a tile data to a v16f32 data.
416/// The row of the tile is selected by a 8b immediate value.
417///
418/// \headerfile <immintrin.h>
419///
420/// \code
421/// __m512 _tile_movrowi(__tile a, const unsigned b);
422/// \endcode
423///
424/// This intrinsic corresponds to the <c> TILEMOVROW </c> instruction.
425///
426/// \param a
427/// The 1st source tile. Max size is 1024 Bytes.
428/// \param b
429/// The 2nd source r32. Size is 4 Bytes.
430/// \returns
431/// The destination v16f32 data. Size is 64 Bytes.
432///
433/// \code{.operation}
434/// VL := 512
435/// VL_bytes := VL>>3
436/// row_index := b&0x3f
437/// row_chunk := (b>>6) * VL_bytes
438/// FOR i := 0 TO (VL_bytes-1)
439/// IF (row_chunk + i >= a.colsb)
440/// dst.byte[i] := 0
441/// ELSE
442/// dst.byte[i] := a.row[row_index].byte[row_chunk+i]
443/// ENDFOR
444/// \endcode
445#define _tile_movrowi(a, b) ((__m512i)__builtin_ia32_tilemovrowi(a, b))
446
233447/// This is internal intrinsic. C/C++ user should avoid calling it directly.
234448
235449static __inline__ __m512 __DEFAULT_FN_ATTRS_AVX512 _tile_cvtrowd2ps_internal(
lib/include/amxbf16transposeintrin.h deleted-94
......@@ -1,94 +0,0 @@
1/*===----- amxbf16transposeintrin.h - AMX-BF16 and AMX-TRANSPOSE ------------===
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 \
12 "Never use <amxbf16transposeintrin.h> directly; use <immintrin.h> instead."
13#endif /* __IMMINTRIN_H */
14
15#ifndef __AMX_BF16TRANSPOSEINTRIN_H
16#define __AMX_BF16TRANSPOSEINTRIN_H
17#ifdef __x86_64__
18
19/* Define the default attributes for the functions in this file. */
20#define __DEFAULT_FN_ATTRS \
21 __attribute__((__always_inline__, __nodebug__, \
22 __target__("amx-bf16,amx-transpose")))
23
24/// Compute transpose and dot-product of BF16 (16-bit) floating-point pairs in
25/// tiles \a a and \a b, accumulating the intermediate single-precision
26/// (32-bit) floating-point elements with elements in \a dst, and store the
27/// 32-bit result back to tile \a dst.
28///
29/// \headerfile <immintrin.h>
30///
31/// \code
32/// void _tile_tdpbf16ps (__tile dst, __tile a, __tile b)
33/// \endcode
34///
35/// \code{.operation}
36/// FOR m := 0 TO dst.rows - 1
37/// tmp := dst.row[m]
38/// FOR k := 0 TO (a.colsb / 4) - 1
39/// FOR n := 0 TO (dst.colsb / 4) - 1
40/// tmp.bf32[n] += FP32(a.row[m].bf16[2*k+0]) *
41/// FP32(b.row[k].bf16[2*n+0])
42/// tmp.bf32[n] += FP32(a.row[m].bf16[2*k+1]) *
43/// FP32(b.row[k].bf16[2*n+1])
44/// ENDFOR
45/// ENDFOR
46/// write_row_and_zero(dst, m, tmp, dst.colsb)
47/// ENDFOR
48/// zero_upper_rows(dst, dst.rows)
49/// zero_tileconfig_start()
50/// \endcode
51///
52/// This intrinsic corresponds to the \c TTDPBF16PS instruction.
53///
54/// \param dst
55/// The destination tile. Max size is 1024 Bytes.
56/// \param a
57/// The 1st source tile. Max size is 1024 Bytes.
58/// \param b
59/// The 2nd source tile. Max size is 1024 Bytes.
60#define _tile_tdpbf16ps(dst, a, b) __builtin_ia32_ttdpbf16ps((dst), (a), (b))
61
62/// This is internal intrinsic. C/C++ user should avoid calling it directly.
63static __inline__ _tile1024i __DEFAULT_FN_ATTRS
64_tile_tdpbf16ps_internal(unsigned short m, unsigned short n, unsigned short k,
65 _tile1024i dst, _tile1024i src1, _tile1024i src2) {
66 return __builtin_ia32_ttdpbf16ps_internal(m, n, k, dst, src1, src2);
67}
68
69/// Compute transpose and dot-product of BF16 (16-bit) floating-point pairs in
70/// tiles src0 and src1, accumulating the intermediate single-precision
71/// (32-bit) floating-point elements with elements in "dst", and store the
72/// 32-bit result back to tile "dst".
73///
74/// \headerfile <immintrin.h>
75///
76/// This intrinsic corresponds to the <c> TTDPBF16PS </c> instruction.
77///
78/// \param dst
79/// The destination tile. Max size is 1024 Bytes.
80/// \param src0
81/// The 1st source tile. Max size is 1024 Bytes.
82/// \param src1
83/// The 2nd source tile. Max size is 1024 Bytes.
84__DEFAULT_FN_ATTRS
85static __inline__ void __tile_tdpbf16ps(__tile1024i *dst, __tile1024i src0,
86 __tile1024i src1) {
87 dst->tile = _tile_tdpbf16ps_internal(src0.row, src1.col, src0.col, dst->tile,
88 src0.tile, src1.tile);
89}
90
91#undef __DEFAULT_FN_ATTRS
92
93#endif /* __x86_64__ */
94#endif /* __AMX_BF16TRANSPOSEINTRIN_H */
lib/include/amxcomplextransposeintrin.h deleted-303
......@@ -1,303 +0,0 @@
1/*===----- amxcomplextransposeintrin.h - AMX-COMPLEX and AMX-TRANSPOSE ------===
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 \
12 "Never use <amxcomplextransposeintrin.h> directly; include <immintrin.h> instead."
13#endif // __IMMINTRIN_H
14
15#ifndef __AMX_COMPLEXTRANSPOSEINTRIN_H
16#define __AMX_COMPLEXTRANSPOSEINTRIN_H
17#ifdef __x86_64__
18
19#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("amx-complex,amx-transpose")))
22
23/// Perform matrix multiplication of two tiles containing complex elements and
24/// accumulate the results into a packed single precision tile. Each dword
25/// element in input tiles \a a and \a b is interpreted as a complex number
26/// with FP16 real part and FP16 imaginary part.
27/// Calculates the imaginary part of the result. For each possible combination
28/// of (transposed column of \a a, column of \a b), it performs a set of
29/// multiplication and accumulations on all corresponding complex numbers
30/// (one from \a a and one from \a b). The imaginary part of the \a a element
31/// is multiplied with the real part of the corresponding \a b element, and
32/// the real part of the \a a element is multiplied with the imaginary part
33/// of the corresponding \a b elements. The two accumulated results are
34/// added, and then accumulated into the corresponding row and column of
35/// \a dst.
36///
37/// \headerfile <x86intrin.h>
38///
39/// \code
40/// void _tile_tcmmimfp16ps(__tile dst, __tile a, __tile b);
41/// \endcode
42///
43/// \code{.operation}
44/// FOR m := 0 TO dst.rows - 1
45/// tmp := dst.row[m]
46/// FOR k := 0 TO a.rows - 1
47/// FOR n := 0 TO (dst.colsb / 4) - 1
48/// tmp.fp32[n] += FP32(a.row[m].fp16[2*k+0]) * FP32(b.row[k].fp16[2*n+1])
49/// tmp.fp32[n] += FP32(a.row[m].fp16[2*k+1]) * FP32(b.row[k].fp16[2*n+0])
50/// ENDFOR
51/// ENDFOR
52/// write_row_and_zero(dst, m, tmp, dst.colsb)
53/// ENDFOR
54/// zero_upper_rows(dst, dst.rows)
55/// zero_tileconfig_start()
56/// \endcode
57///
58/// This intrinsic corresponds to the \c TTCMMIMFP16PS instruction.
59///
60/// \param dst
61/// The destination tile. Max size is 1024 Bytes.
62/// \param a
63/// The 1st source tile. Max size is 1024 Bytes.
64/// \param b
65/// The 2nd source tile. Max size is 1024 Bytes.
66#define _tile_tcmmimfp16ps(dst, a, b) \
67 __builtin_ia32_ttcmmimfp16ps((dst), (a), (b))
68
69/// Perform matrix multiplication of two tiles containing complex elements and
70/// accumulate the results into a packed single precision tile. Each dword
71/// element in input tiles \a a and \a b is interpreted as a complex number
72/// with FP16 real part and FP16 imaginary part.
73/// Calculates the real part of the result. For each possible combination
74/// of (rtransposed colum of \a a, column of \a b), it performs a set of
75/// multiplication and accumulations on all corresponding complex numbers
76/// (one from \a a and one from \a b). The real part of the \a a element is
77/// multiplied with the real part of the corresponding \a b element, and the
78/// negated imaginary part of the \a a element is multiplied with the
79/// imaginary part of the corresponding \a b elements. The two accumulated
80/// results are added, and then accumulated into the corresponding row and
81/// column of \a dst.
82///
83/// \headerfile <x86intrin.h>
84///
85/// \code
86/// void _tile_tcmmrlfp16ps(__tile dst, __tile a, __tile b);
87/// \endcode
88///
89/// \code{.operation}
90/// FOR m := 0 TO dst.rows - 1
91/// tmp := dst.row[m]
92/// FOR k := 0 TO a.rows - 1
93/// FOR n := 0 TO (dst.colsb / 4) - 1
94/// tmp.fp32[n] += FP32(a.row[m].fp16[2*k+0]) * FP32(b.row[k].fp16[2*n+0])
95/// tmp.fp32[n] += FP32(-a.row[m].fp16[2*k+1]) * FP32(b.row[k].fp16[2*n+1])
96/// ENDFOR
97/// ENDFOR
98/// write_row_and_zero(dst, m, tmp, dst.colsb)
99/// ENDFOR
100/// zero_upper_rows(dst, dst.rows)
101/// zero_tileconfig_start()
102/// \endcode
103///
104/// This intrinsic corresponds to the \c TTCMMIMFP16PS instruction.
105///
106/// \param dst
107/// The destination tile. Max size is 1024 Bytes.
108/// \param a
109/// The 1st source tile. Max size is 1024 Bytes.
110/// \param b
111/// The 2nd source tile. Max size is 1024 Bytes.
112#define _tile_tcmmrlfp16ps(dst, a, b) \
113 __builtin_ia32_ttcmmrlfp16ps((dst), (a), (b))
114
115/// Perform matrix conjugate transpose and multiplication of two tiles
116/// containing complex elements and accumulate the results into a packed
117/// single precision tile. Each dword element in input tiles \a a and \a b
118/// is interpreted as a complex number with FP16 real part and FP16 imaginary
119/// part.
120/// Calculates the imaginary part of the result. For each possible combination
121/// of (transposed column of \a a, column of \a b), it performs a set of
122/// multiplication and accumulations on all corresponding complex numbers
123/// (one from \a a and one from \a b). The negated imaginary part of the \a a
124/// element is multiplied with the real part of the corresponding \a b
125/// element, and the real part of the \a a element is multiplied with the
126/// imaginary part of the corresponding \a b elements. The two accumulated
127/// results are added, and then accumulated into the corresponding row and
128/// column of \a dst.
129///
130/// \headerfile <x86intrin.h>
131///
132/// \code
133/// void _tile_conjtcmmimfp16ps(__tile dst, __tile a, __tile b);
134/// \endcode
135///
136/// \code{.operation}
137/// FOR m := 0 TO dst.rows - 1
138/// tmp := dst.row[m]
139/// FOR k := 0 TO a.rows - 1
140/// FOR n := 0 TO (dst.colsb / 4) - 1
141/// tmp.fp32[n] += FP32(a.row[m].fp16[2*k+0]) * FP32(b.row[k].fp16[2*n+1])
142/// tmp.fp32[n] += FP32(-a.row[m].fp16[2*k+1]) * FP32(b.row[k].fp16[2*n+0])
143/// ENDFOR
144/// ENDFOR
145/// write_row_and_zero(dst, m, tmp, dst.colsb)
146/// ENDFOR
147/// zero_upper_rows(dst, dst.rows)
148/// zero_tileconfig_start()
149/// \endcode
150///
151/// This intrinsic corresponds to the \c TCONJTCMMIMFP16PS instruction.
152///
153/// \param dst
154/// The destination tile. Max size is 1024 Bytes.
155/// \param a
156/// The 1st source tile. Max size is 1024 Bytes.
157/// \param b
158/// The 2nd source tile. Max size is 1024 Bytes.
159#define _tile_conjtcmmimfp16ps(dst, a, b) \
160 __builtin_ia32_tconjtcmmimfp16ps((dst), (a), (b))
161
162/// Perform conjugate transpose of an FP16-pair of complex elements from \a a
163/// and writes the result to \a dst.
164///
165/// \headerfile <x86intrin.h>
166///
167/// \code
168/// void _tile_conjtfp16(__tile dst, __tile a);
169/// \endcode
170///
171/// \code{.operation}
172/// FOR i := 0 TO dst.rows - 1
173/// FOR j := 0 TO (dst.colsb / 4) - 1
174/// tmp.fp16[2*j+0] := a.row[j].fp16[2*i+0]
175/// tmp.fp16[2*j+1] := -a.row[j].fp16[2*i+1]
176/// ENDFOR
177/// write_row_and_zero(dst, i, tmp, dst.colsb)
178/// ENDFOR
179/// zero_upper_rows(dst, dst.rows)
180/// zero_tileconfig_start()
181/// \endcode
182///
183/// This intrinsic corresponds to the \c TCONJTFP16 instruction.
184///
185/// \param dst
186/// The destination tile. Max size is 1024 Bytes.
187/// \param a
188/// The source tile. Max size is 1024 Bytes.
189#define _tile_conjtfp16(dst, a) __builtin_ia32_tconjtfp16((dst), (a))
190
191static __inline__ _tile1024i __DEFAULT_FN_ATTRS _tile_tcmmimfp16ps_internal(
192 unsigned short m, unsigned short n, unsigned short k, _tile1024i dst,
193 _tile1024i src1, _tile1024i src2) {
194 return __builtin_ia32_ttcmmimfp16ps_internal(m, n, k, dst, src1, src2);
195}
196
197static __inline__ _tile1024i __DEFAULT_FN_ATTRS _tile_tcmmrlfp16ps_internal(
198 unsigned short m, unsigned short n, unsigned short k, _tile1024i dst,
199 _tile1024i src1, _tile1024i src2) {
200 return __builtin_ia32_ttcmmrlfp16ps_internal(m, n, k, dst, src1, src2);
201}
202
203static __inline__ _tile1024i __DEFAULT_FN_ATTRS _tile_conjtcmmimfp16ps_internal(
204 unsigned short m, unsigned short n, unsigned short k, _tile1024i dst,
205 _tile1024i src1, _tile1024i src2) {
206 return __builtin_ia32_tconjtcmmimfp16ps_internal(m, n, k, dst, src1, src2);
207}
208
209static __inline__ _tile1024i __DEFAULT_FN_ATTRS
210_tile_conjtfp16_internal(unsigned short m, unsigned short n, _tile1024i src) {
211 return __builtin_ia32_tconjtfp16_internal(m, n, src);
212}
213
214/// Perform matrix multiplication of two tiles containing complex elements and
215/// accumulate the results into a packed single precision tile. Each dword
216/// element in input tiles src0 and src1 is interpreted as a complex number
217/// with FP16 real part and FP16 imaginary part.
218/// This function calculates the imaginary part of the result.
219///
220/// \headerfile <immintrin.h>
221///
222/// This intrinsic corresponds to the <c> TTCMMIMFP16PS </c> instruction.
223///
224/// \param dst
225/// The destination tile. Max size is 1024 Bytes.
226/// \param src0
227/// The 1st source tile. Max size is 1024 Bytes.
228/// \param src1
229/// The 2nd source tile. Max size is 1024 Bytes.
230__DEFAULT_FN_ATTRS
231static void __tile_tcmmimfp16ps(__tile1024i *dst, __tile1024i src0,
232 __tile1024i src1) {
233 dst->tile = _tile_tcmmimfp16ps_internal(src0.row, src1.col, src0.col,
234 dst->tile, src0.tile, src1.tile);
235}
236
237/// Perform matrix multiplication of two tiles containing complex elements and
238/// accumulate the results into a packed single precision tile. Each dword
239/// element in input tiles src0 and src1 is interpreted as a complex number
240/// with FP16 real part and FP16 imaginary part.
241/// This function calculates the real part of the result.
242///
243/// \headerfile <immintrin.h>
244///
245/// This intrinsic corresponds to the <c> TTCMMRLFP16PS </c> instruction.
246///
247/// \param dst
248/// The destination tile. Max size is 1024 Bytes.
249/// \param src0
250/// The 1st source tile. Max size is 1024 Bytes.
251/// \param src1
252/// The 2nd source tile. Max size is 1024 Bytes.
253__DEFAULT_FN_ATTRS
254static void __tile_tcmmrlfp16ps(__tile1024i *dst, __tile1024i src0,
255 __tile1024i src1) {
256 dst->tile = _tile_tcmmrlfp16ps_internal(src0.row, src1.col, src0.col,
257 dst->tile, src0.tile, src1.tile);
258}
259
260/// Perform matrix conjugate transpose and multiplication of two tiles
261/// containing complex elements and accumulate the results into a packed
262/// single precision tile. Each dword element in input tiles src0 and src1
263/// is interpreted as a complex number with FP16 real part and FP16 imaginary
264/// part.
265/// This function calculates the imaginary part of the result.
266///
267/// \headerfile <immintrin.h>
268///
269/// This intrinsic corresponds to the <c> TCONJTCMMIMFP16PS </c> instruction.
270///
271/// \param dst
272/// The destination tile. Max size is 1024 Bytes.
273/// \param src0
274/// The 1st source tile. Max size is 1024 Bytes.
275/// \param src1
276/// The 2nd source tile. Max size is 1024 Bytes.
277__DEFAULT_FN_ATTRS
278static void __tile_conjtcmmimfp16ps(__tile1024i *dst, __tile1024i src0,
279 __tile1024i src1) {
280 dst->tile = _tile_conjtcmmimfp16ps_internal(src0.row, src1.col, src0.col,
281 dst->tile, src0.tile, src1.tile);
282}
283
284/// Perform conjugate transpose of an FP16-pair of complex elements from src and
285/// writes the result to dst.
286///
287/// \headerfile <immintrin.h>
288///
289/// This intrinsic corresponds to the <c> TCONJTFP16 </c> instruction.
290///
291/// \param dst
292/// The destination tile. Max size is 1024 Bytes.
293/// \param src
294/// The source tile. Max size is 1024 Bytes.
295__DEFAULT_FN_ATTRS
296static void __tile_conjtfp16(__tile1024i *dst, __tile1024i src) {
297 dst->tile = _tile_conjtfp16_internal(src.row, src.col, src.tile);
298}
299
300#undef __DEFAULT_FN_ATTRS
301
302#endif // __x86_64__
303#endif // __AMX_COMPLEXTRANSPOSEINTRIN_H
lib/include/amxfp16transposeintrin.h deleted-94
......@@ -1,94 +0,0 @@
1/*===----- amxfp16transposeintrin.h - AMX-FP16 and AMX-TRANSPOSE ------------===
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 \
12 "Never use <amxfp16transposeintrin.h> directly; use <immintrin.h> instead."
13#endif /* __IMMINTRIN_H */
14
15#ifndef __AMX_FP16TRANSPOSEINTRIN_H
16#define __AMX_FP16TRANSPOSEINTRIN_H
17#ifdef __x86_64__
18
19/* Define the default attributes for the functions in this file. */
20#define __DEFAULT_FN_ATTRS \
21 __attribute__((__always_inline__, __nodebug__, \
22 __target__("amx-fp16,amx-transpose")))
23
24/// Compute transpose and dot-product of FP16 (16-bit) floating-point pairs in
25/// tiles \a a and \a b, accumulating the intermediate single-precision
26/// (32-bit) floating-point elements with elements in \a dst, and store the
27/// 32-bit result back to tile \a dst.
28///
29/// \headerfile <immintrin.h>
30///
31/// \code
32/// void _tile_tdpfp16ps (__tile dst, __tile a, __tile b)
33/// \endcode
34///
35/// \code{.operation}
36/// FOR m := 0 TO dst.rows - 1
37/// tmp := dst.row[m]
38/// FOR k := 0 TO (a.colsb / 4) - 1
39/// FOR n := 0 TO (dst.colsb / 4) - 1
40/// tmp.fp32[n] += FP32(a.row[m].fp16[2*k+0]) *
41/// FP32(b.row[k].fp16[2*n+0])
42/// tmp.fp32[n] += FP32(a.row[m].fp16[2*k+1]) *
43/// FP32(b.row[k].fp16[2*n+1])
44/// ENDFOR
45/// ENDFOR
46/// write_row_and_zero(dst, m, tmp, dst.colsb)
47/// ENDFOR
48/// zero_upper_rows(dst, dst.rows)
49/// zero_tileconfig_start()
50/// \endcode
51///
52/// This intrinsic corresponds to the \c TTDPFP16PS instruction.
53///
54/// \param dst
55/// The destination tile. Max size is 1024 Bytes.
56/// \param a
57/// The 1st source tile. Max size is 1024 Bytes.
58/// \param b
59/// The 2nd source tile. Max size is 1024 Bytes.
60#define _tile_tdpfp16ps(dst, a, b) __builtin_ia32_ttdpfp16ps((dst), (a), (b))
61
62/// This is internal intrinsic. C/C++ user should avoid calling it directly.
63static __inline__ _tile1024i __DEFAULT_FN_ATTRS
64_tile_tdpfp16ps_internal(unsigned short m, unsigned short n, unsigned short k,
65 _tile1024i dst, _tile1024i src1, _tile1024i src2) {
66 return __builtin_ia32_ttdpfp16ps_internal(m, n, k, dst, src1, src2);
67}
68
69/// Compute transpose and dot-product of FP16 (16-bit) floating-point pairs in
70/// tiles src0 and src1, accumulating the intermediate single-precision
71/// (32-bit) floating-point elements with elements in "dst", and store the
72/// 32-bit result back to tile "dst".
73///
74/// \headerfile <immintrin.h>
75///
76/// This intrinsic corresponds to the <c> TTDPFP16PS </c> instruction.
77///
78/// \param dst
79/// The destination tile. Max size is 1024 Bytes.
80/// \param src0
81/// The 1st source tile. Max size is 1024 Bytes.
82/// \param src1
83/// The 2nd source tile. Max size is 1024 Bytes.
84__DEFAULT_FN_ATTRS
85static __inline__ void __tile_tdpfp16ps(__tile1024i *dst, __tile1024i src0,
86 __tile1024i src1) {
87 dst->tile = _tile_tdpfp16ps_internal(src0.row, src1.col, src0.col, dst->tile,
88 src0.tile, src1.tile);
89}
90
91#undef __DEFAULT_FN_ATTRS
92
93#endif /* __x86_64__ */
94#endif /* __AMX_FP16TRANSPOSEINTRIN_H */
lib/include/amxintrin.h-2
......@@ -230,8 +230,6 @@ static __inline__ void __DEFAULT_FN_ATTRS_TILE _tile_release(void) {
230230/// bytes. Since there is no 2D type in llvm IR, we use vector type to
231231/// represent 2D tile and the fixed size is maximum amx tile register size.
232232typedef int _tile1024i __attribute__((__vector_size__(1024), __aligned__(64)));
233typedef int _tile1024i_1024a
234 __attribute__((__vector_size__(1024), __aligned__(1024)));
235233
236234/// This is internal intrinsic. C/C++ user should avoid calling it directly.
237235static __inline__ _tile1024i __DEFAULT_FN_ATTRS_TILE
lib/include/amxmovrstransposeintrin.h deleted-200
......@@ -1,200 +0,0 @@
1/* ===--- amxmovrstransposeintrin.h - AMX_MOVRS_TRANSPOSE 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 __IMMINTRIN_H
11#error \
12 "Never use <amxmovrstransposeintrin.h> directly; use <immintrin.h> instead."
13#endif /* __IMMINTRIN_H */
14
15#ifndef __AMX_MOVRS_TRANSPOSEINTRIN_H
16#define __AMX_MOVRS_TRANSPOSEINTRIN_H
17#ifdef __x86_64__
18
19#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("amx-transpose,amx-movrs")))
22
23#define _tile_2rpntlvwz0rs(tdst, base, stride) \
24 __builtin_ia32_t2rpntlvwz0rs(tdst, base, stride)
25#define _tile_2rpntlvwz0rst1(tdst, base, stride) \
26 __builtin_ia32_t2rpntlvwz0rst1(tdst, base, stride)
27#define _tile_2rpntlvwz1rs(tdst, base, stride) \
28 __builtin_ia32_t2rpntlvwz1rs(tdst, base, stride)
29#define _tile_2rpntlvwz1rst1(tdst, base, stride) \
30 __builtin_ia32_t2rpntlvwz1rst1(tdst, base, stride)
31
32static __inline__ void __DEFAULT_FN_ATTRS _tile_2rpntlvwz0rs_internal(
33 unsigned short row, unsigned short col0, unsigned short col1,
34 _tile1024i *dst0, _tile1024i *dst1, const void *base,
35 __SIZE_TYPE__ stride) {
36 // Use __tile1024i_1024a* to escape the alignment check in
37 // clang/test/Headers/x86-intrinsics-headers-clean.cpp
38 __builtin_ia32_t2rpntlvwz0rs_internal(
39 row, col0, col1, (_tile1024i_1024a *)dst0, (_tile1024i_1024a *)dst1, base,
40 (__SIZE_TYPE__)(stride));
41}
42
43static __inline__ void __DEFAULT_FN_ATTRS _tile_2rpntlvwz0rst1_internal(
44 unsigned short row, unsigned short col0, unsigned short col1,
45 _tile1024i *dst0, _tile1024i *dst1, const void *base,
46 __SIZE_TYPE__ stride) {
47 __builtin_ia32_t2rpntlvwz0rst1_internal(
48 row, col0, col1, (_tile1024i_1024a *)dst0, (_tile1024i_1024a *)dst1, base,
49 (__SIZE_TYPE__)(stride));
50}
51
52static __inline__ void __DEFAULT_FN_ATTRS _tile_2rpntlvwz1rs_internal(
53 unsigned short row, unsigned short col0, unsigned short col1,
54 _tile1024i *dst0, _tile1024i *dst1, const void *base,
55 __SIZE_TYPE__ stride) {
56 __builtin_ia32_t2rpntlvwz1rs_internal(
57 row, col0, col1, (_tile1024i_1024a *)dst0, (_tile1024i_1024a *)dst1, base,
58 (__SIZE_TYPE__)(stride));
59}
60
61static __inline__ void __DEFAULT_FN_ATTRS _tile_2rpntlvwz1rst1_internal(
62 unsigned short row, unsigned short col0, unsigned short col1,
63 _tile1024i *dst0, _tile1024i *dst1, const void *base,
64 __SIZE_TYPE__ stride) {
65 __builtin_ia32_t2rpntlvwz1rst1_internal(
66 row, col0, col1, (_tile1024i_1024a *)dst0, (_tile1024i_1024a *)dst1, base,
67 (__SIZE_TYPE__)(stride));
68}
69
70/// Converts a pair of tiles from memory into VNNI format, and places the
71/// results in a pair of destinations specified by dst. The pair of tiles
72/// in memory is specified via a tsib; the second tile is after the first
73/// one, separated by the same stride that separates each row.
74/// The tile configuration for the destination tiles indicates the amount
75/// of data to read from memory. The instruction will load a number of rows
76/// that is equal to twice the number of rows in tmm1. The size of each row
77/// is equal to the average width of the destination tiles. If the second
78/// tile is configured with zero rows and columns, only the first tile will
79/// be written.
80/// Provides a hint to the implementation that the data will likely become
81/// read shared in the near future and the data caching can be optimized.
82///
83/// \headerfile <immintrin.h>
84///
85/// This intrinsic corresponds to the <c> T2RPNTLVWZ0RS </c> instruction.
86///
87/// \param dst0
88/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
89/// \param dst1
90/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
91/// \param base
92/// A pointer to base address.
93/// \param stride
94/// The stride between the rows' data to be loaded in memory.
95__DEFAULT_FN_ATTRS
96static void __tile_2rpntlvwz0rs(__tile1024i *dst0, __tile1024i *dst1,
97 const void *base, __SIZE_TYPE__ stride) {
98 _tile_2rpntlvwz0rs_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
99 &dst1->tile, base, stride);
100}
101
102/// Converts a pair of tiles from memory into VNNI format, and places the
103/// results in a pair of destinations specified by dst. The pair of tiles
104/// in memory is specified via a tsib; the second tile is after the first
105/// one, separated by the same stride that separates each row.
106/// The tile configuration for the destination tiles indicates the amount
107/// of data to read from memory. The instruction will load a number of rows
108/// that is equal to twice the number of rows in tmm1. The size of each row
109/// is equal to the average width of the destination tiles. If the second
110/// tile is configured with zero rows and columns, only the first tile will
111/// be written.
112///
113/// \headerfile <immintrin.h>
114///
115/// This intrinsic corresponds to the <c> T2RPNTLVWZ0T1RS </c> instruction.
116///
117/// \param dst0
118/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
119/// \param dst1
120/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
121/// \param base
122/// A pointer to base address.
123/// \param stride
124/// The stride between the rows' data to be loaded in memory.
125__DEFAULT_FN_ATTRS
126static void __tile_2rpntlvwz0rst1(__tile1024i *dst0, __tile1024i *dst1,
127 const void *base, __SIZE_TYPE__ stride) {
128 _tile_2rpntlvwz0rst1_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
129 &dst1->tile, base, stride);
130}
131
132/// Converts a pair of tiles from memory into VNNI format, and places the
133/// results in a pair of destinations specified by dst. The pair of tiles
134/// in memory is specified via a tsib; the second tile is after the first
135/// one, separated by the same stride that separates each row.
136/// The tile configuration for the destination tiles indicates the amount
137/// of data to read from memory. The instruction will load a number of rows
138/// that is equal to twice the number of rows in tmm1. The size of each row
139/// is equal to the average width of the destination tiles. If the second
140/// tile is configured with zero rows and columns, only the first tile will
141/// be written. The last row will be not be read from memory but instead
142/// filled with zeros.
143/// Provides a hint to the implementation that the data will likely become
144/// read shared in the near future and the data caching can be optimized.
145///
146/// \headerfile <immintrin.h>
147///
148/// This intrinsic corresponds to the <c> T2RPNTLVWZ1 </c> instruction.
149///
150/// \param dst0
151/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
152/// \param dst1
153/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
154/// \param base
155/// A pointer to base address.
156/// \param stride
157/// The stride between the rows' data to be loaded in memory.
158__DEFAULT_FN_ATTRS
159static void __tile_2rpntlvwz1rs(__tile1024i *dst0, __tile1024i *dst1,
160 const void *base, __SIZE_TYPE__ stride) {
161 _tile_2rpntlvwz1rs_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
162 &dst1->tile, base, stride);
163}
164
165/// Converts a pair of tiles from memory into VNNI format, and places the
166/// results in a pair of destinations specified by dst. The pair of tiles
167/// in memory is specified via a tsib; the second tile is after the first
168/// one, separated by the same stride that separates each row.
169/// The tile configuration for the destination tiles indicates the amount
170/// of data to read from memory. The instruction will load a number of rows
171/// that is equal to twice the number of rows in tmm1. The size of each row
172/// is equal to the average width of the destination tiles. If the second
173/// tile is configured with zero rows and columns, only the first tile will
174/// be written. The last row will be not be read from memory but instead
175/// filled with zeros.
176/// Provides a hint to the implementation that the data will likely become
177/// read shared in the near future and the data caching can be optimized.
178///
179/// \headerfile <immintrin.h>
180///
181/// This intrinsic corresponds to the <c> T2RPNTLVWZ1T1RS </c> instruction.
182///
183/// \param dst0
184/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
185/// \param dst1
186/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
187/// \param base
188/// A pointer to base address.
189/// \param stride
190/// The stride between the rows' data to be loaded in memory.
191__DEFAULT_FN_ATTRS
192static void __tile_2rpntlvwz1rst1(__tile1024i *dst0, __tile1024i *dst1,
193 const void *base, __SIZE_TYPE__ stride) {
194 _tile_2rpntlvwz1rst1_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
195 &dst1->tile, base, stride);
196}
197
198#undef __DEFAULT_FN_ATTRS
199#endif /* __x86_64__ */
200#endif /* __AMX_MOVRS_TRANSPOSEINTRIN_H */
lib/include/amxtf32transposeintrin.h deleted-105
......@@ -1,105 +0,0 @@
1/*===--------- amxtf32transposeintrin.h - AMX-TF32 and AMX-TRANSPOSE --------===
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 __IMMINTRIN_H
10#error \
11 "Never use <amxtf32transposeintrin.h> directly; include <immintrin.h> instead."
12#endif // __IMMINTRIN_H
13
14#ifndef __AMX_TF32TRANSPOSEINTRIN_H
15#define __AMX_TF32TRANSPOSEINTRIN_H
16#ifdef __x86_64__
17
18#define __DEFAULT_FN_ATTRS_TF32_TRANSPOSE \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("amx-tf32,amx-transpose")))
21
22/// \code
23/// void _tile_tmmultf32ps(constexpr int srcdst, constexpr int a, \
24/// constexpr int b);
25/// \endcode
26///
27/// This intrinsic corresponds to the <c> TTMMULTF32PS </c> instruction.
28///
29/// \param srcdst
30/// The destination tile. Max size is 1024 Bytes.
31/// \param a
32/// The 1st source tile. Max size is 1024 Bytes.
33/// \param b
34/// The 2nd source tile. Max size is 1024 Bytes.
35///
36/// \code{.operation}
37/// DEFINE zero_lower_mantissa_bits_fp32(x[31:0]) {
38/// dword[12:0] := 0
39/// dword[31:13] := x[31:13]
40/// return dword
41/// }
42///
43/// DEFINE silence_snan_fp32(x[31:0]) {
44/// IF (x.exponent == 255 and x.fraction != 0 and x.fraction[22] == 0)
45/// x.fraction[22] := 1
46/// return x
47/// }
48///
49/// elements_dest:= srcdst.colsb/4
50///
51/// FOR m := 0 TO (srcdst.rows-1)
52/// tmp[511:0] := 0
53/// FOR k := 0 TO (a.rows-1)
54/// FOR n := 0 TO (elements_dest-1)
55/// a1e := silence_snan_fp32(a.row[k].fp32[m])
56/// a2e := silence_snan_fp32(b.row[k].fp32[n])
57/// s1e := zero_lower_mantissa_bits_fp32(a1e)
58/// s2e := zero_lower_mantissa_bits_fp32(a2e)
59/// tmp.fp32[n] += s1e * s2e
60/// ENDFOR
61/// ENDFOR
62///
63/// FOR n := 0 TO (elements_dest-1)
64/// tmp.fp32[n] += srcdst.row[m].fp32[n]
65/// ENDFOR
66/// write_row_and_zero(srcdst, m, tmp, srcdst.colsb)
67///
68/// ENDFOR
69///
70/// zero_upper_rows(srcdst, srcdst.rows)
71/// zero_tileconfig_start()
72/// \endcode
73#define _tile_tmmultf32ps(srcdst, a, b) \
74 __builtin_ia32_ttmmultf32ps((srcdst), (a), (b))
75
76// dst = m x n (srcdest), src1 = k x m, src2 = k x n
77static __inline__ _tile1024i __DEFAULT_FN_ATTRS_TF32_TRANSPOSE
78_tile_tmmultf32ps_internal(unsigned short m, unsigned short n, unsigned short k,
79 _tile1024i dst, _tile1024i src1, _tile1024i src2) {
80 return __builtin_ia32_ttmmultf32ps_internal(m, n, k, dst, src1, src2);
81}
82
83/// Compute transpose and do Matrix Multiplication of src0 and src1, and then do
84/// Matrix Plus with dst. All the calculation is base on float32 but with the
85/// lower 13-bit set to 0.
86///
87/// \headerfile <immintrin.h>
88///
89/// This intrinsic corresponds to the <c> TTMMULTF32PS </c> instruction.
90///
91/// \param dst
92/// The destination tile. Max size is 1024 Bytes.
93/// \param src0
94/// The 1st source tile. Max size is 1024 Bytes.
95/// \param src1
96/// The 2nd source tile. Max size is 1024 Bytes.
97__DEFAULT_FN_ATTRS_TF32_TRANSPOSE
98static void __tile_tmmultf32ps(__tile1024i *dst, __tile1024i src0,
99 __tile1024i src1) {
100 dst->tile = _tile_tmmultf32ps_internal(src0.row, src1.col, src0.col,
101 dst->tile, src0.tile, src1.tile);
102}
103
104#endif // __x86_64__
105#endif // __AMX_TF32TRANSPOSEINTRIN_H
lib/include/amxtransposeintrin.h deleted-248
......@@ -1,248 +0,0 @@
1/* ===--- amxtransposeintrin.h - AMX_TRANSPOSE 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 <amxtransposeintrin.h> directly; use <immintrin.h> instead."
12#endif /* __IMMINTRIN_H */
13
14#ifndef __AMX_TRANSPOSEINTRIN_H
15#define __AMX_TRANSPOSEINTRIN_H
16#ifdef __x86_64__
17
18#define __DEFAULT_FN_ATTRS_TRANSPOSE \
19 __attribute__((__always_inline__, __nodebug__, __target__("amx-transpose")))
20
21#define _tile_2rpntlvwz0(tdst, base, stride) \
22 __builtin_ia32_t2rpntlvwz0(tdst, base, stride)
23#define _tile_2rpntlvwz0t1(tdst, base, stride) \
24 __builtin_ia32_t2rpntlvwz0t1(tdst, base, stride)
25#define _tile_2rpntlvwz1(tdst, base, stride) \
26 __builtin_ia32_t2rpntlvwz1(tdst, base, stride)
27#define _tile_2rpntlvwz1t1(tdst, base, stride) \
28 __builtin_ia32_t2rpntlvwz1t1(tdst, base, stride)
29
30/// Transpose 32-bit elements from \a src and write the result to \a dst.
31///
32/// \headerfile <immintrin.h>
33///
34/// \code
35/// void _tile_transposed(__tile dst, __tile src);
36/// \endcode
37///
38/// This intrinsic corresponds to the <c> TTRANSPOSED </c> instruction.
39///
40/// \param dst
41/// The destination tile. Max size is 1024 Bytes.
42/// \param src
43/// The source tile. Max size is 1024 Bytes.
44///
45/// \code{.operation}
46///
47/// FOR i := 0 TO (dst.rows-1)
48/// tmp[511:0] := 0
49/// FOR j := 0 TO (dst.colsb/4-1)
50/// tmp.dword[j] := src.row[j].dword[i]
51/// ENDFOR
52/// dst.row[i] := tmp
53/// ENDFOR
54///
55/// zero_upper_rows(dst, dst.rows)
56/// zero_tileconfig_start()
57/// \endcode
58#define _tile_transposed(dst, src) __builtin_ia32_ttransposed(dst, src)
59
60static __inline__ void __DEFAULT_FN_ATTRS_TRANSPOSE _tile_2rpntlvwz0_internal(
61 unsigned short row, unsigned short col0, unsigned short col1,
62 _tile1024i *dst0, _tile1024i *dst1, const void *base,
63 __SIZE_TYPE__ stride) {
64 // Use __tile1024i_1024a* to escape the alignment check in
65 // clang/test/Headers/x86-intrinsics-headers-clean.cpp
66 __builtin_ia32_t2rpntlvwz0_internal(row, col0, col1, (_tile1024i_1024a *)dst0,
67 (_tile1024i_1024a *)dst1, base,
68 (__SIZE_TYPE__)(stride));
69}
70
71static __inline__ void __DEFAULT_FN_ATTRS_TRANSPOSE _tile_2rpntlvwz0t1_internal(
72 unsigned short row, unsigned short col0, unsigned short col1,
73 _tile1024i *dst0, _tile1024i *dst1, const void *base,
74 __SIZE_TYPE__ stride) {
75 __builtin_ia32_t2rpntlvwz0t1_internal(
76 row, col0, col1, (_tile1024i_1024a *)dst0, (_tile1024i_1024a *)dst1, base,
77 (__SIZE_TYPE__)(stride));
78}
79
80static __inline__ void __DEFAULT_FN_ATTRS_TRANSPOSE _tile_2rpntlvwz1_internal(
81 unsigned short row, unsigned short col0, unsigned short col1,
82 _tile1024i *dst0, _tile1024i *dst1, const void *base,
83 __SIZE_TYPE__ stride) {
84 __builtin_ia32_t2rpntlvwz1_internal(row, col0, col1, (_tile1024i_1024a *)dst0,
85 (_tile1024i_1024a *)dst1, base,
86 (__SIZE_TYPE__)(stride));
87}
88
89static __inline__ void __DEFAULT_FN_ATTRS_TRANSPOSE _tile_2rpntlvwz1t1_internal(
90 unsigned short row, unsigned short col0, unsigned short col1,
91 _tile1024i *dst0, _tile1024i *dst1, const void *base,
92 __SIZE_TYPE__ stride) {
93 __builtin_ia32_t2rpntlvwz1t1_internal(
94 row, col0, col1, (_tile1024i_1024a *)dst0, (_tile1024i_1024a *)dst1, base,
95 (__SIZE_TYPE__)(stride));
96}
97
98// This is internal intrinsic. C/C++ user should avoid calling it directly.
99static __inline__ _tile1024i __DEFAULT_FN_ATTRS_TRANSPOSE
100_tile_transposed_internal(unsigned short m, unsigned short n, _tile1024i src) {
101 return __builtin_ia32_ttransposed_internal(m, n, src);
102}
103
104/// Converts a pair of tiles from memory into VNNI format, and places the
105/// results in a pair of destinations specified by dst. The pair of tiles
106/// in memory is specified via a tsib; the second tile is after the first
107/// one, separated by the same stride that separates each row.
108/// The tile configuration for the destination tiles indicates the amount
109/// of data to read from memory. The instruction will load a number of rows
110/// that is equal to twice the number of rows in tmm1. The size of each row
111/// is equal to the average width of the destination tiles. If the second
112/// tile is configured with zero rows and columns, only the first tile will
113/// be written.
114/// Provides a hint to the implementation that the data will likely not be
115/// reused in the near future and the data caching can be optimized.
116///
117/// \headerfile <immintrin.h>
118///
119/// This intrinsic corresponds to the <c> T2RPNTLVWZ0 </c> instruction.
120///
121/// \param dst0
122/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
123/// \param dst1
124/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
125/// \param base
126/// A pointer to base address.
127/// \param stride
128/// The stride between the rows' data to be loaded in memory.
129__DEFAULT_FN_ATTRS_TRANSPOSE
130static void __tile_2rpntlvwz0(__tile1024i *dst0, __tile1024i *dst1,
131 const void *base, __SIZE_TYPE__ stride) {
132 _tile_2rpntlvwz0_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
133 &dst1->tile, base, stride);
134}
135
136/// Converts a pair of tiles from memory into VNNI format, and places the
137/// results in a pair of destinations specified by dst. The pair of tiles
138/// in memory is specified via a tsib; the second tile is after the first
139/// one, separated by the same stride that separates each row.
140/// The tile configuration for the destination tiles indicates the amount
141/// of data to read from memory. The instruction will load a number of rows
142/// that is equal to twice the number of rows in tmm1. The size of each row
143/// is equal to the average width of the destination tiles. If the second
144/// tile is configured with zero rows and columns, only the first tile will
145/// be written.
146///
147/// \headerfile <immintrin.h>
148///
149/// This intrinsic corresponds to the <c> T2RPNTLVWZ0T1 </c> instruction.
150///
151/// \param dst0
152/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
153/// \param dst1
154/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
155/// \param base
156/// A pointer to base address.
157/// \param stride
158/// The stride between the rows' data to be loaded in memory.
159__DEFAULT_FN_ATTRS_TRANSPOSE
160static void __tile_2rpntlvwz0t1(__tile1024i *dst0, __tile1024i *dst1,
161 const void *base, __SIZE_TYPE__ stride) {
162 _tile_2rpntlvwz0t1_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
163 &dst1->tile, base, stride);
164}
165
166/// Converts a pair of tiles from memory into VNNI format, and places the
167/// results in a pair of destinations specified by dst. The pair of tiles
168/// in memory is specified via a tsib; the second tile is after the first
169/// one, separated by the same stride that separates each row.
170/// The tile configuration for the destination tiles indicates the amount
171/// of data to read from memory. The instruction will load a number of rows
172/// that is equal to twice the number of rows in tmm1. The size of each row
173/// is equal to the average width of the destination tiles. If the second
174/// tile is configured with zero rows and columns, only the first tile will
175/// be written. The last row will be not be read from memory but instead
176/// filled with zeros.
177/// Provides a hint to the implementation that the data will likely not be
178/// reused in the near future and the data caching can be optimized.
179///
180/// \headerfile <immintrin.h>
181///
182/// This intrinsic corresponds to the <c> T2RPNTLVWZ1 </c> instruction.
183///
184/// \param dst0
185/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
186/// \param dst1
187/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
188/// \param base
189/// A pointer to base address.
190/// \param stride
191/// The stride between the rows' data to be loaded in memory.
192__DEFAULT_FN_ATTRS_TRANSPOSE
193static void __tile_2rpntlvwz1(__tile1024i *dst0, __tile1024i *dst1,
194 const void *base, __SIZE_TYPE__ stride) {
195 _tile_2rpntlvwz1_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
196 &dst1->tile, base, stride);
197}
198
199/// Converts a pair of tiles from memory into VNNI format, and places the
200/// results in a pair of destinations specified by dst. The pair of tiles
201/// in memory is specified via a tsib; the second tile is after the first
202/// one, separated by the same stride that separates each row.
203/// The tile configuration for the destination tiles indicates the amount
204/// of data to read from memory. The instruction will load a number of rows
205/// that is equal to twice the number of rows in tmm1. The size of each row
206/// is equal to the average width of the destination tiles. If the second
207/// tile is configured with zero rows and columns, only the first tile will
208/// be written. The last row will be not be read from memory but instead
209/// filled with zeros.
210/// Provides a hint to the implementation that the data will likely not be
211/// reused in the near future and the data caching can be optimized.
212///
213/// \headerfile <immintrin.h>
214///
215/// This intrinsic corresponds to the <c> T2RPNTLVWZ1T1 </c> instruction.
216///
217/// \param dst0
218/// First tile of destination tile pair. Max size is 1024i*2 Bytes.
219/// \param dst1
220/// Second tile of destination tile pair. Max size is 1024i*2 Bytes.
221/// \param base
222/// A pointer to base address.
223/// \param stride
224/// The stride between the rows' data to be loaded in memory.
225__DEFAULT_FN_ATTRS_TRANSPOSE
226static void __tile_2rpntlvwz1t1(__tile1024i *dst0, __tile1024i *dst1,
227 const void *base, __SIZE_TYPE__ stride) {
228 _tile_2rpntlvwz1t1_internal(dst0->row, dst0->col, dst1->col, &dst0->tile,
229 &dst1->tile, base, stride);
230}
231
232/// Transpose 32-bit elements from src and write the result to dst.
233///
234/// \headerfile <immintrin.h>
235///
236/// This intrinsic corresponds to the <c> TTRANSPOSED </c> instruction.
237///
238/// \param dst
239/// The destination tile. Max size is 1024 Bytes.
240/// \param src
241/// The source tile. Max size is 1024 Bytes.
242__DEFAULT_FN_ATTRS_TRANSPOSE
243static void __tile_transposed(__tile1024i *dst, __tile1024i src) {
244 dst->tile = _tile_transposed_internal(dst->row, dst->col, src.tile);
245}
246
247#endif /* __x86_64__ */
248#endif /* __AMX_TRANSPOSEINTRIN_H */
lib/include/arm_acle.h+37-27
......@@ -55,11 +55,37 @@ __chkfeat(uint64_t __features) {
5555/* 7.5 Swap */
5656static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
5757__swp(uint32_t __x, volatile uint32_t *__p) {
58 uint32_t v;
59 do
60 v = __builtin_arm_ldrex(__p);
61 while (__builtin_arm_strex(__x, __p));
62 return v;
58 uint32_t __v;
59#if (__ARM_FEATURE_LDREX & 4) || __ARM_ARCH_6M__ || __linux__
60 /*
61 * Using this clang builtin is sensible in most situations. Where
62 * LDREX and STREX are available, it will compile to a loop using
63 * them. Otherwise it will compile to a libcall, requiring the
64 * runtime to provide that library function.
65 *
66 * That's unavoidable on Armv6-M, which has no atomic instructions
67 * at all (not even SWP), so in that situation the user will just
68 * have to provide an implementation of __atomic_exchange_4 (perhaps
69 * it would temporarily disable interrupts, and then do a separate
70 * load and store).
71 *
72 * We also use the libcall strategy on pre-Armv7 Linux targets, on
73 * the theory that Linux's runtime support library _will_ provide a
74 * suitable libcall, and it's better to use that than the SWP
75 * instruction because then when the same binary is run on a later
76 * Linux system the libcall implementation will use LDREX instead.
77 */
78 __v = __atomic_exchange_n(__p, __x, __ATOMIC_RELAXED);
79#else
80 /*
81 * But for older Arm architectures when the target is not Linux, we
82 * fall back to using the SWP instruction via inline assembler. ACLE
83 * is clear that we're allowed to do this, but shouldn't do it if we
84 * have a better alternative.
85 */
86 __asm__("swp %0, %1, [%2]" : "=r"(__v) : "r"(__x), "r"(__p) : "memory");
87#endif
88 return __v;
6389}
6490
6591/* 7.6 Memory prefetch intrinsics */
......@@ -72,6 +98,12 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
7298#else
7399#define __pldx(access_kind, cache_level, retention_policy, addr) \
74100 __builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
101#define __pldx_range(access_kind, retention_policy, length, count, stride, \
102 reuse_distance, addr) \
103 __builtin_arm_range_prefetch_x(addr, access_kind, retention_policy, length, \
104 count, stride, reuse_distance)
105#define __pld_range(access_kind, retention_policy, metadata, addr) \
106 __builtin_arm_range_prefetch(addr, access_kind, retention_policy, metadata)
75107#endif
76108
77109/* 7.6.2 Instruction prefetch */
......@@ -795,28 +827,6 @@ __arm_st64bv0(void *__addr, data512_t __value) {
795827
796828#endif // __ARM_FEATURE_COPROC
797829
798/* 17 Transactional Memory Extension (TME) Intrinsics */
799#if defined(__ARM_FEATURE_TME) && __ARM_FEATURE_TME
800
801#define _TMFAILURE_REASON 0x00007fffu
802#define _TMFAILURE_RTRY 0x00008000u
803#define _TMFAILURE_CNCL 0x00010000u
804#define _TMFAILURE_MEM 0x00020000u
805#define _TMFAILURE_IMP 0x00040000u
806#define _TMFAILURE_ERR 0x00080000u
807#define _TMFAILURE_SIZE 0x00100000u
808#define _TMFAILURE_NEST 0x00200000u
809#define _TMFAILURE_DBG 0x00400000u
810#define _TMFAILURE_INT 0x00800000u
811#define _TMFAILURE_TRIVIAL 0x01000000u
812
813#define __tstart() __builtin_arm_tstart()
814#define __tcommit() __builtin_arm_tcommit()
815#define __tcancel(__arg) __builtin_arm_tcancel(__arg)
816#define __ttest() __builtin_arm_ttest()
817
818#endif /* __ARM_FEATURE_TME */
819
820830/* 8.7 Armv8.5-A Random number generation intrinsics */
821831#if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
822832static __inline__ int __attribute__((__always_inline__, __nodebug__, target("rand")))
lib/include/arm_neon.h+218-82
......@@ -10562,7 +10562,7 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1056210562#define vget_lane_p8(__p0, __p1) __extension__ ({ \
1056310563 poly8_t __ret; \
1056410564 poly8x8_t __s0 = __p0; \
10565 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vget_lane_i8(__s0, __p1)); \
10565 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vget_lane_i8(__builtin_bit_cast(int8x8_t, __s0), __p1)); \
1056610566 __ret; \
1056710567})
1056810568#else
......@@ -10570,13 +10570,13 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1057010570 poly8_t __ret; \
1057110571 poly8x8_t __s0 = __p0; \
1057210572 poly8x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_8); \
10573 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vget_lane_i8(__rev0, __p1)); \
10573 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vget_lane_i8(__builtin_bit_cast(int8x8_t, __rev0), __p1)); \
1057410574 __ret; \
1057510575})
1057610576#define __noswap_vget_lane_p8(__p0, __p1) __extension__ ({ \
1057710577 poly8_t __ret; \
1057810578 poly8x8_t __s0 = __p0; \
10579 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vget_lane_i8(__s0, __p1)); \
10579 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vget_lane_i8(__builtin_bit_cast(int8x8_t, __s0), __p1)); \
1058010580 __ret; \
1058110581})
1058210582#endif
......@@ -10585,7 +10585,7 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1058510585#define vget_lane_p16(__p0, __p1) __extension__ ({ \
1058610586 poly16_t __ret; \
1058710587 poly16x4_t __s0 = __p0; \
10588 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vget_lane_i16(__s0, __p1)); \
10588 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vget_lane_i16(__builtin_bit_cast(int16x4_t, __s0), __p1)); \
1058910589 __ret; \
1059010590})
1059110591#else
......@@ -10593,13 +10593,13 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1059310593 poly16_t __ret; \
1059410594 poly16x4_t __s0 = __p0; \
1059510595 poly16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
10596 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vget_lane_i16(__rev0, __p1)); \
10596 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vget_lane_i16(__builtin_bit_cast(int16x4_t, __rev0), __p1)); \
1059710597 __ret; \
1059810598})
1059910599#define __noswap_vget_lane_p16(__p0, __p1) __extension__ ({ \
1060010600 poly16_t __ret; \
1060110601 poly16x4_t __s0 = __p0; \
10602 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vget_lane_i16(__s0, __p1)); \
10602 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vget_lane_i16(__builtin_bit_cast(int16x4_t, __s0), __p1)); \
1060310603 __ret; \
1060410604})
1060510605#endif
......@@ -10608,7 +10608,7 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1060810608#define vgetq_lane_p8(__p0, __p1) __extension__ ({ \
1060910609 poly8_t __ret; \
1061010610 poly8x16_t __s0 = __p0; \
10611 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vgetq_lane_i8(__s0, __p1)); \
10611 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vgetq_lane_i8(__builtin_bit_cast(int8x16_t, __s0), __p1)); \
1061210612 __ret; \
1061310613})
1061410614#else
......@@ -10616,13 +10616,13 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1061610616 poly8_t __ret; \
1061710617 poly8x16_t __s0 = __p0; \
1061810618 poly8x16_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_8); \
10619 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vgetq_lane_i8(__rev0, __p1)); \
10619 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vgetq_lane_i8(__builtin_bit_cast(int8x16_t, __rev0), __p1)); \
1062010620 __ret; \
1062110621})
1062210622#define __noswap_vgetq_lane_p8(__p0, __p1) __extension__ ({ \
1062310623 poly8_t __ret; \
1062410624 poly8x16_t __s0 = __p0; \
10625 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vgetq_lane_i8(__s0, __p1)); \
10625 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vgetq_lane_i8(__builtin_bit_cast(int8x16_t, __s0), __p1)); \
1062610626 __ret; \
1062710627})
1062810628#endif
......@@ -10631,7 +10631,7 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1063110631#define vgetq_lane_p16(__p0, __p1) __extension__ ({ \
1063210632 poly16_t __ret; \
1063310633 poly16x8_t __s0 = __p0; \
10634 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vgetq_lane_i16(__s0, __p1)); \
10634 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vgetq_lane_i16(__builtin_bit_cast(int16x8_t, __s0), __p1)); \
1063510635 __ret; \
1063610636})
1063710637#else
......@@ -10639,13 +10639,13 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1063910639 poly16_t __ret; \
1064010640 poly16x8_t __s0 = __p0; \
1064110641 poly16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
10642 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vgetq_lane_i16(__rev0, __p1)); \
10642 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vgetq_lane_i16(__builtin_bit_cast(int16x8_t, __rev0), __p1)); \
1064310643 __ret; \
1064410644})
1064510645#define __noswap_vgetq_lane_p16(__p0, __p1) __extension__ ({ \
1064610646 poly16_t __ret; \
1064710647 poly16x8_t __s0 = __p0; \
10648 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vgetq_lane_i16(__s0, __p1)); \
10648 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vgetq_lane_i16(__builtin_bit_cast(int16x8_t, __s0), __p1)); \
1064910649 __ret; \
1065010650})
1065110651#endif
......@@ -27027,7 +27027,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2702727027 poly8x8_t __ret; \
2702827028 poly8_t __s0 = __p0; \
2702927029 poly8x8_t __s1 = __p1; \
27030 __ret = __builtin_bit_cast(poly8x8_t, __builtin_neon_vset_lane_i8(__s0, __s1, __p2)); \
27030 __ret = __builtin_bit_cast(poly8x8_t, __builtin_neon_vset_lane_i8(__s0, __builtin_bit_cast(int8x8_t, __s1), __p2)); \
2703127031 __ret; \
2703227032})
2703327033#else
......@@ -27036,7 +27036,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2703627036 poly8_t __s0 = __p0; \
2703727037 poly8x8_t __s1 = __p1; \
2703827038 poly8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
27039 __ret = __builtin_bit_cast(poly8x8_t, __builtin_neon_vset_lane_i8(__s0, __rev1, __p2)); \
27039 __ret = __builtin_bit_cast(poly8x8_t, __builtin_neon_vset_lane_i8(__s0, __builtin_bit_cast(int8x8_t, __rev1), __p2)); \
2704027040 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_8); \
2704127041 __ret; \
2704227042})
......@@ -27044,7 +27044,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2704427044 poly8x8_t __ret; \
2704527045 poly8_t __s0 = __p0; \
2704627046 poly8x8_t __s1 = __p1; \
27047 __ret = __builtin_bit_cast(poly8x8_t, __builtin_neon_vset_lane_i8(__s0, __s1, __p2)); \
27047 __ret = __builtin_bit_cast(poly8x8_t, __builtin_neon_vset_lane_i8(__s0, __builtin_bit_cast(int8x8_t, __s1), __p2)); \
2704827048 __ret; \
2704927049})
2705027050#endif
......@@ -27054,7 +27054,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2705427054 poly16x4_t __ret; \
2705527055 poly16_t __s0 = __p0; \
2705627056 poly16x4_t __s1 = __p1; \
27057 __ret = __builtin_bit_cast(poly16x4_t, __builtin_neon_vset_lane_i16(__s0, __s1, __p2)); \
27057 __ret = __builtin_bit_cast(poly16x4_t, __builtin_neon_vset_lane_i16(__s0, __builtin_bit_cast(int16x4_t, __s1), __p2)); \
2705827058 __ret; \
2705927059})
2706027060#else
......@@ -27063,7 +27063,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2706327063 poly16_t __s0 = __p0; \
2706427064 poly16x4_t __s1 = __p1; \
2706527065 poly16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
27066 __ret = __builtin_bit_cast(poly16x4_t, __builtin_neon_vset_lane_i16(__s0, __rev1, __p2)); \
27066 __ret = __builtin_bit_cast(poly16x4_t, __builtin_neon_vset_lane_i16(__s0, __builtin_bit_cast(int16x4_t, __rev1), __p2)); \
2706727067 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
2706827068 __ret; \
2706927069})
......@@ -27071,7 +27071,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2707127071 poly16x4_t __ret; \
2707227072 poly16_t __s0 = __p0; \
2707327073 poly16x4_t __s1 = __p1; \
27074 __ret = __builtin_bit_cast(poly16x4_t, __builtin_neon_vset_lane_i16(__s0, __s1, __p2)); \
27074 __ret = __builtin_bit_cast(poly16x4_t, __builtin_neon_vset_lane_i16(__s0, __builtin_bit_cast(int16x4_t, __s1), __p2)); \
2707527075 __ret; \
2707627076})
2707727077#endif
......@@ -27081,7 +27081,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2708127081 poly8x16_t __ret; \
2708227082 poly8_t __s0 = __p0; \
2708327083 poly8x16_t __s1 = __p1; \
27084 __ret = __builtin_bit_cast(poly8x16_t, __builtin_neon_vsetq_lane_i8(__s0, __s1, __p2)); \
27084 __ret = __builtin_bit_cast(poly8x16_t, __builtin_neon_vsetq_lane_i8(__s0, __builtin_bit_cast(int8x16_t, __s1), __p2)); \
2708527085 __ret; \
2708627086})
2708727087#else
......@@ -27090,7 +27090,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2709027090 poly8_t __s0 = __p0; \
2709127091 poly8x16_t __s1 = __p1; \
2709227092 poly8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
27093 __ret = __builtin_bit_cast(poly8x16_t, __builtin_neon_vsetq_lane_i8(__s0, __rev1, __p2)); \
27093 __ret = __builtin_bit_cast(poly8x16_t, __builtin_neon_vsetq_lane_i8(__s0, __builtin_bit_cast(int8x16_t, __rev1), __p2)); \
2709427094 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_8); \
2709527095 __ret; \
2709627096})
......@@ -27098,7 +27098,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2709827098 poly8x16_t __ret; \
2709927099 poly8_t __s0 = __p0; \
2710027100 poly8x16_t __s1 = __p1; \
27101 __ret = __builtin_bit_cast(poly8x16_t, __builtin_neon_vsetq_lane_i8(__s0, __s1, __p2)); \
27101 __ret = __builtin_bit_cast(poly8x16_t, __builtin_neon_vsetq_lane_i8(__s0, __builtin_bit_cast(int8x16_t, __s1), __p2)); \
2710227102 __ret; \
2710327103})
2710427104#endif
......@@ -27108,7 +27108,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2710827108 poly16x8_t __ret; \
2710927109 poly16_t __s0 = __p0; \
2711027110 poly16x8_t __s1 = __p1; \
27111 __ret = __builtin_bit_cast(poly16x8_t, __builtin_neon_vsetq_lane_i16(__s0, __s1, __p2)); \
27111 __ret = __builtin_bit_cast(poly16x8_t, __builtin_neon_vsetq_lane_i16(__s0, __builtin_bit_cast(int16x8_t, __s1), __p2)); \
2711227112 __ret; \
2711327113})
2711427114#else
......@@ -27117,7 +27117,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2711727117 poly16_t __s0 = __p0; \
2711827118 poly16x8_t __s1 = __p1; \
2711927119 poly16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
27120 __ret = __builtin_bit_cast(poly16x8_t, __builtin_neon_vsetq_lane_i16(__s0, __rev1, __p2)); \
27120 __ret = __builtin_bit_cast(poly16x8_t, __builtin_neon_vsetq_lane_i16(__s0, __builtin_bit_cast(int16x8_t, __rev1), __p2)); \
2712127121 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
2712227122 __ret; \
2712327123})
......@@ -27125,7 +27125,7 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2712527125 poly16x8_t __ret; \
2712627126 poly16_t __s0 = __p0; \
2712727127 poly16x8_t __s1 = __p1; \
27128 __ret = __builtin_bit_cast(poly16x8_t, __builtin_neon_vsetq_lane_i16(__s0, __s1, __p2)); \
27128 __ret = __builtin_bit_cast(poly16x8_t, __builtin_neon_vsetq_lane_i16(__s0, __builtin_bit_cast(int16x8_t, __s1), __p2)); \
2712927129 __ret; \
2713027130})
2713127131#endif
......@@ -41141,6 +41141,42 @@ __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("f8f16mm,neon"))) float16x8_t vmmlaq_f16_mf8_fpm(float16x8_t __p0, mfloat8x16_t __p1, mfloat8x16_t __p2, fpm_t __p3) {
41146 float16x8_t __ret;
41147 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmmlaq_f16_mf8_fpm(__builtin_bit_cast(int8x16_t, __p0), __p1, __p2, __p3));
41148 return __ret;
41149}
41150#else
41151__ai __attribute__((target("f8f16mm,neon"))) float16x8_t vmmlaq_f16_mf8_fpm(float16x8_t __p0, mfloat8x16_t __p1, mfloat8x16_t __p2, fpm_t __p3) {
41152 float16x8_t __ret;
41153 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
41154 mfloat8x16_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_8);
41155 mfloat8x16_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_8);
41156 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmmlaq_f16_mf8_fpm(__builtin_bit_cast(int8x16_t, __rev0), __rev1, __rev2, __p3));
41157 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
41158 return __ret;
41159}
41160#endif
41161
41162#ifdef __LITTLE_ENDIAN__
41163__ai __attribute__((target("f8f32mm,neon"))) float32x4_t vmmlaq_f32_mf8_fpm(float32x4_t __p0, mfloat8x16_t __p1, mfloat8x16_t __p2, fpm_t __p3) {
41164 float32x4_t __ret;
41165 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vmmlaq_f32_mf8_fpm(__p0, __p1, __p2, __p3));
41166 return __ret;
41167}
41168#else
41169__ai __attribute__((target("f8f32mm,neon"))) float32x4_t vmmlaq_f32_mf8_fpm(float32x4_t __p0, mfloat8x16_t __p1, mfloat8x16_t __p2, fpm_t __p3) {
41170 float32x4_t __ret;
41171 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
41172 mfloat8x16_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_8);
41173 mfloat8x16_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_8);
41174 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vmmlaq_f32_mf8_fpm(__rev0, __rev1, __rev2, __p3));
41175 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
41176 return __ret;
41177}
41178#endif
41179
4114441180#ifdef __LITTLE_ENDIAN__
4114541181__ai __attribute__((target("fp8,neon"))) bfloat16x8_t vcvt1_bf16_mf8_fpm(mfloat8x8_t __p0, fpm_t __p1) {
4114641182 bfloat16x8_t __ret;
......@@ -49847,6 +49883,16 @@ __ai __attribute__((target("neon"))) int32_t vcvts_s32_f32(float32_t __p0) {
4984749883 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvts_s32_f32(__p0));
4984849884 return __ret;
4984949885}
49886__ai __attribute__((target("neon"))) int32_t vcvtd_s32_f64(float64_t __p0) {
49887 int32_t __ret;
49888 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtd_s32_f64(__p0));
49889 return __ret;
49890}
49891__ai __attribute__((target("neon"))) int64_t vcvts_s64_f32(float32_t __p0) {
49892 int64_t __ret;
49893 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvts_s64_f32(__p0));
49894 return __ret;
49895}
4985049896__ai __attribute__((target("neon"))) int64_t vcvtd_s64_f64(float64_t __p0) {
4985149897 int64_t __ret;
4985249898 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtd_s64_f64(__p0));
......@@ -49878,6 +49924,16 @@ __ai __attribute__((target("neon"))) uint32_t vcvts_u32_f32(float32_t __p0) {
4987849924 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvts_u32_f32(__p0));
4987949925 return __ret;
4988049926}
49927__ai __attribute__((target("neon"))) uint32_t vcvtd_u32_f64(float64_t __p0) {
49928 uint32_t __ret;
49929 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtd_u32_f64(__p0));
49930 return __ret;
49931}
49932__ai __attribute__((target("neon"))) uint64_t vcvts_u64_f32(float32_t __p0) {
49933 uint64_t __ret;
49934 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvts_u64_f32(__p0));
49935 return __ret;
49936}
4988149937__ai __attribute__((target("neon"))) uint64_t vcvtd_u64_f64(float64_t __p0) {
4988249938 uint64_t __ret;
4988349939 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtd_u64_f64(__p0));
......@@ -49909,6 +49965,11 @@ __ai __attribute__((target("neon"))) int32_t vcvtas_s32_f32(float32_t __p0) {
4990949965 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtas_s32_f32(__p0));
4991049966 return __ret;
4991149967}
49968__ai __attribute__((target("neon"))) int32_t vcvtad_s32_f64(float64_t __p0) {
49969 int32_t __ret;
49970 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtad_s32_f64(__p0));
49971 return __ret;
49972}
4991249973#ifdef __LITTLE_ENDIAN__
4991349974__ai __attribute__((target("neon"))) int64x2_t vcvtaq_s64_f64(float64x2_t __p0) {
4991449975 int64x2_t __ret;
......@@ -49930,6 +49991,11 @@ __ai __attribute__((target("neon"))) int64x1_t vcvta_s64_f64(float64x1_t __p0) {
4993049991 __ret = __builtin_bit_cast(int64x1_t, __builtin_neon_vcvta_s64_v(__builtin_bit_cast(int8x8_t, __p0), 3));
4993149992 return __ret;
4993249993}
49994__ai __attribute__((target("neon"))) int64_t vcvtas_s64_f32(float32_t __p0) {
49995 int64_t __ret;
49996 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtas_s64_f32(__p0));
49997 return __ret;
49998}
4993349999__ai __attribute__((target("neon"))) int64_t vcvtad_s64_f64(float64_t __p0) {
4993450000 int64_t __ret;
4993550001 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtad_s64_f64(__p0));
......@@ -49940,6 +50006,11 @@ __ai __attribute__((target("neon"))) uint32_t vcvtas_u32_f32(float32_t __p0) {
4994050006 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtas_u32_f32(__p0));
4994150007 return __ret;
4994250008}
50009__ai __attribute__((target("neon"))) uint32_t vcvtad_u32_f64(float64_t __p0) {
50010 uint32_t __ret;
50011 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtad_u32_f64(__p0));
50012 return __ret;
50013}
4994350014#ifdef __LITTLE_ENDIAN__
4994450015__ai __attribute__((target("neon"))) uint64x2_t vcvtaq_u64_f64(float64x2_t __p0) {
4994550016 uint64x2_t __ret;
......@@ -49961,6 +50032,11 @@ __ai __attribute__((target("neon"))) uint64x1_t vcvta_u64_f64(float64x1_t __p0)
4996150032 __ret = __builtin_bit_cast(uint64x1_t, __builtin_neon_vcvta_u64_v(__builtin_bit_cast(int8x8_t, __p0), 19));
4996250033 return __ret;
4996350034}
50035__ai __attribute__((target("neon"))) uint64_t vcvtas_u64_f32(float32_t __p0) {
50036 uint64_t __ret;
50037 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtas_u64_f32(__p0));
50038 return __ret;
50039}
4996450040__ai __attribute__((target("neon"))) uint64_t vcvtad_u64_f64(float64_t __p0) {
4996550041 uint64_t __ret;
4996650042 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtad_u64_f64(__p0));
......@@ -49971,6 +50047,11 @@ __ai __attribute__((target("neon"))) int32_t vcvtms_s32_f32(float32_t __p0) {
4997150047 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtms_s32_f32(__p0));
4997250048 return __ret;
4997350049}
50050__ai __attribute__((target("neon"))) int32_t vcvtmd_s32_f64(float64_t __p0) {
50051 int32_t __ret;
50052 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtmd_s32_f64(__p0));
50053 return __ret;
50054}
4997450055#ifdef __LITTLE_ENDIAN__
4997550056__ai __attribute__((target("neon"))) int64x2_t vcvtmq_s64_f64(float64x2_t __p0) {
4997650057 int64x2_t __ret;
......@@ -49992,6 +50073,11 @@ __ai __attribute__((target("neon"))) int64x1_t vcvtm_s64_f64(float64x1_t __p0) {
4999250073 __ret = __builtin_bit_cast(int64x1_t, __builtin_neon_vcvtm_s64_v(__builtin_bit_cast(int8x8_t, __p0), 3));
4999350074 return __ret;
4999450075}
50076__ai __attribute__((target("neon"))) int64_t vcvtms_s64_f32(float32_t __p0) {
50077 int64_t __ret;
50078 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtms_s64_f32(__p0));
50079 return __ret;
50080}
4999550081__ai __attribute__((target("neon"))) int64_t vcvtmd_s64_f64(float64_t __p0) {
4999650082 int64_t __ret;
4999750083 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtmd_s64_f64(__p0));
......@@ -50002,6 +50088,11 @@ __ai __attribute__((target("neon"))) uint32_t vcvtms_u32_f32(float32_t __p0) {
5000250088 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtms_u32_f32(__p0));
5000350089 return __ret;
5000450090}
50091__ai __attribute__((target("neon"))) uint32_t vcvtmd_u32_f64(float64_t __p0) {
50092 uint32_t __ret;
50093 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtmd_u32_f64(__p0));
50094 return __ret;
50095}
5000550096#ifdef __LITTLE_ENDIAN__
5000650097__ai __attribute__((target("neon"))) uint64x2_t vcvtmq_u64_f64(float64x2_t __p0) {
5000750098 uint64x2_t __ret;
......@@ -50023,6 +50114,11 @@ __ai __attribute__((target("neon"))) uint64x1_t vcvtm_u64_f64(float64x1_t __p0)
5002350114 __ret = __builtin_bit_cast(uint64x1_t, __builtin_neon_vcvtm_u64_v(__builtin_bit_cast(int8x8_t, __p0), 19));
5002450115 return __ret;
5002550116}
50117__ai __attribute__((target("neon"))) uint64_t vcvtms_u64_f32(float32_t __p0) {
50118 uint64_t __ret;
50119 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtms_u64_f32(__p0));
50120 return __ret;
50121}
5002650122__ai __attribute__((target("neon"))) uint64_t vcvtmd_u64_f64(float64_t __p0) {
5002750123 uint64_t __ret;
5002850124 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtmd_u64_f64(__p0));
......@@ -50033,6 +50129,11 @@ __ai __attribute__((target("neon"))) int32_t vcvtns_s32_f32(float32_t __p0) {
5003350129 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtns_s32_f32(__p0));
5003450130 return __ret;
5003550131}
50132__ai __attribute__((target("neon"))) int32_t vcvtnd_s32_f64(float64_t __p0) {
50133 int32_t __ret;
50134 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtnd_s32_f64(__p0));
50135 return __ret;
50136}
5003650137#ifdef __LITTLE_ENDIAN__
5003750138__ai __attribute__((target("neon"))) int64x2_t vcvtnq_s64_f64(float64x2_t __p0) {
5003850139 int64x2_t __ret;
......@@ -50054,6 +50155,11 @@ __ai __attribute__((target("neon"))) int64x1_t vcvtn_s64_f64(float64x1_t __p0) {
5005450155 __ret = __builtin_bit_cast(int64x1_t, __builtin_neon_vcvtn_s64_v(__builtin_bit_cast(int8x8_t, __p0), 3));
5005550156 return __ret;
5005650157}
50158__ai __attribute__((target("neon"))) int64_t vcvtns_s64_f32(float32_t __p0) {
50159 int64_t __ret;
50160 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtns_s64_f32(__p0));
50161 return __ret;
50162}
5005750163__ai __attribute__((target("neon"))) int64_t vcvtnd_s64_f64(float64_t __p0) {
5005850164 int64_t __ret;
5005950165 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtnd_s64_f64(__p0));
......@@ -50064,6 +50170,11 @@ __ai __attribute__((target("neon"))) uint32_t vcvtns_u32_f32(float32_t __p0) {
5006450170 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtns_u32_f32(__p0));
5006550171 return __ret;
5006650172}
50173__ai __attribute__((target("neon"))) uint32_t vcvtnd_u32_f64(float64_t __p0) {
50174 uint32_t __ret;
50175 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtnd_u32_f64(__p0));
50176 return __ret;
50177}
5006750178#ifdef __LITTLE_ENDIAN__
5006850179__ai __attribute__((target("neon"))) uint64x2_t vcvtnq_u64_f64(float64x2_t __p0) {
5006950180 uint64x2_t __ret;
......@@ -50085,6 +50196,11 @@ __ai __attribute__((target("neon"))) uint64x1_t vcvtn_u64_f64(float64x1_t __p0)
5008550196 __ret = __builtin_bit_cast(uint64x1_t, __builtin_neon_vcvtn_u64_v(__builtin_bit_cast(int8x8_t, __p0), 19));
5008650197 return __ret;
5008750198}
50199__ai __attribute__((target("neon"))) uint64_t vcvtns_u64_f32(float32_t __p0) {
50200 uint64_t __ret;
50201 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtns_u64_f32(__p0));
50202 return __ret;
50203}
5008850204__ai __attribute__((target("neon"))) uint64_t vcvtnd_u64_f64(float64_t __p0) {
5008950205 uint64_t __ret;
5009050206 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtnd_u64_f64(__p0));
......@@ -50095,6 +50211,11 @@ __ai __attribute__((target("neon"))) int32_t vcvtps_s32_f32(float32_t __p0) {
5009550211 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtps_s32_f32(__p0));
5009650212 return __ret;
5009750213}
50214__ai __attribute__((target("neon"))) int32_t vcvtpd_s32_f64(float64_t __p0) {
50215 int32_t __ret;
50216 __ret = __builtin_bit_cast(int32_t, __builtin_neon_vcvtpd_s32_f64(__p0));
50217 return __ret;
50218}
5009850219#ifdef __LITTLE_ENDIAN__
5009950220__ai __attribute__((target("neon"))) int64x2_t vcvtpq_s64_f64(float64x2_t __p0) {
5010050221 int64x2_t __ret;
......@@ -50116,6 +50237,11 @@ __ai __attribute__((target("neon"))) int64x1_t vcvtp_s64_f64(float64x1_t __p0) {
5011650237 __ret = __builtin_bit_cast(int64x1_t, __builtin_neon_vcvtp_s64_v(__builtin_bit_cast(int8x8_t, __p0), 3));
5011750238 return __ret;
5011850239}
50240__ai __attribute__((target("neon"))) int64_t vcvtps_s64_f32(float32_t __p0) {
50241 int64_t __ret;
50242 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtps_s64_f32(__p0));
50243 return __ret;
50244}
5011950245__ai __attribute__((target("neon"))) int64_t vcvtpd_s64_f64(float64_t __p0) {
5012050246 int64_t __ret;
5012150247 __ret = __builtin_bit_cast(int64_t, __builtin_neon_vcvtpd_s64_f64(__p0));
......@@ -50126,6 +50252,11 @@ __ai __attribute__((target("neon"))) uint32_t vcvtps_u32_f32(float32_t __p0) {
5012650252 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtps_u32_f32(__p0));
5012750253 return __ret;
5012850254}
50255__ai __attribute__((target("neon"))) uint32_t vcvtpd_u32_f64(float64_t __p0) {
50256 uint32_t __ret;
50257 __ret = __builtin_bit_cast(uint32_t, __builtin_neon_vcvtpd_u32_f64(__p0));
50258 return __ret;
50259}
5012950260#ifdef __LITTLE_ENDIAN__
5013050261__ai __attribute__((target("neon"))) uint64x2_t vcvtpq_u64_f64(float64x2_t __p0) {
5013150262 uint64x2_t __ret;
......@@ -50147,6 +50278,11 @@ __ai __attribute__((target("neon"))) uint64x1_t vcvtp_u64_f64(float64x1_t __p0)
5014750278 __ret = __builtin_bit_cast(uint64x1_t, __builtin_neon_vcvtp_u64_v(__builtin_bit_cast(int8x8_t, __p0), 19));
5014850279 return __ret;
5014950280}
50281__ai __attribute__((target("neon"))) uint64_t vcvtps_u64_f32(float32_t __p0) {
50282 uint64_t __ret;
50283 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtps_u64_f32(__p0));
50284 return __ret;
50285}
5015050286__ai __attribute__((target("neon"))) uint64_t vcvtpd_u64_f64(float64_t __p0) {
5015150287 uint64_t __ret;
5015250288 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vcvtpd_u64_f64(__p0));
......@@ -50255,7 +50391,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5025550391#define vdupb_lane_p8(__p0, __p1) __extension__ ({ \
5025650392 poly8_t __ret; \
5025750393 poly8x8_t __s0 = __p0; \
50258 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_lane_i8(__s0, __p1)); \
50394 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_lane_i8(__builtin_bit_cast(int8x8_t, __s0), __p1)); \
5025950395 __ret; \
5026050396})
5026150397#else
......@@ -50263,7 +50399,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5026350399 poly8_t __ret; \
5026450400 poly8x8_t __s0 = __p0; \
5026550401 poly8x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_8); \
50266 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_lane_i8(__rev0, __p1)); \
50402 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_lane_i8(__builtin_bit_cast(int8x8_t, __rev0), __p1)); \
5026750403 __ret; \
5026850404})
5026950405#endif
......@@ -50272,7 +50408,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5027250408#define vduph_lane_p16(__p0, __p1) __extension__ ({ \
5027350409 poly16_t __ret; \
5027450410 poly16x4_t __s0 = __p0; \
50275 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_lane_i16(__s0, __p1)); \
50411 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_lane_i16(__builtin_bit_cast(int16x4_t, __s0), __p1)); \
5027650412 __ret; \
5027750413})
5027850414#else
......@@ -50280,7 +50416,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5028050416 poly16_t __ret; \
5028150417 poly16x4_t __s0 = __p0; \
5028250418 poly16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
50283 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_lane_i16(__rev0, __p1)); \
50419 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_lane_i16(__builtin_bit_cast(int16x4_t, __rev0), __p1)); \
5028450420 __ret; \
5028550421})
5028650422#endif
......@@ -50506,7 +50642,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5050650642#define vdupb_laneq_p8(__p0, __p1) __extension__ ({ \
5050750643 poly8_t __ret; \
5050850644 poly8x16_t __s0 = __p0; \
50509 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_laneq_i8(__s0, __p1)); \
50645 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_laneq_i8(__builtin_bit_cast(int8x16_t, __s0), __p1)); \
5051050646 __ret; \
5051150647})
5051250648#else
......@@ -50514,7 +50650,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5051450650 poly8_t __ret; \
5051550651 poly8x16_t __s0 = __p0; \
5051650652 poly8x16_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_8); \
50517 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_laneq_i8(__rev0, __p1)); \
50653 __ret = __builtin_bit_cast(poly8_t, __builtin_neon_vdupb_laneq_i8(__builtin_bit_cast(int8x16_t, __rev0), __p1)); \
5051850654 __ret; \
5051950655})
5052050656#endif
......@@ -50523,7 +50659,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5052350659#define vduph_laneq_p16(__p0, __p1) __extension__ ({ \
5052450660 poly16_t __ret; \
5052550661 poly16x8_t __s0 = __p0; \
50526 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_laneq_i16(__s0, __p1)); \
50662 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_laneq_i16(__builtin_bit_cast(int16x8_t, __s0), __p1)); \
5052750663 __ret; \
5052850664})
5052950665#else
......@@ -50531,7 +50667,7 @@ __ai __attribute__((target("neon"))) float32x2_t vdiv_f32(float32x2_t __p0, floa
5053150667 poly16_t __ret; \
5053250668 poly16x8_t __s0 = __p0; \
5053350669 poly16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
50534 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_laneq_i16(__rev0, __p1)); \
50670 __ret = __builtin_bit_cast(poly16_t, __builtin_neon_vduph_laneq_i16(__builtin_bit_cast(int16x8_t, __rev0), __p1)); \
5053550671 __ret; \
5053650672})
5053750673#endif
......@@ -52105,14 +52241,14 @@ __ai __attribute__((target("neon"))) float64x1_t vget_high_f64(float64x2_t __p0)
5210552241#define vget_lane_p64(__p0, __p1) __extension__ ({ \
5210652242 poly64_t __ret; \
5210752243 poly64x1_t __s0 = __p0; \
52108 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vget_lane_i64(__s0, __p1)); \
52244 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vget_lane_i64(__builtin_bit_cast(int64x1_t, __s0), __p1)); \
5210952245 __ret; \
5211052246})
5211152247#ifdef __LITTLE_ENDIAN__
5211252248#define vgetq_lane_p64(__p0, __p1) __extension__ ({ \
5211352249 poly64_t __ret; \
5211452250 poly64x2_t __s0 = __p0; \
52115 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vgetq_lane_i64(__s0, __p1)); \
52251 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vgetq_lane_i64(__builtin_bit_cast(int64x2_t, __s0), __p1)); \
5211652252 __ret; \
5211752253})
5211852254#else
......@@ -52120,13 +52256,13 @@ __ai __attribute__((target("neon"))) float64x1_t vget_high_f64(float64x2_t __p0)
5212052256 poly64_t __ret; \
5212152257 poly64x2_t __s0 = __p0; \
5212252258 poly64x2_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_64); \
52123 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vgetq_lane_i64(__rev0, __p1)); \
52259 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vgetq_lane_i64(__builtin_bit_cast(int64x2_t, __rev0), __p1)); \
5212452260 __ret; \
5212552261})
5212652262#define __noswap_vgetq_lane_p64(__p0, __p1) __extension__ ({ \
5212752263 poly64_t __ret; \
5212852264 poly64x2_t __s0 = __p0; \
52129 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vgetq_lane_i64(__s0, __p1)); \
52265 __ret = __builtin_bit_cast(poly64_t, __builtin_neon_vgetq_lane_i64(__builtin_bit_cast(int64x2_t, __s0), __p1)); \
5213052266 __ret; \
5213152267})
5213252268#endif
......@@ -59743,20 +59879,20 @@ __ai __attribute__((target("neon"))) int16_t vqrshlh_s16(int16_t __p0, int16_t _
5974359879})
5974459880#ifdef __LITTLE_ENDIAN__
5974559881#define vqrshrun_high_n_s32(__p0_716, __p1_716, __p2_716) __extension__ ({ \
59746 int16x8_t __ret_716; \
59747 int16x4_t __s0_716 = __p0_716; \
59882 uint16x8_t __ret_716; \
59883 uint16x4_t __s0_716 = __p0_716; \
5974859884 int32x4_t __s1_716 = __p1_716; \
59749 __ret_716 = __builtin_bit_cast(int16x8_t, vcombine_s16(__builtin_bit_cast(int16x4_t, __s0_716), __builtin_bit_cast(int16x4_t, vqrshrun_n_s32(__s1_716, __p2_716)))); \
59885 __ret_716 = __builtin_bit_cast(uint16x8_t, vcombine_u16(__builtin_bit_cast(uint16x4_t, __s0_716), __builtin_bit_cast(uint16x4_t, vqrshrun_n_s32(__s1_716, __p2_716)))); \
5975059886 __ret_716; \
5975159887})
5975259888#else
5975359889#define vqrshrun_high_n_s32(__p0_717, __p1_717, __p2_717) __extension__ ({ \
59754 int16x8_t __ret_717; \
59755 int16x4_t __s0_717 = __p0_717; \
59890 uint16x8_t __ret_717; \
59891 uint16x4_t __s0_717 = __p0_717; \
5975659892 int32x4_t __s1_717 = __p1_717; \
59757 int16x4_t __rev0_717; __rev0_717 = __builtin_shufflevector(__s0_717, __s0_717, __lane_reverse_64_16); \
59893 uint16x4_t __rev0_717; __rev0_717 = __builtin_shufflevector(__s0_717, __s0_717, __lane_reverse_64_16); \
5975859894 int32x4_t __rev1_717; __rev1_717 = __builtin_shufflevector(__s1_717, __s1_717, __lane_reverse_128_32); \
59759 __ret_717 = __builtin_bit_cast(int16x8_t, __noswap_vcombine_s16(__builtin_bit_cast(int16x4_t, __rev0_717), __builtin_bit_cast(int16x4_t, __noswap_vqrshrun_n_s32(__rev1_717, __p2_717)))); \
59895 __ret_717 = __builtin_bit_cast(uint16x8_t, __noswap_vcombine_u16(__builtin_bit_cast(uint16x4_t, __rev0_717), __builtin_bit_cast(uint16x4_t, __noswap_vqrshrun_n_s32(__rev1_717, __p2_717)))); \
5976059896 __ret_717 = __builtin_shufflevector(__ret_717, __ret_717, __lane_reverse_128_16); \
5976159897 __ret_717; \
5976259898})
......@@ -59764,20 +59900,20 @@ __ai __attribute__((target("neon"))) int16_t vqrshlh_s16(int16_t __p0, int16_t _
5976459900
5976559901#ifdef __LITTLE_ENDIAN__
5976659902#define vqrshrun_high_n_s64(__p0_718, __p1_718, __p2_718) __extension__ ({ \
59767 int32x4_t __ret_718; \
59768 int32x2_t __s0_718 = __p0_718; \
59903 uint32x4_t __ret_718; \
59904 uint32x2_t __s0_718 = __p0_718; \
5976959905 int64x2_t __s1_718 = __p1_718; \
59770 __ret_718 = __builtin_bit_cast(int32x4_t, vcombine_s32(__builtin_bit_cast(int32x2_t, __s0_718), __builtin_bit_cast(int32x2_t, vqrshrun_n_s64(__s1_718, __p2_718)))); \
59906 __ret_718 = __builtin_bit_cast(uint32x4_t, vcombine_u32(__builtin_bit_cast(uint32x2_t, __s0_718), __builtin_bit_cast(uint32x2_t, vqrshrun_n_s64(__s1_718, __p2_718)))); \
5977159907 __ret_718; \
5977259908})
5977359909#else
5977459910#define vqrshrun_high_n_s64(__p0_719, __p1_719, __p2_719) __extension__ ({ \
59775 int32x4_t __ret_719; \
59776 int32x2_t __s0_719 = __p0_719; \
59911 uint32x4_t __ret_719; \
59912 uint32x2_t __s0_719 = __p0_719; \
5977759913 int64x2_t __s1_719 = __p1_719; \
59778 int32x2_t __rev0_719; __rev0_719 = __builtin_shufflevector(__s0_719, __s0_719, __lane_reverse_64_32); \
59914 uint32x2_t __rev0_719; __rev0_719 = __builtin_shufflevector(__s0_719, __s0_719, __lane_reverse_64_32); \
5977959915 int64x2_t __rev1_719; __rev1_719 = __builtin_shufflevector(__s1_719, __s1_719, __lane_reverse_128_64); \
59780 __ret_719 = __builtin_bit_cast(int32x4_t, __noswap_vcombine_s32(__builtin_bit_cast(int32x2_t, __rev0_719), __builtin_bit_cast(int32x2_t, __noswap_vqrshrun_n_s64(__rev1_719, __p2_719)))); \
59916 __ret_719 = __builtin_bit_cast(uint32x4_t, __noswap_vcombine_u32(__builtin_bit_cast(uint32x2_t, __rev0_719), __builtin_bit_cast(uint32x2_t, __noswap_vqrshrun_n_s64(__rev1_719, __p2_719)))); \
5978159917 __ret_719 = __builtin_shufflevector(__ret_719, __ret_719, __lane_reverse_128_32); \
5978259918 __ret_719; \
5978359919})
......@@ -59785,20 +59921,20 @@ __ai __attribute__((target("neon"))) int16_t vqrshlh_s16(int16_t __p0, int16_t _
5978559921
5978659922#ifdef __LITTLE_ENDIAN__
5978759923#define vqrshrun_high_n_s16(__p0_720, __p1_720, __p2_720) __extension__ ({ \
59788 int8x16_t __ret_720; \
59789 int8x8_t __s0_720 = __p0_720; \
59924 uint8x16_t __ret_720; \
59925 uint8x8_t __s0_720 = __p0_720; \
5979059926 int16x8_t __s1_720 = __p1_720; \
59791 __ret_720 = __builtin_bit_cast(int8x16_t, vcombine_s8(__builtin_bit_cast(int8x8_t, __s0_720), __builtin_bit_cast(int8x8_t, vqrshrun_n_s16(__s1_720, __p2_720)))); \
59927 __ret_720 = __builtin_bit_cast(uint8x16_t, vcombine_u8(__builtin_bit_cast(uint8x8_t, __s0_720), __builtin_bit_cast(uint8x8_t, vqrshrun_n_s16(__s1_720, __p2_720)))); \
5979259928 __ret_720; \
5979359929})
5979459930#else
5979559931#define vqrshrun_high_n_s16(__p0_721, __p1_721, __p2_721) __extension__ ({ \
59796 int8x16_t __ret_721; \
59797 int8x8_t __s0_721 = __p0_721; \
59932 uint8x16_t __ret_721; \
59933 uint8x8_t __s0_721 = __p0_721; \
5979859934 int16x8_t __s1_721 = __p1_721; \
59799 int8x8_t __rev0_721; __rev0_721 = __builtin_shufflevector(__s0_721, __s0_721, __lane_reverse_64_8); \
59935 uint8x8_t __rev0_721; __rev0_721 = __builtin_shufflevector(__s0_721, __s0_721, __lane_reverse_64_8); \
5980059936 int16x8_t __rev1_721; __rev1_721 = __builtin_shufflevector(__s1_721, __s1_721, __lane_reverse_128_16); \
59801 __ret_721 = __builtin_bit_cast(int8x16_t, __noswap_vcombine_s8(__builtin_bit_cast(int8x8_t, __rev0_721), __builtin_bit_cast(int8x8_t, __noswap_vqrshrun_n_s16(__rev1_721, __p2_721)))); \
59937 __ret_721 = __builtin_bit_cast(uint8x16_t, __noswap_vcombine_u8(__builtin_bit_cast(uint8x8_t, __rev0_721), __builtin_bit_cast(uint8x8_t, __noswap_vqrshrun_n_s16(__rev1_721, __p2_721)))); \
5980259938 __ret_721 = __builtin_shufflevector(__ret_721, __ret_721, __lane_reverse_128_8); \
5980359939 __ret_721; \
5980459940})
......@@ -60098,20 +60234,20 @@ __ai __attribute__((target("neon"))) int16_t vqshlh_s16(int16_t __p0, int16_t __
6009860234})
6009960235#ifdef __LITTLE_ENDIAN__
6010060236#define vqshrun_high_n_s32(__p0_734, __p1_734, __p2_734) __extension__ ({ \
60101 int16x8_t __ret_734; \
60102 int16x4_t __s0_734 = __p0_734; \
60237 uint16x8_t __ret_734; \
60238 uint16x4_t __s0_734 = __p0_734; \
6010360239 int32x4_t __s1_734 = __p1_734; \
60104 __ret_734 = __builtin_bit_cast(int16x8_t, vcombine_s16(__builtin_bit_cast(int16x4_t, __s0_734), __builtin_bit_cast(int16x4_t, vqshrun_n_s32(__s1_734, __p2_734)))); \
60240 __ret_734 = __builtin_bit_cast(uint16x8_t, vcombine_u16(__builtin_bit_cast(uint16x4_t, __s0_734), __builtin_bit_cast(uint16x4_t, vqshrun_n_s32(__s1_734, __p2_734)))); \
6010560241 __ret_734; \
6010660242})
6010760243#else
6010860244#define vqshrun_high_n_s32(__p0_735, __p1_735, __p2_735) __extension__ ({ \
60109 int16x8_t __ret_735; \
60110 int16x4_t __s0_735 = __p0_735; \
60245 uint16x8_t __ret_735; \
60246 uint16x4_t __s0_735 = __p0_735; \
6011160247 int32x4_t __s1_735 = __p1_735; \
60112 int16x4_t __rev0_735; __rev0_735 = __builtin_shufflevector(__s0_735, __s0_735, __lane_reverse_64_16); \
60248 uint16x4_t __rev0_735; __rev0_735 = __builtin_shufflevector(__s0_735, __s0_735, __lane_reverse_64_16); \
6011360249 int32x4_t __rev1_735; __rev1_735 = __builtin_shufflevector(__s1_735, __s1_735, __lane_reverse_128_32); \
60114 __ret_735 = __builtin_bit_cast(int16x8_t, __noswap_vcombine_s16(__builtin_bit_cast(int16x4_t, __rev0_735), __builtin_bit_cast(int16x4_t, __noswap_vqshrun_n_s32(__rev1_735, __p2_735)))); \
60250 __ret_735 = __builtin_bit_cast(uint16x8_t, __noswap_vcombine_u16(__builtin_bit_cast(uint16x4_t, __rev0_735), __builtin_bit_cast(uint16x4_t, __noswap_vqshrun_n_s32(__rev1_735, __p2_735)))); \
6011560251 __ret_735 = __builtin_shufflevector(__ret_735, __ret_735, __lane_reverse_128_16); \
6011660252 __ret_735; \
6011760253})
......@@ -60119,20 +60255,20 @@ __ai __attribute__((target("neon"))) int16_t vqshlh_s16(int16_t __p0, int16_t __
6011960255
6012060256#ifdef __LITTLE_ENDIAN__
6012160257#define vqshrun_high_n_s64(__p0_736, __p1_736, __p2_736) __extension__ ({ \
60122 int32x4_t __ret_736; \
60123 int32x2_t __s0_736 = __p0_736; \
60258 uint32x4_t __ret_736; \
60259 uint32x2_t __s0_736 = __p0_736; \
6012460260 int64x2_t __s1_736 = __p1_736; \
60125 __ret_736 = __builtin_bit_cast(int32x4_t, vcombine_s32(__builtin_bit_cast(int32x2_t, __s0_736), __builtin_bit_cast(int32x2_t, vqshrun_n_s64(__s1_736, __p2_736)))); \
60261 __ret_736 = __builtin_bit_cast(uint32x4_t, vcombine_u32(__builtin_bit_cast(uint32x2_t, __s0_736), __builtin_bit_cast(uint32x2_t, vqshrun_n_s64(__s1_736, __p2_736)))); \
6012660262 __ret_736; \
6012760263})
6012860264#else
6012960265#define vqshrun_high_n_s64(__p0_737, __p1_737, __p2_737) __extension__ ({ \
60130 int32x4_t __ret_737; \
60131 int32x2_t __s0_737 = __p0_737; \
60266 uint32x4_t __ret_737; \
60267 uint32x2_t __s0_737 = __p0_737; \
6013260268 int64x2_t __s1_737 = __p1_737; \
60133 int32x2_t __rev0_737; __rev0_737 = __builtin_shufflevector(__s0_737, __s0_737, __lane_reverse_64_32); \
60269 uint32x2_t __rev0_737; __rev0_737 = __builtin_shufflevector(__s0_737, __s0_737, __lane_reverse_64_32); \
6013460270 int64x2_t __rev1_737; __rev1_737 = __builtin_shufflevector(__s1_737, __s1_737, __lane_reverse_128_64); \
60135 __ret_737 = __builtin_bit_cast(int32x4_t, __noswap_vcombine_s32(__builtin_bit_cast(int32x2_t, __rev0_737), __builtin_bit_cast(int32x2_t, __noswap_vqshrun_n_s64(__rev1_737, __p2_737)))); \
60271 __ret_737 = __builtin_bit_cast(uint32x4_t, __noswap_vcombine_u32(__builtin_bit_cast(uint32x2_t, __rev0_737), __builtin_bit_cast(uint32x2_t, __noswap_vqshrun_n_s64(__rev1_737, __p2_737)))); \
6013660272 __ret_737 = __builtin_shufflevector(__ret_737, __ret_737, __lane_reverse_128_32); \
6013760273 __ret_737; \
6013860274})
......@@ -60140,20 +60276,20 @@ __ai __attribute__((target("neon"))) int16_t vqshlh_s16(int16_t __p0, int16_t __
6014060276
6014160277#ifdef __LITTLE_ENDIAN__
6014260278#define vqshrun_high_n_s16(__p0_738, __p1_738, __p2_738) __extension__ ({ \
60143 int8x16_t __ret_738; \
60144 int8x8_t __s0_738 = __p0_738; \
60279 uint8x16_t __ret_738; \
60280 uint8x8_t __s0_738 = __p0_738; \
6014560281 int16x8_t __s1_738 = __p1_738; \
60146 __ret_738 = __builtin_bit_cast(int8x16_t, vcombine_s8(__builtin_bit_cast(int8x8_t, __s0_738), __builtin_bit_cast(int8x8_t, vqshrun_n_s16(__s1_738, __p2_738)))); \
60282 __ret_738 = __builtin_bit_cast(uint8x16_t, vcombine_u8(__builtin_bit_cast(uint8x8_t, __s0_738), __builtin_bit_cast(uint8x8_t, vqshrun_n_s16(__s1_738, __p2_738)))); \
6014760283 __ret_738; \
6014860284})
6014960285#else
6015060286#define vqshrun_high_n_s16(__p0_739, __p1_739, __p2_739) __extension__ ({ \
60151 int8x16_t __ret_739; \
60152 int8x8_t __s0_739 = __p0_739; \
60287 uint8x16_t __ret_739; \
60288 uint8x8_t __s0_739 = __p0_739; \
6015360289 int16x8_t __s1_739 = __p1_739; \
60154 int8x8_t __rev0_739; __rev0_739 = __builtin_shufflevector(__s0_739, __s0_739, __lane_reverse_64_8); \
60290 uint8x8_t __rev0_739; __rev0_739 = __builtin_shufflevector(__s0_739, __s0_739, __lane_reverse_64_8); \
6015560291 int16x8_t __rev1_739; __rev1_739 = __builtin_shufflevector(__s1_739, __s1_739, __lane_reverse_128_16); \
60156 __ret_739 = __builtin_bit_cast(int8x16_t, __noswap_vcombine_s8(__builtin_bit_cast(int8x8_t, __rev0_739), __builtin_bit_cast(int8x8_t, __noswap_vqshrun_n_s16(__rev1_739, __p2_739)))); \
60292 __ret_739 = __builtin_bit_cast(uint8x16_t, __noswap_vcombine_u8(__builtin_bit_cast(uint8x8_t, __rev0_739), __builtin_bit_cast(uint8x8_t, __noswap_vqshrun_n_s16(__rev1_739, __p2_739)))); \
6015760293 __ret_739 = __builtin_shufflevector(__ret_739, __ret_739, __lane_reverse_128_8); \
6015860294 __ret_739; \
6015960295})
......@@ -64345,7 +64481,7 @@ __ai __attribute__((target("neon"))) int8x16_t vrsubhn_high_s16(int8x8_t __p0, i
6434564481 poly64x1_t __ret; \
6434664482 poly64_t __s0 = __p0; \
6434764483 poly64x1_t __s1 = __p1; \
64348 __ret = __builtin_bit_cast(poly64x1_t, __builtin_neon_vset_lane_i64(__s0, __s1, __p2)); \
64484 __ret = __builtin_bit_cast(poly64x1_t, __builtin_neon_vset_lane_i64(__s0, __builtin_bit_cast(int64x1_t, __s1), __p2)); \
6434964485 __ret; \
6435064486})
6435164487#ifdef __LITTLE_ENDIAN__
......@@ -64353,7 +64489,7 @@ __ai __attribute__((target("neon"))) int8x16_t vrsubhn_high_s16(int8x8_t __p0, i
6435364489 poly64x2_t __ret; \
6435464490 poly64_t __s0 = __p0; \
6435564491 poly64x2_t __s1 = __p1; \
64356 __ret = __builtin_bit_cast(poly64x2_t, __builtin_neon_vsetq_lane_i64(__s0, __s1, __p2)); \
64492 __ret = __builtin_bit_cast(poly64x2_t, __builtin_neon_vsetq_lane_i64(__s0, __builtin_bit_cast(int64x2_t, __s1), __p2)); \
6435764493 __ret; \
6435864494})
6435964495#else
......@@ -64362,7 +64498,7 @@ __ai __attribute__((target("neon"))) int8x16_t vrsubhn_high_s16(int8x8_t __p0, i
6436264498 poly64_t __s0 = __p0; \
6436364499 poly64x2_t __s1 = __p1; \
6436464500 poly64x2_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_64); \
64365 __ret = __builtin_bit_cast(poly64x2_t, __builtin_neon_vsetq_lane_i64(__s0, __rev1, __p2)); \
64501 __ret = __builtin_bit_cast(poly64x2_t, __builtin_neon_vsetq_lane_i64(__s0, __builtin_bit_cast(int64x2_t, __rev1), __p2)); \
6436664502 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_64); \
6436764503 __ret; \
6436864504})
......@@ -64370,7 +64506,7 @@ __ai __attribute__((target("neon"))) int8x16_t vrsubhn_high_s16(int8x8_t __p0, i
6437064506 poly64x2_t __ret; \
6437164507 poly64_t __s0 = __p0; \
6437264508 poly64x2_t __s1 = __p1; \
64373 __ret = __builtin_bit_cast(poly64x2_t, __builtin_neon_vsetq_lane_i64(__s0, __s1, __p2)); \
64509 __ret = __builtin_bit_cast(poly64x2_t, __builtin_neon_vsetq_lane_i64(__s0, __builtin_bit_cast(int64x2_t, __s1), __p2)); \
6437464510 __ret; \
6437564511})
6437664512#endif
lib/include/arm_sme.h+8-8
......@@ -796,8 +796,6 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za16_mf8_vg1x2
796796void svdot_za16_mf8_vg1x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
797797__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za16_mf8_vg1x4_fpm)))
798798void svdot_za16_mf8_vg1x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8x4_t, fpm_t);
799__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za16_mf8_vg2x1_fpm)))
800void svmla_single_za16_mf8_vg2x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
801799__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za16_mf8_vg2x2_fpm)))
802800void svmla_single_za16_mf8_vg2x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, fpm_t);
803801__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za16_mf8_vg2x4_fpm)))
......@@ -808,6 +806,8 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za16_mf8_
808806void svmla_lane_za16_mf8_vg2x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, uint64_t, fpm_t);
809807__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za16_mf8_vg2x4_fpm)))
810808void svmla_lane_za16_mf8_vg2x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8_t, uint64_t, fpm_t);
809__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za16_mf8_vg2x1_fpm)))
810void svmla_za16_mf8_vg2x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
811811__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za16_mf8_vg2x2_fpm)))
812812void svmla_za16_mf8_vg2x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
813813__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za16_mf8_vg2x4_fpm)))
......@@ -828,8 +828,6 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za16_mf8_vg1x
828828void svdot_za16_vg1x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
829829__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za16_mf8_vg1x4_fpm)))
830830void svdot_za16_vg1x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8x4_t, fpm_t);
831__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za16_mf8_vg2x1_fpm)))
832void svmla_za16_vg2x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
833831__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za16_mf8_vg2x2_fpm)))
834832void svmla_za16_vg2x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, fpm_t);
835833__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za16_mf8_vg2x4_fpm)))
......@@ -840,6 +838,8 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za16_mf8
840838void svmla_lane_za16_vg2x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, uint64_t, fpm_t);
841839__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za16_mf8_vg2x4_fpm)))
842840void svmla_lane_za16_vg2x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8_t, uint64_t, fpm_t);
841__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za16_mf8_vg2x1_fpm)))
842void svmla_za16_vg2x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
843843__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za16_mf8_vg2x2_fpm)))
844844void svmla_za16_vg2x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
845845__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za16_mf8_vg2x4_fpm)))
......@@ -860,8 +860,6 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za32_mf8_vg1x2
860860void svdot_za32_mf8_vg1x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
861861__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za32_mf8_vg1x4_fpm)))
862862void svdot_za32_mf8_vg1x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8x4_t, fpm_t);
863__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za32_mf8_vg4x1_fpm)))
864void svmla_single_za32_mf8_vg4x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
865863__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za32_mf8_vg4x2_fpm)))
866864void svmla_single_za32_mf8_vg4x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, fpm_t);
867865__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za32_mf8_vg4x4_fpm)))
......@@ -872,6 +870,8 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za32_mf8_
872870void svmla_lane_za32_mf8_vg4x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, uint64_t, fpm_t);
873871__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za32_mf8_vg4x4_fpm)))
874872void svmla_lane_za32_mf8_vg4x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8_t, uint64_t, fpm_t);
873__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za32_mf8_vg4x1_fpm)))
874void svmla_za32_mf8_vg4x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
875875__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za32_mf8_vg4x2_fpm)))
876876void svmla_za32_mf8_vg4x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
877877__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za32_mf8_vg4x4_fpm)))
......@@ -894,8 +894,6 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za32_mf8_vg1x
894894void svdot_za32_vg1x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
895895__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svdot_za32_mf8_vg1x4_fpm)))
896896void svdot_za32_vg1x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8x4_t, fpm_t);
897__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za32_mf8_vg4x1_fpm)))
898void svmla_za32_vg4x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
899897__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za32_mf8_vg4x2_fpm)))
900898void svmla_za32_vg4x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, fpm_t);
901899__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_single_za32_mf8_vg4x4_fpm)))
......@@ -906,6 +904,8 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za32_mf8
906904void svmla_lane_za32_vg4x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8_t, uint64_t, fpm_t);
907905__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_lane_za32_mf8_vg4x4_fpm)))
908906void svmla_lane_za32_vg4x4_fpm(uint32_t, svmfloat8x4_t, svmfloat8_t, uint64_t, fpm_t);
907__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za32_mf8_vg4x1_fpm)))
908void svmla_za32_vg4x1_fpm(uint32_t, svmfloat8_t, svmfloat8_t, fpm_t);
909909__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za32_mf8_vg4x2_fpm)))
910910void svmla_za32_vg4x2_fpm(uint32_t, svmfloat8x2_t, svmfloat8x2_t, fpm_t);
911911__aio __attribute__((__clang_arm_builtin_alias(__builtin_sme_svmla_za32_mf8_vg4x4_fpm)))
lib/include/arm_sve.h+4162-3782
......@@ -4617,6 +4617,86 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_x2)))
46174617svbfloat16x2_t svminnm(svbfloat16x2_t, svbfloat16x2_t);
46184618__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_x4)))
46194619svbfloat16x4_t svminnm(svbfloat16x4_t, svbfloat16x4_t);
4620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_bf16_x2)))
4621svbfloat16x2_t svmul_single_bf16_x2(svbfloat16x2_t, svbfloat16_t);
4622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_bf16_x4)))
4623svbfloat16x4_t svmul_single_bf16_x4(svbfloat16x4_t, svbfloat16_t);
4624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x2)))
4625svbfloat16x2_t svmul_bf16_x2(svbfloat16x2_t, svbfloat16x2_t);
4626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x4)))
4627svbfloat16x4_t svmul_bf16_x4(svbfloat16x4_t, svbfloat16x4_t);
4628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_single_bf16_x2)))
4629svbfloat16x2_t svscale_single_bf16_x2(svbfloat16x2_t, svint16_t);
4630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_single_bf16_x4)))
4631svbfloat16x4_t svscale_single_bf16_x4(svbfloat16x4_t, svint16_t);
4632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_x2)))
4633svbfloat16x2_t svscale_bf16_x2(svbfloat16x2_t, svint16x2_t);
4634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_x4)))
4635svbfloat16x4_t svscale_bf16_x4(svbfloat16x4_t, svint16x4_t);
4636__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_bf16_x2)))
4637svbfloat16x2_t svmul(svbfloat16x2_t, svbfloat16_t);
4638__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_bf16_x4)))
4639svbfloat16x4_t svmul(svbfloat16x4_t, svbfloat16_t);
4640__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x2)))
4641svbfloat16x2_t svmul(svbfloat16x2_t, svbfloat16x2_t);
4642__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x4)))
4643svbfloat16x4_t svmul(svbfloat16x4_t, svbfloat16x4_t);
4644__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_single_bf16_x2)))
4645svbfloat16x2_t svscale(svbfloat16x2_t, svint16_t);
4646__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_single_bf16_x4)))
4647svbfloat16x4_t svscale(svbfloat16x4_t, svint16_t);
4648__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_x2)))
4649svbfloat16x2_t svscale(svbfloat16x2_t, svint16x2_t);
4650__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_x4)))
4651svbfloat16x4_t svscale(svbfloat16x4_t, svint16x4_t);
4652__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f64_x2)))
4653svfloat64x2_t svmul_single_f64_x2(svfloat64x2_t, svfloat64_t);
4654__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f32_x2)))
4655svfloat32x2_t svmul_single_f32_x2(svfloat32x2_t, svfloat32_t);
4656__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f16_x2)))
4657svfloat16x2_t svmul_single_f16_x2(svfloat16x2_t, svfloat16_t);
4658__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f64_x4)))
4659svfloat64x4_t svmul_single_f64_x4(svfloat64x4_t, svfloat64_t);
4660__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f32_x4)))
4661svfloat32x4_t svmul_single_f32_x4(svfloat32x4_t, svfloat32_t);
4662__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f16_x4)))
4663svfloat16x4_t svmul_single_f16_x4(svfloat16x4_t, svfloat16_t);
4664__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f64_x2)))
4665svfloat64x2_t svmul_f64_x2(svfloat64x2_t, svfloat64x2_t);
4666__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f32_x2)))
4667svfloat32x2_t svmul_f32_x2(svfloat32x2_t, svfloat32x2_t);
4668__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f16_x2)))
4669svfloat16x2_t svmul_f16_x2(svfloat16x2_t, svfloat16x2_t);
4670__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f64_x4)))
4671svfloat64x4_t svmul_f64_x4(svfloat64x4_t, svfloat64x4_t);
4672__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f32_x4)))
4673svfloat32x4_t svmul_f32_x4(svfloat32x4_t, svfloat32x4_t);
4674__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f16_x4)))
4675svfloat16x4_t svmul_f16_x4(svfloat16x4_t, svfloat16x4_t);
4676__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f64_x2)))
4677svfloat64x2_t svmul(svfloat64x2_t, svfloat64_t);
4678__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f32_x2)))
4679svfloat32x2_t svmul(svfloat32x2_t, svfloat32_t);
4680__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f16_x2)))
4681svfloat16x2_t svmul(svfloat16x2_t, svfloat16_t);
4682__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f64_x4)))
4683svfloat64x4_t svmul(svfloat64x4_t, svfloat64_t);
4684__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f32_x4)))
4685svfloat32x4_t svmul(svfloat32x4_t, svfloat32_t);
4686__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_single_f16_x4)))
4687svfloat16x4_t svmul(svfloat16x4_t, svfloat16_t);
4688__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f64_x2)))
4689svfloat64x2_t svmul(svfloat64x2_t, svfloat64x2_t);
4690__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f32_x2)))
4691svfloat32x2_t svmul(svfloat32x2_t, svfloat32x2_t);
4692__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f16_x2)))
4693svfloat16x2_t svmul(svfloat16x2_t, svfloat16x2_t);
4694__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f64_x4)))
4695svfloat64x4_t svmul(svfloat64x4_t, svfloat64x4_t);
4696__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f32_x4)))
4697svfloat32x4_t svmul(svfloat32x4_t, svfloat32x4_t);
4698__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f16_x4)))
4699svfloat16x4_t svmul(svfloat16x4_t, svfloat16x4_t);
46204700__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadda_f64)))
46214701float64_t svadda_f64(svbool_t, float64_t, svfloat64_t);
46224702__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadda_f32)))
......@@ -4655,18 +4735,6 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadrw_u32base_s32in
46554735svuint32_t svadrw_u32base_s32index(svuint32_t, svint32_t);
46564736__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadrw_u64base_s64index)))
46574737svuint64_t svadrw_u64base_s64index(svuint64_t, svint64_t);
4658__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u32)))
4659svuint32_t svcompact_u32(svbool_t, svuint32_t);
4660__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u64)))
4661svuint64_t svcompact_u64(svbool_t, svuint64_t);
4662__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f64)))
4663svfloat64_t svcompact_f64(svbool_t, svfloat64_t);
4664__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f32)))
4665svfloat32_t svcompact_f32(svbool_t, svfloat32_t);
4666__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s32)))
4667svint32_t svcompact_s32(svbool_t, svint32_t);
4668__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s64)))
4669svint64_t svcompact_s64(svbool_t, svint64_t);
46704738__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_gather_u32base_index_u32)))
46714739svuint32_t svld1_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
46724740__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_gather_u64base_index_u64)))
......@@ -5923,18 +5991,6 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadrw_u32base_s32i
59235991svuint32_t svadrw_index(svuint32_t, svint32_t);
59245992__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadrw_u64base_s64index)))
59255993svuint64_t svadrw_index(svuint64_t, svint64_t);
5926__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u32)))
5927svuint32_t svcompact(svbool_t, svuint32_t);
5928__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u64)))
5929svuint64_t svcompact(svbool_t, svuint64_t);
5930__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f64)))
5931svfloat64_t svcompact(svbool_t, svfloat64_t);
5932__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f32)))
5933svfloat32_t svcompact(svbool_t, svfloat32_t);
5934__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s32)))
5935svint32_t svcompact(svbool_t, svint32_t);
5936__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s64)))
5937svint64_t svcompact(svbool_t, svint64_t);
59385994__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_gather_u32base_index_u32)))
59395995svuint32_t svld1_gather_index_u32(svbool_t, svuint32_t, int64_t);
59405996__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_gather_u64base_index_u64)))
......@@ -8777,3764 +8833,222 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzipq2_mf8)))
87778833svmfloat8_t svzipq2(svmfloat8_t, svmfloat8_t);
87788834__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzipq2_s16)))
87798835svint16_t svzipq2(svint16_t, svint16_t);
8780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmmla_f32)))
8781svfloat32_t svbfmmla_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
8782__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmmla_f32)))
8783svfloat32_t svbfmmla(svfloat32_t, svbfloat16_t, svbfloat16_t);
8784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_n_f32)))
8785svfloat32_t svbfdot_n_f32(svfloat32_t, svbfloat16_t, bfloat16_t);
8786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_f32)))
8787svfloat32_t svbfdot_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
8788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_lane_f32)))
8789svfloat32_t svbfdot_lane_f32(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
8790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_n_f32)))
8791svfloat32_t svbfmlalb_n_f32(svfloat32_t, svbfloat16_t, bfloat16_t);
8792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_f32)))
8793svfloat32_t svbfmlalb_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
8794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_lane_f32)))
8795svfloat32_t svbfmlalb_lane_f32(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
8796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_n_f32)))
8797svfloat32_t svbfmlalt_n_f32(svfloat32_t, svbfloat16_t, bfloat16_t);
8798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_f32)))
8799svfloat32_t svbfmlalt_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
8800__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_lane_f32)))
8801svfloat32_t svbfmlalt_lane_f32(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
8802__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_m)))
8803svbfloat16_t svcvt_bf16_f32_m(svbfloat16_t, svbool_t, svfloat32_t);
8804__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_x)))
8805svbfloat16_t svcvt_bf16_f32_x(svbool_t, svfloat32_t);
8806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_z)))
8807svbfloat16_t svcvt_bf16_f32_z(svbool_t, svfloat32_t);
8808__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_bf16_f32_m)))
8809svbfloat16_t svcvtnt_bf16_f32_m(svbfloat16_t, svbool_t, svfloat32_t);
8810__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_n_f32)))
8811svfloat32_t svbfdot(svfloat32_t, svbfloat16_t, bfloat16_t);
8812__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_f32)))
8813svfloat32_t svbfdot(svfloat32_t, svbfloat16_t, svbfloat16_t);
8814__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_lane_f32)))
8815svfloat32_t svbfdot_lane(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
8816__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_n_f32)))
8817svfloat32_t svbfmlalb(svfloat32_t, svbfloat16_t, bfloat16_t);
8818__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_f32)))
8819svfloat32_t svbfmlalb(svfloat32_t, svbfloat16_t, svbfloat16_t);
8820__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_lane_f32)))
8821svfloat32_t svbfmlalb_lane(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
8822__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_n_f32)))
8823svfloat32_t svbfmlalt(svfloat32_t, svbfloat16_t, bfloat16_t);
8824__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_f32)))
8825svfloat32_t svbfmlalt(svfloat32_t, svbfloat16_t, svbfloat16_t);
8826__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_lane_f32)))
8827svfloat32_t svbfmlalt_lane(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
8828__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_m)))
8829svbfloat16_t svcvt_bf16_m(svbfloat16_t, svbool_t, svfloat32_t);
8830__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_x)))
8831svbfloat16_t svcvt_bf16_x(svbool_t, svfloat32_t);
8832__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_z)))
8833svbfloat16_t svcvt_bf16_z(svbool_t, svfloat32_t);
8834__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_bf16_f32_m)))
8835svbfloat16_t svcvtnt_bf16_m(svbfloat16_t, svbool_t, svfloat32_t);
8836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32)))
8837svfloat32_t svmmla_f32(svfloat32_t, svfloat32_t, svfloat32_t);
8838__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32)))
8839svfloat32_t svmmla(svfloat32_t, svfloat32_t, svfloat32_t);
8840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u8)))
8841svuint8_t svld1ro_u8(svbool_t, uint8_t const *);
8842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u32)))
8843svuint32_t svld1ro_u32(svbool_t, uint32_t const *);
8844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u64)))
8845svuint64_t svld1ro_u64(svbool_t, uint64_t const *);
8846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u16)))
8847svuint16_t svld1ro_u16(svbool_t, uint16_t const *);
8848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_bf16)))
8849svbfloat16_t svld1ro_bf16(svbool_t, bfloat16_t const *);
8850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s8)))
8851svint8_t svld1ro_s8(svbool_t, int8_t const *);
8852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f64)))
8853svfloat64_t svld1ro_f64(svbool_t, float64_t const *);
8854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f32)))
8855svfloat32_t svld1ro_f32(svbool_t, float32_t const *);
8856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f16)))
8857svfloat16_t svld1ro_f16(svbool_t, float16_t const *);
8858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s32)))
8859svint32_t svld1ro_s32(svbool_t, int32_t const *);
8860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s64)))
8861svint64_t svld1ro_s64(svbool_t, int64_t const *);
8862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_mf8)))
8863svmfloat8_t svld1ro_mf8(svbool_t, mfloat8_t const *);
8864__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s16)))
8865svint16_t svld1ro_s16(svbool_t, int16_t const *);
8866__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f64)))
8867svfloat64_t svmmla_f64(svfloat64_t, svfloat64_t, svfloat64_t);
8868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u8)))
8869svuint8_t svtrn1q_u8(svuint8_t, svuint8_t);
8870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u32)))
8871svuint32_t svtrn1q_u32(svuint32_t, svuint32_t);
8872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u64)))
8873svuint64_t svtrn1q_u64(svuint64_t, svuint64_t);
8874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u16)))
8875svuint16_t svtrn1q_u16(svuint16_t, svuint16_t);
8876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_bf16)))
8877svbfloat16_t svtrn1q_bf16(svbfloat16_t, svbfloat16_t);
8878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s8)))
8879svint8_t svtrn1q_s8(svint8_t, svint8_t);
8880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f64)))
8881svfloat64_t svtrn1q_f64(svfloat64_t, svfloat64_t);
8882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f32)))
8883svfloat32_t svtrn1q_f32(svfloat32_t, svfloat32_t);
8884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f16)))
8885svfloat16_t svtrn1q_f16(svfloat16_t, svfloat16_t);
8886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s32)))
8887svint32_t svtrn1q_s32(svint32_t, svint32_t);
8888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s64)))
8889svint64_t svtrn1q_s64(svint64_t, svint64_t);
8890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s16)))
8891svint16_t svtrn1q_s16(svint16_t, svint16_t);
8892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u8)))
8893svuint8_t svtrn2q_u8(svuint8_t, svuint8_t);
8894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u32)))
8895svuint32_t svtrn2q_u32(svuint32_t, svuint32_t);
8896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u64)))
8897svuint64_t svtrn2q_u64(svuint64_t, svuint64_t);
8898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u16)))
8899svuint16_t svtrn2q_u16(svuint16_t, svuint16_t);
8900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_bf16)))
8901svbfloat16_t svtrn2q_bf16(svbfloat16_t, svbfloat16_t);
8902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s8)))
8903svint8_t svtrn2q_s8(svint8_t, svint8_t);
8904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f64)))
8905svfloat64_t svtrn2q_f64(svfloat64_t, svfloat64_t);
8906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f32)))
8907svfloat32_t svtrn2q_f32(svfloat32_t, svfloat32_t);
8908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f16)))
8909svfloat16_t svtrn2q_f16(svfloat16_t, svfloat16_t);
8910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s32)))
8911svint32_t svtrn2q_s32(svint32_t, svint32_t);
8912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s64)))
8913svint64_t svtrn2q_s64(svint64_t, svint64_t);
8914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s16)))
8915svint16_t svtrn2q_s16(svint16_t, svint16_t);
8916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u8)))
8917svuint8_t svuzp1q_u8(svuint8_t, svuint8_t);
8918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u32)))
8919svuint32_t svuzp1q_u32(svuint32_t, svuint32_t);
8920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u64)))
8921svuint64_t svuzp1q_u64(svuint64_t, svuint64_t);
8922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u16)))
8923svuint16_t svuzp1q_u16(svuint16_t, svuint16_t);
8924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_bf16)))
8925svbfloat16_t svuzp1q_bf16(svbfloat16_t, svbfloat16_t);
8926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s8)))
8927svint8_t svuzp1q_s8(svint8_t, svint8_t);
8928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f64)))
8929svfloat64_t svuzp1q_f64(svfloat64_t, svfloat64_t);
8930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f32)))
8931svfloat32_t svuzp1q_f32(svfloat32_t, svfloat32_t);
8932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f16)))
8933svfloat16_t svuzp1q_f16(svfloat16_t, svfloat16_t);
8934__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s32)))
8935svint32_t svuzp1q_s32(svint32_t, svint32_t);
8936__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s64)))
8937svint64_t svuzp1q_s64(svint64_t, svint64_t);
8938__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s16)))
8939svint16_t svuzp1q_s16(svint16_t, svint16_t);
8940__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u8)))
8941svuint8_t svuzp2q_u8(svuint8_t, svuint8_t);
8942__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u32)))
8943svuint32_t svuzp2q_u32(svuint32_t, svuint32_t);
8944__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u64)))
8945svuint64_t svuzp2q_u64(svuint64_t, svuint64_t);
8946__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u16)))
8947svuint16_t svuzp2q_u16(svuint16_t, svuint16_t);
8948__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_bf16)))
8949svbfloat16_t svuzp2q_bf16(svbfloat16_t, svbfloat16_t);
8950__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s8)))
8951svint8_t svuzp2q_s8(svint8_t, svint8_t);
8952__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f64)))
8953svfloat64_t svuzp2q_f64(svfloat64_t, svfloat64_t);
8954__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f32)))
8955svfloat32_t svuzp2q_f32(svfloat32_t, svfloat32_t);
8956__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f16)))
8957svfloat16_t svuzp2q_f16(svfloat16_t, svfloat16_t);
8958__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s32)))
8959svint32_t svuzp2q_s32(svint32_t, svint32_t);
8960__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s64)))
8961svint64_t svuzp2q_s64(svint64_t, svint64_t);
8962__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s16)))
8963svint16_t svuzp2q_s16(svint16_t, svint16_t);
8964__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u8)))
8965svuint8_t svzip1q_u8(svuint8_t, svuint8_t);
8966__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u32)))
8967svuint32_t svzip1q_u32(svuint32_t, svuint32_t);
8968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u64)))
8969svuint64_t svzip1q_u64(svuint64_t, svuint64_t);
8970__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u16)))
8971svuint16_t svzip1q_u16(svuint16_t, svuint16_t);
8972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_bf16)))
8973svbfloat16_t svzip1q_bf16(svbfloat16_t, svbfloat16_t);
8974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s8)))
8975svint8_t svzip1q_s8(svint8_t, svint8_t);
8976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f64)))
8977svfloat64_t svzip1q_f64(svfloat64_t, svfloat64_t);
8978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f32)))
8979svfloat32_t svzip1q_f32(svfloat32_t, svfloat32_t);
8980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f16)))
8981svfloat16_t svzip1q_f16(svfloat16_t, svfloat16_t);
8982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s32)))
8983svint32_t svzip1q_s32(svint32_t, svint32_t);
8984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s64)))
8985svint64_t svzip1q_s64(svint64_t, svint64_t);
8986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s16)))
8987svint16_t svzip1q_s16(svint16_t, svint16_t);
8988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u8)))
8989svuint8_t svzip2q_u8(svuint8_t, svuint8_t);
8990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u32)))
8991svuint32_t svzip2q_u32(svuint32_t, svuint32_t);
8992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u64)))
8993svuint64_t svzip2q_u64(svuint64_t, svuint64_t);
8994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u16)))
8995svuint16_t svzip2q_u16(svuint16_t, svuint16_t);
8996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_bf16)))
8997svbfloat16_t svzip2q_bf16(svbfloat16_t, svbfloat16_t);
8998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s8)))
8999svint8_t svzip2q_s8(svint8_t, svint8_t);
9000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f64)))
9001svfloat64_t svzip2q_f64(svfloat64_t, svfloat64_t);
9002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f32)))
9003svfloat32_t svzip2q_f32(svfloat32_t, svfloat32_t);
9004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f16)))
9005svfloat16_t svzip2q_f16(svfloat16_t, svfloat16_t);
9006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s32)))
9007svint32_t svzip2q_s32(svint32_t, svint32_t);
9008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s64)))
9009svint64_t svzip2q_s64(svint64_t, svint64_t);
9010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s16)))
9011svint16_t svzip2q_s16(svint16_t, svint16_t);
9012__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u8)))
9013svuint8_t svld1ro(svbool_t, uint8_t const *);
9014__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u32)))
9015svuint32_t svld1ro(svbool_t, uint32_t const *);
9016__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u64)))
9017svuint64_t svld1ro(svbool_t, uint64_t const *);
9018__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u16)))
9019svuint16_t svld1ro(svbool_t, uint16_t const *);
9020__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_bf16)))
9021svbfloat16_t svld1ro(svbool_t, bfloat16_t const *);
9022__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s8)))
9023svint8_t svld1ro(svbool_t, int8_t const *);
9024__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f64)))
9025svfloat64_t svld1ro(svbool_t, float64_t const *);
9026__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f32)))
9027svfloat32_t svld1ro(svbool_t, float32_t const *);
9028__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f16)))
9029svfloat16_t svld1ro(svbool_t, float16_t const *);
9030__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s32)))
9031svint32_t svld1ro(svbool_t, int32_t const *);
9032__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s64)))
9033svint64_t svld1ro(svbool_t, int64_t const *);
9034__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_mf8)))
9035svmfloat8_t svld1ro(svbool_t, mfloat8_t const *);
9036__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s16)))
9037svint16_t svld1ro(svbool_t, int16_t const *);
9038__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f64)))
9039svfloat64_t svmmla(svfloat64_t, svfloat64_t, svfloat64_t);
9040__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u8)))
9041svuint8_t svtrn1q(svuint8_t, svuint8_t);
9042__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u32)))
9043svuint32_t svtrn1q(svuint32_t, svuint32_t);
9044__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u64)))
9045svuint64_t svtrn1q(svuint64_t, svuint64_t);
9046__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u16)))
9047svuint16_t svtrn1q(svuint16_t, svuint16_t);
9048__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_bf16)))
9049svbfloat16_t svtrn1q(svbfloat16_t, svbfloat16_t);
9050__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s8)))
9051svint8_t svtrn1q(svint8_t, svint8_t);
9052__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f64)))
9053svfloat64_t svtrn1q(svfloat64_t, svfloat64_t);
9054__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f32)))
9055svfloat32_t svtrn1q(svfloat32_t, svfloat32_t);
9056__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f16)))
9057svfloat16_t svtrn1q(svfloat16_t, svfloat16_t);
9058__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s32)))
9059svint32_t svtrn1q(svint32_t, svint32_t);
9060__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s64)))
9061svint64_t svtrn1q(svint64_t, svint64_t);
9062__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s16)))
9063svint16_t svtrn1q(svint16_t, svint16_t);
9064__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u8)))
9065svuint8_t svtrn2q(svuint8_t, svuint8_t);
9066__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u32)))
9067svuint32_t svtrn2q(svuint32_t, svuint32_t);
9068__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u64)))
9069svuint64_t svtrn2q(svuint64_t, svuint64_t);
9070__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u16)))
9071svuint16_t svtrn2q(svuint16_t, svuint16_t);
9072__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_bf16)))
9073svbfloat16_t svtrn2q(svbfloat16_t, svbfloat16_t);
9074__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s8)))
9075svint8_t svtrn2q(svint8_t, svint8_t);
9076__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f64)))
9077svfloat64_t svtrn2q(svfloat64_t, svfloat64_t);
9078__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f32)))
9079svfloat32_t svtrn2q(svfloat32_t, svfloat32_t);
9080__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f16)))
9081svfloat16_t svtrn2q(svfloat16_t, svfloat16_t);
9082__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s32)))
9083svint32_t svtrn2q(svint32_t, svint32_t);
9084__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s64)))
9085svint64_t svtrn2q(svint64_t, svint64_t);
9086__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s16)))
9087svint16_t svtrn2q(svint16_t, svint16_t);
9088__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u8)))
9089svuint8_t svuzp1q(svuint8_t, svuint8_t);
9090__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u32)))
9091svuint32_t svuzp1q(svuint32_t, svuint32_t);
9092__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u64)))
9093svuint64_t svuzp1q(svuint64_t, svuint64_t);
9094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u16)))
9095svuint16_t svuzp1q(svuint16_t, svuint16_t);
9096__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_bf16)))
9097svbfloat16_t svuzp1q(svbfloat16_t, svbfloat16_t);
9098__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s8)))
9099svint8_t svuzp1q(svint8_t, svint8_t);
9100__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f64)))
9101svfloat64_t svuzp1q(svfloat64_t, svfloat64_t);
9102__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f32)))
9103svfloat32_t svuzp1q(svfloat32_t, svfloat32_t);
9104__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f16)))
9105svfloat16_t svuzp1q(svfloat16_t, svfloat16_t);
9106__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s32)))
9107svint32_t svuzp1q(svint32_t, svint32_t);
9108__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s64)))
9109svint64_t svuzp1q(svint64_t, svint64_t);
9110__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s16)))
9111svint16_t svuzp1q(svint16_t, svint16_t);
9112__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u8)))
9113svuint8_t svuzp2q(svuint8_t, svuint8_t);
9114__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u32)))
9115svuint32_t svuzp2q(svuint32_t, svuint32_t);
9116__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u64)))
9117svuint64_t svuzp2q(svuint64_t, svuint64_t);
9118__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u16)))
9119svuint16_t svuzp2q(svuint16_t, svuint16_t);
9120__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_bf16)))
9121svbfloat16_t svuzp2q(svbfloat16_t, svbfloat16_t);
9122__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s8)))
9123svint8_t svuzp2q(svint8_t, svint8_t);
9124__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f64)))
9125svfloat64_t svuzp2q(svfloat64_t, svfloat64_t);
9126__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f32)))
9127svfloat32_t svuzp2q(svfloat32_t, svfloat32_t);
9128__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f16)))
9129svfloat16_t svuzp2q(svfloat16_t, svfloat16_t);
9130__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s32)))
9131svint32_t svuzp2q(svint32_t, svint32_t);
9132__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s64)))
9133svint64_t svuzp2q(svint64_t, svint64_t);
9134__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s16)))
9135svint16_t svuzp2q(svint16_t, svint16_t);
9136__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u8)))
9137svuint8_t svzip1q(svuint8_t, svuint8_t);
9138__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u32)))
9139svuint32_t svzip1q(svuint32_t, svuint32_t);
9140__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u64)))
9141svuint64_t svzip1q(svuint64_t, svuint64_t);
9142__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u16)))
9143svuint16_t svzip1q(svuint16_t, svuint16_t);
9144__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_bf16)))
9145svbfloat16_t svzip1q(svbfloat16_t, svbfloat16_t);
9146__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s8)))
9147svint8_t svzip1q(svint8_t, svint8_t);
9148__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f64)))
9149svfloat64_t svzip1q(svfloat64_t, svfloat64_t);
9150__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f32)))
9151svfloat32_t svzip1q(svfloat32_t, svfloat32_t);
9152__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f16)))
9153svfloat16_t svzip1q(svfloat16_t, svfloat16_t);
9154__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s32)))
9155svint32_t svzip1q(svint32_t, svint32_t);
9156__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s64)))
9157svint64_t svzip1q(svint64_t, svint64_t);
9158__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s16)))
9159svint16_t svzip1q(svint16_t, svint16_t);
9160__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u8)))
9161svuint8_t svzip2q(svuint8_t, svuint8_t);
9162__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u32)))
9163svuint32_t svzip2q(svuint32_t, svuint32_t);
9164__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u64)))
9165svuint64_t svzip2q(svuint64_t, svuint64_t);
9166__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u16)))
9167svuint16_t svzip2q(svuint16_t, svuint16_t);
9168__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_bf16)))
9169svbfloat16_t svzip2q(svbfloat16_t, svbfloat16_t);
9170__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s8)))
9171svint8_t svzip2q(svint8_t, svint8_t);
9172__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f64)))
9173svfloat64_t svzip2q(svfloat64_t, svfloat64_t);
9174__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f32)))
9175svfloat32_t svzip2q(svfloat32_t, svfloat32_t);
9176__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f16)))
9177svfloat16_t svzip2q(svfloat16_t, svfloat16_t);
9178__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s32)))
9179svint32_t svzip2q(svint32_t, svint32_t);
9180__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s64)))
9181svint64_t svzip2q(svint64_t, svint64_t);
9182__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s16)))
9183svint16_t svzip2q(svint16_t, svint16_t);
9184__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_s32)))
9185svint32_t svmmla_s32(svint32_t, svint8_t, svint8_t);
9186__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_u32)))
9187svuint32_t svmmla_u32(svuint32_t, svuint8_t, svuint8_t);
9188__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusmmla_s32)))
9189svint32_t svusmmla_s32(svint32_t, svuint8_t, svint8_t);
9190__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_s32)))
9191svint32_t svmmla(svint32_t, svint8_t, svint8_t);
9192__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_u32)))
9193svuint32_t svmmla(svuint32_t, svuint8_t, svuint8_t);
9194__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusmmla_s32)))
9195svint32_t svusmmla(svint32_t, svuint8_t, svint8_t);
9196__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_n_s32)))
9197svint32_t svsudot_n_s32(svint32_t, svint8_t, uint8_t);
9198__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_s32)))
9199svint32_t svsudot_s32(svint32_t, svint8_t, svuint8_t);
9200__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_lane_s32)))
9201svint32_t svsudot_lane_s32(svint32_t, svint8_t, svuint8_t, uint64_t);
9202__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_n_s32)))
9203svint32_t svusdot_n_s32(svint32_t, svuint8_t, int8_t);
9204__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_s32)))
9205svint32_t svusdot_s32(svint32_t, svuint8_t, svint8_t);
9206__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_lane_s32)))
9207svint32_t svusdot_lane_s32(svint32_t, svuint8_t, svint8_t, uint64_t);
9208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_n_s32)))
9209svint32_t svsudot(svint32_t, svint8_t, uint8_t);
9210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_s32)))
9211svint32_t svsudot(svint32_t, svint8_t, svuint8_t);
9212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_lane_s32)))
9213svint32_t svsudot_lane(svint32_t, svint8_t, svuint8_t, uint64_t);
9214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_n_s32)))
9215svint32_t svusdot(svint32_t, svuint8_t, int8_t);
9216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_s32)))
9217svint32_t svusdot(svint32_t, svuint8_t, svint8_t);
9218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_lane_s32)))
9219svint32_t svusdot_lane(svint32_t, svuint8_t, svint8_t, uint64_t);
9220__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_u64)))
9221svuint64_t svrax1_u64(svuint64_t, svuint64_t);
9222__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_s64)))
9223svint64_t svrax1_s64(svint64_t, svint64_t);
9224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_u64)))
9225svuint64_t svrax1(svuint64_t, svuint64_t);
9226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_s64)))
9227svint64_t svrax1(svint64_t, svint64_t);
9228__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u32_z)))
9229svuint32_t svhistcnt_u32_z(svbool_t, svuint32_t, svuint32_t);
9230__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u64_z)))
9231svuint64_t svhistcnt_u64_z(svbool_t, svuint64_t, svuint64_t);
9232__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s32_z)))
9233svuint32_t svhistcnt_s32_z(svbool_t, svint32_t, svint32_t);
9234__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s64_z)))
9235svuint64_t svhistcnt_s64_z(svbool_t, svint64_t, svint64_t);
9236__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_u8)))
9237svuint8_t svhistseg_u8(svuint8_t, svuint8_t);
9238__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_s8)))
9239svuint8_t svhistseg_s8(svint8_t, svint8_t);
9240__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_u32)))
9241svuint32_t svldnt1_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
9242__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_u64)))
9243svuint64_t svldnt1_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
9244__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_f64)))
9245svfloat64_t svldnt1_gather_u64base_index_f64(svbool_t, svuint64_t, int64_t);
9246__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_f32)))
9247svfloat32_t svldnt1_gather_u32base_index_f32(svbool_t, svuint32_t, int64_t);
9248__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_s32)))
9249svint32_t svldnt1_gather_u32base_index_s32(svbool_t, svuint32_t, int64_t);
9250__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_s64)))
9251svint64_t svldnt1_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
9252__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_u32)))
9253svuint32_t svldnt1_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
9254__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_u64)))
9255svuint64_t svldnt1_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9256__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_f64)))
9257svfloat64_t svldnt1_gather_u64base_offset_f64(svbool_t, svuint64_t, int64_t);
9258__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_f32)))
9259svfloat32_t svldnt1_gather_u32base_offset_f32(svbool_t, svuint32_t, int64_t);
9260__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_s32)))
9261svint32_t svldnt1_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
9262__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_s64)))
9263svint64_t svldnt1_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9264__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_u32)))
9265svuint32_t svldnt1_gather_u32base_u32(svbool_t, svuint32_t);
9266__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_u64)))
9267svuint64_t svldnt1_gather_u64base_u64(svbool_t, svuint64_t);
9268__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_f64)))
9269svfloat64_t svldnt1_gather_u64base_f64(svbool_t, svuint64_t);
9270__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_f32)))
9271svfloat32_t svldnt1_gather_u32base_f32(svbool_t, svuint32_t);
9272__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_s32)))
9273svint32_t svldnt1_gather_u32base_s32(svbool_t, svuint32_t);
9274__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_s64)))
9275svint64_t svldnt1_gather_u64base_s64(svbool_t, svuint64_t);
9276__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_u64)))
9277svuint64_t svldnt1_gather_s64index_u64(svbool_t, uint64_t const *, svint64_t);
9278__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_f64)))
9279svfloat64_t svldnt1_gather_s64index_f64(svbool_t, float64_t const *, svint64_t);
9280__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_s64)))
9281svint64_t svldnt1_gather_s64index_s64(svbool_t, int64_t const *, svint64_t);
9282__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_u64)))
9283svuint64_t svldnt1_gather_u64index_u64(svbool_t, uint64_t const *, svuint64_t);
9284__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_f64)))
9285svfloat64_t svldnt1_gather_u64index_f64(svbool_t, float64_t const *, svuint64_t);
9286__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_s64)))
9287svint64_t svldnt1_gather_u64index_s64(svbool_t, int64_t const *, svuint64_t);
9288__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_u32)))
9289svuint32_t svldnt1_gather_u32offset_u32(svbool_t, uint32_t const *, svuint32_t);
9290__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_f32)))
9291svfloat32_t svldnt1_gather_u32offset_f32(svbool_t, float32_t const *, svuint32_t);
9292__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_s32)))
9293svint32_t svldnt1_gather_u32offset_s32(svbool_t, int32_t const *, svuint32_t);
9294__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_u64)))
9295svuint64_t svldnt1_gather_s64offset_u64(svbool_t, uint64_t const *, svint64_t);
9296__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_f64)))
9297svfloat64_t svldnt1_gather_s64offset_f64(svbool_t, float64_t const *, svint64_t);
9298__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_s64)))
9299svint64_t svldnt1_gather_s64offset_s64(svbool_t, int64_t const *, svint64_t);
9300__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_u64)))
9301svuint64_t svldnt1_gather_u64offset_u64(svbool_t, uint64_t const *, svuint64_t);
9302__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_f64)))
9303svfloat64_t svldnt1_gather_u64offset_f64(svbool_t, float64_t const *, svuint64_t);
9304__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_s64)))
9305svint64_t svldnt1_gather_u64offset_s64(svbool_t, int64_t const *, svuint64_t);
9306__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_u32)))
9307svuint32_t svldnt1sb_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
9308__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_u64)))
9309svuint64_t svldnt1sb_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9310__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_s32)))
9311svint32_t svldnt1sb_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
9312__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_s64)))
9313svint64_t svldnt1sb_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9314__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_u32)))
9315svuint32_t svldnt1sb_gather_u32base_u32(svbool_t, svuint32_t);
9316__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_u64)))
9317svuint64_t svldnt1sb_gather_u64base_u64(svbool_t, svuint64_t);
9318__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_s32)))
9319svint32_t svldnt1sb_gather_u32base_s32(svbool_t, svuint32_t);
9320__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_s64)))
9321svint64_t svldnt1sb_gather_u64base_s64(svbool_t, svuint64_t);
9322__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_u32)))
9323svuint32_t svldnt1sb_gather_u32offset_u32(svbool_t, int8_t const *, svuint32_t);
9324__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_s32)))
9325svint32_t svldnt1sb_gather_u32offset_s32(svbool_t, int8_t const *, svuint32_t);
9326__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_u64)))
9327svuint64_t svldnt1sb_gather_s64offset_u64(svbool_t, int8_t const *, svint64_t);
9328__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_s64)))
9329svint64_t svldnt1sb_gather_s64offset_s64(svbool_t, int8_t const *, svint64_t);
9330__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_u64)))
9331svuint64_t svldnt1sb_gather_u64offset_u64(svbool_t, int8_t const *, svuint64_t);
9332__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_s64)))
9333svint64_t svldnt1sb_gather_u64offset_s64(svbool_t, int8_t const *, svuint64_t);
9334__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_u32)))
9335svuint32_t svldnt1sh_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
9336__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_u64)))
9337svuint64_t svldnt1sh_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
9338__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_s32)))
9339svint32_t svldnt1sh_gather_u32base_index_s32(svbool_t, svuint32_t, int64_t);
9340__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_s64)))
9341svint64_t svldnt1sh_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
9342__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_u32)))
9343svuint32_t svldnt1sh_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
9344__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_u64)))
9345svuint64_t svldnt1sh_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9346__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_s32)))
9347svint32_t svldnt1sh_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
9348__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_s64)))
9349svint64_t svldnt1sh_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9350__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_u32)))
9351svuint32_t svldnt1sh_gather_u32base_u32(svbool_t, svuint32_t);
9352__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_u64)))
9353svuint64_t svldnt1sh_gather_u64base_u64(svbool_t, svuint64_t);
9354__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_s32)))
9355svint32_t svldnt1sh_gather_u32base_s32(svbool_t, svuint32_t);
9356__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_s64)))
9357svint64_t svldnt1sh_gather_u64base_s64(svbool_t, svuint64_t);
9358__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_u64)))
9359svuint64_t svldnt1sh_gather_s64index_u64(svbool_t, int16_t const *, svint64_t);
9360__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_s64)))
9361svint64_t svldnt1sh_gather_s64index_s64(svbool_t, int16_t const *, svint64_t);
9362__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_u64)))
9363svuint64_t svldnt1sh_gather_u64index_u64(svbool_t, int16_t const *, svuint64_t);
9364__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_s64)))
9365svint64_t svldnt1sh_gather_u64index_s64(svbool_t, int16_t const *, svuint64_t);
9366__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_u32)))
9367svuint32_t svldnt1sh_gather_u32offset_u32(svbool_t, int16_t const *, svuint32_t);
9368__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_s32)))
9369svint32_t svldnt1sh_gather_u32offset_s32(svbool_t, int16_t const *, svuint32_t);
9370__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_u64)))
9371svuint64_t svldnt1sh_gather_s64offset_u64(svbool_t, int16_t const *, svint64_t);
9372__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_s64)))
9373svint64_t svldnt1sh_gather_s64offset_s64(svbool_t, int16_t const *, svint64_t);
9374__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_u64)))
9375svuint64_t svldnt1sh_gather_u64offset_u64(svbool_t, int16_t const *, svuint64_t);
9376__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_s64)))
9377svint64_t svldnt1sh_gather_u64offset_s64(svbool_t, int16_t const *, svuint64_t);
9378__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_u64)))
9379svuint64_t svldnt1sw_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
9380__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_s64)))
9381svint64_t svldnt1sw_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
9382__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_u64)))
9383svuint64_t svldnt1sw_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9384__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_s64)))
9385svint64_t svldnt1sw_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9386__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_u64)))
9387svuint64_t svldnt1sw_gather_u64base_u64(svbool_t, svuint64_t);
9388__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_s64)))
9389svint64_t svldnt1sw_gather_u64base_s64(svbool_t, svuint64_t);
9390__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_u64)))
9391svuint64_t svldnt1sw_gather_s64index_u64(svbool_t, int32_t const *, svint64_t);
9392__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_s64)))
9393svint64_t svldnt1sw_gather_s64index_s64(svbool_t, int32_t const *, svint64_t);
9394__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_u64)))
9395svuint64_t svldnt1sw_gather_u64index_u64(svbool_t, int32_t const *, svuint64_t);
9396__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_s64)))
9397svint64_t svldnt1sw_gather_u64index_s64(svbool_t, int32_t const *, svuint64_t);
9398__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_u64)))
9399svuint64_t svldnt1sw_gather_s64offset_u64(svbool_t, int32_t const *, svint64_t);
9400__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_s64)))
9401svint64_t svldnt1sw_gather_s64offset_s64(svbool_t, int32_t const *, svint64_t);
9402__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_u64)))
9403svuint64_t svldnt1sw_gather_u64offset_u64(svbool_t, int32_t const *, svuint64_t);
9404__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_s64)))
9405svint64_t svldnt1sw_gather_u64offset_s64(svbool_t, int32_t const *, svuint64_t);
9406__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_u32)))
9407svuint32_t svldnt1ub_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
9408__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_u64)))
9409svuint64_t svldnt1ub_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9410__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_s32)))
9411svint32_t svldnt1ub_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
9412__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_s64)))
9413svint64_t svldnt1ub_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9414__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_u32)))
9415svuint32_t svldnt1ub_gather_u32base_u32(svbool_t, svuint32_t);
9416__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_u64)))
9417svuint64_t svldnt1ub_gather_u64base_u64(svbool_t, svuint64_t);
9418__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_s32)))
9419svint32_t svldnt1ub_gather_u32base_s32(svbool_t, svuint32_t);
9420__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_s64)))
9421svint64_t svldnt1ub_gather_u64base_s64(svbool_t, svuint64_t);
9422__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_u32)))
9423svuint32_t svldnt1ub_gather_u32offset_u32(svbool_t, uint8_t const *, svuint32_t);
9424__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_s32)))
9425svint32_t svldnt1ub_gather_u32offset_s32(svbool_t, uint8_t const *, svuint32_t);
9426__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_u64)))
9427svuint64_t svldnt1ub_gather_s64offset_u64(svbool_t, uint8_t const *, svint64_t);
9428__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_s64)))
9429svint64_t svldnt1ub_gather_s64offset_s64(svbool_t, uint8_t const *, svint64_t);
9430__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_u64)))
9431svuint64_t svldnt1ub_gather_u64offset_u64(svbool_t, uint8_t const *, svuint64_t);
9432__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_s64)))
9433svint64_t svldnt1ub_gather_u64offset_s64(svbool_t, uint8_t const *, svuint64_t);
9434__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_u32)))
9435svuint32_t svldnt1uh_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
9436__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_u64)))
9437svuint64_t svldnt1uh_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
9438__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_s32)))
9439svint32_t svldnt1uh_gather_u32base_index_s32(svbool_t, svuint32_t, int64_t);
9440__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_s64)))
9441svint64_t svldnt1uh_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
9442__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_u32)))
9443svuint32_t svldnt1uh_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
9444__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_u64)))
9445svuint64_t svldnt1uh_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9446__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_s32)))
9447svint32_t svldnt1uh_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
9448__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_s64)))
9449svint64_t svldnt1uh_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9450__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_u32)))
9451svuint32_t svldnt1uh_gather_u32base_u32(svbool_t, svuint32_t);
9452__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_u64)))
9453svuint64_t svldnt1uh_gather_u64base_u64(svbool_t, svuint64_t);
9454__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_s32)))
9455svint32_t svldnt1uh_gather_u32base_s32(svbool_t, svuint32_t);
9456__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_s64)))
9457svint64_t svldnt1uh_gather_u64base_s64(svbool_t, svuint64_t);
9458__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_u64)))
9459svuint64_t svldnt1uh_gather_s64index_u64(svbool_t, uint16_t const *, svint64_t);
9460__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_s64)))
9461svint64_t svldnt1uh_gather_s64index_s64(svbool_t, uint16_t const *, svint64_t);
9462__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_u64)))
9463svuint64_t svldnt1uh_gather_u64index_u64(svbool_t, uint16_t const *, svuint64_t);
9464__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_s64)))
9465svint64_t svldnt1uh_gather_u64index_s64(svbool_t, uint16_t const *, svuint64_t);
9466__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_u32)))
9467svuint32_t svldnt1uh_gather_u32offset_u32(svbool_t, uint16_t const *, svuint32_t);
9468__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_s32)))
9469svint32_t svldnt1uh_gather_u32offset_s32(svbool_t, uint16_t const *, svuint32_t);
9470__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_u64)))
9471svuint64_t svldnt1uh_gather_s64offset_u64(svbool_t, uint16_t const *, svint64_t);
9472__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_s64)))
9473svint64_t svldnt1uh_gather_s64offset_s64(svbool_t, uint16_t const *, svint64_t);
9474__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_u64)))
9475svuint64_t svldnt1uh_gather_u64offset_u64(svbool_t, uint16_t const *, svuint64_t);
9476__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_s64)))
9477svint64_t svldnt1uh_gather_u64offset_s64(svbool_t, uint16_t const *, svuint64_t);
9478__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_u64)))
9479svuint64_t svldnt1uw_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
9480__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_s64)))
9481svint64_t svldnt1uw_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
9482__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_u64)))
9483svuint64_t svldnt1uw_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
9484__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_s64)))
9485svint64_t svldnt1uw_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
9486__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_u64)))
9487svuint64_t svldnt1uw_gather_u64base_u64(svbool_t, svuint64_t);
9488__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_s64)))
9489svint64_t svldnt1uw_gather_u64base_s64(svbool_t, svuint64_t);
9490__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_u64)))
9491svuint64_t svldnt1uw_gather_s64index_u64(svbool_t, uint32_t const *, svint64_t);
9492__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_s64)))
9493svint64_t svldnt1uw_gather_s64index_s64(svbool_t, uint32_t const *, svint64_t);
9494__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_u64)))
9495svuint64_t svldnt1uw_gather_u64index_u64(svbool_t, uint32_t const *, svuint64_t);
9496__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_s64)))
9497svint64_t svldnt1uw_gather_u64index_s64(svbool_t, uint32_t const *, svuint64_t);
9498__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_u64)))
9499svuint64_t svldnt1uw_gather_s64offset_u64(svbool_t, uint32_t const *, svint64_t);
9500__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_s64)))
9501svint64_t svldnt1uw_gather_s64offset_s64(svbool_t, uint32_t const *, svint64_t);
9502__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_u64)))
9503svuint64_t svldnt1uw_gather_u64offset_u64(svbool_t, uint32_t const *, svuint64_t);
9504__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_s64)))
9505svint64_t svldnt1uw_gather_u64offset_s64(svbool_t, uint32_t const *, svuint64_t);
9506__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u8)))
9507svbool_t svmatch_u8(svbool_t, svuint8_t, svuint8_t);
9508__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u16)))
9509svbool_t svmatch_u16(svbool_t, svuint16_t, svuint16_t);
9510__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s8)))
9511svbool_t svmatch_s8(svbool_t, svint8_t, svint8_t);
9512__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s16)))
9513svbool_t svmatch_s16(svbool_t, svint16_t, svint16_t);
9514__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u8)))
9515svbool_t svnmatch_u8(svbool_t, svuint8_t, svuint8_t);
9516__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u16)))
9517svbool_t svnmatch_u16(svbool_t, svuint16_t, svuint16_t);
9518__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s8)))
9519svbool_t svnmatch_s8(svbool_t, svint8_t, svint8_t);
9520__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s16)))
9521svbool_t svnmatch_s16(svbool_t, svint16_t, svint16_t);
9522__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_u32)))
9523void svstnt1_scatter_u32base_index_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
9524__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_u64)))
9525void svstnt1_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9526__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_f64)))
9527void svstnt1_scatter_u64base_index_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
9528__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_f32)))
9529void svstnt1_scatter_u32base_index_f32(svbool_t, svuint32_t, int64_t, svfloat32_t);
9530__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_s32)))
9531void svstnt1_scatter_u32base_index_s32(svbool_t, svuint32_t, int64_t, svint32_t);
9532__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_s64)))
9533void svstnt1_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9534__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_u32)))
9535void svstnt1_scatter_u32base_offset_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
9536__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_u64)))
9537void svstnt1_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9538__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_f64)))
9539void svstnt1_scatter_u64base_offset_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
9540__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_f32)))
9541void svstnt1_scatter_u32base_offset_f32(svbool_t, svuint32_t, int64_t, svfloat32_t);
9542__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_s32)))
9543void svstnt1_scatter_u32base_offset_s32(svbool_t, svuint32_t, int64_t, svint32_t);
9544__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_s64)))
9545void svstnt1_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9546__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_u32)))
9547void svstnt1_scatter_u32base_u32(svbool_t, svuint32_t, svuint32_t);
9548__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_u64)))
9549void svstnt1_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
9550__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_f64)))
9551void svstnt1_scatter_u64base_f64(svbool_t, svuint64_t, svfloat64_t);
9552__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_f32)))
9553void svstnt1_scatter_u32base_f32(svbool_t, svuint32_t, svfloat32_t);
9554__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_s32)))
9555void svstnt1_scatter_u32base_s32(svbool_t, svuint32_t, svint32_t);
9556__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_s64)))
9557void svstnt1_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
9558__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_u64)))
9559void svstnt1_scatter_s64index_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
9560__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_f64)))
9561void svstnt1_scatter_s64index_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
9562__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_s64)))
9563void svstnt1_scatter_s64index_s64(svbool_t, int64_t *, svint64_t, svint64_t);
9564__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_u64)))
9565void svstnt1_scatter_u64index_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
9566__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_f64)))
9567void svstnt1_scatter_u64index_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
9568__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_s64)))
9569void svstnt1_scatter_u64index_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
9570__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_u32)))
9571void svstnt1_scatter_u32offset_u32(svbool_t, uint32_t *, svuint32_t, svuint32_t);
9572__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_f32)))
9573void svstnt1_scatter_u32offset_f32(svbool_t, float32_t *, svuint32_t, svfloat32_t);
9574__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_s32)))
9575void svstnt1_scatter_u32offset_s32(svbool_t, int32_t *, svuint32_t, svint32_t);
9576__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_u64)))
9577void svstnt1_scatter_s64offset_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
9578__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_f64)))
9579void svstnt1_scatter_s64offset_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
9580__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_s64)))
9581void svstnt1_scatter_s64offset_s64(svbool_t, int64_t *, svint64_t, svint64_t);
9582__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_u64)))
9583void svstnt1_scatter_u64offset_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
9584__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_f64)))
9585void svstnt1_scatter_u64offset_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
9586__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_s64)))
9587void svstnt1_scatter_u64offset_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
9588__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_u32)))
9589void svstnt1b_scatter_u32base_offset_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
9590__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_u64)))
9591void svstnt1b_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9592__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_s32)))
9593void svstnt1b_scatter_u32base_offset_s32(svbool_t, svuint32_t, int64_t, svint32_t);
9594__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_s64)))
9595void svstnt1b_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9596__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_u32)))
9597void svstnt1b_scatter_u32base_u32(svbool_t, svuint32_t, svuint32_t);
9598__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_u64)))
9599void svstnt1b_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
9600__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_s32)))
9601void svstnt1b_scatter_u32base_s32(svbool_t, svuint32_t, svint32_t);
9602__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_s64)))
9603void svstnt1b_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
9604__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_s32)))
9605void svstnt1b_scatter_u32offset_s32(svbool_t, int8_t *, svuint32_t, svint32_t);
9606__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_u32)))
9607void svstnt1b_scatter_u32offset_u32(svbool_t, uint8_t *, svuint32_t, svuint32_t);
9608__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_s64)))
9609void svstnt1b_scatter_s64offset_s64(svbool_t, int8_t *, svint64_t, svint64_t);
9610__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_u64)))
9611void svstnt1b_scatter_s64offset_u64(svbool_t, uint8_t *, svint64_t, svuint64_t);
9612__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_s64)))
9613void svstnt1b_scatter_u64offset_s64(svbool_t, int8_t *, svuint64_t, svint64_t);
9614__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_u64)))
9615void svstnt1b_scatter_u64offset_u64(svbool_t, uint8_t *, svuint64_t, svuint64_t);
9616__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_u32)))
9617void svstnt1h_scatter_u32base_index_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
9618__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_u64)))
9619void svstnt1h_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_s32)))
9621void svstnt1h_scatter_u32base_index_s32(svbool_t, svuint32_t, int64_t, svint32_t);
9622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_s64)))
9623void svstnt1h_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_u32)))
9625void svstnt1h_scatter_u32base_offset_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
9626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_u64)))
9627void svstnt1h_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_s32)))
9629void svstnt1h_scatter_u32base_offset_s32(svbool_t, svuint32_t, int64_t, svint32_t);
9630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_s64)))
9631void svstnt1h_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_u32)))
9633void svstnt1h_scatter_u32base_u32(svbool_t, svuint32_t, svuint32_t);
9634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_u64)))
9635void svstnt1h_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
9636__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_s32)))
9637void svstnt1h_scatter_u32base_s32(svbool_t, svuint32_t, svint32_t);
9638__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_s64)))
9639void svstnt1h_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
9640__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_s64)))
9641void svstnt1h_scatter_s64index_s64(svbool_t, int16_t *, svint64_t, svint64_t);
9642__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_u64)))
9643void svstnt1h_scatter_s64index_u64(svbool_t, uint16_t *, svint64_t, svuint64_t);
9644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_s64)))
9645void svstnt1h_scatter_u64index_s64(svbool_t, int16_t *, svuint64_t, svint64_t);
9646__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_u64)))
9647void svstnt1h_scatter_u64index_u64(svbool_t, uint16_t *, svuint64_t, svuint64_t);
9648__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_s32)))
9649void svstnt1h_scatter_u32offset_s32(svbool_t, int16_t *, svuint32_t, svint32_t);
9650__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_u32)))
9651void svstnt1h_scatter_u32offset_u32(svbool_t, uint16_t *, svuint32_t, svuint32_t);
9652__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_s64)))
9653void svstnt1h_scatter_s64offset_s64(svbool_t, int16_t *, svint64_t, svint64_t);
9654__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_u64)))
9655void svstnt1h_scatter_s64offset_u64(svbool_t, uint16_t *, svint64_t, svuint64_t);
9656__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_s64)))
9657void svstnt1h_scatter_u64offset_s64(svbool_t, int16_t *, svuint64_t, svint64_t);
9658__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_u64)))
9659void svstnt1h_scatter_u64offset_u64(svbool_t, uint16_t *, svuint64_t, svuint64_t);
9660__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_u64)))
9661void svstnt1w_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9662__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_s64)))
9663void svstnt1w_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9664__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_u64)))
9665void svstnt1w_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
9666__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_s64)))
9667void svstnt1w_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
9668__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_u64)))
9669void svstnt1w_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
9670__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_s64)))
9671void svstnt1w_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
9672__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_s64)))
9673void svstnt1w_scatter_s64index_s64(svbool_t, int32_t *, svint64_t, svint64_t);
9674__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_u64)))
9675void svstnt1w_scatter_s64index_u64(svbool_t, uint32_t *, svint64_t, svuint64_t);
9676__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_s64)))
9677void svstnt1w_scatter_u64index_s64(svbool_t, int32_t *, svuint64_t, svint64_t);
9678__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_u64)))
9679void svstnt1w_scatter_u64index_u64(svbool_t, uint32_t *, svuint64_t, svuint64_t);
9680__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_s64)))
9681void svstnt1w_scatter_s64offset_s64(svbool_t, int32_t *, svint64_t, svint64_t);
9682__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_u64)))
9683void svstnt1w_scatter_s64offset_u64(svbool_t, uint32_t *, svint64_t, svuint64_t);
9684__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_s64)))
9685void svstnt1w_scatter_u64offset_s64(svbool_t, int32_t *, svuint64_t, svint64_t);
9686__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_u64)))
9687void svstnt1w_scatter_u64offset_u64(svbool_t, uint32_t *, svuint64_t, svuint64_t);
9688__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u32_z)))
9689svuint32_t svhistcnt_z(svbool_t, svuint32_t, svuint32_t);
9690__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u64_z)))
9691svuint64_t svhistcnt_z(svbool_t, svuint64_t, svuint64_t);
9692__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s32_z)))
9693svuint32_t svhistcnt_z(svbool_t, svint32_t, svint32_t);
9694__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s64_z)))
9695svuint64_t svhistcnt_z(svbool_t, svint64_t, svint64_t);
9696__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_u8)))
9697svuint8_t svhistseg(svuint8_t, svuint8_t);
9698__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_s8)))
9699svuint8_t svhistseg(svint8_t, svint8_t);
9700__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_u32)))
9701svuint32_t svldnt1_gather_index_u32(svbool_t, svuint32_t, int64_t);
9702__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_u64)))
9703svuint64_t svldnt1_gather_index_u64(svbool_t, svuint64_t, int64_t);
9704__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_f64)))
9705svfloat64_t svldnt1_gather_index_f64(svbool_t, svuint64_t, int64_t);
9706__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_f32)))
9707svfloat32_t svldnt1_gather_index_f32(svbool_t, svuint32_t, int64_t);
9708__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_s32)))
9709svint32_t svldnt1_gather_index_s32(svbool_t, svuint32_t, int64_t);
9710__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_s64)))
9711svint64_t svldnt1_gather_index_s64(svbool_t, svuint64_t, int64_t);
9712__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_u32)))
9713svuint32_t svldnt1_gather_offset_u32(svbool_t, svuint32_t, int64_t);
9714__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_u64)))
9715svuint64_t svldnt1_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9716__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_f64)))
9717svfloat64_t svldnt1_gather_offset_f64(svbool_t, svuint64_t, int64_t);
9718__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_f32)))
9719svfloat32_t svldnt1_gather_offset_f32(svbool_t, svuint32_t, int64_t);
9720__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_s32)))
9721svint32_t svldnt1_gather_offset_s32(svbool_t, svuint32_t, int64_t);
9722__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_s64)))
9723svint64_t svldnt1_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9724__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_u32)))
9725svuint32_t svldnt1_gather_u32(svbool_t, svuint32_t);
9726__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_u64)))
9727svuint64_t svldnt1_gather_u64(svbool_t, svuint64_t);
9728__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_f64)))
9729svfloat64_t svldnt1_gather_f64(svbool_t, svuint64_t);
9730__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_f32)))
9731svfloat32_t svldnt1_gather_f32(svbool_t, svuint32_t);
9732__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_s32)))
9733svint32_t svldnt1_gather_s32(svbool_t, svuint32_t);
9734__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_s64)))
9735svint64_t svldnt1_gather_s64(svbool_t, svuint64_t);
9736__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_u64)))
9737svuint64_t svldnt1_gather_index(svbool_t, uint64_t const *, svint64_t);
9738__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_f64)))
9739svfloat64_t svldnt1_gather_index(svbool_t, float64_t const *, svint64_t);
9740__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_s64)))
9741svint64_t svldnt1_gather_index(svbool_t, int64_t const *, svint64_t);
9742__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_u64)))
9743svuint64_t svldnt1_gather_index(svbool_t, uint64_t const *, svuint64_t);
9744__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_f64)))
9745svfloat64_t svldnt1_gather_index(svbool_t, float64_t const *, svuint64_t);
9746__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_s64)))
9747svint64_t svldnt1_gather_index(svbool_t, int64_t const *, svuint64_t);
9748__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_u32)))
9749svuint32_t svldnt1_gather_offset(svbool_t, uint32_t const *, svuint32_t);
9750__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_f32)))
9751svfloat32_t svldnt1_gather_offset(svbool_t, float32_t const *, svuint32_t);
9752__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_s32)))
9753svint32_t svldnt1_gather_offset(svbool_t, int32_t const *, svuint32_t);
9754__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_u64)))
9755svuint64_t svldnt1_gather_offset(svbool_t, uint64_t const *, svint64_t);
9756__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_f64)))
9757svfloat64_t svldnt1_gather_offset(svbool_t, float64_t const *, svint64_t);
9758__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_s64)))
9759svint64_t svldnt1_gather_offset(svbool_t, int64_t const *, svint64_t);
9760__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_u64)))
9761svuint64_t svldnt1_gather_offset(svbool_t, uint64_t const *, svuint64_t);
9762__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_f64)))
9763svfloat64_t svldnt1_gather_offset(svbool_t, float64_t const *, svuint64_t);
9764__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_s64)))
9765svint64_t svldnt1_gather_offset(svbool_t, int64_t const *, svuint64_t);
9766__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_u32)))
9767svuint32_t svldnt1sb_gather_offset_u32(svbool_t, svuint32_t, int64_t);
9768__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_u64)))
9769svuint64_t svldnt1sb_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9770__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_s32)))
9771svint32_t svldnt1sb_gather_offset_s32(svbool_t, svuint32_t, int64_t);
9772__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_s64)))
9773svint64_t svldnt1sb_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9774__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_u32)))
9775svuint32_t svldnt1sb_gather_u32(svbool_t, svuint32_t);
9776__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_u64)))
9777svuint64_t svldnt1sb_gather_u64(svbool_t, svuint64_t);
9778__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_s32)))
9779svint32_t svldnt1sb_gather_s32(svbool_t, svuint32_t);
9780__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_s64)))
9781svint64_t svldnt1sb_gather_s64(svbool_t, svuint64_t);
9782__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_u32)))
9783svuint32_t svldnt1sb_gather_offset_u32(svbool_t, int8_t const *, svuint32_t);
9784__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_s32)))
9785svint32_t svldnt1sb_gather_offset_s32(svbool_t, int8_t const *, svuint32_t);
9786__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_u64)))
9787svuint64_t svldnt1sb_gather_offset_u64(svbool_t, int8_t const *, svint64_t);
9788__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_s64)))
9789svint64_t svldnt1sb_gather_offset_s64(svbool_t, int8_t const *, svint64_t);
9790__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_u64)))
9791svuint64_t svldnt1sb_gather_offset_u64(svbool_t, int8_t const *, svuint64_t);
9792__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_s64)))
9793svint64_t svldnt1sb_gather_offset_s64(svbool_t, int8_t const *, svuint64_t);
9794__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_u32)))
9795svuint32_t svldnt1sh_gather_index_u32(svbool_t, svuint32_t, int64_t);
9796__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_u64)))
9797svuint64_t svldnt1sh_gather_index_u64(svbool_t, svuint64_t, int64_t);
9798__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_s32)))
9799svint32_t svldnt1sh_gather_index_s32(svbool_t, svuint32_t, int64_t);
9800__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_s64)))
9801svint64_t svldnt1sh_gather_index_s64(svbool_t, svuint64_t, int64_t);
9802__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_u32)))
9803svuint32_t svldnt1sh_gather_offset_u32(svbool_t, svuint32_t, int64_t);
9804__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_u64)))
9805svuint64_t svldnt1sh_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9806__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_s32)))
9807svint32_t svldnt1sh_gather_offset_s32(svbool_t, svuint32_t, int64_t);
9808__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_s64)))
9809svint64_t svldnt1sh_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9810__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_u32)))
9811svuint32_t svldnt1sh_gather_u32(svbool_t, svuint32_t);
9812__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_u64)))
9813svuint64_t svldnt1sh_gather_u64(svbool_t, svuint64_t);
9814__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_s32)))
9815svint32_t svldnt1sh_gather_s32(svbool_t, svuint32_t);
9816__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_s64)))
9817svint64_t svldnt1sh_gather_s64(svbool_t, svuint64_t);
9818__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_u64)))
9819svuint64_t svldnt1sh_gather_index_u64(svbool_t, int16_t const *, svint64_t);
9820__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_s64)))
9821svint64_t svldnt1sh_gather_index_s64(svbool_t, int16_t const *, svint64_t);
9822__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_u64)))
9823svuint64_t svldnt1sh_gather_index_u64(svbool_t, int16_t const *, svuint64_t);
9824__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_s64)))
9825svint64_t svldnt1sh_gather_index_s64(svbool_t, int16_t const *, svuint64_t);
9826__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_u32)))
9827svuint32_t svldnt1sh_gather_offset_u32(svbool_t, int16_t const *, svuint32_t);
9828__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_s32)))
9829svint32_t svldnt1sh_gather_offset_s32(svbool_t, int16_t const *, svuint32_t);
9830__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_u64)))
9831svuint64_t svldnt1sh_gather_offset_u64(svbool_t, int16_t const *, svint64_t);
9832__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_s64)))
9833svint64_t svldnt1sh_gather_offset_s64(svbool_t, int16_t const *, svint64_t);
9834__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_u64)))
9835svuint64_t svldnt1sh_gather_offset_u64(svbool_t, int16_t const *, svuint64_t);
9836__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_s64)))
9837svint64_t svldnt1sh_gather_offset_s64(svbool_t, int16_t const *, svuint64_t);
9838__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_u64)))
9839svuint64_t svldnt1sw_gather_index_u64(svbool_t, svuint64_t, int64_t);
9840__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_s64)))
9841svint64_t svldnt1sw_gather_index_s64(svbool_t, svuint64_t, int64_t);
9842__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_u64)))
9843svuint64_t svldnt1sw_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9844__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_s64)))
9845svint64_t svldnt1sw_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9846__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_u64)))
9847svuint64_t svldnt1sw_gather_u64(svbool_t, svuint64_t);
9848__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_s64)))
9849svint64_t svldnt1sw_gather_s64(svbool_t, svuint64_t);
9850__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_u64)))
9851svuint64_t svldnt1sw_gather_index_u64(svbool_t, int32_t const *, svint64_t);
9852__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_s64)))
9853svint64_t svldnt1sw_gather_index_s64(svbool_t, int32_t const *, svint64_t);
9854__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_u64)))
9855svuint64_t svldnt1sw_gather_index_u64(svbool_t, int32_t const *, svuint64_t);
9856__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_s64)))
9857svint64_t svldnt1sw_gather_index_s64(svbool_t, int32_t const *, svuint64_t);
9858__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_u64)))
9859svuint64_t svldnt1sw_gather_offset_u64(svbool_t, int32_t const *, svint64_t);
9860__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_s64)))
9861svint64_t svldnt1sw_gather_offset_s64(svbool_t, int32_t const *, svint64_t);
9862__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_u64)))
9863svuint64_t svldnt1sw_gather_offset_u64(svbool_t, int32_t const *, svuint64_t);
9864__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_s64)))
9865svint64_t svldnt1sw_gather_offset_s64(svbool_t, int32_t const *, svuint64_t);
9866__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_u32)))
9867svuint32_t svldnt1ub_gather_offset_u32(svbool_t, svuint32_t, int64_t);
9868__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_u64)))
9869svuint64_t svldnt1ub_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9870__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_s32)))
9871svint32_t svldnt1ub_gather_offset_s32(svbool_t, svuint32_t, int64_t);
9872__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_s64)))
9873svint64_t svldnt1ub_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9874__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_u32)))
9875svuint32_t svldnt1ub_gather_u32(svbool_t, svuint32_t);
9876__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_u64)))
9877svuint64_t svldnt1ub_gather_u64(svbool_t, svuint64_t);
9878__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_s32)))
9879svint32_t svldnt1ub_gather_s32(svbool_t, svuint32_t);
9880__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_s64)))
9881svint64_t svldnt1ub_gather_s64(svbool_t, svuint64_t);
9882__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_u32)))
9883svuint32_t svldnt1ub_gather_offset_u32(svbool_t, uint8_t const *, svuint32_t);
9884__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_s32)))
9885svint32_t svldnt1ub_gather_offset_s32(svbool_t, uint8_t const *, svuint32_t);
9886__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_u64)))
9887svuint64_t svldnt1ub_gather_offset_u64(svbool_t, uint8_t const *, svint64_t);
9888__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_s64)))
9889svint64_t svldnt1ub_gather_offset_s64(svbool_t, uint8_t const *, svint64_t);
9890__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_u64)))
9891svuint64_t svldnt1ub_gather_offset_u64(svbool_t, uint8_t const *, svuint64_t);
9892__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_s64)))
9893svint64_t svldnt1ub_gather_offset_s64(svbool_t, uint8_t const *, svuint64_t);
9894__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_u32)))
9895svuint32_t svldnt1uh_gather_index_u32(svbool_t, svuint32_t, int64_t);
9896__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_u64)))
9897svuint64_t svldnt1uh_gather_index_u64(svbool_t, svuint64_t, int64_t);
9898__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_s32)))
9899svint32_t svldnt1uh_gather_index_s32(svbool_t, svuint32_t, int64_t);
9900__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_s64)))
9901svint64_t svldnt1uh_gather_index_s64(svbool_t, svuint64_t, int64_t);
9902__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_u32)))
9903svuint32_t svldnt1uh_gather_offset_u32(svbool_t, svuint32_t, int64_t);
9904__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_u64)))
9905svuint64_t svldnt1uh_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9906__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_s32)))
9907svint32_t svldnt1uh_gather_offset_s32(svbool_t, svuint32_t, int64_t);
9908__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_s64)))
9909svint64_t svldnt1uh_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9910__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_u32)))
9911svuint32_t svldnt1uh_gather_u32(svbool_t, svuint32_t);
9912__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_u64)))
9913svuint64_t svldnt1uh_gather_u64(svbool_t, svuint64_t);
9914__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_s32)))
9915svint32_t svldnt1uh_gather_s32(svbool_t, svuint32_t);
9916__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_s64)))
9917svint64_t svldnt1uh_gather_s64(svbool_t, svuint64_t);
9918__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_u64)))
9919svuint64_t svldnt1uh_gather_index_u64(svbool_t, uint16_t const *, svint64_t);
9920__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_s64)))
9921svint64_t svldnt1uh_gather_index_s64(svbool_t, uint16_t const *, svint64_t);
9922__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_u64)))
9923svuint64_t svldnt1uh_gather_index_u64(svbool_t, uint16_t const *, svuint64_t);
9924__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_s64)))
9925svint64_t svldnt1uh_gather_index_s64(svbool_t, uint16_t const *, svuint64_t);
9926__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_u32)))
9927svuint32_t svldnt1uh_gather_offset_u32(svbool_t, uint16_t const *, svuint32_t);
9928__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_s32)))
9929svint32_t svldnt1uh_gather_offset_s32(svbool_t, uint16_t const *, svuint32_t);
9930__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_u64)))
9931svuint64_t svldnt1uh_gather_offset_u64(svbool_t, uint16_t const *, svint64_t);
9932__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_s64)))
9933svint64_t svldnt1uh_gather_offset_s64(svbool_t, uint16_t const *, svint64_t);
9934__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_u64)))
9935svuint64_t svldnt1uh_gather_offset_u64(svbool_t, uint16_t const *, svuint64_t);
9936__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_s64)))
9937svint64_t svldnt1uh_gather_offset_s64(svbool_t, uint16_t const *, svuint64_t);
9938__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_u64)))
9939svuint64_t svldnt1uw_gather_index_u64(svbool_t, svuint64_t, int64_t);
9940__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_s64)))
9941svint64_t svldnt1uw_gather_index_s64(svbool_t, svuint64_t, int64_t);
9942__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_u64)))
9943svuint64_t svldnt1uw_gather_offset_u64(svbool_t, svuint64_t, int64_t);
9944__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_s64)))
9945svint64_t svldnt1uw_gather_offset_s64(svbool_t, svuint64_t, int64_t);
9946__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_u64)))
9947svuint64_t svldnt1uw_gather_u64(svbool_t, svuint64_t);
9948__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_s64)))
9949svint64_t svldnt1uw_gather_s64(svbool_t, svuint64_t);
9950__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_u64)))
9951svuint64_t svldnt1uw_gather_index_u64(svbool_t, uint32_t const *, svint64_t);
9952__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_s64)))
9953svint64_t svldnt1uw_gather_index_s64(svbool_t, uint32_t const *, svint64_t);
9954__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_u64)))
9955svuint64_t svldnt1uw_gather_index_u64(svbool_t, uint32_t const *, svuint64_t);
9956__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_s64)))
9957svint64_t svldnt1uw_gather_index_s64(svbool_t, uint32_t const *, svuint64_t);
9958__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_u64)))
9959svuint64_t svldnt1uw_gather_offset_u64(svbool_t, uint32_t const *, svint64_t);
9960__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_s64)))
9961svint64_t svldnt1uw_gather_offset_s64(svbool_t, uint32_t const *, svint64_t);
9962__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_u64)))
9963svuint64_t svldnt1uw_gather_offset_u64(svbool_t, uint32_t const *, svuint64_t);
9964__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_s64)))
9965svint64_t svldnt1uw_gather_offset_s64(svbool_t, uint32_t const *, svuint64_t);
9966__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u8)))
9967svbool_t svmatch(svbool_t, svuint8_t, svuint8_t);
9968__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u16)))
9969svbool_t svmatch(svbool_t, svuint16_t, svuint16_t);
9970__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s8)))
9971svbool_t svmatch(svbool_t, svint8_t, svint8_t);
9972__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s16)))
9973svbool_t svmatch(svbool_t, svint16_t, svint16_t);
9974__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u8)))
9975svbool_t svnmatch(svbool_t, svuint8_t, svuint8_t);
9976__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u16)))
9977svbool_t svnmatch(svbool_t, svuint16_t, svuint16_t);
9978__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s8)))
9979svbool_t svnmatch(svbool_t, svint8_t, svint8_t);
9980__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s16)))
9981svbool_t svnmatch(svbool_t, svint16_t, svint16_t);
9982__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_u32)))
9983void svstnt1_scatter_index(svbool_t, svuint32_t, int64_t, svuint32_t);
9984__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_u64)))
9985void svstnt1_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
9986__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_f64)))
9987void svstnt1_scatter_index(svbool_t, svuint64_t, int64_t, svfloat64_t);
9988__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_f32)))
9989void svstnt1_scatter_index(svbool_t, svuint32_t, int64_t, svfloat32_t);
9990__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_s32)))
9991void svstnt1_scatter_index(svbool_t, svuint32_t, int64_t, svint32_t);
9992__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_s64)))
9993void svstnt1_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
9994__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_u32)))
9995void svstnt1_scatter_offset(svbool_t, svuint32_t, int64_t, svuint32_t);
9996__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_u64)))
9997void svstnt1_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
9998__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_f64)))
9999void svstnt1_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat64_t);
10000__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_f32)))
10001void svstnt1_scatter_offset(svbool_t, svuint32_t, int64_t, svfloat32_t);
10002__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_s32)))
10003void svstnt1_scatter_offset(svbool_t, svuint32_t, int64_t, svint32_t);
10004__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_s64)))
10005void svstnt1_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
10006__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_u32)))
10007void svstnt1_scatter(svbool_t, svuint32_t, svuint32_t);
10008__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_u64)))
10009void svstnt1_scatter(svbool_t, svuint64_t, svuint64_t);
10010__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_f64)))
10011void svstnt1_scatter(svbool_t, svuint64_t, svfloat64_t);
10012__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_f32)))
10013void svstnt1_scatter(svbool_t, svuint32_t, svfloat32_t);
10014__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_s32)))
10015void svstnt1_scatter(svbool_t, svuint32_t, svint32_t);
10016__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_s64)))
10017void svstnt1_scatter(svbool_t, svuint64_t, svint64_t);
10018__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_u64)))
10019void svstnt1_scatter_index(svbool_t, uint64_t *, svint64_t, svuint64_t);
10020__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_f64)))
10021void svstnt1_scatter_index(svbool_t, float64_t *, svint64_t, svfloat64_t);
10022__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_s64)))
10023void svstnt1_scatter_index(svbool_t, int64_t *, svint64_t, svint64_t);
10024__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_u64)))
10025void svstnt1_scatter_index(svbool_t, uint64_t *, svuint64_t, svuint64_t);
10026__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_f64)))
10027void svstnt1_scatter_index(svbool_t, float64_t *, svuint64_t, svfloat64_t);
10028__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_s64)))
10029void svstnt1_scatter_index(svbool_t, int64_t *, svuint64_t, svint64_t);
10030__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_u32)))
10031void svstnt1_scatter_offset(svbool_t, uint32_t *, svuint32_t, svuint32_t);
10032__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_f32)))
10033void svstnt1_scatter_offset(svbool_t, float32_t *, svuint32_t, svfloat32_t);
10034__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_s32)))
10035void svstnt1_scatter_offset(svbool_t, int32_t *, svuint32_t, svint32_t);
10036__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_u64)))
10037void svstnt1_scatter_offset(svbool_t, uint64_t *, svint64_t, svuint64_t);
10038__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_f64)))
10039void svstnt1_scatter_offset(svbool_t, float64_t *, svint64_t, svfloat64_t);
10040__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_s64)))
10041void svstnt1_scatter_offset(svbool_t, int64_t *, svint64_t, svint64_t);
10042__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_u64)))
10043void svstnt1_scatter_offset(svbool_t, uint64_t *, svuint64_t, svuint64_t);
10044__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_f64)))
10045void svstnt1_scatter_offset(svbool_t, float64_t *, svuint64_t, svfloat64_t);
10046__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_s64)))
10047void svstnt1_scatter_offset(svbool_t, int64_t *, svuint64_t, svint64_t);
10048__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_u32)))
10049void svstnt1b_scatter_offset(svbool_t, svuint32_t, int64_t, svuint32_t);
10050__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_u64)))
10051void svstnt1b_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
10052__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_s32)))
10053void svstnt1b_scatter_offset(svbool_t, svuint32_t, int64_t, svint32_t);
10054__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_s64)))
10055void svstnt1b_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
10056__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_u32)))
10057void svstnt1b_scatter(svbool_t, svuint32_t, svuint32_t);
10058__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_u64)))
10059void svstnt1b_scatter(svbool_t, svuint64_t, svuint64_t);
10060__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_s32)))
10061void svstnt1b_scatter(svbool_t, svuint32_t, svint32_t);
10062__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_s64)))
10063void svstnt1b_scatter(svbool_t, svuint64_t, svint64_t);
10064__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_s32)))
10065void svstnt1b_scatter_offset(svbool_t, int8_t *, svuint32_t, svint32_t);
10066__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_u32)))
10067void svstnt1b_scatter_offset(svbool_t, uint8_t *, svuint32_t, svuint32_t);
10068__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_s64)))
10069void svstnt1b_scatter_offset(svbool_t, int8_t *, svint64_t, svint64_t);
10070__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_u64)))
10071void svstnt1b_scatter_offset(svbool_t, uint8_t *, svint64_t, svuint64_t);
10072__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_s64)))
10073void svstnt1b_scatter_offset(svbool_t, int8_t *, svuint64_t, svint64_t);
10074__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_u64)))
10075void svstnt1b_scatter_offset(svbool_t, uint8_t *, svuint64_t, svuint64_t);
10076__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_u32)))
10077void svstnt1h_scatter_index(svbool_t, svuint32_t, int64_t, svuint32_t);
10078__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_u64)))
10079void svstnt1h_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
10080__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_s32)))
10081void svstnt1h_scatter_index(svbool_t, svuint32_t, int64_t, svint32_t);
10082__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_s64)))
10083void svstnt1h_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
10084__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_u32)))
10085void svstnt1h_scatter_offset(svbool_t, svuint32_t, int64_t, svuint32_t);
10086__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_u64)))
10087void svstnt1h_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
10088__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_s32)))
10089void svstnt1h_scatter_offset(svbool_t, svuint32_t, int64_t, svint32_t);
10090__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_s64)))
10091void svstnt1h_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
10092__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_u32)))
10093void svstnt1h_scatter(svbool_t, svuint32_t, svuint32_t);
10094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_u64)))
10095void svstnt1h_scatter(svbool_t, svuint64_t, svuint64_t);
10096__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_s32)))
10097void svstnt1h_scatter(svbool_t, svuint32_t, svint32_t);
10098__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_s64)))
10099void svstnt1h_scatter(svbool_t, svuint64_t, svint64_t);
10100__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_s64)))
10101void svstnt1h_scatter_index(svbool_t, int16_t *, svint64_t, svint64_t);
10102__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_u64)))
10103void svstnt1h_scatter_index(svbool_t, uint16_t *, svint64_t, svuint64_t);
10104__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_s64)))
10105void svstnt1h_scatter_index(svbool_t, int16_t *, svuint64_t, svint64_t);
10106__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_u64)))
10107void svstnt1h_scatter_index(svbool_t, uint16_t *, svuint64_t, svuint64_t);
10108__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_s32)))
10109void svstnt1h_scatter_offset(svbool_t, int16_t *, svuint32_t, svint32_t);
10110__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_u32)))
10111void svstnt1h_scatter_offset(svbool_t, uint16_t *, svuint32_t, svuint32_t);
10112__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_s64)))
10113void svstnt1h_scatter_offset(svbool_t, int16_t *, svint64_t, svint64_t);
10114__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_u64)))
10115void svstnt1h_scatter_offset(svbool_t, uint16_t *, svint64_t, svuint64_t);
10116__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_s64)))
10117void svstnt1h_scatter_offset(svbool_t, int16_t *, svuint64_t, svint64_t);
10118__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_u64)))
10119void svstnt1h_scatter_offset(svbool_t, uint16_t *, svuint64_t, svuint64_t);
10120__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_u64)))
10121void svstnt1w_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
10122__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_s64)))
10123void svstnt1w_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
10124__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_u64)))
10125void svstnt1w_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
10126__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_s64)))
10127void svstnt1w_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
10128__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_u64)))
10129void svstnt1w_scatter(svbool_t, svuint64_t, svuint64_t);
10130__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_s64)))
10131void svstnt1w_scatter(svbool_t, svuint64_t, svint64_t);
10132__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_s64)))
10133void svstnt1w_scatter_index(svbool_t, int32_t *, svint64_t, svint64_t);
10134__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_u64)))
10135void svstnt1w_scatter_index(svbool_t, uint32_t *, svint64_t, svuint64_t);
10136__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_s64)))
10137void svstnt1w_scatter_index(svbool_t, int32_t *, svuint64_t, svint64_t);
10138__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_u64)))
10139void svstnt1w_scatter_index(svbool_t, uint32_t *, svuint64_t, svuint64_t);
10140__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_s64)))
10141void svstnt1w_scatter_offset(svbool_t, int32_t *, svint64_t, svint64_t);
10142__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_u64)))
10143void svstnt1w_scatter_offset(svbool_t, uint32_t *, svint64_t, svuint64_t);
10144__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_s64)))
10145void svstnt1w_scatter_offset(svbool_t, int32_t *, svuint64_t, svint64_t);
10146__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_u64)))
10147void svstnt1w_scatter_offset(svbool_t, uint32_t *, svuint64_t, svuint64_t);
10148__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_m)))
10149svfloat64_t svamax_n_f64_m(svbool_t, svfloat64_t, float64_t);
10150__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_m)))
10151svfloat32_t svamax_n_f32_m(svbool_t, svfloat32_t, float32_t);
10152__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_m)))
10153svfloat16_t svamax_n_f16_m(svbool_t, svfloat16_t, float16_t);
10154__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_x)))
10155svfloat64_t svamax_n_f64_x(svbool_t, svfloat64_t, float64_t);
10156__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_x)))
10157svfloat32_t svamax_n_f32_x(svbool_t, svfloat32_t, float32_t);
10158__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_x)))
10159svfloat16_t svamax_n_f16_x(svbool_t, svfloat16_t, float16_t);
10160__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_z)))
10161svfloat64_t svamax_n_f64_z(svbool_t, svfloat64_t, float64_t);
10162__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_z)))
10163svfloat32_t svamax_n_f32_z(svbool_t, svfloat32_t, float32_t);
10164__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_z)))
10165svfloat16_t svamax_n_f16_z(svbool_t, svfloat16_t, float16_t);
10166__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_m)))
10167svfloat64_t svamax_f64_m(svbool_t, svfloat64_t, svfloat64_t);
10168__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_m)))
10169svfloat32_t svamax_f32_m(svbool_t, svfloat32_t, svfloat32_t);
10170__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_m)))
10171svfloat16_t svamax_f16_m(svbool_t, svfloat16_t, svfloat16_t);
10172__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_x)))
10173svfloat64_t svamax_f64_x(svbool_t, svfloat64_t, svfloat64_t);
10174__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_x)))
10175svfloat32_t svamax_f32_x(svbool_t, svfloat32_t, svfloat32_t);
10176__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_x)))
10177svfloat16_t svamax_f16_x(svbool_t, svfloat16_t, svfloat16_t);
10178__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_z)))
10179svfloat64_t svamax_f64_z(svbool_t, svfloat64_t, svfloat64_t);
10180__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_z)))
10181svfloat32_t svamax_f32_z(svbool_t, svfloat32_t, svfloat32_t);
10182__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_z)))
10183svfloat16_t svamax_f16_z(svbool_t, svfloat16_t, svfloat16_t);
10184__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_m)))
10185svfloat64_t svamin_n_f64_m(svbool_t, svfloat64_t, float64_t);
10186__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_m)))
10187svfloat32_t svamin_n_f32_m(svbool_t, svfloat32_t, float32_t);
10188__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_m)))
10189svfloat16_t svamin_n_f16_m(svbool_t, svfloat16_t, float16_t);
10190__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_x)))
10191svfloat64_t svamin_n_f64_x(svbool_t, svfloat64_t, float64_t);
10192__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_x)))
10193svfloat32_t svamin_n_f32_x(svbool_t, svfloat32_t, float32_t);
10194__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_x)))
10195svfloat16_t svamin_n_f16_x(svbool_t, svfloat16_t, float16_t);
10196__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_z)))
10197svfloat64_t svamin_n_f64_z(svbool_t, svfloat64_t, float64_t);
10198__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_z)))
10199svfloat32_t svamin_n_f32_z(svbool_t, svfloat32_t, float32_t);
10200__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_z)))
10201svfloat16_t svamin_n_f16_z(svbool_t, svfloat16_t, float16_t);
10202__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_m)))
10203svfloat64_t svamin_f64_m(svbool_t, svfloat64_t, svfloat64_t);
10204__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_m)))
10205svfloat32_t svamin_f32_m(svbool_t, svfloat32_t, svfloat32_t);
10206__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_m)))
10207svfloat16_t svamin_f16_m(svbool_t, svfloat16_t, svfloat16_t);
10208__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_x)))
10209svfloat64_t svamin_f64_x(svbool_t, svfloat64_t, svfloat64_t);
10210__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_x)))
10211svfloat32_t svamin_f32_x(svbool_t, svfloat32_t, svfloat32_t);
10212__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_x)))
10213svfloat16_t svamin_f16_x(svbool_t, svfloat16_t, svfloat16_t);
10214__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_z)))
10215svfloat64_t svamin_f64_z(svbool_t, svfloat64_t, svfloat64_t);
10216__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_z)))
10217svfloat32_t svamin_f32_z(svbool_t, svfloat32_t, svfloat32_t);
10218__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_z)))
10219svfloat16_t svamin_f16_z(svbool_t, svfloat16_t, svfloat16_t);
10220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_m)))
10221svfloat64_t svamax_m(svbool_t, svfloat64_t, float64_t);
10222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_m)))
10223svfloat32_t svamax_m(svbool_t, svfloat32_t, float32_t);
10224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_m)))
10225svfloat16_t svamax_m(svbool_t, svfloat16_t, float16_t);
10226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_x)))
10227svfloat64_t svamax_x(svbool_t, svfloat64_t, float64_t);
10228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_x)))
10229svfloat32_t svamax_x(svbool_t, svfloat32_t, float32_t);
10230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_x)))
10231svfloat16_t svamax_x(svbool_t, svfloat16_t, float16_t);
10232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_z)))
10233svfloat64_t svamax_z(svbool_t, svfloat64_t, float64_t);
10234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_z)))
10235svfloat32_t svamax_z(svbool_t, svfloat32_t, float32_t);
10236__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_z)))
10237svfloat16_t svamax_z(svbool_t, svfloat16_t, float16_t);
10238__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_m)))
10239svfloat64_t svamax_m(svbool_t, svfloat64_t, svfloat64_t);
10240__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_m)))
10241svfloat32_t svamax_m(svbool_t, svfloat32_t, svfloat32_t);
10242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_m)))
10243svfloat16_t svamax_m(svbool_t, svfloat16_t, svfloat16_t);
10244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_x)))
10245svfloat64_t svamax_x(svbool_t, svfloat64_t, svfloat64_t);
10246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_x)))
10247svfloat32_t svamax_x(svbool_t, svfloat32_t, svfloat32_t);
10248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_x)))
10249svfloat16_t svamax_x(svbool_t, svfloat16_t, svfloat16_t);
10250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_z)))
10251svfloat64_t svamax_z(svbool_t, svfloat64_t, svfloat64_t);
10252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_z)))
10253svfloat32_t svamax_z(svbool_t, svfloat32_t, svfloat32_t);
10254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_z)))
10255svfloat16_t svamax_z(svbool_t, svfloat16_t, svfloat16_t);
10256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_m)))
10257svfloat64_t svamin_m(svbool_t, svfloat64_t, float64_t);
10258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_m)))
10259svfloat32_t svamin_m(svbool_t, svfloat32_t, float32_t);
10260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_m)))
10261svfloat16_t svamin_m(svbool_t, svfloat16_t, float16_t);
10262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_x)))
10263svfloat64_t svamin_x(svbool_t, svfloat64_t, float64_t);
10264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_x)))
10265svfloat32_t svamin_x(svbool_t, svfloat32_t, float32_t);
10266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_x)))
10267svfloat16_t svamin_x(svbool_t, svfloat16_t, float16_t);
10268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_z)))
10269svfloat64_t svamin_z(svbool_t, svfloat64_t, float64_t);
10270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_z)))
10271svfloat32_t svamin_z(svbool_t, svfloat32_t, float32_t);
10272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_z)))
10273svfloat16_t svamin_z(svbool_t, svfloat16_t, float16_t);
10274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_m)))
10275svfloat64_t svamin_m(svbool_t, svfloat64_t, svfloat64_t);
10276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_m)))
10277svfloat32_t svamin_m(svbool_t, svfloat32_t, svfloat32_t);
10278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_m)))
10279svfloat16_t svamin_m(svbool_t, svfloat16_t, svfloat16_t);
10280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_x)))
10281svfloat64_t svamin_x(svbool_t, svfloat64_t, svfloat64_t);
10282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_x)))
10283svfloat32_t svamin_x(svbool_t, svfloat32_t, svfloat32_t);
10284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_x)))
10285svfloat16_t svamin_x(svbool_t, svfloat16_t, svfloat16_t);
10286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_z)))
10287svfloat64_t svamin_z(svbool_t, svfloat64_t, svfloat64_t);
10288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_z)))
10289svfloat32_t svamin_z(svbool_t, svfloat32_t, svfloat32_t);
10290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_z)))
10291svfloat16_t svamin_z(svbool_t, svfloat16_t, svfloat16_t);
10292__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f16_mf8_fpm)))
10293svfloat16_t svdot_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
10294__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f16_mf8_fpm)))
10295svfloat16_t svdot_n_f16_mf8_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
10296__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f16_mf8_fpm)))
10297svfloat16_t svdot_lane_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f16_mf8_fpm)))
10299svfloat16_t svdot_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
10300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f16_mf8_fpm)))
10301svfloat16_t svdot_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
10302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f16_mf8_fpm)))
10303svfloat16_t svdot_lane_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10304__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f32_mf8_fpm)))
10305svfloat32_t svdot_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10306__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f32_mf8_fpm)))
10307svfloat32_t svdot_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10308__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f32_mf8_fpm)))
10309svfloat32_t svdot_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f32_mf8_fpm)))
10311svfloat32_t svdot_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f32_mf8_fpm)))
10313svfloat32_t svdot_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f32_mf8_fpm)))
10315svfloat32_t svdot_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10316__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_f16_mf8_fpm)))
10317svfloat16_t svmlalb_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
10318__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_n_f16_mf8_fpm)))
10319svfloat16_t svmlalb_n_f16_mf8_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
10320__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_lane_f16_mf8_fpm)))
10321svfloat16_t svmlalb_lane_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10322__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_f32_mf8_fpm)))
10323svfloat32_t svmlallbb_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10324__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_n_f32_mf8_fpm)))
10325svfloat32_t svmlallbb_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10326__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_lane_f32_mf8_fpm)))
10327svfloat32_t svmlallbb_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10328__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_f32_mf8_fpm)))
10329svfloat32_t svmlallbt_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10330__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_n_f32_mf8_fpm)))
10331svfloat32_t svmlallbt_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10332__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_lane_f32_mf8_fpm)))
10333svfloat32_t svmlallbt_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10334__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_f32_mf8_fpm)))
10335svfloat32_t svmlalltb_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10336__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_n_f32_mf8_fpm)))
10337svfloat32_t svmlalltb_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10338__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_lane_f32_mf8_fpm)))
10339svfloat32_t svmlalltb_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10340__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_f32_mf8_fpm)))
10341svfloat32_t svmlalltt_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10342__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_n_f32_mf8_fpm)))
10343svfloat32_t svmlalltt_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10344__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_lane_f32_mf8_fpm)))
10345svfloat32_t svmlalltt_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10346__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_f16_mf8_fpm)))
10347svfloat16_t svmlalt_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
10348__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_n_f16_mf8_fpm)))
10349svfloat16_t svmlalt_n_f16_mf8_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
10350__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_lane_f16_mf8_fpm)))
10351svfloat16_t svmlalt_lane_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_f16_mf8_fpm)))
10353svfloat16_t svmlalb_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
10354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_n_f16_mf8_fpm)))
10355svfloat16_t svmlalb_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
10356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_lane_f16_mf8_fpm)))
10357svfloat16_t svmlalb_lane_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_f32_mf8_fpm)))
10359svfloat32_t svmlallbb_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_n_f32_mf8_fpm)))
10361svfloat32_t svmlallbb_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_lane_f32_mf8_fpm)))
10363svfloat32_t svmlallbb_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_f32_mf8_fpm)))
10365svfloat32_t svmlallbt_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_n_f32_mf8_fpm)))
10367svfloat32_t svmlallbt_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_lane_f32_mf8_fpm)))
10369svfloat32_t svmlallbt_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_f32_mf8_fpm)))
10371svfloat32_t svmlalltb_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_n_f32_mf8_fpm)))
10373svfloat32_t svmlalltb_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_lane_f32_mf8_fpm)))
10375svfloat32_t svmlalltb_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_f32_mf8_fpm)))
10377svfloat32_t svmlalltt_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
10378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_n_f32_mf8_fpm)))
10379svfloat32_t svmlalltt_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
10380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_lane_f32_mf8_fpm)))
10381svfloat32_t svmlalltt_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_f16_mf8_fpm)))
10383svfloat16_t svmlalt_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
10384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_n_f16_mf8_fpm)))
10385svfloat16_t svmlalt_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
10386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_lane_f16_mf8_fpm)))
10387svfloat16_t svmlalt_lane_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
10388__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_bf16_mf8_fpm)))
10389svbfloat16_t svcvt1_bf16_mf8_fpm(svmfloat8_t, fpm_t);
10390__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_f16_mf8_fpm)))
10391svfloat16_t svcvt1_f16_mf8_fpm(svmfloat8_t, fpm_t);
10392__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_bf16_mf8_fpm)))
10393svbfloat16_t svcvt2_bf16_mf8_fpm(svmfloat8_t, fpm_t);
10394__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_f16_mf8_fpm)))
10395svfloat16_t svcvt2_f16_mf8_fpm(svmfloat8_t, fpm_t);
10396__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_bf16_mf8_fpm)))
10397svbfloat16_t svcvtlt1_bf16_mf8_fpm(svmfloat8_t, fpm_t);
10398__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_f16_mf8_fpm)))
10399svfloat16_t svcvtlt1_f16_mf8_fpm(svmfloat8_t, fpm_t);
10400__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_bf16_mf8_fpm)))
10401svbfloat16_t svcvtlt2_bf16_mf8_fpm(svmfloat8_t, fpm_t);
10402__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_f16_mf8_fpm)))
10403svfloat16_t svcvtlt2_f16_mf8_fpm(svmfloat8_t, fpm_t);
10404__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_bf16_x2_fpm)))
10405svmfloat8_t svcvtn_mf8_bf16_x2_fpm(svbfloat16x2_t, fpm_t);
10406__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_f16_x2_fpm)))
10407svmfloat8_t svcvtn_mf8_f16_x2_fpm(svfloat16x2_t, fpm_t);
10408__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnb_mf8_f32_x2_fpm)))
10409svmfloat8_t svcvtnb_mf8_f32_x2_fpm(svfloat32x2_t, fpm_t);
10410__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_mf8_f32_x2_fpm)))
10411svmfloat8_t svcvtnt_mf8_f32_x2_fpm(svmfloat8_t, svfloat32x2_t, fpm_t);
10412__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_bf16_mf8_fpm)))
10413svbfloat16_t svcvt1_bf16_fpm(svmfloat8_t, fpm_t);
10414__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_f16_mf8_fpm)))
10415svfloat16_t svcvt1_f16_fpm(svmfloat8_t, fpm_t);
10416__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_bf16_mf8_fpm)))
10417svbfloat16_t svcvt2_bf16_fpm(svmfloat8_t, fpm_t);
10418__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_f16_mf8_fpm)))
10419svfloat16_t svcvt2_f16_fpm(svmfloat8_t, fpm_t);
10420__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_bf16_mf8_fpm)))
10421svbfloat16_t svcvtlt1_bf16_fpm(svmfloat8_t, fpm_t);
10422__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_f16_mf8_fpm)))
10423svfloat16_t svcvtlt1_f16_fpm(svmfloat8_t, fpm_t);
10424__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_bf16_mf8_fpm)))
10425svbfloat16_t svcvtlt2_bf16_fpm(svmfloat8_t, fpm_t);
10426__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_f16_mf8_fpm)))
10427svfloat16_t svcvtlt2_f16_fpm(svmfloat8_t, fpm_t);
10428__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_bf16_x2_fpm)))
10429svmfloat8_t svcvtn_mf8_fpm(svbfloat16x2_t, fpm_t);
10430__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_f16_x2_fpm)))
10431svmfloat8_t svcvtn_mf8_fpm(svfloat16x2_t, fpm_t);
10432__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnb_mf8_f32_x2_fpm)))
10433svmfloat8_t svcvtnb_mf8_fpm(svfloat32x2_t, fpm_t);
10434__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_mf8_f32_x2_fpm)))
10435svmfloat8_t svcvtnt_mf8_fpm(svmfloat8_t, svfloat32x2_t, fpm_t);
10436__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u8)))
10437svuint8_t svluti2_lane_u8(svuint8_t, svuint8_t, uint64_t);
10438__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s8)))
10439svint8_t svluti2_lane_s8(svint8_t, svuint8_t, uint64_t);
10440__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u16)))
10441svuint16_t svluti2_lane_u16(svuint16_t, svuint8_t, uint64_t);
10442__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_bf16)))
10443svbfloat16_t svluti2_lane_bf16(svbfloat16_t, svuint8_t, uint64_t);
10444__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_f16)))
10445svfloat16_t svluti2_lane_f16(svfloat16_t, svuint8_t, uint64_t);
10446__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s16)))
10447svint16_t svluti2_lane_s16(svint16_t, svuint8_t, uint64_t);
10448__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u8)))
10449svuint8_t svluti4_lane_u8(svuint8_t, svuint8_t, uint64_t);
10450__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s8)))
10451svint8_t svluti4_lane_s8(svint8_t, svuint8_t, uint64_t);
10452__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16)))
10453svuint16_t svluti4_lane_u16(svuint16_t, svuint8_t, uint64_t);
10454__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16)))
10455svbfloat16_t svluti4_lane_bf16(svbfloat16_t, svuint8_t, uint64_t);
10456__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16)))
10457svfloat16_t svluti4_lane_f16(svfloat16_t, svuint8_t, uint64_t);
10458__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16)))
10459svint16_t svluti4_lane_s16(svint16_t, svuint8_t, uint64_t);
10460__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16_x2)))
10461svuint16_t svluti4_lane_u16_x2(svuint16x2_t, svuint8_t, uint64_t);
10462__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16_x2)))
10463svbfloat16_t svluti4_lane_bf16_x2(svbfloat16x2_t, svuint8_t, uint64_t);
10464__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16_x2)))
10465svfloat16_t svluti4_lane_f16_x2(svfloat16x2_t, svuint8_t, uint64_t);
10466__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16_x2)))
10467svint16_t svluti4_lane_s16_x2(svint16x2_t, svuint8_t, uint64_t);
10468__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u8)))
10469svuint8_t svluti2_lane(svuint8_t, svuint8_t, uint64_t);
10470__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s8)))
10471svint8_t svluti2_lane(svint8_t, svuint8_t, uint64_t);
10472__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u16)))
10473svuint16_t svluti2_lane(svuint16_t, svuint8_t, uint64_t);
10474__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_bf16)))
10475svbfloat16_t svluti2_lane(svbfloat16_t, svuint8_t, uint64_t);
10476__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_f16)))
10477svfloat16_t svluti2_lane(svfloat16_t, svuint8_t, uint64_t);
10478__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s16)))
10479svint16_t svluti2_lane(svint16_t, svuint8_t, uint64_t);
10480__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u8)))
10481svuint8_t svluti4_lane(svuint8_t, svuint8_t, uint64_t);
10482__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s8)))
10483svint8_t svluti4_lane(svint8_t, svuint8_t, uint64_t);
10484__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16)))
10485svuint16_t svluti4_lane(svuint16_t, svuint8_t, uint64_t);
10486__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16)))
10487svbfloat16_t svluti4_lane(svbfloat16_t, svuint8_t, uint64_t);
10488__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16)))
10489svfloat16_t svluti4_lane(svfloat16_t, svuint8_t, uint64_t);
10490__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16)))
10491svint16_t svluti4_lane(svint16_t, svuint8_t, uint64_t);
10492__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16_x2)))
10493svuint16_t svluti4_lane(svuint16x2_t, svuint8_t, uint64_t);
10494__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16_x2)))
10495svbfloat16_t svluti4_lane(svbfloat16x2_t, svuint8_t, uint64_t);
10496__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16_x2)))
10497svfloat16_t svluti4_lane(svfloat16x2_t, svuint8_t, uint64_t);
10498__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16_x2)))
10499svint16_t svluti4_lane(svint16x2_t, svuint8_t, uint64_t);
10500__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_u8)))
10501svuint8_t svaesd_u8(svuint8_t, svuint8_t);
10502__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_u8)))
10503svuint8_t svaese_u8(svuint8_t, svuint8_t);
10504__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesimc_u8)))
10505svuint8_t svaesimc_u8(svuint8_t);
10506__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesmc_u8)))
10507svuint8_t svaesmc_u8(svuint8_t);
10508__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_n_u64)))
10509svuint64_t svpmullb_pair_n_u64(svuint64_t, uint64_t);
10510__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_u64)))
10511svuint64_t svpmullb_pair_u64(svuint64_t, svuint64_t);
10512__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_n_u64)))
10513svuint64_t svpmullt_pair_n_u64(svuint64_t, uint64_t);
10514__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_u64)))
10515svuint64_t svpmullt_pair_u64(svuint64_t, svuint64_t);
10516__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_u8)))
10517svuint8_t svaesd(svuint8_t, svuint8_t);
10518__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_u8)))
10519svuint8_t svaese(svuint8_t, svuint8_t);
10520__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesimc_u8)))
10521svuint8_t svaesimc(svuint8_t);
10522__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesmc_u8)))
10523svuint8_t svaesmc(svuint8_t);
10524__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_n_u64)))
10525svuint64_t svpmullb_pair(svuint64_t, uint64_t);
10526__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_u64)))
10527svuint64_t svpmullb_pair(svuint64_t, svuint64_t);
10528__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_n_u64)))
10529svuint64_t svpmullt_pair(svuint64_t, uint64_t);
10530__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_u64)))
10531svuint64_t svpmullt_pair(svuint64_t, svuint64_t);
10532__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_m)))
10533svbfloat16_t svadd_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10534__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_x)))
10535svbfloat16_t svadd_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10536__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_z)))
10537svbfloat16_t svadd_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10538__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_m)))
10539svbfloat16_t svadd_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10540__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_x)))
10541svbfloat16_t svadd_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10542__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_z)))
10543svbfloat16_t svadd_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10544__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svclamp_bf16)))
10545svbfloat16_t svclamp_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t);
10546__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_m)))
10547svbfloat16_t svmax_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10548__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_x)))
10549svbfloat16_t svmax_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10550__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_z)))
10551svbfloat16_t svmax_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10552__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_m)))
10553svbfloat16_t svmax_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10554__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_x)))
10555svbfloat16_t svmax_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10556__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_z)))
10557svbfloat16_t svmax_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10558__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_m)))
10559svbfloat16_t svmaxnm_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10560__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_x)))
10561svbfloat16_t svmaxnm_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10562__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_z)))
10563svbfloat16_t svmaxnm_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10564__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_m)))
10565svbfloat16_t svmaxnm_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10566__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_x)))
10567svbfloat16_t svmaxnm_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10568__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_z)))
10569svbfloat16_t svmaxnm_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10570__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_m)))
10571svbfloat16_t svmin_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10572__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_x)))
10573svbfloat16_t svmin_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10574__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_z)))
10575svbfloat16_t svmin_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10576__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_m)))
10577svbfloat16_t svmin_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10578__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_x)))
10579svbfloat16_t svmin_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10580__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_z)))
10581svbfloat16_t svmin_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10582__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_m)))
10583svbfloat16_t svminnm_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10584__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_x)))
10585svbfloat16_t svminnm_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10586__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_z)))
10587svbfloat16_t svminnm_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10588__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_m)))
10589svbfloat16_t svminnm_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10590__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_x)))
10591svbfloat16_t svminnm_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10592__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_z)))
10593svbfloat16_t svminnm_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10594__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_m)))
10595svbfloat16_t svmla_n_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10596__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_x)))
10597svbfloat16_t svmla_n_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10598__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_z)))
10599svbfloat16_t svmla_n_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10600__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_m)))
10601svbfloat16_t svmla_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10602__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_x)))
10603svbfloat16_t svmla_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10604__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_z)))
10605svbfloat16_t svmla_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10606__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_lane_bf16)))
10607svbfloat16_t svmla_lane_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
10608__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_m)))
10609svbfloat16_t svmls_n_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10610__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_x)))
10611svbfloat16_t svmls_n_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10612__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_z)))
10613svbfloat16_t svmls_n_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10614__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_m)))
10615svbfloat16_t svmls_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10616__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_x)))
10617svbfloat16_t svmls_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10618__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_z)))
10619svbfloat16_t svmls_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_lane_bf16)))
10621svbfloat16_t svmls_lane_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
10622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_m)))
10623svbfloat16_t svmul_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_x)))
10625svbfloat16_t svmul_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_z)))
10627svbfloat16_t svmul_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_m)))
10629svbfloat16_t svmul_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x)))
10631svbfloat16_t svmul_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_z)))
10633svbfloat16_t svmul_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_lane_bf16)))
10635svbfloat16_t svmul_lane_bf16(svbfloat16_t, svbfloat16_t, uint64_t);
10636__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_m)))
10637svbfloat16_t svsub_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
10638__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_x)))
10639svbfloat16_t svsub_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
10640__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_z)))
10641svbfloat16_t svsub_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
10642__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_m)))
10643svbfloat16_t svsub_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
10644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_x)))
10645svbfloat16_t svsub_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
10646__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_z)))
10647svbfloat16_t svsub_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
10648__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_m)))
10649svbfloat16_t svadd_m(svbool_t, svbfloat16_t, bfloat16_t);
10650__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_x)))
10651svbfloat16_t svadd_x(svbool_t, svbfloat16_t, bfloat16_t);
10652__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_z)))
10653svbfloat16_t svadd_z(svbool_t, svbfloat16_t, bfloat16_t);
10654__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_m)))
10655svbfloat16_t svadd_m(svbool_t, svbfloat16_t, svbfloat16_t);
10656__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_x)))
10657svbfloat16_t svadd_x(svbool_t, svbfloat16_t, svbfloat16_t);
10658__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_z)))
10659svbfloat16_t svadd_z(svbool_t, svbfloat16_t, svbfloat16_t);
10660__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svclamp_bf16)))
10661svbfloat16_t svclamp(svbfloat16_t, svbfloat16_t, svbfloat16_t);
10662__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_m)))
10663svbfloat16_t svmax_m(svbool_t, svbfloat16_t, bfloat16_t);
10664__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_x)))
10665svbfloat16_t svmax_x(svbool_t, svbfloat16_t, bfloat16_t);
10666__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_z)))
10667svbfloat16_t svmax_z(svbool_t, svbfloat16_t, bfloat16_t);
10668__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_m)))
10669svbfloat16_t svmax_m(svbool_t, svbfloat16_t, svbfloat16_t);
10670__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_x)))
10671svbfloat16_t svmax_x(svbool_t, svbfloat16_t, svbfloat16_t);
10672__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_z)))
10673svbfloat16_t svmax_z(svbool_t, svbfloat16_t, svbfloat16_t);
10674__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_m)))
10675svbfloat16_t svmaxnm_m(svbool_t, svbfloat16_t, bfloat16_t);
10676__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_x)))
10677svbfloat16_t svmaxnm_x(svbool_t, svbfloat16_t, bfloat16_t);
10678__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_z)))
10679svbfloat16_t svmaxnm_z(svbool_t, svbfloat16_t, bfloat16_t);
10680__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_m)))
10681svbfloat16_t svmaxnm_m(svbool_t, svbfloat16_t, svbfloat16_t);
10682__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_x)))
10683svbfloat16_t svmaxnm_x(svbool_t, svbfloat16_t, svbfloat16_t);
10684__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_z)))
10685svbfloat16_t svmaxnm_z(svbool_t, svbfloat16_t, svbfloat16_t);
10686__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_m)))
10687svbfloat16_t svmin_m(svbool_t, svbfloat16_t, bfloat16_t);
10688__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_x)))
10689svbfloat16_t svmin_x(svbool_t, svbfloat16_t, bfloat16_t);
10690__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_z)))
10691svbfloat16_t svmin_z(svbool_t, svbfloat16_t, bfloat16_t);
10692__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_m)))
10693svbfloat16_t svmin_m(svbool_t, svbfloat16_t, svbfloat16_t);
10694__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_x)))
10695svbfloat16_t svmin_x(svbool_t, svbfloat16_t, svbfloat16_t);
10696__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_z)))
10697svbfloat16_t svmin_z(svbool_t, svbfloat16_t, svbfloat16_t);
10698__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_m)))
10699svbfloat16_t svminnm_m(svbool_t, svbfloat16_t, bfloat16_t);
10700__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_x)))
10701svbfloat16_t svminnm_x(svbool_t, svbfloat16_t, bfloat16_t);
10702__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_z)))
10703svbfloat16_t svminnm_z(svbool_t, svbfloat16_t, bfloat16_t);
10704__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_m)))
10705svbfloat16_t svminnm_m(svbool_t, svbfloat16_t, svbfloat16_t);
10706__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_x)))
10707svbfloat16_t svminnm_x(svbool_t, svbfloat16_t, svbfloat16_t);
10708__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_z)))
10709svbfloat16_t svminnm_z(svbool_t, svbfloat16_t, svbfloat16_t);
10710__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_m)))
10711svbfloat16_t svmla_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10712__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_x)))
10713svbfloat16_t svmla_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10714__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_z)))
10715svbfloat16_t svmla_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10716__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_m)))
10717svbfloat16_t svmla_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10718__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_x)))
10719svbfloat16_t svmla_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10720__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_z)))
10721svbfloat16_t svmla_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10722__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_lane_bf16)))
10723svbfloat16_t svmla_lane(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
10724__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_m)))
10725svbfloat16_t svmls_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10726__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_x)))
10727svbfloat16_t svmls_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10728__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_z)))
10729svbfloat16_t svmls_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
10730__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_m)))
10731svbfloat16_t svmls_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10732__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_x)))
10733svbfloat16_t svmls_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10734__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_z)))
10735svbfloat16_t svmls_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
10736__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_lane_bf16)))
10737svbfloat16_t svmls_lane(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
10738__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_m)))
10739svbfloat16_t svmul_m(svbool_t, svbfloat16_t, bfloat16_t);
10740__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_x)))
10741svbfloat16_t svmul_x(svbool_t, svbfloat16_t, bfloat16_t);
10742__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_z)))
10743svbfloat16_t svmul_z(svbool_t, svbfloat16_t, bfloat16_t);
10744__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_m)))
10745svbfloat16_t svmul_m(svbool_t, svbfloat16_t, svbfloat16_t);
10746__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x)))
10747svbfloat16_t svmul_x(svbool_t, svbfloat16_t, svbfloat16_t);
10748__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_z)))
10749svbfloat16_t svmul_z(svbool_t, svbfloat16_t, svbfloat16_t);
10750__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_lane_bf16)))
10751svbfloat16_t svmul_lane(svbfloat16_t, svbfloat16_t, uint64_t);
10752__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_m)))
10753svbfloat16_t svsub_m(svbool_t, svbfloat16_t, bfloat16_t);
10754__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_x)))
10755svbfloat16_t svsub_x(svbool_t, svbfloat16_t, bfloat16_t);
10756__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_z)))
10757svbfloat16_t svsub_z(svbool_t, svbfloat16_t, bfloat16_t);
10758__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_m)))
10759svbfloat16_t svsub_m(svbool_t, svbfloat16_t, svbfloat16_t);
10760__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_x)))
10761svbfloat16_t svsub_x(svbool_t, svbfloat16_t, svbfloat16_t);
10762__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_z)))
10763svbfloat16_t svsub_z(svbool_t, svbfloat16_t, svbfloat16_t);
10764__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u8)))
10765svuint8_t svbdep_n_u8(svuint8_t, uint8_t);
10766__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u32)))
10767svuint32_t svbdep_n_u32(svuint32_t, uint32_t);
10768__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u64)))
10769svuint64_t svbdep_n_u64(svuint64_t, uint64_t);
10770__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u16)))
10771svuint16_t svbdep_n_u16(svuint16_t, uint16_t);
10772__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u8)))
10773svuint8_t svbdep_u8(svuint8_t, svuint8_t);
10774__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u32)))
10775svuint32_t svbdep_u32(svuint32_t, svuint32_t);
10776__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u64)))
10777svuint64_t svbdep_u64(svuint64_t, svuint64_t);
10778__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u16)))
10779svuint16_t svbdep_u16(svuint16_t, svuint16_t);
10780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u8)))
10781svuint8_t svbext_n_u8(svuint8_t, uint8_t);
10782__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u32)))
10783svuint32_t svbext_n_u32(svuint32_t, uint32_t);
10784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u64)))
10785svuint64_t svbext_n_u64(svuint64_t, uint64_t);
10786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u16)))
10787svuint16_t svbext_n_u16(svuint16_t, uint16_t);
10788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u8)))
10789svuint8_t svbext_u8(svuint8_t, svuint8_t);
10790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u32)))
10791svuint32_t svbext_u32(svuint32_t, svuint32_t);
10792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u64)))
10793svuint64_t svbext_u64(svuint64_t, svuint64_t);
10794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u16)))
10795svuint16_t svbext_u16(svuint16_t, svuint16_t);
10796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u8)))
10797svuint8_t svbgrp_n_u8(svuint8_t, uint8_t);
10798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u32)))
10799svuint32_t svbgrp_n_u32(svuint32_t, uint32_t);
10800__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u64)))
10801svuint64_t svbgrp_n_u64(svuint64_t, uint64_t);
10802__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u16)))
10803svuint16_t svbgrp_n_u16(svuint16_t, uint16_t);
10804__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u8)))
10805svuint8_t svbgrp_u8(svuint8_t, svuint8_t);
10806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u32)))
10807svuint32_t svbgrp_u32(svuint32_t, svuint32_t);
10808__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u64)))
10809svuint64_t svbgrp_u64(svuint64_t, svuint64_t);
10810__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u16)))
10811svuint16_t svbgrp_u16(svuint16_t, svuint16_t);
10812__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u8)))
10813svuint8_t svbdep(svuint8_t, uint8_t);
10814__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u32)))
10815svuint32_t svbdep(svuint32_t, uint32_t);
10816__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u64)))
10817svuint64_t svbdep(svuint64_t, uint64_t);
10818__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u16)))
10819svuint16_t svbdep(svuint16_t, uint16_t);
10820__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u8)))
10821svuint8_t svbdep(svuint8_t, svuint8_t);
10822__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u32)))
10823svuint32_t svbdep(svuint32_t, svuint32_t);
10824__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u64)))
10825svuint64_t svbdep(svuint64_t, svuint64_t);
10826__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u16)))
10827svuint16_t svbdep(svuint16_t, svuint16_t);
10828__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u8)))
10829svuint8_t svbext(svuint8_t, uint8_t);
10830__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u32)))
10831svuint32_t svbext(svuint32_t, uint32_t);
10832__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u64)))
10833svuint64_t svbext(svuint64_t, uint64_t);
10834__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u16)))
10835svuint16_t svbext(svuint16_t, uint16_t);
10836__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u8)))
10837svuint8_t svbext(svuint8_t, svuint8_t);
10838__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u32)))
10839svuint32_t svbext(svuint32_t, svuint32_t);
10840__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u64)))
10841svuint64_t svbext(svuint64_t, svuint64_t);
10842__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u16)))
10843svuint16_t svbext(svuint16_t, svuint16_t);
10844__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u8)))
10845svuint8_t svbgrp(svuint8_t, uint8_t);
10846__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u32)))
10847svuint32_t svbgrp(svuint32_t, uint32_t);
10848__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u64)))
10849svuint64_t svbgrp(svuint64_t, uint64_t);
10850__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u16)))
10851svuint16_t svbgrp(svuint16_t, uint16_t);
10852__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u8)))
10853svuint8_t svbgrp(svuint8_t, svuint8_t);
10854__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u32)))
10855svuint32_t svbgrp(svuint32_t, svuint32_t);
10856__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u64)))
10857svuint64_t svbgrp(svuint64_t, svuint64_t);
10858__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u16)))
10859svuint16_t svbgrp(svuint16_t, svuint16_t);
10860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4e_u32)))
10861svuint32_t svsm4e_u32(svuint32_t, svuint32_t);
10862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4ekey_u32)))
10863svuint32_t svsm4ekey_u32(svuint32_t, svuint32_t);
10864__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4e_u32)))
10865svuint32_t svsm4e(svuint32_t, svuint32_t);
10866__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4ekey_u32)))
10867svuint32_t svsm4ekey(svuint32_t, svuint32_t);
10868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u32)))
10869svuint32_t svld1q_gather_u64base_index_u32(svbool_t, svuint64_t, int64_t);
10870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u64)))
10871svuint64_t svld1q_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
10872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u16)))
10873svuint16_t svld1q_gather_u64base_index_u16(svbool_t, svuint64_t, int64_t);
10874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_bf16)))
10875svbfloat16_t svld1q_gather_u64base_index_bf16(svbool_t, svuint64_t, int64_t);
10876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f64)))
10877svfloat64_t svld1q_gather_u64base_index_f64(svbool_t, svuint64_t, int64_t);
10878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f32)))
10879svfloat32_t svld1q_gather_u64base_index_f32(svbool_t, svuint64_t, int64_t);
10880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f16)))
10881svfloat16_t svld1q_gather_u64base_index_f16(svbool_t, svuint64_t, int64_t);
10882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s32)))
10883svint32_t svld1q_gather_u64base_index_s32(svbool_t, svuint64_t, int64_t);
10884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s64)))
10885svint64_t svld1q_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
10886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s16)))
10887svint16_t svld1q_gather_u64base_index_s16(svbool_t, svuint64_t, int64_t);
10888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u8)))
10889svuint8_t svld1q_gather_u64base_offset_u8(svbool_t, svuint64_t, int64_t);
10890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u32)))
10891svuint32_t svld1q_gather_u64base_offset_u32(svbool_t, svuint64_t, int64_t);
10892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u64)))
10893svuint64_t svld1q_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
10894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u16)))
10895svuint16_t svld1q_gather_u64base_offset_u16(svbool_t, svuint64_t, int64_t);
10896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_bf16)))
10897svbfloat16_t svld1q_gather_u64base_offset_bf16(svbool_t, svuint64_t, int64_t);
10898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s8)))
10899svint8_t svld1q_gather_u64base_offset_s8(svbool_t, svuint64_t, int64_t);
10900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f64)))
10901svfloat64_t svld1q_gather_u64base_offset_f64(svbool_t, svuint64_t, int64_t);
10902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f32)))
10903svfloat32_t svld1q_gather_u64base_offset_f32(svbool_t, svuint64_t, int64_t);
10904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f16)))
10905svfloat16_t svld1q_gather_u64base_offset_f16(svbool_t, svuint64_t, int64_t);
10906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s32)))
10907svint32_t svld1q_gather_u64base_offset_s32(svbool_t, svuint64_t, int64_t);
10908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s64)))
10909svint64_t svld1q_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
10910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_mf8)))
10911svmfloat8_t svld1q_gather_u64base_offset_mf8(svbool_t, svuint64_t, int64_t);
10912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s16)))
10913svint16_t svld1q_gather_u64base_offset_s16(svbool_t, svuint64_t, int64_t);
10914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u8)))
10915svuint8_t svld1q_gather_u64base_u8(svbool_t, svuint64_t);
10916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u32)))
10917svuint32_t svld1q_gather_u64base_u32(svbool_t, svuint64_t);
10918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u64)))
10919svuint64_t svld1q_gather_u64base_u64(svbool_t, svuint64_t);
10920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u16)))
10921svuint16_t svld1q_gather_u64base_u16(svbool_t, svuint64_t);
10922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_bf16)))
10923svbfloat16_t svld1q_gather_u64base_bf16(svbool_t, svuint64_t);
10924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s8)))
10925svint8_t svld1q_gather_u64base_s8(svbool_t, svuint64_t);
10926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f64)))
10927svfloat64_t svld1q_gather_u64base_f64(svbool_t, svuint64_t);
10928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f32)))
10929svfloat32_t svld1q_gather_u64base_f32(svbool_t, svuint64_t);
10930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f16)))
10931svfloat16_t svld1q_gather_u64base_f16(svbool_t, svuint64_t);
10932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s32)))
10933svint32_t svld1q_gather_u64base_s32(svbool_t, svuint64_t);
10934__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s64)))
10935svint64_t svld1q_gather_u64base_s64(svbool_t, svuint64_t);
10936__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_mf8)))
10937svmfloat8_t svld1q_gather_u64base_mf8(svbool_t, svuint64_t);
10938__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s16)))
10939svint16_t svld1q_gather_u64base_s16(svbool_t, svuint64_t);
10940__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u32)))
10941svuint32_t svld1q_gather_u64index_u32(svbool_t, uint32_t const *, svuint64_t);
10942__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u64)))
10943svuint64_t svld1q_gather_u64index_u64(svbool_t, uint64_t const *, svuint64_t);
10944__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u16)))
10945svuint16_t svld1q_gather_u64index_u16(svbool_t, uint16_t const *, svuint64_t);
10946__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_bf16)))
10947svbfloat16_t svld1q_gather_u64index_bf16(svbool_t, bfloat16_t const *, svuint64_t);
10948__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f64)))
10949svfloat64_t svld1q_gather_u64index_f64(svbool_t, float64_t const *, svuint64_t);
10950__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f32)))
10951svfloat32_t svld1q_gather_u64index_f32(svbool_t, float32_t const *, svuint64_t);
10952__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f16)))
10953svfloat16_t svld1q_gather_u64index_f16(svbool_t, float16_t const *, svuint64_t);
10954__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s32)))
10955svint32_t svld1q_gather_u64index_s32(svbool_t, int32_t const *, svuint64_t);
10956__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s64)))
10957svint64_t svld1q_gather_u64index_s64(svbool_t, int64_t const *, svuint64_t);
10958__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s16)))
10959svint16_t svld1q_gather_u64index_s16(svbool_t, int16_t const *, svuint64_t);
10960__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u8)))
10961svuint8_t svld1q_gather_u64offset_u8(svbool_t, uint8_t const *, svuint64_t);
10962__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u32)))
10963svuint32_t svld1q_gather_u64offset_u32(svbool_t, uint32_t const *, svuint64_t);
10964__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u64)))
10965svuint64_t svld1q_gather_u64offset_u64(svbool_t, uint64_t const *, svuint64_t);
10966__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u16)))
10967svuint16_t svld1q_gather_u64offset_u16(svbool_t, uint16_t const *, svuint64_t);
10968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_bf16)))
10969svbfloat16_t svld1q_gather_u64offset_bf16(svbool_t, bfloat16_t const *, svuint64_t);
10970__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s8)))
10971svint8_t svld1q_gather_u64offset_s8(svbool_t, int8_t const *, svuint64_t);
10972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f64)))
10973svfloat64_t svld1q_gather_u64offset_f64(svbool_t, float64_t const *, svuint64_t);
10974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f32)))
10975svfloat32_t svld1q_gather_u64offset_f32(svbool_t, float32_t const *, svuint64_t);
10976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f16)))
10977svfloat16_t svld1q_gather_u64offset_f16(svbool_t, float16_t const *, svuint64_t);
10978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s32)))
10979svint32_t svld1q_gather_u64offset_s32(svbool_t, int32_t const *, svuint64_t);
10980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s64)))
10981svint64_t svld1q_gather_u64offset_s64(svbool_t, int64_t const *, svuint64_t);
10982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_mf8)))
10983svmfloat8_t svld1q_gather_u64offset_mf8(svbool_t, mfloat8_t const *, svuint64_t);
10984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s16)))
10985svint16_t svld1q_gather_u64offset_s16(svbool_t, int16_t const *, svuint64_t);
10986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_u64)))
10987svuint64_t svld1udq_u64(svbool_t, uint64_t const *);
10988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_f64)))
10989svfloat64_t svld1udq_f64(svbool_t, float64_t const *);
10990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_s64)))
10991svint64_t svld1udq_s64(svbool_t, int64_t const *);
10992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_u64)))
10993svuint64_t svld1udq_vnum_u64(svbool_t, uint64_t const *, int64_t);
10994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_f64)))
10995svfloat64_t svld1udq_vnum_f64(svbool_t, float64_t const *, int64_t);
10996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_s64)))
10997svint64_t svld1udq_vnum_s64(svbool_t, int64_t const *, int64_t);
10998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_u32)))
10999svuint32_t svld1uwq_u32(svbool_t, uint32_t const *);
11000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_f32)))
11001svfloat32_t svld1uwq_f32(svbool_t, float32_t const *);
11002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_s32)))
11003svint32_t svld1uwq_s32(svbool_t, int32_t const *);
11004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_u32)))
11005svuint32_t svld1uwq_vnum_u32(svbool_t, uint32_t const *, int64_t);
11006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_f32)))
11007svfloat32_t svld1uwq_vnum_f32(svbool_t, float32_t const *, int64_t);
11008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_s32)))
11009svint32_t svld1uwq_vnum_s32(svbool_t, int32_t const *, int64_t);
11010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_u64)))
11011void svst1dq_u64(svbool_t, uint64_t *, svuint64_t);
11012__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_f64)))
11013void svst1dq_f64(svbool_t, float64_t *, svfloat64_t);
11014__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_s64)))
11015void svst1dq_s64(svbool_t, int64_t *, svint64_t);
11016__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_u64)))
11017void svst1dq_vnum_u64(svbool_t, uint64_t *, int64_t, svuint64_t);
11018__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_f64)))
11019void svst1dq_vnum_f64(svbool_t, float64_t *, int64_t, svfloat64_t);
11020__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_s64)))
11021void svst1dq_vnum_s64(svbool_t, int64_t *, int64_t, svint64_t);
11022__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u8)))
11023void svst1q_scatter_u64base_u8(svbool_t, svuint64_t, svuint8_t);
11024__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u32)))
11025void svst1q_scatter_u64base_u32(svbool_t, svuint64_t, svuint32_t);
11026__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u64)))
11027void svst1q_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
11028__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u16)))
11029void svst1q_scatter_u64base_u16(svbool_t, svuint64_t, svuint16_t);
11030__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_bf16)))
11031void svst1q_scatter_u64base_bf16(svbool_t, svuint64_t, svbfloat16_t);
11032__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s8)))
11033void svst1q_scatter_u64base_s8(svbool_t, svuint64_t, svint8_t);
11034__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f64)))
11035void svst1q_scatter_u64base_f64(svbool_t, svuint64_t, svfloat64_t);
11036__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f32)))
11037void svst1q_scatter_u64base_f32(svbool_t, svuint64_t, svfloat32_t);
11038__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f16)))
11039void svst1q_scatter_u64base_f16(svbool_t, svuint64_t, svfloat16_t);
11040__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s32)))
11041void svst1q_scatter_u64base_s32(svbool_t, svuint64_t, svint32_t);
11042__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s64)))
11043void svst1q_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
11044__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_mf8)))
11045void svst1q_scatter_u64base_mf8(svbool_t, svuint64_t, svmfloat8_t);
11046__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s16)))
11047void svst1q_scatter_u64base_s16(svbool_t, svuint64_t, svint16_t);
11048__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u32)))
11049void svst1q_scatter_u64base_index_u32(svbool_t, svuint64_t, int64_t, svuint32_t);
11050__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u64)))
11051void svst1q_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
11052__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u16)))
11053void svst1q_scatter_u64base_index_u16(svbool_t, svuint64_t, int64_t, svuint16_t);
11054__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_bf16)))
11055void svst1q_scatter_u64base_index_bf16(svbool_t, svuint64_t, int64_t, svbfloat16_t);
11056__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f64)))
11057void svst1q_scatter_u64base_index_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
11058__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f32)))
11059void svst1q_scatter_u64base_index_f32(svbool_t, svuint64_t, int64_t, svfloat32_t);
11060__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f16)))
11061void svst1q_scatter_u64base_index_f16(svbool_t, svuint64_t, int64_t, svfloat16_t);
11062__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s32)))
11063void svst1q_scatter_u64base_index_s32(svbool_t, svuint64_t, int64_t, svint32_t);
11064__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s64)))
11065void svst1q_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
11066__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s16)))
11067void svst1q_scatter_u64base_index_s16(svbool_t, svuint64_t, int64_t, svint16_t);
11068__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u8)))
11069void svst1q_scatter_u64base_offset_u8(svbool_t, svuint64_t, int64_t, svuint8_t);
11070__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u32)))
11071void svst1q_scatter_u64base_offset_u32(svbool_t, svuint64_t, int64_t, svuint32_t);
11072__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u64)))
11073void svst1q_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
11074__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u16)))
11075void svst1q_scatter_u64base_offset_u16(svbool_t, svuint64_t, int64_t, svuint16_t);
11076__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_bf16)))
11077void svst1q_scatter_u64base_offset_bf16(svbool_t, svuint64_t, int64_t, svbfloat16_t);
11078__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s8)))
11079void svst1q_scatter_u64base_offset_s8(svbool_t, svuint64_t, int64_t, svint8_t);
11080__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f64)))
11081void svst1q_scatter_u64base_offset_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
11082__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f32)))
11083void svst1q_scatter_u64base_offset_f32(svbool_t, svuint64_t, int64_t, svfloat32_t);
11084__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f16)))
11085void svst1q_scatter_u64base_offset_f16(svbool_t, svuint64_t, int64_t, svfloat16_t);
11086__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s32)))
11087void svst1q_scatter_u64base_offset_s32(svbool_t, svuint64_t, int64_t, svint32_t);
11088__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s64)))
11089void svst1q_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
11090__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_mf8)))
11091void svst1q_scatter_u64base_offset_mf8(svbool_t, svuint64_t, int64_t, svmfloat8_t);
11092__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s16)))
11093void svst1q_scatter_u64base_offset_s16(svbool_t, svuint64_t, int64_t, svint16_t);
11094__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u32)))
11095void svst1q_scatter_s64index_u32(svbool_t, uint32_t *, svint64_t, svuint32_t);
11096__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u64)))
11097void svst1q_scatter_s64index_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
11098__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u16)))
11099void svst1q_scatter_s64index_u16(svbool_t, uint16_t *, svint64_t, svuint16_t);
11100__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_bf16)))
11101void svst1q_scatter_s64index_bf16(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
11102__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f64)))
11103void svst1q_scatter_s64index_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
11104__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f32)))
11105void svst1q_scatter_s64index_f32(svbool_t, float32_t *, svint64_t, svfloat32_t);
11106__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f16)))
11107void svst1q_scatter_s64index_f16(svbool_t, float16_t *, svint64_t, svfloat16_t);
11108__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s32)))
11109void svst1q_scatter_s64index_s32(svbool_t, int32_t *, svint64_t, svint32_t);
11110__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s64)))
11111void svst1q_scatter_s64index_s64(svbool_t, int64_t *, svint64_t, svint64_t);
11112__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s16)))
11113void svst1q_scatter_s64index_s16(svbool_t, int16_t *, svint64_t, svint16_t);
11114__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u32)))
11115void svst1q_scatter_u64index_u32(svbool_t, uint32_t *, svuint64_t, svuint32_t);
11116__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u64)))
11117void svst1q_scatter_u64index_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
11118__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u16)))
11119void svst1q_scatter_u64index_u16(svbool_t, uint16_t *, svuint64_t, svuint16_t);
11120__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_bf16)))
11121void svst1q_scatter_u64index_bf16(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
11122__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f64)))
11123void svst1q_scatter_u64index_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
11124__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f32)))
11125void svst1q_scatter_u64index_f32(svbool_t, float32_t *, svuint64_t, svfloat32_t);
11126__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f16)))
11127void svst1q_scatter_u64index_f16(svbool_t, float16_t *, svuint64_t, svfloat16_t);
11128__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s32)))
11129void svst1q_scatter_u64index_s32(svbool_t, int32_t *, svuint64_t, svint32_t);
11130__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s64)))
11131void svst1q_scatter_u64index_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
11132__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s16)))
11133void svst1q_scatter_u64index_s16(svbool_t, int16_t *, svuint64_t, svint16_t);
11134__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u8)))
11135void svst1q_scatter_s64offset_u8(svbool_t, uint8_t *, svint64_t, svuint8_t);
11136__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u32)))
11137void svst1q_scatter_s64offset_u32(svbool_t, uint32_t *, svint64_t, svuint32_t);
11138__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u64)))
11139void svst1q_scatter_s64offset_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
11140__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u16)))
11141void svst1q_scatter_s64offset_u16(svbool_t, uint16_t *, svint64_t, svuint16_t);
11142__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_bf16)))
11143void svst1q_scatter_s64offset_bf16(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
11144__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s8)))
11145void svst1q_scatter_s64offset_s8(svbool_t, int8_t *, svint64_t, svint8_t);
11146__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f64)))
11147void svst1q_scatter_s64offset_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
11148__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f32)))
11149void svst1q_scatter_s64offset_f32(svbool_t, float32_t *, svint64_t, svfloat32_t);
11150__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f16)))
11151void svst1q_scatter_s64offset_f16(svbool_t, float16_t *, svint64_t, svfloat16_t);
11152__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s32)))
11153void svst1q_scatter_s64offset_s32(svbool_t, int32_t *, svint64_t, svint32_t);
11154__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s64)))
11155void svst1q_scatter_s64offset_s64(svbool_t, int64_t *, svint64_t, svint64_t);
11156__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_mf8)))
11157void svst1q_scatter_s64offset_mf8(svbool_t, mfloat8_t *, svint64_t, svmfloat8_t);
11158__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s16)))
11159void svst1q_scatter_s64offset_s16(svbool_t, int16_t *, svint64_t, svint16_t);
11160__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u8)))
11161void svst1q_scatter_u64offset_u8(svbool_t, uint8_t *, svuint64_t, svuint8_t);
11162__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u32)))
11163void svst1q_scatter_u64offset_u32(svbool_t, uint32_t *, svuint64_t, svuint32_t);
11164__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u64)))
11165void svst1q_scatter_u64offset_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
11166__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u16)))
11167void svst1q_scatter_u64offset_u16(svbool_t, uint16_t *, svuint64_t, svuint16_t);
11168__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_bf16)))
11169void svst1q_scatter_u64offset_bf16(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
11170__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s8)))
11171void svst1q_scatter_u64offset_s8(svbool_t, int8_t *, svuint64_t, svint8_t);
11172__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f64)))
11173void svst1q_scatter_u64offset_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
11174__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f32)))
11175void svst1q_scatter_u64offset_f32(svbool_t, float32_t *, svuint64_t, svfloat32_t);
11176__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f16)))
11177void svst1q_scatter_u64offset_f16(svbool_t, float16_t *, svuint64_t, svfloat16_t);
11178__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s32)))
11179void svst1q_scatter_u64offset_s32(svbool_t, int32_t *, svuint64_t, svint32_t);
11180__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s64)))
11181void svst1q_scatter_u64offset_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
11182__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_mf8)))
11183void svst1q_scatter_u64offset_mf8(svbool_t, mfloat8_t *, svuint64_t, svmfloat8_t);
11184__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s16)))
11185void svst1q_scatter_u64offset_s16(svbool_t, int16_t *, svuint64_t, svint16_t);
11186__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_u32)))
11187void svst1wq_u32(svbool_t, uint32_t *, svuint32_t);
11188__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_f32)))
11189void svst1wq_f32(svbool_t, float32_t *, svfloat32_t);
11190__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_s32)))
11191void svst1wq_s32(svbool_t, int32_t *, svint32_t);
11192__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_u32)))
11193void svst1wq_vnum_u32(svbool_t, uint32_t *, int64_t, svuint32_t);
11194__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_f32)))
11195void svst1wq_vnum_f32(svbool_t, float32_t *, int64_t, svfloat32_t);
11196__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_s32)))
11197void svst1wq_vnum_s32(svbool_t, int32_t *, int64_t, svint32_t);
11198__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u32)))
11199svuint32_t svld1q_gather_index_u32(svbool_t, svuint64_t, int64_t);
11200__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u64)))
11201svuint64_t svld1q_gather_index_u64(svbool_t, svuint64_t, int64_t);
11202__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u16)))
11203svuint16_t svld1q_gather_index_u16(svbool_t, svuint64_t, int64_t);
11204__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_bf16)))
11205svbfloat16_t svld1q_gather_index_bf16(svbool_t, svuint64_t, int64_t);
11206__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f64)))
11207svfloat64_t svld1q_gather_index_f64(svbool_t, svuint64_t, int64_t);
11208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f32)))
11209svfloat32_t svld1q_gather_index_f32(svbool_t, svuint64_t, int64_t);
11210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f16)))
11211svfloat16_t svld1q_gather_index_f16(svbool_t, svuint64_t, int64_t);
11212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s32)))
11213svint32_t svld1q_gather_index_s32(svbool_t, svuint64_t, int64_t);
11214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s64)))
11215svint64_t svld1q_gather_index_s64(svbool_t, svuint64_t, int64_t);
11216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s16)))
11217svint16_t svld1q_gather_index_s16(svbool_t, svuint64_t, int64_t);
11218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u8)))
11219svuint8_t svld1q_gather_offset_u8(svbool_t, svuint64_t, int64_t);
11220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u32)))
11221svuint32_t svld1q_gather_offset_u32(svbool_t, svuint64_t, int64_t);
11222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u64)))
11223svuint64_t svld1q_gather_offset_u64(svbool_t, svuint64_t, int64_t);
11224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u16)))
11225svuint16_t svld1q_gather_offset_u16(svbool_t, svuint64_t, int64_t);
11226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_bf16)))
11227svbfloat16_t svld1q_gather_offset_bf16(svbool_t, svuint64_t, int64_t);
11228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s8)))
11229svint8_t svld1q_gather_offset_s8(svbool_t, svuint64_t, int64_t);
11230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f64)))
11231svfloat64_t svld1q_gather_offset_f64(svbool_t, svuint64_t, int64_t);
11232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f32)))
11233svfloat32_t svld1q_gather_offset_f32(svbool_t, svuint64_t, int64_t);
11234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f16)))
11235svfloat16_t svld1q_gather_offset_f16(svbool_t, svuint64_t, int64_t);
11236__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s32)))
11237svint32_t svld1q_gather_offset_s32(svbool_t, svuint64_t, int64_t);
11238__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s64)))
11239svint64_t svld1q_gather_offset_s64(svbool_t, svuint64_t, int64_t);
11240__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_mf8)))
11241svmfloat8_t svld1q_gather_offset_mf8(svbool_t, svuint64_t, int64_t);
11242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s16)))
11243svint16_t svld1q_gather_offset_s16(svbool_t, svuint64_t, int64_t);
11244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u8)))
11245svuint8_t svld1q_gather_u8(svbool_t, svuint64_t);
11246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u32)))
11247svuint32_t svld1q_gather_u32(svbool_t, svuint64_t);
11248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u64)))
11249svuint64_t svld1q_gather_u64(svbool_t, svuint64_t);
11250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u16)))
11251svuint16_t svld1q_gather_u16(svbool_t, svuint64_t);
11252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_bf16)))
11253svbfloat16_t svld1q_gather_bf16(svbool_t, svuint64_t);
11254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s8)))
11255svint8_t svld1q_gather_s8(svbool_t, svuint64_t);
11256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f64)))
11257svfloat64_t svld1q_gather_f64(svbool_t, svuint64_t);
11258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f32)))
11259svfloat32_t svld1q_gather_f32(svbool_t, svuint64_t);
11260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f16)))
11261svfloat16_t svld1q_gather_f16(svbool_t, svuint64_t);
11262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s32)))
11263svint32_t svld1q_gather_s32(svbool_t, svuint64_t);
11264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s64)))
11265svint64_t svld1q_gather_s64(svbool_t, svuint64_t);
11266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_mf8)))
11267svmfloat8_t svld1q_gather_mf8(svbool_t, svuint64_t);
11268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s16)))
11269svint16_t svld1q_gather_s16(svbool_t, svuint64_t);
11270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u32)))
11271svuint32_t svld1q_gather_index(svbool_t, uint32_t const *, svuint64_t);
11272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u64)))
11273svuint64_t svld1q_gather_index(svbool_t, uint64_t const *, svuint64_t);
11274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u16)))
11275svuint16_t svld1q_gather_index(svbool_t, uint16_t const *, svuint64_t);
11276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_bf16)))
11277svbfloat16_t svld1q_gather_index(svbool_t, bfloat16_t const *, svuint64_t);
11278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f64)))
11279svfloat64_t svld1q_gather_index(svbool_t, float64_t const *, svuint64_t);
11280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f32)))
11281svfloat32_t svld1q_gather_index(svbool_t, float32_t const *, svuint64_t);
11282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f16)))
11283svfloat16_t svld1q_gather_index(svbool_t, float16_t const *, svuint64_t);
11284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s32)))
11285svint32_t svld1q_gather_index(svbool_t, int32_t const *, svuint64_t);
11286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s64)))
11287svint64_t svld1q_gather_index(svbool_t, int64_t const *, svuint64_t);
11288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s16)))
11289svint16_t svld1q_gather_index(svbool_t, int16_t const *, svuint64_t);
11290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u8)))
11291svuint8_t svld1q_gather_offset(svbool_t, uint8_t const *, svuint64_t);
11292__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u32)))
11293svuint32_t svld1q_gather_offset(svbool_t, uint32_t const *, svuint64_t);
11294__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u64)))
11295svuint64_t svld1q_gather_offset(svbool_t, uint64_t const *, svuint64_t);
11296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u16)))
11297svuint16_t svld1q_gather_offset(svbool_t, uint16_t const *, svuint64_t);
11298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_bf16)))
11299svbfloat16_t svld1q_gather_offset(svbool_t, bfloat16_t const *, svuint64_t);
11300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s8)))
11301svint8_t svld1q_gather_offset(svbool_t, int8_t const *, svuint64_t);
11302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f64)))
11303svfloat64_t svld1q_gather_offset(svbool_t, float64_t const *, svuint64_t);
11304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f32)))
11305svfloat32_t svld1q_gather_offset(svbool_t, float32_t const *, svuint64_t);
11306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f16)))
11307svfloat16_t svld1q_gather_offset(svbool_t, float16_t const *, svuint64_t);
11308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s32)))
11309svint32_t svld1q_gather_offset(svbool_t, int32_t const *, svuint64_t);
11310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s64)))
11311svint64_t svld1q_gather_offset(svbool_t, int64_t const *, svuint64_t);
11312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_mf8)))
11313svmfloat8_t svld1q_gather_offset(svbool_t, mfloat8_t const *, svuint64_t);
11314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s16)))
11315svint16_t svld1q_gather_offset(svbool_t, int16_t const *, svuint64_t);
11316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_u64)))
11317svuint64_t svld1udq(svbool_t, uint64_t const *);
11318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_f64)))
11319svfloat64_t svld1udq(svbool_t, float64_t const *);
11320__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_s64)))
11321svint64_t svld1udq(svbool_t, int64_t const *);
11322__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_u64)))
11323svuint64_t svld1udq_vnum(svbool_t, uint64_t const *, int64_t);
11324__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_f64)))
11325svfloat64_t svld1udq_vnum(svbool_t, float64_t const *, int64_t);
11326__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_s64)))
11327svint64_t svld1udq_vnum(svbool_t, int64_t const *, int64_t);
11328__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_u32)))
11329svuint32_t svld1uwq(svbool_t, uint32_t const *);
11330__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_f32)))
11331svfloat32_t svld1uwq(svbool_t, float32_t const *);
11332__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_s32)))
11333svint32_t svld1uwq(svbool_t, int32_t const *);
11334__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_u32)))
11335svuint32_t svld1uwq_vnum(svbool_t, uint32_t const *, int64_t);
11336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_f32)))
11337svfloat32_t svld1uwq_vnum(svbool_t, float32_t const *, int64_t);
11338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_s32)))
11339svint32_t svld1uwq_vnum(svbool_t, int32_t const *, int64_t);
11340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_u64)))
11341void svst1dq(svbool_t, uint64_t *, svuint64_t);
11342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_f64)))
11343void svst1dq(svbool_t, float64_t *, svfloat64_t);
11344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_s64)))
11345void svst1dq(svbool_t, int64_t *, svint64_t);
11346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_u64)))
11347void svst1dq_vnum(svbool_t, uint64_t *, int64_t, svuint64_t);
11348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_f64)))
11349void svst1dq_vnum(svbool_t, float64_t *, int64_t, svfloat64_t);
11350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_s64)))
11351void svst1dq_vnum(svbool_t, int64_t *, int64_t, svint64_t);
11352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u8)))
11353void svst1q_scatter(svbool_t, svuint64_t, svuint8_t);
11354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u32)))
11355void svst1q_scatter(svbool_t, svuint64_t, svuint32_t);
11356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u64)))
11357void svst1q_scatter(svbool_t, svuint64_t, svuint64_t);
11358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u16)))
11359void svst1q_scatter(svbool_t, svuint64_t, svuint16_t);
11360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_bf16)))
11361void svst1q_scatter(svbool_t, svuint64_t, svbfloat16_t);
11362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s8)))
11363void svst1q_scatter(svbool_t, svuint64_t, svint8_t);
11364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f64)))
11365void svst1q_scatter(svbool_t, svuint64_t, svfloat64_t);
11366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f32)))
11367void svst1q_scatter(svbool_t, svuint64_t, svfloat32_t);
11368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f16)))
11369void svst1q_scatter(svbool_t, svuint64_t, svfloat16_t);
11370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s32)))
11371void svst1q_scatter(svbool_t, svuint64_t, svint32_t);
11372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s64)))
11373void svst1q_scatter(svbool_t, svuint64_t, svint64_t);
11374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_mf8)))
11375void svst1q_scatter(svbool_t, svuint64_t, svmfloat8_t);
11376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s16)))
11377void svst1q_scatter(svbool_t, svuint64_t, svint16_t);
11378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u32)))
11379void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svuint32_t);
11380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u64)))
11381void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
11382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u16)))
11383void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svuint16_t);
11384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_bf16)))
11385void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svbfloat16_t);
11386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f64)))
11387void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svfloat64_t);
11388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f32)))
11389void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svfloat32_t);
11390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f16)))
11391void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svfloat16_t);
11392__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s32)))
11393void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svint32_t);
11394__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s64)))
11395void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
11396__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s16)))
11397void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svint16_t);
11398__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u8)))
11399void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint8_t);
11400__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u32)))
11401void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint32_t);
11402__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u64)))
11403void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
11404__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u16)))
11405void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint16_t);
11406__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_bf16)))
11407void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svbfloat16_t);
11408__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s8)))
11409void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint8_t);
11410__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f64)))
11411void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat64_t);
11412__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f32)))
11413void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat32_t);
11414__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f16)))
11415void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat16_t);
11416__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s32)))
11417void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint32_t);
11418__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s64)))
11419void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
11420__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_mf8)))
11421void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svmfloat8_t);
11422__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s16)))
11423void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint16_t);
11424__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u32)))
11425void svst1q_scatter_index(svbool_t, uint32_t *, svint64_t, svuint32_t);
11426__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u64)))
11427void svst1q_scatter_index(svbool_t, uint64_t *, svint64_t, svuint64_t);
11428__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u16)))
11429void svst1q_scatter_index(svbool_t, uint16_t *, svint64_t, svuint16_t);
11430__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_bf16)))
11431void svst1q_scatter_index(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
11432__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f64)))
11433void svst1q_scatter_index(svbool_t, float64_t *, svint64_t, svfloat64_t);
11434__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f32)))
11435void svst1q_scatter_index(svbool_t, float32_t *, svint64_t, svfloat32_t);
11436__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f16)))
11437void svst1q_scatter_index(svbool_t, float16_t *, svint64_t, svfloat16_t);
11438__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s32)))
11439void svst1q_scatter_index(svbool_t, int32_t *, svint64_t, svint32_t);
11440__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s64)))
11441void svst1q_scatter_index(svbool_t, int64_t *, svint64_t, svint64_t);
11442__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s16)))
11443void svst1q_scatter_index(svbool_t, int16_t *, svint64_t, svint16_t);
11444__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u32)))
11445void svst1q_scatter_index(svbool_t, uint32_t *, svuint64_t, svuint32_t);
11446__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u64)))
11447void svst1q_scatter_index(svbool_t, uint64_t *, svuint64_t, svuint64_t);
11448__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u16)))
11449void svst1q_scatter_index(svbool_t, uint16_t *, svuint64_t, svuint16_t);
11450__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_bf16)))
11451void svst1q_scatter_index(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
11452__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f64)))
11453void svst1q_scatter_index(svbool_t, float64_t *, svuint64_t, svfloat64_t);
11454__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f32)))
11455void svst1q_scatter_index(svbool_t, float32_t *, svuint64_t, svfloat32_t);
11456__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f16)))
11457void svst1q_scatter_index(svbool_t, float16_t *, svuint64_t, svfloat16_t);
11458__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s32)))
11459void svst1q_scatter_index(svbool_t, int32_t *, svuint64_t, svint32_t);
11460__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s64)))
11461void svst1q_scatter_index(svbool_t, int64_t *, svuint64_t, svint64_t);
11462__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s16)))
11463void svst1q_scatter_index(svbool_t, int16_t *, svuint64_t, svint16_t);
11464__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u8)))
11465void svst1q_scatter_offset(svbool_t, uint8_t *, svint64_t, svuint8_t);
11466__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u32)))
11467void svst1q_scatter_offset(svbool_t, uint32_t *, svint64_t, svuint32_t);
11468__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u64)))
11469void svst1q_scatter_offset(svbool_t, uint64_t *, svint64_t, svuint64_t);
11470__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u16)))
11471void svst1q_scatter_offset(svbool_t, uint16_t *, svint64_t, svuint16_t);
11472__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_bf16)))
11473void svst1q_scatter_offset(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
11474__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s8)))
11475void svst1q_scatter_offset(svbool_t, int8_t *, svint64_t, svint8_t);
11476__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f64)))
11477void svst1q_scatter_offset(svbool_t, float64_t *, svint64_t, svfloat64_t);
11478__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f32)))
11479void svst1q_scatter_offset(svbool_t, float32_t *, svint64_t, svfloat32_t);
11480__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f16)))
11481void svst1q_scatter_offset(svbool_t, float16_t *, svint64_t, svfloat16_t);
11482__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s32)))
11483void svst1q_scatter_offset(svbool_t, int32_t *, svint64_t, svint32_t);
11484__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s64)))
11485void svst1q_scatter_offset(svbool_t, int64_t *, svint64_t, svint64_t);
11486__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_mf8)))
11487void svst1q_scatter_offset(svbool_t, mfloat8_t *, svint64_t, svmfloat8_t);
11488__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s16)))
11489void svst1q_scatter_offset(svbool_t, int16_t *, svint64_t, svint16_t);
11490__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u8)))
11491void svst1q_scatter_offset(svbool_t, uint8_t *, svuint64_t, svuint8_t);
11492__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u32)))
11493void svst1q_scatter_offset(svbool_t, uint32_t *, svuint64_t, svuint32_t);
11494__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u64)))
11495void svst1q_scatter_offset(svbool_t, uint64_t *, svuint64_t, svuint64_t);
11496__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u16)))
11497void svst1q_scatter_offset(svbool_t, uint16_t *, svuint64_t, svuint16_t);
11498__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_bf16)))
11499void svst1q_scatter_offset(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
11500__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s8)))
11501void svst1q_scatter_offset(svbool_t, int8_t *, svuint64_t, svint8_t);
11502__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f64)))
11503void svst1q_scatter_offset(svbool_t, float64_t *, svuint64_t, svfloat64_t);
11504__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f32)))
11505void svst1q_scatter_offset(svbool_t, float32_t *, svuint64_t, svfloat32_t);
11506__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f16)))
11507void svst1q_scatter_offset(svbool_t, float16_t *, svuint64_t, svfloat16_t);
11508__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s32)))
11509void svst1q_scatter_offset(svbool_t, int32_t *, svuint64_t, svint32_t);
11510__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s64)))
11511void svst1q_scatter_offset(svbool_t, int64_t *, svuint64_t, svint64_t);
11512__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_mf8)))
11513void svst1q_scatter_offset(svbool_t, mfloat8_t *, svuint64_t, svmfloat8_t);
11514__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s16)))
11515void svst1q_scatter_offset(svbool_t, int16_t *, svuint64_t, svint16_t);
11516__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_u32)))
11517void svst1wq(svbool_t, uint32_t *, svuint32_t);
11518__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_f32)))
11519void svst1wq(svbool_t, float32_t *, svfloat32_t);
11520__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_s32)))
11521void svst1wq(svbool_t, int32_t *, svint32_t);
11522__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_u32)))
11523void svst1wq_vnum(svbool_t, uint32_t *, int64_t, svuint32_t);
11524__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_f32)))
11525void svst1wq_vnum(svbool_t, float32_t *, int64_t, svfloat32_t);
11526__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_s32)))
11527void svst1wq_vnum(svbool_t, int32_t *, int64_t, svint32_t);
11528__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c8)))
11529uint64_t svcntp_c8(svcount_t, uint64_t);
11530__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c32)))
11531uint64_t svcntp_c32(svcount_t, uint64_t);
11532__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c64)))
11533uint64_t svcntp_c64(svcount_t, uint64_t);
11534__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c16)))
11535uint64_t svcntp_c16(svcount_t, uint64_t);
11536__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x2)))
11537svuint8x2_t svld1_u8_x2(svcount_t, uint8_t const *);
11538__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x2)))
11539svint8x2_t svld1_s8_x2(svcount_t, int8_t const *);
11540__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x2)))
11541svmfloat8x2_t svld1_mf8_x2(svcount_t, mfloat8_t const *);
11542__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x2)))
11543svuint64x2_t svld1_u64_x2(svcount_t, uint64_t const *);
11544__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x2)))
11545svfloat64x2_t svld1_f64_x2(svcount_t, float64_t const *);
11546__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x2)))
11547svint64x2_t svld1_s64_x2(svcount_t, int64_t const *);
11548__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x2)))
11549svuint16x2_t svld1_u16_x2(svcount_t, uint16_t const *);
11550__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x2)))
11551svbfloat16x2_t svld1_bf16_x2(svcount_t, bfloat16_t const *);
11552__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x2)))
11553svfloat16x2_t svld1_f16_x2(svcount_t, float16_t const *);
11554__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x2)))
11555svint16x2_t svld1_s16_x2(svcount_t, int16_t const *);
11556__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x2)))
11557svuint32x2_t svld1_u32_x2(svcount_t, uint32_t const *);
11558__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x2)))
11559svfloat32x2_t svld1_f32_x2(svcount_t, float32_t const *);
11560__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x2)))
11561svint32x2_t svld1_s32_x2(svcount_t, int32_t const *);
11562__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x4)))
11563svuint8x4_t svld1_u8_x4(svcount_t, uint8_t const *);
11564__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x4)))
11565svint8x4_t svld1_s8_x4(svcount_t, int8_t const *);
11566__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x4)))
11567svmfloat8x4_t svld1_mf8_x4(svcount_t, mfloat8_t const *);
11568__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x4)))
11569svuint64x4_t svld1_u64_x4(svcount_t, uint64_t const *);
11570__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x4)))
11571svfloat64x4_t svld1_f64_x4(svcount_t, float64_t const *);
11572__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x4)))
11573svint64x4_t svld1_s64_x4(svcount_t, int64_t const *);
11574__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x4)))
11575svuint16x4_t svld1_u16_x4(svcount_t, uint16_t const *);
11576__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x4)))
11577svbfloat16x4_t svld1_bf16_x4(svcount_t, bfloat16_t const *);
11578__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x4)))
11579svfloat16x4_t svld1_f16_x4(svcount_t, float16_t const *);
11580__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x4)))
11581svint16x4_t svld1_s16_x4(svcount_t, int16_t const *);
11582__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x4)))
11583svuint32x4_t svld1_u32_x4(svcount_t, uint32_t const *);
11584__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x4)))
11585svfloat32x4_t svld1_f32_x4(svcount_t, float32_t const *);
11586__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x4)))
11587svint32x4_t svld1_s32_x4(svcount_t, int32_t const *);
11588__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x2)))
11589svuint8x2_t svld1_vnum_u8_x2(svcount_t, uint8_t const *, int64_t);
11590__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x2)))
11591svint8x2_t svld1_vnum_s8_x2(svcount_t, int8_t const *, int64_t);
11592__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x2)))
11593svmfloat8x2_t svld1_vnum_mf8_x2(svcount_t, mfloat8_t const *, int64_t);
11594__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x2)))
11595svuint64x2_t svld1_vnum_u64_x2(svcount_t, uint64_t const *, int64_t);
11596__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x2)))
11597svfloat64x2_t svld1_vnum_f64_x2(svcount_t, float64_t const *, int64_t);
11598__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x2)))
11599svint64x2_t svld1_vnum_s64_x2(svcount_t, int64_t const *, int64_t);
11600__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x2)))
11601svuint16x2_t svld1_vnum_u16_x2(svcount_t, uint16_t const *, int64_t);
11602__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x2)))
11603svbfloat16x2_t svld1_vnum_bf16_x2(svcount_t, bfloat16_t const *, int64_t);
11604__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x2)))
11605svfloat16x2_t svld1_vnum_f16_x2(svcount_t, float16_t const *, int64_t);
11606__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x2)))
11607svint16x2_t svld1_vnum_s16_x2(svcount_t, int16_t const *, int64_t);
11608__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x2)))
11609svuint32x2_t svld1_vnum_u32_x2(svcount_t, uint32_t const *, int64_t);
11610__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x2)))
11611svfloat32x2_t svld1_vnum_f32_x2(svcount_t, float32_t const *, int64_t);
11612__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x2)))
11613svint32x2_t svld1_vnum_s32_x2(svcount_t, int32_t const *, int64_t);
11614__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x4)))
11615svuint8x4_t svld1_vnum_u8_x4(svcount_t, uint8_t const *, int64_t);
11616__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x4)))
11617svint8x4_t svld1_vnum_s8_x4(svcount_t, int8_t const *, int64_t);
11618__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x4)))
11619svmfloat8x4_t svld1_vnum_mf8_x4(svcount_t, mfloat8_t const *, int64_t);
11620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x4)))
11621svuint64x4_t svld1_vnum_u64_x4(svcount_t, uint64_t const *, int64_t);
11622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x4)))
11623svfloat64x4_t svld1_vnum_f64_x4(svcount_t, float64_t const *, int64_t);
11624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x4)))
11625svint64x4_t svld1_vnum_s64_x4(svcount_t, int64_t const *, int64_t);
11626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x4)))
11627svuint16x4_t svld1_vnum_u16_x4(svcount_t, uint16_t const *, int64_t);
11628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x4)))
11629svbfloat16x4_t svld1_vnum_bf16_x4(svcount_t, bfloat16_t const *, int64_t);
11630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x4)))
11631svfloat16x4_t svld1_vnum_f16_x4(svcount_t, float16_t const *, int64_t);
11632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x4)))
11633svint16x4_t svld1_vnum_s16_x4(svcount_t, int16_t const *, int64_t);
11634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x4)))
11635svuint32x4_t svld1_vnum_u32_x4(svcount_t, uint32_t const *, int64_t);
11636__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x4)))
11637svfloat32x4_t svld1_vnum_f32_x4(svcount_t, float32_t const *, int64_t);
11638__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x4)))
11639svint32x4_t svld1_vnum_s32_x4(svcount_t, int32_t const *, int64_t);
11640__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x2)))
11641svuint8x2_t svldnt1_u8_x2(svcount_t, uint8_t const *);
11642__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x2)))
11643svint8x2_t svldnt1_s8_x2(svcount_t, int8_t const *);
11644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x2)))
11645svmfloat8x2_t svldnt1_mf8_x2(svcount_t, mfloat8_t const *);
11646__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x2)))
11647svuint64x2_t svldnt1_u64_x2(svcount_t, uint64_t const *);
11648__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x2)))
11649svfloat64x2_t svldnt1_f64_x2(svcount_t, float64_t const *);
11650__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x2)))
11651svint64x2_t svldnt1_s64_x2(svcount_t, int64_t const *);
11652__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x2)))
11653svuint16x2_t svldnt1_u16_x2(svcount_t, uint16_t const *);
11654__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x2)))
11655svbfloat16x2_t svldnt1_bf16_x2(svcount_t, bfloat16_t const *);
11656__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x2)))
11657svfloat16x2_t svldnt1_f16_x2(svcount_t, float16_t const *);
11658__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x2)))
11659svint16x2_t svldnt1_s16_x2(svcount_t, int16_t const *);
11660__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x2)))
11661svuint32x2_t svldnt1_u32_x2(svcount_t, uint32_t const *);
11662__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x2)))
11663svfloat32x2_t svldnt1_f32_x2(svcount_t, float32_t const *);
11664__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x2)))
11665svint32x2_t svldnt1_s32_x2(svcount_t, int32_t const *);
11666__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x4)))
11667svuint8x4_t svldnt1_u8_x4(svcount_t, uint8_t const *);
11668__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x4)))
11669svint8x4_t svldnt1_s8_x4(svcount_t, int8_t const *);
11670__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x4)))
11671svmfloat8x4_t svldnt1_mf8_x4(svcount_t, mfloat8_t const *);
11672__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x4)))
11673svuint64x4_t svldnt1_u64_x4(svcount_t, uint64_t const *);
11674__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x4)))
11675svfloat64x4_t svldnt1_f64_x4(svcount_t, float64_t const *);
11676__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x4)))
11677svint64x4_t svldnt1_s64_x4(svcount_t, int64_t const *);
11678__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x4)))
11679svuint16x4_t svldnt1_u16_x4(svcount_t, uint16_t const *);
11680__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x4)))
11681svbfloat16x4_t svldnt1_bf16_x4(svcount_t, bfloat16_t const *);
11682__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x4)))
11683svfloat16x4_t svldnt1_f16_x4(svcount_t, float16_t const *);
11684__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x4)))
11685svint16x4_t svldnt1_s16_x4(svcount_t, int16_t const *);
11686__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x4)))
11687svuint32x4_t svldnt1_u32_x4(svcount_t, uint32_t const *);
11688__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x4)))
11689svfloat32x4_t svldnt1_f32_x4(svcount_t, float32_t const *);
11690__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x4)))
11691svint32x4_t svldnt1_s32_x4(svcount_t, int32_t const *);
11692__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x2)))
11693svuint8x2_t svldnt1_vnum_u8_x2(svcount_t, uint8_t const *, int64_t);
11694__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x2)))
11695svint8x2_t svldnt1_vnum_s8_x2(svcount_t, int8_t const *, int64_t);
11696__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x2)))
11697svmfloat8x2_t svldnt1_vnum_mf8_x2(svcount_t, mfloat8_t const *, int64_t);
11698__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x2)))
11699svuint64x2_t svldnt1_vnum_u64_x2(svcount_t, uint64_t const *, int64_t);
11700__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x2)))
11701svfloat64x2_t svldnt1_vnum_f64_x2(svcount_t, float64_t const *, int64_t);
11702__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x2)))
11703svint64x2_t svldnt1_vnum_s64_x2(svcount_t, int64_t const *, int64_t);
11704__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x2)))
11705svuint16x2_t svldnt1_vnum_u16_x2(svcount_t, uint16_t const *, int64_t);
11706__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x2)))
11707svbfloat16x2_t svldnt1_vnum_bf16_x2(svcount_t, bfloat16_t const *, int64_t);
11708__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x2)))
11709svfloat16x2_t svldnt1_vnum_f16_x2(svcount_t, float16_t const *, int64_t);
11710__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x2)))
11711svint16x2_t svldnt1_vnum_s16_x2(svcount_t, int16_t const *, int64_t);
11712__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x2)))
11713svuint32x2_t svldnt1_vnum_u32_x2(svcount_t, uint32_t const *, int64_t);
11714__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x2)))
11715svfloat32x2_t svldnt1_vnum_f32_x2(svcount_t, float32_t const *, int64_t);
11716__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x2)))
11717svint32x2_t svldnt1_vnum_s32_x2(svcount_t, int32_t const *, int64_t);
11718__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x4)))
11719svuint8x4_t svldnt1_vnum_u8_x4(svcount_t, uint8_t const *, int64_t);
11720__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x4)))
11721svint8x4_t svldnt1_vnum_s8_x4(svcount_t, int8_t const *, int64_t);
11722__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x4)))
11723svmfloat8x4_t svldnt1_vnum_mf8_x4(svcount_t, mfloat8_t const *, int64_t);
11724__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x4)))
11725svuint64x4_t svldnt1_vnum_u64_x4(svcount_t, uint64_t const *, int64_t);
11726__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x4)))
11727svfloat64x4_t svldnt1_vnum_f64_x4(svcount_t, float64_t const *, int64_t);
11728__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x4)))
11729svint64x4_t svldnt1_vnum_s64_x4(svcount_t, int64_t const *, int64_t);
11730__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x4)))
11731svuint16x4_t svldnt1_vnum_u16_x4(svcount_t, uint16_t const *, int64_t);
11732__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x4)))
11733svbfloat16x4_t svldnt1_vnum_bf16_x4(svcount_t, bfloat16_t const *, int64_t);
11734__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x4)))
11735svfloat16x4_t svldnt1_vnum_f16_x4(svcount_t, float16_t const *, int64_t);
11736__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x4)))
11737svint16x4_t svldnt1_vnum_s16_x4(svcount_t, int16_t const *, int64_t);
11738__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x4)))
11739svuint32x4_t svldnt1_vnum_u32_x4(svcount_t, uint32_t const *, int64_t);
11740__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x4)))
11741svfloat32x4_t svldnt1_vnum_f32_x4(svcount_t, float32_t const *, int64_t);
11742__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x4)))
11743svint32x4_t svldnt1_vnum_s32_x4(svcount_t, int32_t const *, int64_t);
11744__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c8)))
11745svbool_t svpext_lane_c8(svcount_t, uint64_t);
11746__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c32)))
11747svbool_t svpext_lane_c32(svcount_t, uint64_t);
11748__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c64)))
11749svbool_t svpext_lane_c64(svcount_t, uint64_t);
11750__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c16)))
11751svbool_t svpext_lane_c16(svcount_t, uint64_t);
11752__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c8_x2)))
11753svboolx2_t svpext_lane_c8_x2(svcount_t, uint64_t);
11754__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c32_x2)))
11755svboolx2_t svpext_lane_c32_x2(svcount_t, uint64_t);
11756__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c64_x2)))
11757svboolx2_t svpext_lane_c64_x2(svcount_t, uint64_t);
11758__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c16_x2)))
11759svboolx2_t svpext_lane_c16_x2(svcount_t, uint64_t);
11760__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpfalse_c)))
11761svcount_t svpfalse_c(void);
11762__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c16)))
11763svcount_t svpsel_lane_c16(svcount_t, svbool_t, uint32_t);
11764__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c32)))
11765svcount_t svpsel_lane_c32(svcount_t, svbool_t, uint32_t);
11766__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c64)))
11767svcount_t svpsel_lane_c64(svcount_t, svbool_t, uint32_t);
11768__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c8)))
11769svcount_t svpsel_lane_c8(svcount_t, svbool_t, uint32_t);
11770__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c8)))
11771svcount_t svptrue_c8(void);
11772__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c32)))
11773svcount_t svptrue_c32(void);
11774__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c64)))
11775svcount_t svptrue_c64(void);
11776__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c16)))
11777svcount_t svptrue_c16(void);
11778__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_b)))
11779svbool_t svreinterpret_b(svcount_t);
11780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_c)))
11781svcount_t svreinterpret_c(svbool_t);
11782__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x2)))
11783void svst1_u8_x2(svcount_t, uint8_t *, svuint8x2_t);
11784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x2)))
11785void svst1_s8_x2(svcount_t, int8_t *, svint8x2_t);
11786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x2)))
11787void svst1_mf8_x2(svcount_t, mfloat8_t *, svmfloat8x2_t);
11788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x2)))
11789void svst1_u64_x2(svcount_t, uint64_t *, svuint64x2_t);
11790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x2)))
11791void svst1_f64_x2(svcount_t, float64_t *, svfloat64x2_t);
11792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x2)))
11793void svst1_s64_x2(svcount_t, int64_t *, svint64x2_t);
11794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x2)))
11795void svst1_u16_x2(svcount_t, uint16_t *, svuint16x2_t);
11796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x2)))
11797void svst1_bf16_x2(svcount_t, bfloat16_t *, svbfloat16x2_t);
11798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x2)))
11799void svst1_f16_x2(svcount_t, float16_t *, svfloat16x2_t);
11800__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x2)))
11801void svst1_s16_x2(svcount_t, int16_t *, svint16x2_t);
11802__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x2)))
11803void svst1_u32_x2(svcount_t, uint32_t *, svuint32x2_t);
11804__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x2)))
11805void svst1_f32_x2(svcount_t, float32_t *, svfloat32x2_t);
11806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x2)))
11807void svst1_s32_x2(svcount_t, int32_t *, svint32x2_t);
11808__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x4)))
11809void svst1_u8_x4(svcount_t, uint8_t *, svuint8x4_t);
11810__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x4)))
11811void svst1_s8_x4(svcount_t, int8_t *, svint8x4_t);
11812__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x4)))
11813void svst1_mf8_x4(svcount_t, mfloat8_t *, svmfloat8x4_t);
11814__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x4)))
11815void svst1_u64_x4(svcount_t, uint64_t *, svuint64x4_t);
11816__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x4)))
11817void svst1_f64_x4(svcount_t, float64_t *, svfloat64x4_t);
11818__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x4)))
11819void svst1_s64_x4(svcount_t, int64_t *, svint64x4_t);
11820__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x4)))
11821void svst1_u16_x4(svcount_t, uint16_t *, svuint16x4_t);
11822__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x4)))
11823void svst1_bf16_x4(svcount_t, bfloat16_t *, svbfloat16x4_t);
11824__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x4)))
11825void svst1_f16_x4(svcount_t, float16_t *, svfloat16x4_t);
11826__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x4)))
11827void svst1_s16_x4(svcount_t, int16_t *, svint16x4_t);
11828__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x4)))
11829void svst1_u32_x4(svcount_t, uint32_t *, svuint32x4_t);
11830__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x4)))
11831void svst1_f32_x4(svcount_t, float32_t *, svfloat32x4_t);
11832__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x4)))
11833void svst1_s32_x4(svcount_t, int32_t *, svint32x4_t);
11834__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x2)))
11835void svst1_vnum_u8_x2(svcount_t, uint8_t *, int64_t, svuint8x2_t);
11836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x2)))
11837void svst1_vnum_s8_x2(svcount_t, int8_t *, int64_t, svint8x2_t);
11838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x2)))
11839void svst1_vnum_mf8_x2(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
11840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x2)))
11841void svst1_vnum_u64_x2(svcount_t, uint64_t *, int64_t, svuint64x2_t);
11842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x2)))
11843void svst1_vnum_f64_x2(svcount_t, float64_t *, int64_t, svfloat64x2_t);
11844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x2)))
11845void svst1_vnum_s64_x2(svcount_t, int64_t *, int64_t, svint64x2_t);
11846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x2)))
11847void svst1_vnum_u16_x2(svcount_t, uint16_t *, int64_t, svuint16x2_t);
11848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x2)))
11849void svst1_vnum_bf16_x2(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
11850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x2)))
11851void svst1_vnum_f16_x2(svcount_t, float16_t *, int64_t, svfloat16x2_t);
11852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x2)))
11853void svst1_vnum_s16_x2(svcount_t, int16_t *, int64_t, svint16x2_t);
11854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x2)))
11855void svst1_vnum_u32_x2(svcount_t, uint32_t *, int64_t, svuint32x2_t);
11856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x2)))
11857void svst1_vnum_f32_x2(svcount_t, float32_t *, int64_t, svfloat32x2_t);
11858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x2)))
11859void svst1_vnum_s32_x2(svcount_t, int32_t *, int64_t, svint32x2_t);
11860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x4)))
11861void svst1_vnum_u8_x4(svcount_t, uint8_t *, int64_t, svuint8x4_t);
11862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x4)))
11863void svst1_vnum_s8_x4(svcount_t, int8_t *, int64_t, svint8x4_t);
11864__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x4)))
11865void svst1_vnum_mf8_x4(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
11866__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x4)))
11867void svst1_vnum_u64_x4(svcount_t, uint64_t *, int64_t, svuint64x4_t);
11868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x4)))
11869void svst1_vnum_f64_x4(svcount_t, float64_t *, int64_t, svfloat64x4_t);
11870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x4)))
11871void svst1_vnum_s64_x4(svcount_t, int64_t *, int64_t, svint64x4_t);
11872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x4)))
11873void svst1_vnum_u16_x4(svcount_t, uint16_t *, int64_t, svuint16x4_t);
11874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x4)))
11875void svst1_vnum_bf16_x4(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
11876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x4)))
11877void svst1_vnum_f16_x4(svcount_t, float16_t *, int64_t, svfloat16x4_t);
11878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x4)))
11879void svst1_vnum_s16_x4(svcount_t, int16_t *, int64_t, svint16x4_t);
11880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x4)))
11881void svst1_vnum_u32_x4(svcount_t, uint32_t *, int64_t, svuint32x4_t);
11882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x4)))
11883void svst1_vnum_f32_x4(svcount_t, float32_t *, int64_t, svfloat32x4_t);
11884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x4)))
11885void svst1_vnum_s32_x4(svcount_t, int32_t *, int64_t, svint32x4_t);
11886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x2)))
11887void svstnt1_u8_x2(svcount_t, uint8_t *, svuint8x2_t);
11888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x2)))
11889void svstnt1_s8_x2(svcount_t, int8_t *, svint8x2_t);
11890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x2)))
11891void svstnt1_mf8_x2(svcount_t, mfloat8_t *, svmfloat8x2_t);
11892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x2)))
11893void svstnt1_u64_x2(svcount_t, uint64_t *, svuint64x2_t);
11894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x2)))
11895void svstnt1_f64_x2(svcount_t, float64_t *, svfloat64x2_t);
11896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x2)))
11897void svstnt1_s64_x2(svcount_t, int64_t *, svint64x2_t);
11898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x2)))
11899void svstnt1_u16_x2(svcount_t, uint16_t *, svuint16x2_t);
11900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x2)))
11901void svstnt1_bf16_x2(svcount_t, bfloat16_t *, svbfloat16x2_t);
11902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x2)))
11903void svstnt1_f16_x2(svcount_t, float16_t *, svfloat16x2_t);
11904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x2)))
11905void svstnt1_s16_x2(svcount_t, int16_t *, svint16x2_t);
11906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x2)))
11907void svstnt1_u32_x2(svcount_t, uint32_t *, svuint32x2_t);
11908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x2)))
11909void svstnt1_f32_x2(svcount_t, float32_t *, svfloat32x2_t);
11910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x2)))
11911void svstnt1_s32_x2(svcount_t, int32_t *, svint32x2_t);
11912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x4)))
11913void svstnt1_u8_x4(svcount_t, uint8_t *, svuint8x4_t);
11914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x4)))
11915void svstnt1_s8_x4(svcount_t, int8_t *, svint8x4_t);
11916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x4)))
11917void svstnt1_mf8_x4(svcount_t, mfloat8_t *, svmfloat8x4_t);
11918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x4)))
11919void svstnt1_u64_x4(svcount_t, uint64_t *, svuint64x4_t);
11920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x4)))
11921void svstnt1_f64_x4(svcount_t, float64_t *, svfloat64x4_t);
11922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x4)))
11923void svstnt1_s64_x4(svcount_t, int64_t *, svint64x4_t);
11924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x4)))
11925void svstnt1_u16_x4(svcount_t, uint16_t *, svuint16x4_t);
11926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x4)))
11927void svstnt1_bf16_x4(svcount_t, bfloat16_t *, svbfloat16x4_t);
11928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x4)))
11929void svstnt1_f16_x4(svcount_t, float16_t *, svfloat16x4_t);
11930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x4)))
11931void svstnt1_s16_x4(svcount_t, int16_t *, svint16x4_t);
11932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x4)))
11933void svstnt1_u32_x4(svcount_t, uint32_t *, svuint32x4_t);
11934__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x4)))
11935void svstnt1_f32_x4(svcount_t, float32_t *, svfloat32x4_t);
11936__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x4)))
11937void svstnt1_s32_x4(svcount_t, int32_t *, svint32x4_t);
11938__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x2)))
11939void svstnt1_vnum_u8_x2(svcount_t, uint8_t *, int64_t, svuint8x2_t);
11940__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x2)))
11941void svstnt1_vnum_s8_x2(svcount_t, int8_t *, int64_t, svint8x2_t);
11942__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x2)))
11943void svstnt1_vnum_mf8_x2(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
11944__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x2)))
11945void svstnt1_vnum_u64_x2(svcount_t, uint64_t *, int64_t, svuint64x2_t);
11946__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x2)))
11947void svstnt1_vnum_f64_x2(svcount_t, float64_t *, int64_t, svfloat64x2_t);
11948__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x2)))
11949void svstnt1_vnum_s64_x2(svcount_t, int64_t *, int64_t, svint64x2_t);
11950__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x2)))
11951void svstnt1_vnum_u16_x2(svcount_t, uint16_t *, int64_t, svuint16x2_t);
11952__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x2)))
11953void svstnt1_vnum_bf16_x2(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
11954__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x2)))
11955void svstnt1_vnum_f16_x2(svcount_t, float16_t *, int64_t, svfloat16x2_t);
11956__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x2)))
11957void svstnt1_vnum_s16_x2(svcount_t, int16_t *, int64_t, svint16x2_t);
11958__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x2)))
11959void svstnt1_vnum_u32_x2(svcount_t, uint32_t *, int64_t, svuint32x2_t);
11960__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x2)))
11961void svstnt1_vnum_f32_x2(svcount_t, float32_t *, int64_t, svfloat32x2_t);
11962__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x2)))
11963void svstnt1_vnum_s32_x2(svcount_t, int32_t *, int64_t, svint32x2_t);
11964__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x4)))
11965void svstnt1_vnum_u8_x4(svcount_t, uint8_t *, int64_t, svuint8x4_t);
11966__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x4)))
11967void svstnt1_vnum_s8_x4(svcount_t, int8_t *, int64_t, svint8x4_t);
11968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x4)))
11969void svstnt1_vnum_mf8_x4(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
11970__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x4)))
11971void svstnt1_vnum_u64_x4(svcount_t, uint64_t *, int64_t, svuint64x4_t);
11972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x4)))
11973void svstnt1_vnum_f64_x4(svcount_t, float64_t *, int64_t, svfloat64x4_t);
11974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x4)))
11975void svstnt1_vnum_s64_x4(svcount_t, int64_t *, int64_t, svint64x4_t);
11976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x4)))
11977void svstnt1_vnum_u16_x4(svcount_t, uint16_t *, int64_t, svuint16x4_t);
11978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x4)))
11979void svstnt1_vnum_bf16_x4(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
11980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x4)))
11981void svstnt1_vnum_f16_x4(svcount_t, float16_t *, int64_t, svfloat16x4_t);
11982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x4)))
11983void svstnt1_vnum_s16_x4(svcount_t, int16_t *, int64_t, svint16x4_t);
11984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x4)))
11985void svstnt1_vnum_u32_x4(svcount_t, uint32_t *, int64_t, svuint32x4_t);
11986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x4)))
11987void svstnt1_vnum_f32_x4(svcount_t, float32_t *, int64_t, svfloat32x4_t);
11988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x4)))
11989void svstnt1_vnum_s32_x4(svcount_t, int32_t *, int64_t, svint32x4_t);
11990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_s64)))
11991svcount_t svwhilege_c8_s64(int64_t, int64_t, uint64_t);
11992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_s64)))
11993svcount_t svwhilege_c32_s64(int64_t, int64_t, uint64_t);
11994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_s64)))
11995svcount_t svwhilege_c64_s64(int64_t, int64_t, uint64_t);
11996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_s64)))
11997svcount_t svwhilege_c16_s64(int64_t, int64_t, uint64_t);
11998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_u64)))
11999svcount_t svwhilege_c8_u64(uint64_t, uint64_t, uint64_t);
12000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_u64)))
12001svcount_t svwhilege_c32_u64(uint64_t, uint64_t, uint64_t);
12002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_u64)))
12003svcount_t svwhilege_c64_u64(uint64_t, uint64_t, uint64_t);
12004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_u64)))
12005svcount_t svwhilege_c16_u64(uint64_t, uint64_t, uint64_t);
12006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_s64)))
12007svcount_t svwhilegt_c8_s64(int64_t, int64_t, uint64_t);
12008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_s64)))
12009svcount_t svwhilegt_c32_s64(int64_t, int64_t, uint64_t);
12010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_s64)))
12011svcount_t svwhilegt_c64_s64(int64_t, int64_t, uint64_t);
12012__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_s64)))
12013svcount_t svwhilegt_c16_s64(int64_t, int64_t, uint64_t);
12014__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_u64)))
12015svcount_t svwhilegt_c8_u64(uint64_t, uint64_t, uint64_t);
12016__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_u64)))
12017svcount_t svwhilegt_c32_u64(uint64_t, uint64_t, uint64_t);
12018__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_u64)))
12019svcount_t svwhilegt_c64_u64(uint64_t, uint64_t, uint64_t);
12020__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_u64)))
12021svcount_t svwhilegt_c16_u64(uint64_t, uint64_t, uint64_t);
12022__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_s64)))
12023svcount_t svwhilele_c8_s64(int64_t, int64_t, uint64_t);
12024__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_s64)))
12025svcount_t svwhilele_c32_s64(int64_t, int64_t, uint64_t);
12026__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_s64)))
12027svcount_t svwhilele_c64_s64(int64_t, int64_t, uint64_t);
12028__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_s64)))
12029svcount_t svwhilele_c16_s64(int64_t, int64_t, uint64_t);
12030__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_u64)))
12031svcount_t svwhilele_c8_u64(uint64_t, uint64_t, uint64_t);
12032__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_u64)))
12033svcount_t svwhilele_c32_u64(uint64_t, uint64_t, uint64_t);
12034__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_u64)))
12035svcount_t svwhilele_c64_u64(uint64_t, uint64_t, uint64_t);
12036__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_u64)))
12037svcount_t svwhilele_c16_u64(uint64_t, uint64_t, uint64_t);
12038__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_u64)))
12039svcount_t svwhilelt_c8_u64(uint64_t, uint64_t, uint64_t);
12040__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_u64)))
12041svcount_t svwhilelt_c32_u64(uint64_t, uint64_t, uint64_t);
12042__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_u64)))
12043svcount_t svwhilelt_c64_u64(uint64_t, uint64_t, uint64_t);
12044__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_u64)))
12045svcount_t svwhilelt_c16_u64(uint64_t, uint64_t, uint64_t);
12046__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_s64)))
12047svcount_t svwhilelt_c8_s64(int64_t, int64_t, uint64_t);
12048__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_s64)))
12049svcount_t svwhilelt_c32_s64(int64_t, int64_t, uint64_t);
12050__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_s64)))
12051svcount_t svwhilelt_c64_s64(int64_t, int64_t, uint64_t);
12052__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_s64)))
12053svcount_t svwhilelt_c16_s64(int64_t, int64_t, uint64_t);
12054__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x2)))
12055svuint8x2_t svld1_x2(svcount_t, uint8_t const *);
12056__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x2)))
12057svint8x2_t svld1_x2(svcount_t, int8_t const *);
12058__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x2)))
12059svmfloat8x2_t svld1_x2(svcount_t, mfloat8_t const *);
12060__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x2)))
12061svuint64x2_t svld1_x2(svcount_t, uint64_t const *);
12062__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x2)))
12063svfloat64x2_t svld1_x2(svcount_t, float64_t const *);
12064__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x2)))
12065svint64x2_t svld1_x2(svcount_t, int64_t const *);
12066__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x2)))
12067svuint16x2_t svld1_x2(svcount_t, uint16_t const *);
12068__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x2)))
12069svbfloat16x2_t svld1_x2(svcount_t, bfloat16_t const *);
12070__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x2)))
12071svfloat16x2_t svld1_x2(svcount_t, float16_t const *);
12072__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x2)))
12073svint16x2_t svld1_x2(svcount_t, int16_t const *);
12074__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x2)))
12075svuint32x2_t svld1_x2(svcount_t, uint32_t const *);
12076__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x2)))
12077svfloat32x2_t svld1_x2(svcount_t, float32_t const *);
12078__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x2)))
12079svint32x2_t svld1_x2(svcount_t, int32_t const *);
12080__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x4)))
12081svuint8x4_t svld1_x4(svcount_t, uint8_t const *);
12082__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x4)))
12083svint8x4_t svld1_x4(svcount_t, int8_t const *);
12084__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x4)))
12085svmfloat8x4_t svld1_x4(svcount_t, mfloat8_t const *);
12086__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x4)))
12087svuint64x4_t svld1_x4(svcount_t, uint64_t const *);
12088__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x4)))
12089svfloat64x4_t svld1_x4(svcount_t, float64_t const *);
12090__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x4)))
12091svint64x4_t svld1_x4(svcount_t, int64_t const *);
12092__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x4)))
12093svuint16x4_t svld1_x4(svcount_t, uint16_t const *);
12094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x4)))
12095svbfloat16x4_t svld1_x4(svcount_t, bfloat16_t const *);
12096__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x4)))
12097svfloat16x4_t svld1_x4(svcount_t, float16_t const *);
12098__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x4)))
12099svint16x4_t svld1_x4(svcount_t, int16_t const *);
12100__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x4)))
12101svuint32x4_t svld1_x4(svcount_t, uint32_t const *);
12102__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x4)))
12103svfloat32x4_t svld1_x4(svcount_t, float32_t const *);
12104__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x4)))
12105svint32x4_t svld1_x4(svcount_t, int32_t const *);
12106__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x2)))
12107svuint8x2_t svld1_vnum_x2(svcount_t, uint8_t const *, int64_t);
12108__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x2)))
12109svint8x2_t svld1_vnum_x2(svcount_t, int8_t const *, int64_t);
12110__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x2)))
12111svmfloat8x2_t svld1_vnum_x2(svcount_t, mfloat8_t const *, int64_t);
12112__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x2)))
12113svuint64x2_t svld1_vnum_x2(svcount_t, uint64_t const *, int64_t);
12114__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x2)))
12115svfloat64x2_t svld1_vnum_x2(svcount_t, float64_t const *, int64_t);
12116__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x2)))
12117svint64x2_t svld1_vnum_x2(svcount_t, int64_t const *, int64_t);
12118__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x2)))
12119svuint16x2_t svld1_vnum_x2(svcount_t, uint16_t const *, int64_t);
12120__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x2)))
12121svbfloat16x2_t svld1_vnum_x2(svcount_t, bfloat16_t const *, int64_t);
12122__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x2)))
12123svfloat16x2_t svld1_vnum_x2(svcount_t, float16_t const *, int64_t);
12124__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x2)))
12125svint16x2_t svld1_vnum_x2(svcount_t, int16_t const *, int64_t);
12126__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x2)))
12127svuint32x2_t svld1_vnum_x2(svcount_t, uint32_t const *, int64_t);
12128__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x2)))
12129svfloat32x2_t svld1_vnum_x2(svcount_t, float32_t const *, int64_t);
12130__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x2)))
12131svint32x2_t svld1_vnum_x2(svcount_t, int32_t const *, int64_t);
12132__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x4)))
12133svuint8x4_t svld1_vnum_x4(svcount_t, uint8_t const *, int64_t);
12134__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x4)))
12135svint8x4_t svld1_vnum_x4(svcount_t, int8_t const *, int64_t);
12136__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x4)))
12137svmfloat8x4_t svld1_vnum_x4(svcount_t, mfloat8_t const *, int64_t);
12138__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x4)))
12139svuint64x4_t svld1_vnum_x4(svcount_t, uint64_t const *, int64_t);
12140__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x4)))
12141svfloat64x4_t svld1_vnum_x4(svcount_t, float64_t const *, int64_t);
12142__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x4)))
12143svint64x4_t svld1_vnum_x4(svcount_t, int64_t const *, int64_t);
12144__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x4)))
12145svuint16x4_t svld1_vnum_x4(svcount_t, uint16_t const *, int64_t);
12146__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x4)))
12147svbfloat16x4_t svld1_vnum_x4(svcount_t, bfloat16_t const *, int64_t);
12148__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x4)))
12149svfloat16x4_t svld1_vnum_x4(svcount_t, float16_t const *, int64_t);
12150__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x4)))
12151svint16x4_t svld1_vnum_x4(svcount_t, int16_t const *, int64_t);
12152__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x4)))
12153svuint32x4_t svld1_vnum_x4(svcount_t, uint32_t const *, int64_t);
12154__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x4)))
12155svfloat32x4_t svld1_vnum_x4(svcount_t, float32_t const *, int64_t);
12156__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x4)))
12157svint32x4_t svld1_vnum_x4(svcount_t, int32_t const *, int64_t);
12158__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x2)))
12159svuint8x2_t svldnt1_x2(svcount_t, uint8_t const *);
12160__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x2)))
12161svint8x2_t svldnt1_x2(svcount_t, int8_t const *);
12162__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x2)))
12163svmfloat8x2_t svldnt1_x2(svcount_t, mfloat8_t const *);
12164__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x2)))
12165svuint64x2_t svldnt1_x2(svcount_t, uint64_t const *);
12166__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x2)))
12167svfloat64x2_t svldnt1_x2(svcount_t, float64_t const *);
12168__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x2)))
12169svint64x2_t svldnt1_x2(svcount_t, int64_t const *);
12170__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x2)))
12171svuint16x2_t svldnt1_x2(svcount_t, uint16_t const *);
12172__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x2)))
12173svbfloat16x2_t svldnt1_x2(svcount_t, bfloat16_t const *);
12174__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x2)))
12175svfloat16x2_t svldnt1_x2(svcount_t, float16_t const *);
12176__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x2)))
12177svint16x2_t svldnt1_x2(svcount_t, int16_t const *);
12178__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x2)))
12179svuint32x2_t svldnt1_x2(svcount_t, uint32_t const *);
12180__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x2)))
12181svfloat32x2_t svldnt1_x2(svcount_t, float32_t const *);
12182__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x2)))
12183svint32x2_t svldnt1_x2(svcount_t, int32_t const *);
12184__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x4)))
12185svuint8x4_t svldnt1_x4(svcount_t, uint8_t const *);
12186__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x4)))
12187svint8x4_t svldnt1_x4(svcount_t, int8_t const *);
12188__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x4)))
12189svmfloat8x4_t svldnt1_x4(svcount_t, mfloat8_t const *);
12190__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x4)))
12191svuint64x4_t svldnt1_x4(svcount_t, uint64_t const *);
12192__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x4)))
12193svfloat64x4_t svldnt1_x4(svcount_t, float64_t const *);
12194__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x4)))
12195svint64x4_t svldnt1_x4(svcount_t, int64_t const *);
12196__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x4)))
12197svuint16x4_t svldnt1_x4(svcount_t, uint16_t const *);
12198__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x4)))
12199svbfloat16x4_t svldnt1_x4(svcount_t, bfloat16_t const *);
12200__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x4)))
12201svfloat16x4_t svldnt1_x4(svcount_t, float16_t const *);
12202__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x4)))
12203svint16x4_t svldnt1_x4(svcount_t, int16_t const *);
12204__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x4)))
12205svuint32x4_t svldnt1_x4(svcount_t, uint32_t const *);
12206__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x4)))
12207svfloat32x4_t svldnt1_x4(svcount_t, float32_t const *);
12208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x4)))
12209svint32x4_t svldnt1_x4(svcount_t, int32_t const *);
12210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x2)))
12211svuint8x2_t svldnt1_vnum_x2(svcount_t, uint8_t const *, int64_t);
12212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x2)))
12213svint8x2_t svldnt1_vnum_x2(svcount_t, int8_t const *, int64_t);
12214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x2)))
12215svmfloat8x2_t svldnt1_vnum_x2(svcount_t, mfloat8_t const *, int64_t);
12216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x2)))
12217svuint64x2_t svldnt1_vnum_x2(svcount_t, uint64_t const *, int64_t);
12218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x2)))
12219svfloat64x2_t svldnt1_vnum_x2(svcount_t, float64_t const *, int64_t);
12220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x2)))
12221svint64x2_t svldnt1_vnum_x2(svcount_t, int64_t const *, int64_t);
12222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x2)))
12223svuint16x2_t svldnt1_vnum_x2(svcount_t, uint16_t const *, int64_t);
12224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x2)))
12225svbfloat16x2_t svldnt1_vnum_x2(svcount_t, bfloat16_t const *, int64_t);
12226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x2)))
12227svfloat16x2_t svldnt1_vnum_x2(svcount_t, float16_t const *, int64_t);
12228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x2)))
12229svint16x2_t svldnt1_vnum_x2(svcount_t, int16_t const *, int64_t);
12230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x2)))
12231svuint32x2_t svldnt1_vnum_x2(svcount_t, uint32_t const *, int64_t);
12232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x2)))
12233svfloat32x2_t svldnt1_vnum_x2(svcount_t, float32_t const *, int64_t);
12234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x2)))
12235svint32x2_t svldnt1_vnum_x2(svcount_t, int32_t const *, int64_t);
12236__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x4)))
12237svuint8x4_t svldnt1_vnum_x4(svcount_t, uint8_t const *, int64_t);
12238__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x4)))
12239svint8x4_t svldnt1_vnum_x4(svcount_t, int8_t const *, int64_t);
12240__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x4)))
12241svmfloat8x4_t svldnt1_vnum_x4(svcount_t, mfloat8_t const *, int64_t);
12242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x4)))
12243svuint64x4_t svldnt1_vnum_x4(svcount_t, uint64_t const *, int64_t);
12244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x4)))
12245svfloat64x4_t svldnt1_vnum_x4(svcount_t, float64_t const *, int64_t);
12246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x4)))
12247svint64x4_t svldnt1_vnum_x4(svcount_t, int64_t const *, int64_t);
12248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x4)))
12249svuint16x4_t svldnt1_vnum_x4(svcount_t, uint16_t const *, int64_t);
12250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x4)))
12251svbfloat16x4_t svldnt1_vnum_x4(svcount_t, bfloat16_t const *, int64_t);
12252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x4)))
12253svfloat16x4_t svldnt1_vnum_x4(svcount_t, float16_t const *, int64_t);
12254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x4)))
12255svint16x4_t svldnt1_vnum_x4(svcount_t, int16_t const *, int64_t);
12256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x4)))
12257svuint32x4_t svldnt1_vnum_x4(svcount_t, uint32_t const *, int64_t);
12258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x4)))
12259svfloat32x4_t svldnt1_vnum_x4(svcount_t, float32_t const *, int64_t);
12260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x4)))
12261svint32x4_t svldnt1_vnum_x4(svcount_t, int32_t const *, int64_t);
12262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_b)))
12263svbool_t svreinterpret(svcount_t);
12264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_c)))
12265svcount_t svreinterpret(svbool_t);
12266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x2)))
12267void svst1(svcount_t, uint8_t *, svuint8x2_t);
12268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x2)))
12269void svst1(svcount_t, int8_t *, svint8x2_t);
12270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x2)))
12271void svst1(svcount_t, mfloat8_t *, svmfloat8x2_t);
12272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x2)))
12273void svst1(svcount_t, uint64_t *, svuint64x2_t);
12274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x2)))
12275void svst1(svcount_t, float64_t *, svfloat64x2_t);
12276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x2)))
12277void svst1(svcount_t, int64_t *, svint64x2_t);
12278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x2)))
12279void svst1(svcount_t, uint16_t *, svuint16x2_t);
12280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x2)))
12281void svst1(svcount_t, bfloat16_t *, svbfloat16x2_t);
12282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x2)))
12283void svst1(svcount_t, float16_t *, svfloat16x2_t);
12284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x2)))
12285void svst1(svcount_t, int16_t *, svint16x2_t);
12286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x2)))
12287void svst1(svcount_t, uint32_t *, svuint32x2_t);
12288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x2)))
12289void svst1(svcount_t, float32_t *, svfloat32x2_t);
12290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x2)))
12291void svst1(svcount_t, int32_t *, svint32x2_t);
12292__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x4)))
12293void svst1(svcount_t, uint8_t *, svuint8x4_t);
12294__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x4)))
12295void svst1(svcount_t, int8_t *, svint8x4_t);
12296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x4)))
12297void svst1(svcount_t, mfloat8_t *, svmfloat8x4_t);
12298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x4)))
12299void svst1(svcount_t, uint64_t *, svuint64x4_t);
12300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x4)))
12301void svst1(svcount_t, float64_t *, svfloat64x4_t);
12302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x4)))
12303void svst1(svcount_t, int64_t *, svint64x4_t);
12304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x4)))
12305void svst1(svcount_t, uint16_t *, svuint16x4_t);
12306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x4)))
12307void svst1(svcount_t, bfloat16_t *, svbfloat16x4_t);
12308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x4)))
12309void svst1(svcount_t, float16_t *, svfloat16x4_t);
12310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x4)))
12311void svst1(svcount_t, int16_t *, svint16x4_t);
12312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x4)))
12313void svst1(svcount_t, uint32_t *, svuint32x4_t);
12314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x4)))
12315void svst1(svcount_t, float32_t *, svfloat32x4_t);
12316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x4)))
12317void svst1(svcount_t, int32_t *, svint32x4_t);
12318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x2)))
12319void svst1_vnum(svcount_t, uint8_t *, int64_t, svuint8x2_t);
12320__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x2)))
12321void svst1_vnum(svcount_t, int8_t *, int64_t, svint8x2_t);
12322__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x2)))
12323void svst1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
12324__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x2)))
12325void svst1_vnum(svcount_t, uint64_t *, int64_t, svuint64x2_t);
12326__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x2)))
12327void svst1_vnum(svcount_t, float64_t *, int64_t, svfloat64x2_t);
12328__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x2)))
12329void svst1_vnum(svcount_t, int64_t *, int64_t, svint64x2_t);
12330__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x2)))
12331void svst1_vnum(svcount_t, uint16_t *, int64_t, svuint16x2_t);
12332__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x2)))
12333void svst1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
12334__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x2)))
12335void svst1_vnum(svcount_t, float16_t *, int64_t, svfloat16x2_t);
12336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x2)))
12337void svst1_vnum(svcount_t, int16_t *, int64_t, svint16x2_t);
12338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x2)))
12339void svst1_vnum(svcount_t, uint32_t *, int64_t, svuint32x2_t);
12340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x2)))
12341void svst1_vnum(svcount_t, float32_t *, int64_t, svfloat32x2_t);
12342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x2)))
12343void svst1_vnum(svcount_t, int32_t *, int64_t, svint32x2_t);
12344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x4)))
12345void svst1_vnum(svcount_t, uint8_t *, int64_t, svuint8x4_t);
12346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x4)))
12347void svst1_vnum(svcount_t, int8_t *, int64_t, svint8x4_t);
12348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x4)))
12349void svst1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
12350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x4)))
12351void svst1_vnum(svcount_t, uint64_t *, int64_t, svuint64x4_t);
12352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x4)))
12353void svst1_vnum(svcount_t, float64_t *, int64_t, svfloat64x4_t);
12354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x4)))
12355void svst1_vnum(svcount_t, int64_t *, int64_t, svint64x4_t);
12356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x4)))
12357void svst1_vnum(svcount_t, uint16_t *, int64_t, svuint16x4_t);
12358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x4)))
12359void svst1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
12360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x4)))
12361void svst1_vnum(svcount_t, float16_t *, int64_t, svfloat16x4_t);
12362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x4)))
12363void svst1_vnum(svcount_t, int16_t *, int64_t, svint16x4_t);
12364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x4)))
12365void svst1_vnum(svcount_t, uint32_t *, int64_t, svuint32x4_t);
12366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x4)))
12367void svst1_vnum(svcount_t, float32_t *, int64_t, svfloat32x4_t);
12368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x4)))
12369void svst1_vnum(svcount_t, int32_t *, int64_t, svint32x4_t);
12370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x2)))
12371void svstnt1(svcount_t, uint8_t *, svuint8x2_t);
12372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x2)))
12373void svstnt1(svcount_t, int8_t *, svint8x2_t);
12374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x2)))
12375void svstnt1(svcount_t, mfloat8_t *, svmfloat8x2_t);
12376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x2)))
12377void svstnt1(svcount_t, uint64_t *, svuint64x2_t);
12378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x2)))
12379void svstnt1(svcount_t, float64_t *, svfloat64x2_t);
12380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x2)))
12381void svstnt1(svcount_t, int64_t *, svint64x2_t);
12382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x2)))
12383void svstnt1(svcount_t, uint16_t *, svuint16x2_t);
12384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x2)))
12385void svstnt1(svcount_t, bfloat16_t *, svbfloat16x2_t);
12386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x2)))
12387void svstnt1(svcount_t, float16_t *, svfloat16x2_t);
12388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x2)))
12389void svstnt1(svcount_t, int16_t *, svint16x2_t);
12390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x2)))
12391void svstnt1(svcount_t, uint32_t *, svuint32x2_t);
12392__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x2)))
12393void svstnt1(svcount_t, float32_t *, svfloat32x2_t);
12394__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x2)))
12395void svstnt1(svcount_t, int32_t *, svint32x2_t);
12396__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x4)))
12397void svstnt1(svcount_t, uint8_t *, svuint8x4_t);
12398__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x4)))
12399void svstnt1(svcount_t, int8_t *, svint8x4_t);
12400__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x4)))
12401void svstnt1(svcount_t, mfloat8_t *, svmfloat8x4_t);
12402__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x4)))
12403void svstnt1(svcount_t, uint64_t *, svuint64x4_t);
12404__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x4)))
12405void svstnt1(svcount_t, float64_t *, svfloat64x4_t);
12406__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x4)))
12407void svstnt1(svcount_t, int64_t *, svint64x4_t);
12408__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x4)))
12409void svstnt1(svcount_t, uint16_t *, svuint16x4_t);
12410__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x4)))
12411void svstnt1(svcount_t, bfloat16_t *, svbfloat16x4_t);
12412__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x4)))
12413void svstnt1(svcount_t, float16_t *, svfloat16x4_t);
12414__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x4)))
12415void svstnt1(svcount_t, int16_t *, svint16x4_t);
12416__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x4)))
12417void svstnt1(svcount_t, uint32_t *, svuint32x4_t);
12418__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x4)))
12419void svstnt1(svcount_t, float32_t *, svfloat32x4_t);
12420__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x4)))
12421void svstnt1(svcount_t, int32_t *, svint32x4_t);
12422__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x2)))
12423void svstnt1_vnum(svcount_t, uint8_t *, int64_t, svuint8x2_t);
12424__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x2)))
12425void svstnt1_vnum(svcount_t, int8_t *, int64_t, svint8x2_t);
12426__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x2)))
12427void svstnt1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
12428__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x2)))
12429void svstnt1_vnum(svcount_t, uint64_t *, int64_t, svuint64x2_t);
12430__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x2)))
12431void svstnt1_vnum(svcount_t, float64_t *, int64_t, svfloat64x2_t);
12432__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x2)))
12433void svstnt1_vnum(svcount_t, int64_t *, int64_t, svint64x2_t);
12434__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x2)))
12435void svstnt1_vnum(svcount_t, uint16_t *, int64_t, svuint16x2_t);
12436__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x2)))
12437void svstnt1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
12438__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x2)))
12439void svstnt1_vnum(svcount_t, float16_t *, int64_t, svfloat16x2_t);
12440__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x2)))
12441void svstnt1_vnum(svcount_t, int16_t *, int64_t, svint16x2_t);
12442__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x2)))
12443void svstnt1_vnum(svcount_t, uint32_t *, int64_t, svuint32x2_t);
12444__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x2)))
12445void svstnt1_vnum(svcount_t, float32_t *, int64_t, svfloat32x2_t);
12446__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x2)))
12447void svstnt1_vnum(svcount_t, int32_t *, int64_t, svint32x2_t);
12448__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x4)))
12449void svstnt1_vnum(svcount_t, uint8_t *, int64_t, svuint8x4_t);
12450__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x4)))
12451void svstnt1_vnum(svcount_t, int8_t *, int64_t, svint8x4_t);
12452__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x4)))
12453void svstnt1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
12454__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x4)))
12455void svstnt1_vnum(svcount_t, uint64_t *, int64_t, svuint64x4_t);
12456__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x4)))
12457void svstnt1_vnum(svcount_t, float64_t *, int64_t, svfloat64x4_t);
12458__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x4)))
12459void svstnt1_vnum(svcount_t, int64_t *, int64_t, svint64x4_t);
12460__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x4)))
12461void svstnt1_vnum(svcount_t, uint16_t *, int64_t, svuint16x4_t);
12462__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x4)))
12463void svstnt1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
12464__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x4)))
12465void svstnt1_vnum(svcount_t, float16_t *, int64_t, svfloat16x4_t);
12466__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x4)))
12467void svstnt1_vnum(svcount_t, int16_t *, int64_t, svint16x4_t);
12468__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x4)))
12469void svstnt1_vnum(svcount_t, uint32_t *, int64_t, svuint32x4_t);
12470__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x4)))
12471void svstnt1_vnum(svcount_t, float32_t *, int64_t, svfloat32x4_t);
12472__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x4)))
12473void svstnt1_vnum(svcount_t, int32_t *, int64_t, svint32x4_t);
12474__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_s64)))
12475svcount_t svwhilege_c8(int64_t, int64_t, uint64_t);
12476__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_s64)))
12477svcount_t svwhilege_c32(int64_t, int64_t, uint64_t);
12478__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_s64)))
12479svcount_t svwhilege_c64(int64_t, int64_t, uint64_t);
12480__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_s64)))
12481svcount_t svwhilege_c16(int64_t, int64_t, uint64_t);
12482__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_u64)))
12483svcount_t svwhilege_c8(uint64_t, uint64_t, uint64_t);
12484__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_u64)))
12485svcount_t svwhilege_c32(uint64_t, uint64_t, uint64_t);
12486__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_u64)))
12487svcount_t svwhilege_c64(uint64_t, uint64_t, uint64_t);
12488__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_u64)))
12489svcount_t svwhilege_c16(uint64_t, uint64_t, uint64_t);
12490__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_s64)))
12491svcount_t svwhilegt_c8(int64_t, int64_t, uint64_t);
12492__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_s64)))
12493svcount_t svwhilegt_c32(int64_t, int64_t, uint64_t);
12494__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_s64)))
12495svcount_t svwhilegt_c64(int64_t, int64_t, uint64_t);
12496__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_s64)))
12497svcount_t svwhilegt_c16(int64_t, int64_t, uint64_t);
12498__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_u64)))
12499svcount_t svwhilegt_c8(uint64_t, uint64_t, uint64_t);
12500__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_u64)))
12501svcount_t svwhilegt_c32(uint64_t, uint64_t, uint64_t);
12502__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_u64)))
12503svcount_t svwhilegt_c64(uint64_t, uint64_t, uint64_t);
12504__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_u64)))
12505svcount_t svwhilegt_c16(uint64_t, uint64_t, uint64_t);
12506__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_s64)))
12507svcount_t svwhilele_c8(int64_t, int64_t, uint64_t);
12508__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_s64)))
12509svcount_t svwhilele_c32(int64_t, int64_t, uint64_t);
12510__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_s64)))
12511svcount_t svwhilele_c64(int64_t, int64_t, uint64_t);
12512__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_s64)))
12513svcount_t svwhilele_c16(int64_t, int64_t, uint64_t);
12514__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_u64)))
12515svcount_t svwhilele_c8(uint64_t, uint64_t, uint64_t);
12516__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_u64)))
12517svcount_t svwhilele_c32(uint64_t, uint64_t, uint64_t);
12518__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_u64)))
12519svcount_t svwhilele_c64(uint64_t, uint64_t, uint64_t);
12520__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_u64)))
12521svcount_t svwhilele_c16(uint64_t, uint64_t, uint64_t);
12522__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_u64)))
12523svcount_t svwhilelt_c8(uint64_t, uint64_t, uint64_t);
12524__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_u64)))
12525svcount_t svwhilelt_c32(uint64_t, uint64_t, uint64_t);
12526__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_u64)))
12527svcount_t svwhilelt_c64(uint64_t, uint64_t, uint64_t);
12528__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_u64)))
12529svcount_t svwhilelt_c16(uint64_t, uint64_t, uint64_t);
12530__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_s64)))
12531svcount_t svwhilelt_c8(int64_t, int64_t, uint64_t);
12532__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_s64)))
12533svcount_t svwhilelt_c32(int64_t, int64_t, uint64_t);
12534__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_s64)))
12535svcount_t svwhilelt_c64(int64_t, int64_t, uint64_t);
12536__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_s64)))
12537svcount_t svwhilelt_c16(int64_t, int64_t, uint64_t);
8836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt_f32_f16_z)))
8837svfloat32_t svcvtlt_f32_f16_z(svbool_t, svfloat16_t);
8838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt_f64_f32_z)))
8839svfloat64_t svcvtlt_f64_f32_z(svbool_t, svfloat32_t);
8840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_bf16_f32_z)))
8841svbfloat16_t svcvtnt_bf16_f32_z(svbfloat16_t, svbool_t, svfloat32_t);
8842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_f16_f32_z)))
8843svfloat16_t svcvtnt_f16_f32_z(svfloat16_t, svbool_t, svfloat32_t);
8844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_f32_f64_z)))
8845svfloat32_t svcvtnt_f32_f64_z(svfloat32_t, svbool_t, svfloat64_t);
8846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtxnt_f32_f64_z)))
8847svfloat32_t svcvtxnt_f32_f64_z(svfloat32_t, svbool_t, svfloat64_t);
8848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svfirstp_b8)))
8849int64_t svfirstp_b8(svbool_t, svbool_t);
8850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svfirstp_b32)))
8851int64_t svfirstp_b32(svbool_t, svbool_t);
8852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svfirstp_b64)))
8853int64_t svfirstp_b64(svbool_t, svbool_t);
8854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svfirstp_b16)))
8855int64_t svfirstp_b16(svbool_t, svbool_t);
8856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svlastp_b8)))
8857int64_t svlastp_b8(svbool_t, svbool_t);
8858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svlastp_b32)))
8859int64_t svlastp_b32(svbool_t, svbool_t);
8860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svlastp_b64)))
8861int64_t svlastp_b64(svbool_t, svbool_t);
8862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svlastp_b16)))
8863int64_t svlastp_b16(svbool_t, svbool_t);
8864__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f64_m)))
8865svfloat64_t svrint32x_f64_m(svfloat64_t, svbool_t, svfloat64_t);
8866__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f32_m)))
8867svfloat32_t svrint32x_f32_m(svfloat32_t, svbool_t, svfloat32_t);
8868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f64_x)))
8869svfloat64_t svrint32x_f64_x(svbool_t, svfloat64_t);
8870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f32_x)))
8871svfloat32_t svrint32x_f32_x(svbool_t, svfloat32_t);
8872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f64_z)))
8873svfloat64_t svrint32x_f64_z(svbool_t, svfloat64_t);
8874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f32_z)))
8875svfloat32_t svrint32x_f32_z(svbool_t, svfloat32_t);
8876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f64_m)))
8877svfloat64_t svrint32z_f64_m(svfloat64_t, svbool_t, svfloat64_t);
8878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f32_m)))
8879svfloat32_t svrint32z_f32_m(svfloat32_t, svbool_t, svfloat32_t);
8880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f64_x)))
8881svfloat64_t svrint32z_f64_x(svbool_t, svfloat64_t);
8882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f32_x)))
8883svfloat32_t svrint32z_f32_x(svbool_t, svfloat32_t);
8884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f64_z)))
8885svfloat64_t svrint32z_f64_z(svbool_t, svfloat64_t);
8886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f32_z)))
8887svfloat32_t svrint32z_f32_z(svbool_t, svfloat32_t);
8888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f64_m)))
8889svfloat64_t svrint64x_f64_m(svfloat64_t, svbool_t, svfloat64_t);
8890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f32_m)))
8891svfloat32_t svrint64x_f32_m(svfloat32_t, svbool_t, svfloat32_t);
8892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f64_x)))
8893svfloat64_t svrint64x_f64_x(svbool_t, svfloat64_t);
8894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f32_x)))
8895svfloat32_t svrint64x_f32_x(svbool_t, svfloat32_t);
8896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f64_z)))
8897svfloat64_t svrint64x_f64_z(svbool_t, svfloat64_t);
8898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f32_z)))
8899svfloat32_t svrint64x_f32_z(svbool_t, svfloat32_t);
8900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f64_m)))
8901svfloat64_t svrint64z_f64_m(svfloat64_t, svbool_t, svfloat64_t);
8902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f32_m)))
8903svfloat32_t svrint64z_f32_m(svfloat32_t, svbool_t, svfloat32_t);
8904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f64_x)))
8905svfloat64_t svrint64z_f64_x(svbool_t, svfloat64_t);
8906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f32_x)))
8907svfloat32_t svrint64z_f32_x(svbool_t, svfloat32_t);
8908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f64_z)))
8909svfloat64_t svrint64z_f64_z(svbool_t, svfloat64_t);
8910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f32_z)))
8911svfloat32_t svrint64z_f32_z(svbool_t, svfloat32_t);
8912__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt_f32_f16_z)))
8913svfloat32_t svcvtlt_f32_z(svbool_t, svfloat16_t);
8914__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt_f64_f32_z)))
8915svfloat64_t svcvtlt_f64_z(svbool_t, svfloat32_t);
8916__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_bf16_f32_z)))
8917svbfloat16_t svcvtnt_bf16_z(svbfloat16_t, svbool_t, svfloat32_t);
8918__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_f16_f32_z)))
8919svfloat16_t svcvtnt_f16_z(svfloat16_t, svbool_t, svfloat32_t);
8920__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_f32_f64_z)))
8921svfloat32_t svcvtnt_f32_z(svfloat32_t, svbool_t, svfloat64_t);
8922__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtxnt_f32_f64_z)))
8923svfloat32_t svcvtxnt_f32_z(svfloat32_t, svbool_t, svfloat64_t);
8924__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f64_m)))
8925svfloat64_t svrint32x_m(svfloat64_t, svbool_t, svfloat64_t);
8926__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f32_m)))
8927svfloat32_t svrint32x_m(svfloat32_t, svbool_t, svfloat32_t);
8928__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f64_x)))
8929svfloat64_t svrint32x_x(svbool_t, svfloat64_t);
8930__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f32_x)))
8931svfloat32_t svrint32x_x(svbool_t, svfloat32_t);
8932__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f64_z)))
8933svfloat64_t svrint32x_z(svbool_t, svfloat64_t);
8934__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32x_f32_z)))
8935svfloat32_t svrint32x_z(svbool_t, svfloat32_t);
8936__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f64_m)))
8937svfloat64_t svrint32z_m(svfloat64_t, svbool_t, svfloat64_t);
8938__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f32_m)))
8939svfloat32_t svrint32z_m(svfloat32_t, svbool_t, svfloat32_t);
8940__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f64_x)))
8941svfloat64_t svrint32z_x(svbool_t, svfloat64_t);
8942__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f32_x)))
8943svfloat32_t svrint32z_x(svbool_t, svfloat32_t);
8944__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f64_z)))
8945svfloat64_t svrint32z_z(svbool_t, svfloat64_t);
8946__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint32z_f32_z)))
8947svfloat32_t svrint32z_z(svbool_t, svfloat32_t);
8948__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f64_m)))
8949svfloat64_t svrint64x_m(svfloat64_t, svbool_t, svfloat64_t);
8950__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f32_m)))
8951svfloat32_t svrint64x_m(svfloat32_t, svbool_t, svfloat32_t);
8952__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f64_x)))
8953svfloat64_t svrint64x_x(svbool_t, svfloat64_t);
8954__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f32_x)))
8955svfloat32_t svrint64x_x(svbool_t, svfloat32_t);
8956__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f64_z)))
8957svfloat64_t svrint64x_z(svbool_t, svfloat64_t);
8958__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64x_f32_z)))
8959svfloat32_t svrint64x_z(svbool_t, svfloat32_t);
8960__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f64_m)))
8961svfloat64_t svrint64z_m(svfloat64_t, svbool_t, svfloat64_t);
8962__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f32_m)))
8963svfloat32_t svrint64z_m(svfloat32_t, svbool_t, svfloat32_t);
8964__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f64_x)))
8965svfloat64_t svrint64z_x(svbool_t, svfloat64_t);
8966__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f32_x)))
8967svfloat32_t svrint64z_x(svbool_t, svfloat32_t);
8968__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f64_z)))
8969svfloat64_t svrint64z_z(svbool_t, svfloat64_t);
8970__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrint64z_f32_z)))
8971svfloat32_t svrint64z_z(svbool_t, svfloat32_t);
8972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u8)))
8973svuint8_t svcompact_u8(svbool_t, svuint8_t);
8974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u16)))
8975svuint16_t svcompact_u16(svbool_t, svuint16_t);
8976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_bf16)))
8977svbfloat16_t svcompact_bf16(svbool_t, svbfloat16_t);
8978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s8)))
8979svint8_t svcompact_s8(svbool_t, svint8_t);
8980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f16)))
8981svfloat16_t svcompact_f16(svbool_t, svfloat16_t);
8982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_mf8)))
8983svmfloat8_t svcompact_mf8(svbool_t, svmfloat8_t);
8984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s16)))
8985svint16_t svcompact_s16(svbool_t, svint16_t);
8986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u8)))
8987svuint8_t svexpand_u8(svbool_t, svuint8_t);
8988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u32)))
8989svuint32_t svexpand_u32(svbool_t, svuint32_t);
8990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u64)))
8991svuint64_t svexpand_u64(svbool_t, svuint64_t);
8992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u16)))
8993svuint16_t svexpand_u16(svbool_t, svuint16_t);
8994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_bf16)))
8995svbfloat16_t svexpand_bf16(svbool_t, svbfloat16_t);
8996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s8)))
8997svint8_t svexpand_s8(svbool_t, svint8_t);
8998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_f64)))
8999svfloat64_t svexpand_f64(svbool_t, svfloat64_t);
9000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_f32)))
9001svfloat32_t svexpand_f32(svbool_t, svfloat32_t);
9002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_f16)))
9003svfloat16_t svexpand_f16(svbool_t, svfloat16_t);
9004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s32)))
9005svint32_t svexpand_s32(svbool_t, svint32_t);
9006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s64)))
9007svint64_t svexpand_s64(svbool_t, svint64_t);
9008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_mf8)))
9009svmfloat8_t svexpand_mf8(svbool_t, svmfloat8_t);
9010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s16)))
9011svint16_t svexpand_s16(svbool_t, svint16_t);
9012__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u8)))
9013svuint8_t svcompact(svbool_t, svuint8_t);
9014__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u16)))
9015svuint16_t svcompact(svbool_t, svuint16_t);
9016__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_bf16)))
9017svbfloat16_t svcompact(svbool_t, svbfloat16_t);
9018__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s8)))
9019svint8_t svcompact(svbool_t, svint8_t);
9020__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f16)))
9021svfloat16_t svcompact(svbool_t, svfloat16_t);
9022__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_mf8)))
9023svmfloat8_t svcompact(svbool_t, svmfloat8_t);
9024__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s16)))
9025svint16_t svcompact(svbool_t, svint16_t);
9026__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u8)))
9027svuint8_t svexpand(svbool_t, svuint8_t);
9028__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u32)))
9029svuint32_t svexpand(svbool_t, svuint32_t);
9030__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u64)))
9031svuint64_t svexpand(svbool_t, svuint64_t);
9032__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_u16)))
9033svuint16_t svexpand(svbool_t, svuint16_t);
9034__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_bf16)))
9035svbfloat16_t svexpand(svbool_t, svbfloat16_t);
9036__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s8)))
9037svint8_t svexpand(svbool_t, svint8_t);
9038__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_f64)))
9039svfloat64_t svexpand(svbool_t, svfloat64_t);
9040__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_f32)))
9041svfloat32_t svexpand(svbool_t, svfloat32_t);
9042__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_f16)))
9043svfloat16_t svexpand(svbool_t, svfloat16_t);
9044__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s32)))
9045svint32_t svexpand(svbool_t, svint32_t);
9046__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s64)))
9047svint64_t svexpand(svbool_t, svint64_t);
9048__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_mf8)))
9049svmfloat8_t svexpand(svbool_t, svmfloat8_t);
9050__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s16)))
9051svint16_t svexpand(svbool_t, svint16_t);
125389052__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaba_n_s8)))
125399053svint8_t svaba_n_s8(svint8_t, svint8_t, int8_t);
125409054__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaba_n_s32)))
......@@ -19059,6 +15573,3848 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svxar_n_s64)))
1905915573svint64_t svxar(svint64_t, svint64_t, uint64_t);
1906015574__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svxar_n_s16)))
1906115575svint16_t svxar(svint16_t, svint16_t, uint64_t);
15576__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_m)))
15577svfloat64_t svamax_n_f64_m(svbool_t, svfloat64_t, float64_t);
15578__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_m)))
15579svfloat32_t svamax_n_f32_m(svbool_t, svfloat32_t, float32_t);
15580__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_m)))
15581svfloat16_t svamax_n_f16_m(svbool_t, svfloat16_t, float16_t);
15582__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_x)))
15583svfloat64_t svamax_n_f64_x(svbool_t, svfloat64_t, float64_t);
15584__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_x)))
15585svfloat32_t svamax_n_f32_x(svbool_t, svfloat32_t, float32_t);
15586__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_x)))
15587svfloat16_t svamax_n_f16_x(svbool_t, svfloat16_t, float16_t);
15588__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_z)))
15589svfloat64_t svamax_n_f64_z(svbool_t, svfloat64_t, float64_t);
15590__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_z)))
15591svfloat32_t svamax_n_f32_z(svbool_t, svfloat32_t, float32_t);
15592__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_z)))
15593svfloat16_t svamax_n_f16_z(svbool_t, svfloat16_t, float16_t);
15594__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_m)))
15595svfloat64_t svamax_f64_m(svbool_t, svfloat64_t, svfloat64_t);
15596__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_m)))
15597svfloat32_t svamax_f32_m(svbool_t, svfloat32_t, svfloat32_t);
15598__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_m)))
15599svfloat16_t svamax_f16_m(svbool_t, svfloat16_t, svfloat16_t);
15600__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_x)))
15601svfloat64_t svamax_f64_x(svbool_t, svfloat64_t, svfloat64_t);
15602__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_x)))
15603svfloat32_t svamax_f32_x(svbool_t, svfloat32_t, svfloat32_t);
15604__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_x)))
15605svfloat16_t svamax_f16_x(svbool_t, svfloat16_t, svfloat16_t);
15606__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_z)))
15607svfloat64_t svamax_f64_z(svbool_t, svfloat64_t, svfloat64_t);
15608__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_z)))
15609svfloat32_t svamax_f32_z(svbool_t, svfloat32_t, svfloat32_t);
15610__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_z)))
15611svfloat16_t svamax_f16_z(svbool_t, svfloat16_t, svfloat16_t);
15612__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_m)))
15613svfloat64_t svamin_n_f64_m(svbool_t, svfloat64_t, float64_t);
15614__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_m)))
15615svfloat32_t svamin_n_f32_m(svbool_t, svfloat32_t, float32_t);
15616__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_m)))
15617svfloat16_t svamin_n_f16_m(svbool_t, svfloat16_t, float16_t);
15618__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_x)))
15619svfloat64_t svamin_n_f64_x(svbool_t, svfloat64_t, float64_t);
15620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_x)))
15621svfloat32_t svamin_n_f32_x(svbool_t, svfloat32_t, float32_t);
15622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_x)))
15623svfloat16_t svamin_n_f16_x(svbool_t, svfloat16_t, float16_t);
15624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_z)))
15625svfloat64_t svamin_n_f64_z(svbool_t, svfloat64_t, float64_t);
15626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_z)))
15627svfloat32_t svamin_n_f32_z(svbool_t, svfloat32_t, float32_t);
15628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_z)))
15629svfloat16_t svamin_n_f16_z(svbool_t, svfloat16_t, float16_t);
15630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_m)))
15631svfloat64_t svamin_f64_m(svbool_t, svfloat64_t, svfloat64_t);
15632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_m)))
15633svfloat32_t svamin_f32_m(svbool_t, svfloat32_t, svfloat32_t);
15634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_m)))
15635svfloat16_t svamin_f16_m(svbool_t, svfloat16_t, svfloat16_t);
15636__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_x)))
15637svfloat64_t svamin_f64_x(svbool_t, svfloat64_t, svfloat64_t);
15638__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_x)))
15639svfloat32_t svamin_f32_x(svbool_t, svfloat32_t, svfloat32_t);
15640__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_x)))
15641svfloat16_t svamin_f16_x(svbool_t, svfloat16_t, svfloat16_t);
15642__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_z)))
15643svfloat64_t svamin_f64_z(svbool_t, svfloat64_t, svfloat64_t);
15644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_z)))
15645svfloat32_t svamin_f32_z(svbool_t, svfloat32_t, svfloat32_t);
15646__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_z)))
15647svfloat16_t svamin_f16_z(svbool_t, svfloat16_t, svfloat16_t);
15648__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_m)))
15649svfloat64_t svamax_m(svbool_t, svfloat64_t, float64_t);
15650__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_m)))
15651svfloat32_t svamax_m(svbool_t, svfloat32_t, float32_t);
15652__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_m)))
15653svfloat16_t svamax_m(svbool_t, svfloat16_t, float16_t);
15654__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_x)))
15655svfloat64_t svamax_x(svbool_t, svfloat64_t, float64_t);
15656__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_x)))
15657svfloat32_t svamax_x(svbool_t, svfloat32_t, float32_t);
15658__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_x)))
15659svfloat16_t svamax_x(svbool_t, svfloat16_t, float16_t);
15660__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f64_z)))
15661svfloat64_t svamax_z(svbool_t, svfloat64_t, float64_t);
15662__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f32_z)))
15663svfloat32_t svamax_z(svbool_t, svfloat32_t, float32_t);
15664__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_n_f16_z)))
15665svfloat16_t svamax_z(svbool_t, svfloat16_t, float16_t);
15666__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_m)))
15667svfloat64_t svamax_m(svbool_t, svfloat64_t, svfloat64_t);
15668__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_m)))
15669svfloat32_t svamax_m(svbool_t, svfloat32_t, svfloat32_t);
15670__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_m)))
15671svfloat16_t svamax_m(svbool_t, svfloat16_t, svfloat16_t);
15672__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_x)))
15673svfloat64_t svamax_x(svbool_t, svfloat64_t, svfloat64_t);
15674__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_x)))
15675svfloat32_t svamax_x(svbool_t, svfloat32_t, svfloat32_t);
15676__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_x)))
15677svfloat16_t svamax_x(svbool_t, svfloat16_t, svfloat16_t);
15678__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f64_z)))
15679svfloat64_t svamax_z(svbool_t, svfloat64_t, svfloat64_t);
15680__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f32_z)))
15681svfloat32_t svamax_z(svbool_t, svfloat32_t, svfloat32_t);
15682__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamax_f16_z)))
15683svfloat16_t svamax_z(svbool_t, svfloat16_t, svfloat16_t);
15684__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_m)))
15685svfloat64_t svamin_m(svbool_t, svfloat64_t, float64_t);
15686__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_m)))
15687svfloat32_t svamin_m(svbool_t, svfloat32_t, float32_t);
15688__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_m)))
15689svfloat16_t svamin_m(svbool_t, svfloat16_t, float16_t);
15690__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_x)))
15691svfloat64_t svamin_x(svbool_t, svfloat64_t, float64_t);
15692__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_x)))
15693svfloat32_t svamin_x(svbool_t, svfloat32_t, float32_t);
15694__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_x)))
15695svfloat16_t svamin_x(svbool_t, svfloat16_t, float16_t);
15696__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f64_z)))
15697svfloat64_t svamin_z(svbool_t, svfloat64_t, float64_t);
15698__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f32_z)))
15699svfloat32_t svamin_z(svbool_t, svfloat32_t, float32_t);
15700__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_n_f16_z)))
15701svfloat16_t svamin_z(svbool_t, svfloat16_t, float16_t);
15702__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_m)))
15703svfloat64_t svamin_m(svbool_t, svfloat64_t, svfloat64_t);
15704__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_m)))
15705svfloat32_t svamin_m(svbool_t, svfloat32_t, svfloat32_t);
15706__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_m)))
15707svfloat16_t svamin_m(svbool_t, svfloat16_t, svfloat16_t);
15708__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_x)))
15709svfloat64_t svamin_x(svbool_t, svfloat64_t, svfloat64_t);
15710__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_x)))
15711svfloat32_t svamin_x(svbool_t, svfloat32_t, svfloat32_t);
15712__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_x)))
15713svfloat16_t svamin_x(svbool_t, svfloat16_t, svfloat16_t);
15714__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f64_z)))
15715svfloat64_t svamin_z(svbool_t, svfloat64_t, svfloat64_t);
15716__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f32_z)))
15717svfloat32_t svamin_z(svbool_t, svfloat32_t, svfloat32_t);
15718__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svamin_f16_z)))
15719svfloat16_t svamin_z(svbool_t, svfloat16_t, svfloat16_t);
15720__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_bf16_mf8_fpm)))
15721svbfloat16_t svcvt1_bf16_mf8_fpm(svmfloat8_t, fpm_t);
15722__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_f16_mf8_fpm)))
15723svfloat16_t svcvt1_f16_mf8_fpm(svmfloat8_t, fpm_t);
15724__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_bf16_mf8_fpm)))
15725svbfloat16_t svcvt2_bf16_mf8_fpm(svmfloat8_t, fpm_t);
15726__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_f16_mf8_fpm)))
15727svfloat16_t svcvt2_f16_mf8_fpm(svmfloat8_t, fpm_t);
15728__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_bf16_mf8_fpm)))
15729svbfloat16_t svcvtlt1_bf16_mf8_fpm(svmfloat8_t, fpm_t);
15730__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_f16_mf8_fpm)))
15731svfloat16_t svcvtlt1_f16_mf8_fpm(svmfloat8_t, fpm_t);
15732__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_bf16_mf8_fpm)))
15733svbfloat16_t svcvtlt2_bf16_mf8_fpm(svmfloat8_t, fpm_t);
15734__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_f16_mf8_fpm)))
15735svfloat16_t svcvtlt2_f16_mf8_fpm(svmfloat8_t, fpm_t);
15736__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_bf16_x2_fpm)))
15737svmfloat8_t svcvtn_mf8_bf16_x2_fpm(svbfloat16x2_t, fpm_t);
15738__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_f16_x2_fpm)))
15739svmfloat8_t svcvtn_mf8_f16_x2_fpm(svfloat16x2_t, fpm_t);
15740__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnb_mf8_f32_x2_fpm)))
15741svmfloat8_t svcvtnb_mf8_f32_x2_fpm(svfloat32x2_t, fpm_t);
15742__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_mf8_f32_x2_fpm)))
15743svmfloat8_t svcvtnt_mf8_f32_x2_fpm(svmfloat8_t, svfloat32x2_t, fpm_t);
15744__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_bf16_mf8_fpm)))
15745svbfloat16_t svcvt1_bf16_fpm(svmfloat8_t, fpm_t);
15746__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt1_f16_mf8_fpm)))
15747svfloat16_t svcvt1_f16_fpm(svmfloat8_t, fpm_t);
15748__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_bf16_mf8_fpm)))
15749svbfloat16_t svcvt2_bf16_fpm(svmfloat8_t, fpm_t);
15750__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt2_f16_mf8_fpm)))
15751svfloat16_t svcvt2_f16_fpm(svmfloat8_t, fpm_t);
15752__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_bf16_mf8_fpm)))
15753svbfloat16_t svcvtlt1_bf16_fpm(svmfloat8_t, fpm_t);
15754__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt1_f16_mf8_fpm)))
15755svfloat16_t svcvtlt1_f16_fpm(svmfloat8_t, fpm_t);
15756__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_bf16_mf8_fpm)))
15757svbfloat16_t svcvtlt2_bf16_fpm(svmfloat8_t, fpm_t);
15758__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtlt2_f16_mf8_fpm)))
15759svfloat16_t svcvtlt2_f16_fpm(svmfloat8_t, fpm_t);
15760__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_bf16_x2_fpm)))
15761svmfloat8_t svcvtn_mf8_fpm(svbfloat16x2_t, fpm_t);
15762__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_mf8_f16_x2_fpm)))
15763svmfloat8_t svcvtn_mf8_fpm(svfloat16x2_t, fpm_t);
15764__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnb_mf8_f32_x2_fpm)))
15765svmfloat8_t svcvtnb_mf8_fpm(svfloat32x2_t, fpm_t);
15766__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_mf8_f32_x2_fpm)))
15767svmfloat8_t svcvtnt_mf8_fpm(svmfloat8_t, svfloat32x2_t, fpm_t);
15768__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u8)))
15769svuint8_t svluti2_lane_u8(svuint8_t, svuint8_t, uint64_t);
15770__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s8)))
15771svint8_t svluti2_lane_s8(svint8_t, svuint8_t, uint64_t);
15772__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u16)))
15773svuint16_t svluti2_lane_u16(svuint16_t, svuint8_t, uint64_t);
15774__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_bf16)))
15775svbfloat16_t svluti2_lane_bf16(svbfloat16_t, svuint8_t, uint64_t);
15776__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_f16)))
15777svfloat16_t svluti2_lane_f16(svfloat16_t, svuint8_t, uint64_t);
15778__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s16)))
15779svint16_t svluti2_lane_s16(svint16_t, svuint8_t, uint64_t);
15780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u8)))
15781svuint8_t svluti4_lane_u8(svuint8_t, svuint8_t, uint64_t);
15782__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s8)))
15783svint8_t svluti4_lane_s8(svint8_t, svuint8_t, uint64_t);
15784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16)))
15785svuint16_t svluti4_lane_u16(svuint16_t, svuint8_t, uint64_t);
15786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16)))
15787svbfloat16_t svluti4_lane_bf16(svbfloat16_t, svuint8_t, uint64_t);
15788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16)))
15789svfloat16_t svluti4_lane_f16(svfloat16_t, svuint8_t, uint64_t);
15790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16)))
15791svint16_t svluti4_lane_s16(svint16_t, svuint8_t, uint64_t);
15792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16_x2)))
15793svuint16_t svluti4_lane_u16_x2(svuint16x2_t, svuint8_t, uint64_t);
15794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16_x2)))
15795svbfloat16_t svluti4_lane_bf16_x2(svbfloat16x2_t, svuint8_t, uint64_t);
15796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16_x2)))
15797svfloat16_t svluti4_lane_f16_x2(svfloat16x2_t, svuint8_t, uint64_t);
15798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16_x2)))
15799svint16_t svluti4_lane_s16_x2(svint16x2_t, svuint8_t, uint64_t);
15800__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u8)))
15801svuint8_t svluti2_lane(svuint8_t, svuint8_t, uint64_t);
15802__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s8)))
15803svint8_t svluti2_lane(svint8_t, svuint8_t, uint64_t);
15804__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_u16)))
15805svuint16_t svluti2_lane(svuint16_t, svuint8_t, uint64_t);
15806__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_bf16)))
15807svbfloat16_t svluti2_lane(svbfloat16_t, svuint8_t, uint64_t);
15808__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_f16)))
15809svfloat16_t svluti2_lane(svfloat16_t, svuint8_t, uint64_t);
15810__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti2_lane_s16)))
15811svint16_t svluti2_lane(svint16_t, svuint8_t, uint64_t);
15812__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u8)))
15813svuint8_t svluti4_lane(svuint8_t, svuint8_t, uint64_t);
15814__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s8)))
15815svint8_t svluti4_lane(svint8_t, svuint8_t, uint64_t);
15816__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16)))
15817svuint16_t svluti4_lane(svuint16_t, svuint8_t, uint64_t);
15818__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16)))
15819svbfloat16_t svluti4_lane(svbfloat16_t, svuint8_t, uint64_t);
15820__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16)))
15821svfloat16_t svluti4_lane(svfloat16_t, svuint8_t, uint64_t);
15822__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16)))
15823svint16_t svluti4_lane(svint16_t, svuint8_t, uint64_t);
15824__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_u16_x2)))
15825svuint16_t svluti4_lane(svuint16x2_t, svuint8_t, uint64_t);
15826__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_bf16_x2)))
15827svbfloat16_t svluti4_lane(svbfloat16x2_t, svuint8_t, uint64_t);
15828__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_f16_x2)))
15829svfloat16_t svluti4_lane(svfloat16x2_t, svuint8_t, uint64_t);
15830__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti4_lane_s16_x2)))
15831svint16_t svluti4_lane(svint16x2_t, svuint8_t, uint64_t);
15832__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmmla_f32)))
15833svfloat32_t svbfmmla_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
15834__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmmla_f32)))
15835svfloat32_t svbfmmla(svfloat32_t, svbfloat16_t, svbfloat16_t);
15836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_n_f32)))
15837svfloat32_t svbfdot_n_f32(svfloat32_t, svbfloat16_t, bfloat16_t);
15838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_f32)))
15839svfloat32_t svbfdot_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
15840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_lane_f32)))
15841svfloat32_t svbfdot_lane_f32(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
15842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_n_f32)))
15843svfloat32_t svbfmlalb_n_f32(svfloat32_t, svbfloat16_t, bfloat16_t);
15844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_f32)))
15845svfloat32_t svbfmlalb_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
15846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_lane_f32)))
15847svfloat32_t svbfmlalb_lane_f32(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
15848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_n_f32)))
15849svfloat32_t svbfmlalt_n_f32(svfloat32_t, svbfloat16_t, bfloat16_t);
15850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_f32)))
15851svfloat32_t svbfmlalt_f32(svfloat32_t, svbfloat16_t, svbfloat16_t);
15852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_lane_f32)))
15853svfloat32_t svbfmlalt_lane_f32(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
15854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_m)))
15855svbfloat16_t svcvt_bf16_f32_m(svbfloat16_t, svbool_t, svfloat32_t);
15856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_x)))
15857svbfloat16_t svcvt_bf16_f32_x(svbool_t, svfloat32_t);
15858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_z)))
15859svbfloat16_t svcvt_bf16_f32_z(svbool_t, svfloat32_t);
15860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_bf16_f32_m)))
15861svbfloat16_t svcvtnt_bf16_f32_m(svbfloat16_t, svbool_t, svfloat32_t);
15862__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_n_f32)))
15863svfloat32_t svbfdot(svfloat32_t, svbfloat16_t, bfloat16_t);
15864__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_f32)))
15865svfloat32_t svbfdot(svfloat32_t, svbfloat16_t, svbfloat16_t);
15866__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfdot_lane_f32)))
15867svfloat32_t svbfdot_lane(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
15868__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_n_f32)))
15869svfloat32_t svbfmlalb(svfloat32_t, svbfloat16_t, bfloat16_t);
15870__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_f32)))
15871svfloat32_t svbfmlalb(svfloat32_t, svbfloat16_t, svbfloat16_t);
15872__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalb_lane_f32)))
15873svfloat32_t svbfmlalb_lane(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
15874__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_n_f32)))
15875svfloat32_t svbfmlalt(svfloat32_t, svbfloat16_t, bfloat16_t);
15876__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_f32)))
15877svfloat32_t svbfmlalt(svfloat32_t, svbfloat16_t, svbfloat16_t);
15878__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbfmlalt_lane_f32)))
15879svfloat32_t svbfmlalt_lane(svfloat32_t, svbfloat16_t, svbfloat16_t, uint64_t);
15880__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_m)))
15881svbfloat16_t svcvt_bf16_m(svbfloat16_t, svbool_t, svfloat32_t);
15882__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_x)))
15883svbfloat16_t svcvt_bf16_x(svbool_t, svfloat32_t);
15884__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvt_bf16_f32_z)))
15885svbfloat16_t svcvt_bf16_z(svbool_t, svfloat32_t);
15886__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtnt_bf16_f32_m)))
15887svbfloat16_t svcvtnt_bf16_m(svbfloat16_t, svbool_t, svfloat32_t);
15888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32)))
15889svfloat32_t svmmla_f32(svfloat32_t, svfloat32_t, svfloat32_t);
15890__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32)))
15891svfloat32_t svmmla(svfloat32_t, svfloat32_t, svfloat32_t);
15892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u8)))
15893svuint8_t svld1ro_u8(svbool_t, uint8_t const *);
15894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u32)))
15895svuint32_t svld1ro_u32(svbool_t, uint32_t const *);
15896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u64)))
15897svuint64_t svld1ro_u64(svbool_t, uint64_t const *);
15898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u16)))
15899svuint16_t svld1ro_u16(svbool_t, uint16_t const *);
15900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_bf16)))
15901svbfloat16_t svld1ro_bf16(svbool_t, bfloat16_t const *);
15902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s8)))
15903svint8_t svld1ro_s8(svbool_t, int8_t const *);
15904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f64)))
15905svfloat64_t svld1ro_f64(svbool_t, float64_t const *);
15906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f32)))
15907svfloat32_t svld1ro_f32(svbool_t, float32_t const *);
15908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f16)))
15909svfloat16_t svld1ro_f16(svbool_t, float16_t const *);
15910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s32)))
15911svint32_t svld1ro_s32(svbool_t, int32_t const *);
15912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s64)))
15913svint64_t svld1ro_s64(svbool_t, int64_t const *);
15914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_mf8)))
15915svmfloat8_t svld1ro_mf8(svbool_t, mfloat8_t const *);
15916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s16)))
15917svint16_t svld1ro_s16(svbool_t, int16_t const *);
15918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f64)))
15919svfloat64_t svmmla_f64(svfloat64_t, svfloat64_t, svfloat64_t);
15920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u8)))
15921svuint8_t svtrn1q_u8(svuint8_t, svuint8_t);
15922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u32)))
15923svuint32_t svtrn1q_u32(svuint32_t, svuint32_t);
15924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u64)))
15925svuint64_t svtrn1q_u64(svuint64_t, svuint64_t);
15926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u16)))
15927svuint16_t svtrn1q_u16(svuint16_t, svuint16_t);
15928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_bf16)))
15929svbfloat16_t svtrn1q_bf16(svbfloat16_t, svbfloat16_t);
15930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s8)))
15931svint8_t svtrn1q_s8(svint8_t, svint8_t);
15932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f64)))
15933svfloat64_t svtrn1q_f64(svfloat64_t, svfloat64_t);
15934__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f32)))
15935svfloat32_t svtrn1q_f32(svfloat32_t, svfloat32_t);
15936__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f16)))
15937svfloat16_t svtrn1q_f16(svfloat16_t, svfloat16_t);
15938__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s32)))
15939svint32_t svtrn1q_s32(svint32_t, svint32_t);
15940__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s64)))
15941svint64_t svtrn1q_s64(svint64_t, svint64_t);
15942__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s16)))
15943svint16_t svtrn1q_s16(svint16_t, svint16_t);
15944__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u8)))
15945svuint8_t svtrn2q_u8(svuint8_t, svuint8_t);
15946__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u32)))
15947svuint32_t svtrn2q_u32(svuint32_t, svuint32_t);
15948__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u64)))
15949svuint64_t svtrn2q_u64(svuint64_t, svuint64_t);
15950__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u16)))
15951svuint16_t svtrn2q_u16(svuint16_t, svuint16_t);
15952__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_bf16)))
15953svbfloat16_t svtrn2q_bf16(svbfloat16_t, svbfloat16_t);
15954__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s8)))
15955svint8_t svtrn2q_s8(svint8_t, svint8_t);
15956__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f64)))
15957svfloat64_t svtrn2q_f64(svfloat64_t, svfloat64_t);
15958__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f32)))
15959svfloat32_t svtrn2q_f32(svfloat32_t, svfloat32_t);
15960__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f16)))
15961svfloat16_t svtrn2q_f16(svfloat16_t, svfloat16_t);
15962__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s32)))
15963svint32_t svtrn2q_s32(svint32_t, svint32_t);
15964__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s64)))
15965svint64_t svtrn2q_s64(svint64_t, svint64_t);
15966__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s16)))
15967svint16_t svtrn2q_s16(svint16_t, svint16_t);
15968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u8)))
15969svuint8_t svuzp1q_u8(svuint8_t, svuint8_t);
15970__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u32)))
15971svuint32_t svuzp1q_u32(svuint32_t, svuint32_t);
15972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u64)))
15973svuint64_t svuzp1q_u64(svuint64_t, svuint64_t);
15974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u16)))
15975svuint16_t svuzp1q_u16(svuint16_t, svuint16_t);
15976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_bf16)))
15977svbfloat16_t svuzp1q_bf16(svbfloat16_t, svbfloat16_t);
15978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s8)))
15979svint8_t svuzp1q_s8(svint8_t, svint8_t);
15980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f64)))
15981svfloat64_t svuzp1q_f64(svfloat64_t, svfloat64_t);
15982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f32)))
15983svfloat32_t svuzp1q_f32(svfloat32_t, svfloat32_t);
15984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f16)))
15985svfloat16_t svuzp1q_f16(svfloat16_t, svfloat16_t);
15986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s32)))
15987svint32_t svuzp1q_s32(svint32_t, svint32_t);
15988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s64)))
15989svint64_t svuzp1q_s64(svint64_t, svint64_t);
15990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s16)))
15991svint16_t svuzp1q_s16(svint16_t, svint16_t);
15992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u8)))
15993svuint8_t svuzp2q_u8(svuint8_t, svuint8_t);
15994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u32)))
15995svuint32_t svuzp2q_u32(svuint32_t, svuint32_t);
15996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u64)))
15997svuint64_t svuzp2q_u64(svuint64_t, svuint64_t);
15998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u16)))
15999svuint16_t svuzp2q_u16(svuint16_t, svuint16_t);
16000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_bf16)))
16001svbfloat16_t svuzp2q_bf16(svbfloat16_t, svbfloat16_t);
16002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s8)))
16003svint8_t svuzp2q_s8(svint8_t, svint8_t);
16004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f64)))
16005svfloat64_t svuzp2q_f64(svfloat64_t, svfloat64_t);
16006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f32)))
16007svfloat32_t svuzp2q_f32(svfloat32_t, svfloat32_t);
16008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f16)))
16009svfloat16_t svuzp2q_f16(svfloat16_t, svfloat16_t);
16010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s32)))
16011svint32_t svuzp2q_s32(svint32_t, svint32_t);
16012__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s64)))
16013svint64_t svuzp2q_s64(svint64_t, svint64_t);
16014__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s16)))
16015svint16_t svuzp2q_s16(svint16_t, svint16_t);
16016__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u8)))
16017svuint8_t svzip1q_u8(svuint8_t, svuint8_t);
16018__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u32)))
16019svuint32_t svzip1q_u32(svuint32_t, svuint32_t);
16020__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u64)))
16021svuint64_t svzip1q_u64(svuint64_t, svuint64_t);
16022__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u16)))
16023svuint16_t svzip1q_u16(svuint16_t, svuint16_t);
16024__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_bf16)))
16025svbfloat16_t svzip1q_bf16(svbfloat16_t, svbfloat16_t);
16026__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s8)))
16027svint8_t svzip1q_s8(svint8_t, svint8_t);
16028__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f64)))
16029svfloat64_t svzip1q_f64(svfloat64_t, svfloat64_t);
16030__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f32)))
16031svfloat32_t svzip1q_f32(svfloat32_t, svfloat32_t);
16032__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f16)))
16033svfloat16_t svzip1q_f16(svfloat16_t, svfloat16_t);
16034__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s32)))
16035svint32_t svzip1q_s32(svint32_t, svint32_t);
16036__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s64)))
16037svint64_t svzip1q_s64(svint64_t, svint64_t);
16038__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s16)))
16039svint16_t svzip1q_s16(svint16_t, svint16_t);
16040__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u8)))
16041svuint8_t svzip2q_u8(svuint8_t, svuint8_t);
16042__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u32)))
16043svuint32_t svzip2q_u32(svuint32_t, svuint32_t);
16044__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u64)))
16045svuint64_t svzip2q_u64(svuint64_t, svuint64_t);
16046__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u16)))
16047svuint16_t svzip2q_u16(svuint16_t, svuint16_t);
16048__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_bf16)))
16049svbfloat16_t svzip2q_bf16(svbfloat16_t, svbfloat16_t);
16050__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s8)))
16051svint8_t svzip2q_s8(svint8_t, svint8_t);
16052__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f64)))
16053svfloat64_t svzip2q_f64(svfloat64_t, svfloat64_t);
16054__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f32)))
16055svfloat32_t svzip2q_f32(svfloat32_t, svfloat32_t);
16056__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f16)))
16057svfloat16_t svzip2q_f16(svfloat16_t, svfloat16_t);
16058__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s32)))
16059svint32_t svzip2q_s32(svint32_t, svint32_t);
16060__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s64)))
16061svint64_t svzip2q_s64(svint64_t, svint64_t);
16062__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s16)))
16063svint16_t svzip2q_s16(svint16_t, svint16_t);
16064__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u8)))
16065svuint8_t svld1ro(svbool_t, uint8_t const *);
16066__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u32)))
16067svuint32_t svld1ro(svbool_t, uint32_t const *);
16068__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u64)))
16069svuint64_t svld1ro(svbool_t, uint64_t const *);
16070__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_u16)))
16071svuint16_t svld1ro(svbool_t, uint16_t const *);
16072__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_bf16)))
16073svbfloat16_t svld1ro(svbool_t, bfloat16_t const *);
16074__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s8)))
16075svint8_t svld1ro(svbool_t, int8_t const *);
16076__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f64)))
16077svfloat64_t svld1ro(svbool_t, float64_t const *);
16078__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f32)))
16079svfloat32_t svld1ro(svbool_t, float32_t const *);
16080__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_f16)))
16081svfloat16_t svld1ro(svbool_t, float16_t const *);
16082__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s32)))
16083svint32_t svld1ro(svbool_t, int32_t const *);
16084__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s64)))
16085svint64_t svld1ro(svbool_t, int64_t const *);
16086__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_mf8)))
16087svmfloat8_t svld1ro(svbool_t, mfloat8_t const *);
16088__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1ro_s16)))
16089svint16_t svld1ro(svbool_t, int16_t const *);
16090__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f64)))
16091svfloat64_t svmmla(svfloat64_t, svfloat64_t, svfloat64_t);
16092__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u8)))
16093svuint8_t svtrn1q(svuint8_t, svuint8_t);
16094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u32)))
16095svuint32_t svtrn1q(svuint32_t, svuint32_t);
16096__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u64)))
16097svuint64_t svtrn1q(svuint64_t, svuint64_t);
16098__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_u16)))
16099svuint16_t svtrn1q(svuint16_t, svuint16_t);
16100__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_bf16)))
16101svbfloat16_t svtrn1q(svbfloat16_t, svbfloat16_t);
16102__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s8)))
16103svint8_t svtrn1q(svint8_t, svint8_t);
16104__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f64)))
16105svfloat64_t svtrn1q(svfloat64_t, svfloat64_t);
16106__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f32)))
16107svfloat32_t svtrn1q(svfloat32_t, svfloat32_t);
16108__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_f16)))
16109svfloat16_t svtrn1q(svfloat16_t, svfloat16_t);
16110__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s32)))
16111svint32_t svtrn1q(svint32_t, svint32_t);
16112__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s64)))
16113svint64_t svtrn1q(svint64_t, svint64_t);
16114__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn1q_s16)))
16115svint16_t svtrn1q(svint16_t, svint16_t);
16116__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u8)))
16117svuint8_t svtrn2q(svuint8_t, svuint8_t);
16118__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u32)))
16119svuint32_t svtrn2q(svuint32_t, svuint32_t);
16120__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u64)))
16121svuint64_t svtrn2q(svuint64_t, svuint64_t);
16122__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_u16)))
16123svuint16_t svtrn2q(svuint16_t, svuint16_t);
16124__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_bf16)))
16125svbfloat16_t svtrn2q(svbfloat16_t, svbfloat16_t);
16126__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s8)))
16127svint8_t svtrn2q(svint8_t, svint8_t);
16128__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f64)))
16129svfloat64_t svtrn2q(svfloat64_t, svfloat64_t);
16130__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f32)))
16131svfloat32_t svtrn2q(svfloat32_t, svfloat32_t);
16132__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_f16)))
16133svfloat16_t svtrn2q(svfloat16_t, svfloat16_t);
16134__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s32)))
16135svint32_t svtrn2q(svint32_t, svint32_t);
16136__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s64)))
16137svint64_t svtrn2q(svint64_t, svint64_t);
16138__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svtrn2q_s16)))
16139svint16_t svtrn2q(svint16_t, svint16_t);
16140__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u8)))
16141svuint8_t svuzp1q(svuint8_t, svuint8_t);
16142__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u32)))
16143svuint32_t svuzp1q(svuint32_t, svuint32_t);
16144__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u64)))
16145svuint64_t svuzp1q(svuint64_t, svuint64_t);
16146__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_u16)))
16147svuint16_t svuzp1q(svuint16_t, svuint16_t);
16148__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_bf16)))
16149svbfloat16_t svuzp1q(svbfloat16_t, svbfloat16_t);
16150__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s8)))
16151svint8_t svuzp1q(svint8_t, svint8_t);
16152__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f64)))
16153svfloat64_t svuzp1q(svfloat64_t, svfloat64_t);
16154__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f32)))
16155svfloat32_t svuzp1q(svfloat32_t, svfloat32_t);
16156__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_f16)))
16157svfloat16_t svuzp1q(svfloat16_t, svfloat16_t);
16158__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s32)))
16159svint32_t svuzp1q(svint32_t, svint32_t);
16160__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s64)))
16161svint64_t svuzp1q(svint64_t, svint64_t);
16162__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp1q_s16)))
16163svint16_t svuzp1q(svint16_t, svint16_t);
16164__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u8)))
16165svuint8_t svuzp2q(svuint8_t, svuint8_t);
16166__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u32)))
16167svuint32_t svuzp2q(svuint32_t, svuint32_t);
16168__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u64)))
16169svuint64_t svuzp2q(svuint64_t, svuint64_t);
16170__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_u16)))
16171svuint16_t svuzp2q(svuint16_t, svuint16_t);
16172__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_bf16)))
16173svbfloat16_t svuzp2q(svbfloat16_t, svbfloat16_t);
16174__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s8)))
16175svint8_t svuzp2q(svint8_t, svint8_t);
16176__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f64)))
16177svfloat64_t svuzp2q(svfloat64_t, svfloat64_t);
16178__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f32)))
16179svfloat32_t svuzp2q(svfloat32_t, svfloat32_t);
16180__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_f16)))
16181svfloat16_t svuzp2q(svfloat16_t, svfloat16_t);
16182__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s32)))
16183svint32_t svuzp2q(svint32_t, svint32_t);
16184__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s64)))
16185svint64_t svuzp2q(svint64_t, svint64_t);
16186__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svuzp2q_s16)))
16187svint16_t svuzp2q(svint16_t, svint16_t);
16188__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u8)))
16189svuint8_t svzip1q(svuint8_t, svuint8_t);
16190__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u32)))
16191svuint32_t svzip1q(svuint32_t, svuint32_t);
16192__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u64)))
16193svuint64_t svzip1q(svuint64_t, svuint64_t);
16194__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_u16)))
16195svuint16_t svzip1q(svuint16_t, svuint16_t);
16196__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_bf16)))
16197svbfloat16_t svzip1q(svbfloat16_t, svbfloat16_t);
16198__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s8)))
16199svint8_t svzip1q(svint8_t, svint8_t);
16200__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f64)))
16201svfloat64_t svzip1q(svfloat64_t, svfloat64_t);
16202__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f32)))
16203svfloat32_t svzip1q(svfloat32_t, svfloat32_t);
16204__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_f16)))
16205svfloat16_t svzip1q(svfloat16_t, svfloat16_t);
16206__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s32)))
16207svint32_t svzip1q(svint32_t, svint32_t);
16208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s64)))
16209svint64_t svzip1q(svint64_t, svint64_t);
16210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip1q_s16)))
16211svint16_t svzip1q(svint16_t, svint16_t);
16212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u8)))
16213svuint8_t svzip2q(svuint8_t, svuint8_t);
16214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u32)))
16215svuint32_t svzip2q(svuint32_t, svuint32_t);
16216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u64)))
16217svuint64_t svzip2q(svuint64_t, svuint64_t);
16218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_u16)))
16219svuint16_t svzip2q(svuint16_t, svuint16_t);
16220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_bf16)))
16221svbfloat16_t svzip2q(svbfloat16_t, svbfloat16_t);
16222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s8)))
16223svint8_t svzip2q(svint8_t, svint8_t);
16224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f64)))
16225svfloat64_t svzip2q(svfloat64_t, svfloat64_t);
16226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f32)))
16227svfloat32_t svzip2q(svfloat32_t, svfloat32_t);
16228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_f16)))
16229svfloat16_t svzip2q(svfloat16_t, svfloat16_t);
16230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s32)))
16231svint32_t svzip2q(svint32_t, svint32_t);
16232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s64)))
16233svint64_t svzip2q(svint64_t, svint64_t);
16234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svzip2q_s16)))
16235svint16_t svzip2q(svint16_t, svint16_t);
16236__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_s32)))
16237svint32_t svmmla_s32(svint32_t, svint8_t, svint8_t);
16238__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_u32)))
16239svuint32_t svmmla_u32(svuint32_t, svuint8_t, svuint8_t);
16240__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusmmla_s32)))
16241svint32_t svusmmla_s32(svint32_t, svuint8_t, svint8_t);
16242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_s32)))
16243svint32_t svmmla(svint32_t, svint8_t, svint8_t);
16244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_u32)))
16245svuint32_t svmmla(svuint32_t, svuint8_t, svuint8_t);
16246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusmmla_s32)))
16247svint32_t svusmmla(svint32_t, svuint8_t, svint8_t);
16248__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_n_s32)))
16249svint32_t svsudot_n_s32(svint32_t, svint8_t, uint8_t);
16250__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_s32)))
16251svint32_t svsudot_s32(svint32_t, svint8_t, svuint8_t);
16252__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_lane_s32)))
16253svint32_t svsudot_lane_s32(svint32_t, svint8_t, svuint8_t, uint64_t);
16254__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_n_s32)))
16255svint32_t svusdot_n_s32(svint32_t, svuint8_t, int8_t);
16256__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_s32)))
16257svint32_t svusdot_s32(svint32_t, svuint8_t, svint8_t);
16258__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_lane_s32)))
16259svint32_t svusdot_lane_s32(svint32_t, svuint8_t, svint8_t, uint64_t);
16260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_n_s32)))
16261svint32_t svsudot(svint32_t, svint8_t, uint8_t);
16262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_s32)))
16263svint32_t svsudot(svint32_t, svint8_t, svuint8_t);
16264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsudot_lane_s32)))
16265svint32_t svsudot_lane(svint32_t, svint8_t, svuint8_t, uint64_t);
16266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_n_s32)))
16267svint32_t svusdot(svint32_t, svuint8_t, int8_t);
16268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_s32)))
16269svint32_t svusdot(svint32_t, svuint8_t, svint8_t);
16270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svusdot_lane_s32)))
16271svint32_t svusdot_lane(svint32_t, svuint8_t, svint8_t, uint64_t);
16272__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_lane_u8_x2)))
16273svuint8x2_t svaesd_lane_u8_x2(svuint8x2_t, svuint8_t, uint64_t);
16274__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_lane_u8_x4)))
16275svuint8x4_t svaesd_lane_u8_x4(svuint8x4_t, svuint8_t, uint64_t);
16276__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesdimc_lane_u8_x2)))
16277svuint8x2_t svaesdimc_lane_u8_x2(svuint8x2_t, svuint8_t, uint64_t);
16278__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesdimc_lane_u8_x4)))
16279svuint8x4_t svaesdimc_lane_u8_x4(svuint8x4_t, svuint8_t, uint64_t);
16280__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_lane_u8_x2)))
16281svuint8x2_t svaese_lane_u8_x2(svuint8x2_t, svuint8_t, uint64_t);
16282__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_lane_u8_x4)))
16283svuint8x4_t svaese_lane_u8_x4(svuint8x4_t, svuint8_t, uint64_t);
16284__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesemc_lane_u8_x2)))
16285svuint8x2_t svaesemc_lane_u8_x2(svuint8x2_t, svuint8_t, uint64_t);
16286__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesemc_lane_u8_x4)))
16287svuint8x4_t svaesemc_lane_u8_x4(svuint8x4_t, svuint8_t, uint64_t);
16288__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmlal_pair_n_u64_x2)))
16289svuint64x2_t svpmlal_pair_n_u64_x2(svuint64x2_t, svuint64_t, uint64_t);
16290__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmlal_pair_u64_x2)))
16291svuint64x2_t svpmlal_pair_u64_x2(svuint64x2_t, svuint64_t, svuint64_t);
16292__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmull_pair_n_u64_x2)))
16293svuint64x2_t svpmull_pair_n_u64_x2(svuint64_t, uint64_t);
16294__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmull_pair_u64_x2)))
16295svuint64x2_t svpmull_pair_u64_x2(svuint64_t, svuint64_t);
16296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_lane_u8_x2)))
16297svuint8x2_t svaesd_lane(svuint8x2_t, svuint8_t, uint64_t);
16298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_lane_u8_x4)))
16299svuint8x4_t svaesd_lane(svuint8x4_t, svuint8_t, uint64_t);
16300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesdimc_lane_u8_x2)))
16301svuint8x2_t svaesdimc_lane(svuint8x2_t, svuint8_t, uint64_t);
16302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesdimc_lane_u8_x4)))
16303svuint8x4_t svaesdimc_lane(svuint8x4_t, svuint8_t, uint64_t);
16304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_lane_u8_x2)))
16305svuint8x2_t svaese_lane(svuint8x2_t, svuint8_t, uint64_t);
16306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_lane_u8_x4)))
16307svuint8x4_t svaese_lane(svuint8x4_t, svuint8_t, uint64_t);
16308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesemc_lane_u8_x2)))
16309svuint8x2_t svaesemc_lane(svuint8x2_t, svuint8_t, uint64_t);
16310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesemc_lane_u8_x4)))
16311svuint8x4_t svaesemc_lane(svuint8x4_t, svuint8_t, uint64_t);
16312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmlal_pair_n_u64_x2)))
16313svuint64x2_t svpmlal_pair(svuint64x2_t, svuint64_t, uint64_t);
16314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmlal_pair_u64_x2)))
16315svuint64x2_t svpmlal_pair(svuint64x2_t, svuint64_t, svuint64_t);
16316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmull_pair_n_u64_x2)))
16317svuint64x2_t svpmull_pair(svuint64_t, uint64_t);
16318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmull_pair_u64_x2)))
16319svuint64x2_t svpmull_pair(svuint64_t, svuint64_t);
16320__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_u8)))
16321svuint8_t svaesd_u8(svuint8_t, svuint8_t);
16322__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_u8)))
16323svuint8_t svaese_u8(svuint8_t, svuint8_t);
16324__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesimc_u8)))
16325svuint8_t svaesimc_u8(svuint8_t);
16326__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesmc_u8)))
16327svuint8_t svaesmc_u8(svuint8_t);
16328__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_n_u64)))
16329svuint64_t svpmullb_pair_n_u64(svuint64_t, uint64_t);
16330__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_u64)))
16331svuint64_t svpmullb_pair_u64(svuint64_t, svuint64_t);
16332__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_n_u64)))
16333svuint64_t svpmullt_pair_n_u64(svuint64_t, uint64_t);
16334__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_u64)))
16335svuint64_t svpmullt_pair_u64(svuint64_t, svuint64_t);
16336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesd_u8)))
16337svuint8_t svaesd(svuint8_t, svuint8_t);
16338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaese_u8)))
16339svuint8_t svaese(svuint8_t, svuint8_t);
16340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesimc_u8)))
16341svuint8_t svaesimc(svuint8_t);
16342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaesmc_u8)))
16343svuint8_t svaesmc(svuint8_t);
16344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_n_u64)))
16345svuint64_t svpmullb_pair(svuint64_t, uint64_t);
16346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullb_pair_u64)))
16347svuint64_t svpmullb_pair(svuint64_t, svuint64_t);
16348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_n_u64)))
16349svuint64_t svpmullt_pair(svuint64_t, uint64_t);
16350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpmullt_pair_u64)))
16351svuint64_t svpmullt_pair(svuint64_t, svuint64_t);
16352__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_m)))
16353svbfloat16_t svadd_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16354__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_x)))
16355svbfloat16_t svadd_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16356__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_z)))
16357svbfloat16_t svadd_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16358__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_m)))
16359svbfloat16_t svadd_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16360__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_x)))
16361svbfloat16_t svadd_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16362__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_z)))
16363svbfloat16_t svadd_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16364__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svclamp_bf16)))
16365svbfloat16_t svclamp_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t);
16366__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_m)))
16367svbfloat16_t svmax_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16368__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_x)))
16369svbfloat16_t svmax_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16370__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_z)))
16371svbfloat16_t svmax_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16372__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_m)))
16373svbfloat16_t svmax_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16374__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_x)))
16375svbfloat16_t svmax_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16376__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_z)))
16377svbfloat16_t svmax_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16378__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_m)))
16379svbfloat16_t svmaxnm_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16380__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_x)))
16381svbfloat16_t svmaxnm_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16382__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_z)))
16383svbfloat16_t svmaxnm_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16384__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_m)))
16385svbfloat16_t svmaxnm_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16386__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_x)))
16387svbfloat16_t svmaxnm_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16388__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_z)))
16389svbfloat16_t svmaxnm_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16390__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_m)))
16391svbfloat16_t svmin_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16392__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_x)))
16393svbfloat16_t svmin_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16394__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_z)))
16395svbfloat16_t svmin_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16396__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_m)))
16397svbfloat16_t svmin_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16398__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_x)))
16399svbfloat16_t svmin_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16400__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_z)))
16401svbfloat16_t svmin_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16402__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_m)))
16403svbfloat16_t svminnm_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16404__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_x)))
16405svbfloat16_t svminnm_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16406__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_z)))
16407svbfloat16_t svminnm_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16408__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_m)))
16409svbfloat16_t svminnm_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16410__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_x)))
16411svbfloat16_t svminnm_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16412__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_z)))
16413svbfloat16_t svminnm_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16414__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_m)))
16415svbfloat16_t svmla_n_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16416__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_x)))
16417svbfloat16_t svmla_n_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16418__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_z)))
16419svbfloat16_t svmla_n_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16420__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_m)))
16421svbfloat16_t svmla_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16422__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_x)))
16423svbfloat16_t svmla_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16424__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_z)))
16425svbfloat16_t svmla_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16426__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_lane_bf16)))
16427svbfloat16_t svmla_lane_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
16428__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_m)))
16429svbfloat16_t svmls_n_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16430__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_x)))
16431svbfloat16_t svmls_n_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16432__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_z)))
16433svbfloat16_t svmls_n_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16434__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_m)))
16435svbfloat16_t svmls_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16436__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_x)))
16437svbfloat16_t svmls_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16438__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_z)))
16439svbfloat16_t svmls_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16440__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_lane_bf16)))
16441svbfloat16_t svmls_lane_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
16442__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_m)))
16443svbfloat16_t svmul_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16444__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_x)))
16445svbfloat16_t svmul_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16446__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_z)))
16447svbfloat16_t svmul_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16448__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_m)))
16449svbfloat16_t svmul_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16450__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x)))
16451svbfloat16_t svmul_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16452__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_z)))
16453svbfloat16_t svmul_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16454__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_lane_bf16)))
16455svbfloat16_t svmul_lane_bf16(svbfloat16_t, svbfloat16_t, uint64_t);
16456__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_m)))
16457svbfloat16_t svsub_n_bf16_m(svbool_t, svbfloat16_t, bfloat16_t);
16458__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_x)))
16459svbfloat16_t svsub_n_bf16_x(svbool_t, svbfloat16_t, bfloat16_t);
16460__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_z)))
16461svbfloat16_t svsub_n_bf16_z(svbool_t, svbfloat16_t, bfloat16_t);
16462__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_m)))
16463svbfloat16_t svsub_bf16_m(svbool_t, svbfloat16_t, svbfloat16_t);
16464__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_x)))
16465svbfloat16_t svsub_bf16_x(svbool_t, svbfloat16_t, svbfloat16_t);
16466__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_z)))
16467svbfloat16_t svsub_bf16_z(svbool_t, svbfloat16_t, svbfloat16_t);
16468__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_m)))
16469svbfloat16_t svadd_m(svbool_t, svbfloat16_t, bfloat16_t);
16470__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_x)))
16471svbfloat16_t svadd_x(svbool_t, svbfloat16_t, bfloat16_t);
16472__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_n_bf16_z)))
16473svbfloat16_t svadd_z(svbool_t, svbfloat16_t, bfloat16_t);
16474__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_m)))
16475svbfloat16_t svadd_m(svbool_t, svbfloat16_t, svbfloat16_t);
16476__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_x)))
16477svbfloat16_t svadd_x(svbool_t, svbfloat16_t, svbfloat16_t);
16478__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadd_bf16_z)))
16479svbfloat16_t svadd_z(svbool_t, svbfloat16_t, svbfloat16_t);
16480__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svclamp_bf16)))
16481svbfloat16_t svclamp(svbfloat16_t, svbfloat16_t, svbfloat16_t);
16482__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_m)))
16483svbfloat16_t svmax_m(svbool_t, svbfloat16_t, bfloat16_t);
16484__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_x)))
16485svbfloat16_t svmax_x(svbool_t, svbfloat16_t, bfloat16_t);
16486__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_n_bf16_z)))
16487svbfloat16_t svmax_z(svbool_t, svbfloat16_t, bfloat16_t);
16488__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_m)))
16489svbfloat16_t svmax_m(svbool_t, svbfloat16_t, svbfloat16_t);
16490__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_x)))
16491svbfloat16_t svmax_x(svbool_t, svbfloat16_t, svbfloat16_t);
16492__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmax_bf16_z)))
16493svbfloat16_t svmax_z(svbool_t, svbfloat16_t, svbfloat16_t);
16494__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_m)))
16495svbfloat16_t svmaxnm_m(svbool_t, svbfloat16_t, bfloat16_t);
16496__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_x)))
16497svbfloat16_t svmaxnm_x(svbool_t, svbfloat16_t, bfloat16_t);
16498__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_n_bf16_z)))
16499svbfloat16_t svmaxnm_z(svbool_t, svbfloat16_t, bfloat16_t);
16500__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_m)))
16501svbfloat16_t svmaxnm_m(svbool_t, svbfloat16_t, svbfloat16_t);
16502__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_x)))
16503svbfloat16_t svmaxnm_x(svbool_t, svbfloat16_t, svbfloat16_t);
16504__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmaxnm_bf16_z)))
16505svbfloat16_t svmaxnm_z(svbool_t, svbfloat16_t, svbfloat16_t);
16506__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_m)))
16507svbfloat16_t svmin_m(svbool_t, svbfloat16_t, bfloat16_t);
16508__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_x)))
16509svbfloat16_t svmin_x(svbool_t, svbfloat16_t, bfloat16_t);
16510__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_n_bf16_z)))
16511svbfloat16_t svmin_z(svbool_t, svbfloat16_t, bfloat16_t);
16512__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_m)))
16513svbfloat16_t svmin_m(svbool_t, svbfloat16_t, svbfloat16_t);
16514__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_x)))
16515svbfloat16_t svmin_x(svbool_t, svbfloat16_t, svbfloat16_t);
16516__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmin_bf16_z)))
16517svbfloat16_t svmin_z(svbool_t, svbfloat16_t, svbfloat16_t);
16518__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_m)))
16519svbfloat16_t svminnm_m(svbool_t, svbfloat16_t, bfloat16_t);
16520__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_x)))
16521svbfloat16_t svminnm_x(svbool_t, svbfloat16_t, bfloat16_t);
16522__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_n_bf16_z)))
16523svbfloat16_t svminnm_z(svbool_t, svbfloat16_t, bfloat16_t);
16524__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_m)))
16525svbfloat16_t svminnm_m(svbool_t, svbfloat16_t, svbfloat16_t);
16526__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_x)))
16527svbfloat16_t svminnm_x(svbool_t, svbfloat16_t, svbfloat16_t);
16528__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svminnm_bf16_z)))
16529svbfloat16_t svminnm_z(svbool_t, svbfloat16_t, svbfloat16_t);
16530__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_m)))
16531svbfloat16_t svmla_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16532__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_x)))
16533svbfloat16_t svmla_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16534__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_n_bf16_z)))
16535svbfloat16_t svmla_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16536__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_m)))
16537svbfloat16_t svmla_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16538__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_x)))
16539svbfloat16_t svmla_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16540__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_bf16_z)))
16541svbfloat16_t svmla_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16542__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmla_lane_bf16)))
16543svbfloat16_t svmla_lane(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
16544__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_m)))
16545svbfloat16_t svmls_m(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16546__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_x)))
16547svbfloat16_t svmls_x(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16548__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_n_bf16_z)))
16549svbfloat16_t svmls_z(svbool_t, svbfloat16_t, svbfloat16_t, bfloat16_t);
16550__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_m)))
16551svbfloat16_t svmls_m(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16552__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_x)))
16553svbfloat16_t svmls_x(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16554__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_bf16_z)))
16555svbfloat16_t svmls_z(svbool_t, svbfloat16_t, svbfloat16_t, svbfloat16_t);
16556__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmls_lane_bf16)))
16557svbfloat16_t svmls_lane(svbfloat16_t, svbfloat16_t, svbfloat16_t, uint64_t);
16558__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_m)))
16559svbfloat16_t svmul_m(svbool_t, svbfloat16_t, bfloat16_t);
16560__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_x)))
16561svbfloat16_t svmul_x(svbool_t, svbfloat16_t, bfloat16_t);
16562__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_n_bf16_z)))
16563svbfloat16_t svmul_z(svbool_t, svbfloat16_t, bfloat16_t);
16564__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_m)))
16565svbfloat16_t svmul_m(svbool_t, svbfloat16_t, svbfloat16_t);
16566__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_x)))
16567svbfloat16_t svmul_x(svbool_t, svbfloat16_t, svbfloat16_t);
16568__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_bf16_z)))
16569svbfloat16_t svmul_z(svbool_t, svbfloat16_t, svbfloat16_t);
16570__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_lane_bf16)))
16571svbfloat16_t svmul_lane(svbfloat16_t, svbfloat16_t, uint64_t);
16572__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_m)))
16573svbfloat16_t svsub_m(svbool_t, svbfloat16_t, bfloat16_t);
16574__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_x)))
16575svbfloat16_t svsub_x(svbool_t, svbfloat16_t, bfloat16_t);
16576__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_n_bf16_z)))
16577svbfloat16_t svsub_z(svbool_t, svbfloat16_t, bfloat16_t);
16578__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_m)))
16579svbfloat16_t svsub_m(svbool_t, svbfloat16_t, svbfloat16_t);
16580__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_x)))
16581svbfloat16_t svsub_x(svbool_t, svbfloat16_t, svbfloat16_t);
16582__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_z)))
16583svbfloat16_t svsub_z(svbool_t, svbfloat16_t, svbfloat16_t);
16584__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_m)))
16585svbfloat16_t svscale_n_bf16_m(svbool_t, svbfloat16_t, int16_t);
16586__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_x)))
16587svbfloat16_t svscale_n_bf16_x(svbool_t, svbfloat16_t, int16_t);
16588__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_z)))
16589svbfloat16_t svscale_n_bf16_z(svbool_t, svbfloat16_t, int16_t);
16590__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_m)))
16591svbfloat16_t svscale_bf16_m(svbool_t, svbfloat16_t, svint16_t);
16592__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_x)))
16593svbfloat16_t svscale_bf16_x(svbool_t, svbfloat16_t, svint16_t);
16594__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_z)))
16595svbfloat16_t svscale_bf16_z(svbool_t, svbfloat16_t, svint16_t);
16596__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_m)))
16597svbfloat16_t svscale_m(svbool_t, svbfloat16_t, int16_t);
16598__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_x)))
16599svbfloat16_t svscale_x(svbool_t, svbfloat16_t, int16_t);
16600__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_z)))
16601svbfloat16_t svscale_z(svbool_t, svbfloat16_t, int16_t);
16602__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_m)))
16603svbfloat16_t svscale_m(svbool_t, svbfloat16_t, svint16_t);
16604__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_x)))
16605svbfloat16_t svscale_x(svbool_t, svbfloat16_t, svint16_t);
16606__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_bf16_z)))
16607svbfloat16_t svscale_z(svbool_t, svbfloat16_t, svint16_t);
16608__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u8)))
16609svuint8_t svbdep_n_u8(svuint8_t, uint8_t);
16610__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u32)))
16611svuint32_t svbdep_n_u32(svuint32_t, uint32_t);
16612__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u64)))
16613svuint64_t svbdep_n_u64(svuint64_t, uint64_t);
16614__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u16)))
16615svuint16_t svbdep_n_u16(svuint16_t, uint16_t);
16616__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u8)))
16617svuint8_t svbdep_u8(svuint8_t, svuint8_t);
16618__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u32)))
16619svuint32_t svbdep_u32(svuint32_t, svuint32_t);
16620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u64)))
16621svuint64_t svbdep_u64(svuint64_t, svuint64_t);
16622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u16)))
16623svuint16_t svbdep_u16(svuint16_t, svuint16_t);
16624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u8)))
16625svuint8_t svbext_n_u8(svuint8_t, uint8_t);
16626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u32)))
16627svuint32_t svbext_n_u32(svuint32_t, uint32_t);
16628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u64)))
16629svuint64_t svbext_n_u64(svuint64_t, uint64_t);
16630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u16)))
16631svuint16_t svbext_n_u16(svuint16_t, uint16_t);
16632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u8)))
16633svuint8_t svbext_u8(svuint8_t, svuint8_t);
16634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u32)))
16635svuint32_t svbext_u32(svuint32_t, svuint32_t);
16636__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u64)))
16637svuint64_t svbext_u64(svuint64_t, svuint64_t);
16638__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u16)))
16639svuint16_t svbext_u16(svuint16_t, svuint16_t);
16640__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u8)))
16641svuint8_t svbgrp_n_u8(svuint8_t, uint8_t);
16642__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u32)))
16643svuint32_t svbgrp_n_u32(svuint32_t, uint32_t);
16644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u64)))
16645svuint64_t svbgrp_n_u64(svuint64_t, uint64_t);
16646__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u16)))
16647svuint16_t svbgrp_n_u16(svuint16_t, uint16_t);
16648__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u8)))
16649svuint8_t svbgrp_u8(svuint8_t, svuint8_t);
16650__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u32)))
16651svuint32_t svbgrp_u32(svuint32_t, svuint32_t);
16652__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u64)))
16653svuint64_t svbgrp_u64(svuint64_t, svuint64_t);
16654__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u16)))
16655svuint16_t svbgrp_u16(svuint16_t, svuint16_t);
16656__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u8)))
16657svuint8_t svbdep(svuint8_t, uint8_t);
16658__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u32)))
16659svuint32_t svbdep(svuint32_t, uint32_t);
16660__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u64)))
16661svuint64_t svbdep(svuint64_t, uint64_t);
16662__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_n_u16)))
16663svuint16_t svbdep(svuint16_t, uint16_t);
16664__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u8)))
16665svuint8_t svbdep(svuint8_t, svuint8_t);
16666__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u32)))
16667svuint32_t svbdep(svuint32_t, svuint32_t);
16668__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u64)))
16669svuint64_t svbdep(svuint64_t, svuint64_t);
16670__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbdep_u16)))
16671svuint16_t svbdep(svuint16_t, svuint16_t);
16672__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u8)))
16673svuint8_t svbext(svuint8_t, uint8_t);
16674__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u32)))
16675svuint32_t svbext(svuint32_t, uint32_t);
16676__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u64)))
16677svuint64_t svbext(svuint64_t, uint64_t);
16678__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_n_u16)))
16679svuint16_t svbext(svuint16_t, uint16_t);
16680__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u8)))
16681svuint8_t svbext(svuint8_t, svuint8_t);
16682__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u32)))
16683svuint32_t svbext(svuint32_t, svuint32_t);
16684__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u64)))
16685svuint64_t svbext(svuint64_t, svuint64_t);
16686__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbext_u16)))
16687svuint16_t svbext(svuint16_t, svuint16_t);
16688__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u8)))
16689svuint8_t svbgrp(svuint8_t, uint8_t);
16690__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u32)))
16691svuint32_t svbgrp(svuint32_t, uint32_t);
16692__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u64)))
16693svuint64_t svbgrp(svuint64_t, uint64_t);
16694__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_n_u16)))
16695svuint16_t svbgrp(svuint16_t, uint16_t);
16696__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u8)))
16697svuint8_t svbgrp(svuint8_t, svuint8_t);
16698__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u32)))
16699svuint32_t svbgrp(svuint32_t, svuint32_t);
16700__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u64)))
16701svuint64_t svbgrp(svuint64_t, svuint64_t);
16702__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svbgrp_u16)))
16703svuint16_t svbgrp(svuint16_t, svuint16_t);
16704__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32_f16)))
16705svfloat32_t svmmla_f32_f16(svfloat32_t, svfloat16_t, svfloat16_t);
16706__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32_f16)))
16707svfloat32_t svmmla(svfloat32_t, svfloat16_t, svfloat16_t);
16708__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_u64)))
16709svuint64_t svrax1_u64(svuint64_t, svuint64_t);
16710__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_s64)))
16711svint64_t svrax1_s64(svint64_t, svint64_t);
16712__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_u64)))
16713svuint64_t svrax1(svuint64_t, svuint64_t);
16714__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svrax1_s64)))
16715svint64_t svrax1(svint64_t, svint64_t);
16716__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4e_u32)))
16717svuint32_t svsm4e_u32(svuint32_t, svuint32_t);
16718__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4ekey_u32)))
16719svuint32_t svsm4ekey_u32(svuint32_t, svuint32_t);
16720__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4e_u32)))
16721svuint32_t svsm4e(svuint32_t, svuint32_t);
16722__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsm4ekey_u32)))
16723svuint32_t svsm4ekey(svuint32_t, svuint32_t);
16724__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u32_z)))
16725svuint32_t svhistcnt_u32_z(svbool_t, svuint32_t, svuint32_t);
16726__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u64_z)))
16727svuint64_t svhistcnt_u64_z(svbool_t, svuint64_t, svuint64_t);
16728__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s32_z)))
16729svuint32_t svhistcnt_s32_z(svbool_t, svint32_t, svint32_t);
16730__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s64_z)))
16731svuint64_t svhistcnt_s64_z(svbool_t, svint64_t, svint64_t);
16732__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_u8)))
16733svuint8_t svhistseg_u8(svuint8_t, svuint8_t);
16734__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_s8)))
16735svuint8_t svhistseg_s8(svint8_t, svint8_t);
16736__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_u32)))
16737svuint32_t svldnt1_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
16738__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_u64)))
16739svuint64_t svldnt1_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
16740__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_f64)))
16741svfloat64_t svldnt1_gather_u64base_index_f64(svbool_t, svuint64_t, int64_t);
16742__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_f32)))
16743svfloat32_t svldnt1_gather_u32base_index_f32(svbool_t, svuint32_t, int64_t);
16744__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_s32)))
16745svint32_t svldnt1_gather_u32base_index_s32(svbool_t, svuint32_t, int64_t);
16746__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_s64)))
16747svint64_t svldnt1_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
16748__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_u32)))
16749svuint32_t svldnt1_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
16750__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_u64)))
16751svuint64_t svldnt1_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16752__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_f64)))
16753svfloat64_t svldnt1_gather_u64base_offset_f64(svbool_t, svuint64_t, int64_t);
16754__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_f32)))
16755svfloat32_t svldnt1_gather_u32base_offset_f32(svbool_t, svuint32_t, int64_t);
16756__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_s32)))
16757svint32_t svldnt1_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
16758__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_s64)))
16759svint64_t svldnt1_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16760__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_u32)))
16761svuint32_t svldnt1_gather_u32base_u32(svbool_t, svuint32_t);
16762__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_u64)))
16763svuint64_t svldnt1_gather_u64base_u64(svbool_t, svuint64_t);
16764__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_f64)))
16765svfloat64_t svldnt1_gather_u64base_f64(svbool_t, svuint64_t);
16766__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_f32)))
16767svfloat32_t svldnt1_gather_u32base_f32(svbool_t, svuint32_t);
16768__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_s32)))
16769svint32_t svldnt1_gather_u32base_s32(svbool_t, svuint32_t);
16770__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_s64)))
16771svint64_t svldnt1_gather_u64base_s64(svbool_t, svuint64_t);
16772__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_u64)))
16773svuint64_t svldnt1_gather_s64index_u64(svbool_t, uint64_t const *, svint64_t);
16774__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_f64)))
16775svfloat64_t svldnt1_gather_s64index_f64(svbool_t, float64_t const *, svint64_t);
16776__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_s64)))
16777svint64_t svldnt1_gather_s64index_s64(svbool_t, int64_t const *, svint64_t);
16778__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_u64)))
16779svuint64_t svldnt1_gather_u64index_u64(svbool_t, uint64_t const *, svuint64_t);
16780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_f64)))
16781svfloat64_t svldnt1_gather_u64index_f64(svbool_t, float64_t const *, svuint64_t);
16782__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_s64)))
16783svint64_t svldnt1_gather_u64index_s64(svbool_t, int64_t const *, svuint64_t);
16784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_u32)))
16785svuint32_t svldnt1_gather_u32offset_u32(svbool_t, uint32_t const *, svuint32_t);
16786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_f32)))
16787svfloat32_t svldnt1_gather_u32offset_f32(svbool_t, float32_t const *, svuint32_t);
16788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_s32)))
16789svint32_t svldnt1_gather_u32offset_s32(svbool_t, int32_t const *, svuint32_t);
16790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_u64)))
16791svuint64_t svldnt1_gather_s64offset_u64(svbool_t, uint64_t const *, svint64_t);
16792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_f64)))
16793svfloat64_t svldnt1_gather_s64offset_f64(svbool_t, float64_t const *, svint64_t);
16794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_s64)))
16795svint64_t svldnt1_gather_s64offset_s64(svbool_t, int64_t const *, svint64_t);
16796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_u64)))
16797svuint64_t svldnt1_gather_u64offset_u64(svbool_t, uint64_t const *, svuint64_t);
16798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_f64)))
16799svfloat64_t svldnt1_gather_u64offset_f64(svbool_t, float64_t const *, svuint64_t);
16800__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_s64)))
16801svint64_t svldnt1_gather_u64offset_s64(svbool_t, int64_t const *, svuint64_t);
16802__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_u32)))
16803svuint32_t svldnt1sb_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
16804__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_u64)))
16805svuint64_t svldnt1sb_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_s32)))
16807svint32_t svldnt1sb_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
16808__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_s64)))
16809svint64_t svldnt1sb_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16810__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_u32)))
16811svuint32_t svldnt1sb_gather_u32base_u32(svbool_t, svuint32_t);
16812__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_u64)))
16813svuint64_t svldnt1sb_gather_u64base_u64(svbool_t, svuint64_t);
16814__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_s32)))
16815svint32_t svldnt1sb_gather_u32base_s32(svbool_t, svuint32_t);
16816__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_s64)))
16817svint64_t svldnt1sb_gather_u64base_s64(svbool_t, svuint64_t);
16818__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_u32)))
16819svuint32_t svldnt1sb_gather_u32offset_u32(svbool_t, int8_t const *, svuint32_t);
16820__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_s32)))
16821svint32_t svldnt1sb_gather_u32offset_s32(svbool_t, int8_t const *, svuint32_t);
16822__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_u64)))
16823svuint64_t svldnt1sb_gather_s64offset_u64(svbool_t, int8_t const *, svint64_t);
16824__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_s64)))
16825svint64_t svldnt1sb_gather_s64offset_s64(svbool_t, int8_t const *, svint64_t);
16826__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_u64)))
16827svuint64_t svldnt1sb_gather_u64offset_u64(svbool_t, int8_t const *, svuint64_t);
16828__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_s64)))
16829svint64_t svldnt1sb_gather_u64offset_s64(svbool_t, int8_t const *, svuint64_t);
16830__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_u32)))
16831svuint32_t svldnt1sh_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
16832__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_u64)))
16833svuint64_t svldnt1sh_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
16834__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_s32)))
16835svint32_t svldnt1sh_gather_u32base_index_s32(svbool_t, svuint32_t, int64_t);
16836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_s64)))
16837svint64_t svldnt1sh_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
16838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_u32)))
16839svuint32_t svldnt1sh_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
16840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_u64)))
16841svuint64_t svldnt1sh_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_s32)))
16843svint32_t svldnt1sh_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
16844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_s64)))
16845svint64_t svldnt1sh_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_u32)))
16847svuint32_t svldnt1sh_gather_u32base_u32(svbool_t, svuint32_t);
16848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_u64)))
16849svuint64_t svldnt1sh_gather_u64base_u64(svbool_t, svuint64_t);
16850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_s32)))
16851svint32_t svldnt1sh_gather_u32base_s32(svbool_t, svuint32_t);
16852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_s64)))
16853svint64_t svldnt1sh_gather_u64base_s64(svbool_t, svuint64_t);
16854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_u64)))
16855svuint64_t svldnt1sh_gather_s64index_u64(svbool_t, int16_t const *, svint64_t);
16856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_s64)))
16857svint64_t svldnt1sh_gather_s64index_s64(svbool_t, int16_t const *, svint64_t);
16858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_u64)))
16859svuint64_t svldnt1sh_gather_u64index_u64(svbool_t, int16_t const *, svuint64_t);
16860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_s64)))
16861svint64_t svldnt1sh_gather_u64index_s64(svbool_t, int16_t const *, svuint64_t);
16862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_u32)))
16863svuint32_t svldnt1sh_gather_u32offset_u32(svbool_t, int16_t const *, svuint32_t);
16864__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_s32)))
16865svint32_t svldnt1sh_gather_u32offset_s32(svbool_t, int16_t const *, svuint32_t);
16866__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_u64)))
16867svuint64_t svldnt1sh_gather_s64offset_u64(svbool_t, int16_t const *, svint64_t);
16868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_s64)))
16869svint64_t svldnt1sh_gather_s64offset_s64(svbool_t, int16_t const *, svint64_t);
16870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_u64)))
16871svuint64_t svldnt1sh_gather_u64offset_u64(svbool_t, int16_t const *, svuint64_t);
16872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_s64)))
16873svint64_t svldnt1sh_gather_u64offset_s64(svbool_t, int16_t const *, svuint64_t);
16874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_u64)))
16875svuint64_t svldnt1sw_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
16876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_s64)))
16877svint64_t svldnt1sw_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
16878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_u64)))
16879svuint64_t svldnt1sw_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_s64)))
16881svint64_t svldnt1sw_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_u64)))
16883svuint64_t svldnt1sw_gather_u64base_u64(svbool_t, svuint64_t);
16884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_s64)))
16885svint64_t svldnt1sw_gather_u64base_s64(svbool_t, svuint64_t);
16886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_u64)))
16887svuint64_t svldnt1sw_gather_s64index_u64(svbool_t, int32_t const *, svint64_t);
16888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_s64)))
16889svint64_t svldnt1sw_gather_s64index_s64(svbool_t, int32_t const *, svint64_t);
16890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_u64)))
16891svuint64_t svldnt1sw_gather_u64index_u64(svbool_t, int32_t const *, svuint64_t);
16892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_s64)))
16893svint64_t svldnt1sw_gather_u64index_s64(svbool_t, int32_t const *, svuint64_t);
16894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_u64)))
16895svuint64_t svldnt1sw_gather_s64offset_u64(svbool_t, int32_t const *, svint64_t);
16896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_s64)))
16897svint64_t svldnt1sw_gather_s64offset_s64(svbool_t, int32_t const *, svint64_t);
16898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_u64)))
16899svuint64_t svldnt1sw_gather_u64offset_u64(svbool_t, int32_t const *, svuint64_t);
16900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_s64)))
16901svint64_t svldnt1sw_gather_u64offset_s64(svbool_t, int32_t const *, svuint64_t);
16902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_u32)))
16903svuint32_t svldnt1ub_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
16904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_u64)))
16905svuint64_t svldnt1ub_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_s32)))
16907svint32_t svldnt1ub_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
16908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_s64)))
16909svint64_t svldnt1ub_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_u32)))
16911svuint32_t svldnt1ub_gather_u32base_u32(svbool_t, svuint32_t);
16912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_u64)))
16913svuint64_t svldnt1ub_gather_u64base_u64(svbool_t, svuint64_t);
16914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_s32)))
16915svint32_t svldnt1ub_gather_u32base_s32(svbool_t, svuint32_t);
16916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_s64)))
16917svint64_t svldnt1ub_gather_u64base_s64(svbool_t, svuint64_t);
16918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_u32)))
16919svuint32_t svldnt1ub_gather_u32offset_u32(svbool_t, uint8_t const *, svuint32_t);
16920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_s32)))
16921svint32_t svldnt1ub_gather_u32offset_s32(svbool_t, uint8_t const *, svuint32_t);
16922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_u64)))
16923svuint64_t svldnt1ub_gather_s64offset_u64(svbool_t, uint8_t const *, svint64_t);
16924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_s64)))
16925svint64_t svldnt1ub_gather_s64offset_s64(svbool_t, uint8_t const *, svint64_t);
16926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_u64)))
16927svuint64_t svldnt1ub_gather_u64offset_u64(svbool_t, uint8_t const *, svuint64_t);
16928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_s64)))
16929svint64_t svldnt1ub_gather_u64offset_s64(svbool_t, uint8_t const *, svuint64_t);
16930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_u32)))
16931svuint32_t svldnt1uh_gather_u32base_index_u32(svbool_t, svuint32_t, int64_t);
16932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_u64)))
16933svuint64_t svldnt1uh_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
16934__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_s32)))
16935svint32_t svldnt1uh_gather_u32base_index_s32(svbool_t, svuint32_t, int64_t);
16936__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_s64)))
16937svint64_t svldnt1uh_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
16938__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_u32)))
16939svuint32_t svldnt1uh_gather_u32base_offset_u32(svbool_t, svuint32_t, int64_t);
16940__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_u64)))
16941svuint64_t svldnt1uh_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16942__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_s32)))
16943svint32_t svldnt1uh_gather_u32base_offset_s32(svbool_t, svuint32_t, int64_t);
16944__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_s64)))
16945svint64_t svldnt1uh_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16946__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_u32)))
16947svuint32_t svldnt1uh_gather_u32base_u32(svbool_t, svuint32_t);
16948__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_u64)))
16949svuint64_t svldnt1uh_gather_u64base_u64(svbool_t, svuint64_t);
16950__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_s32)))
16951svint32_t svldnt1uh_gather_u32base_s32(svbool_t, svuint32_t);
16952__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_s64)))
16953svint64_t svldnt1uh_gather_u64base_s64(svbool_t, svuint64_t);
16954__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_u64)))
16955svuint64_t svldnt1uh_gather_s64index_u64(svbool_t, uint16_t const *, svint64_t);
16956__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_s64)))
16957svint64_t svldnt1uh_gather_s64index_s64(svbool_t, uint16_t const *, svint64_t);
16958__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_u64)))
16959svuint64_t svldnt1uh_gather_u64index_u64(svbool_t, uint16_t const *, svuint64_t);
16960__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_s64)))
16961svint64_t svldnt1uh_gather_u64index_s64(svbool_t, uint16_t const *, svuint64_t);
16962__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_u32)))
16963svuint32_t svldnt1uh_gather_u32offset_u32(svbool_t, uint16_t const *, svuint32_t);
16964__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_s32)))
16965svint32_t svldnt1uh_gather_u32offset_s32(svbool_t, uint16_t const *, svuint32_t);
16966__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_u64)))
16967svuint64_t svldnt1uh_gather_s64offset_u64(svbool_t, uint16_t const *, svint64_t);
16968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_s64)))
16969svint64_t svldnt1uh_gather_s64offset_s64(svbool_t, uint16_t const *, svint64_t);
16970__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_u64)))
16971svuint64_t svldnt1uh_gather_u64offset_u64(svbool_t, uint16_t const *, svuint64_t);
16972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_s64)))
16973svint64_t svldnt1uh_gather_u64offset_s64(svbool_t, uint16_t const *, svuint64_t);
16974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_u64)))
16975svuint64_t svldnt1uw_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
16976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_s64)))
16977svint64_t svldnt1uw_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
16978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_u64)))
16979svuint64_t svldnt1uw_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
16980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_s64)))
16981svint64_t svldnt1uw_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
16982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_u64)))
16983svuint64_t svldnt1uw_gather_u64base_u64(svbool_t, svuint64_t);
16984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_s64)))
16985svint64_t svldnt1uw_gather_u64base_s64(svbool_t, svuint64_t);
16986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_u64)))
16987svuint64_t svldnt1uw_gather_s64index_u64(svbool_t, uint32_t const *, svint64_t);
16988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_s64)))
16989svint64_t svldnt1uw_gather_s64index_s64(svbool_t, uint32_t const *, svint64_t);
16990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_u64)))
16991svuint64_t svldnt1uw_gather_u64index_u64(svbool_t, uint32_t const *, svuint64_t);
16992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_s64)))
16993svint64_t svldnt1uw_gather_u64index_s64(svbool_t, uint32_t const *, svuint64_t);
16994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_u64)))
16995svuint64_t svldnt1uw_gather_s64offset_u64(svbool_t, uint32_t const *, svint64_t);
16996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_s64)))
16997svint64_t svldnt1uw_gather_s64offset_s64(svbool_t, uint32_t const *, svint64_t);
16998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_u64)))
16999svuint64_t svldnt1uw_gather_u64offset_u64(svbool_t, uint32_t const *, svuint64_t);
17000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_s64)))
17001svint64_t svldnt1uw_gather_u64offset_s64(svbool_t, uint32_t const *, svuint64_t);
17002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u8)))
17003svbool_t svmatch_u8(svbool_t, svuint8_t, svuint8_t);
17004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u16)))
17005svbool_t svmatch_u16(svbool_t, svuint16_t, svuint16_t);
17006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s8)))
17007svbool_t svmatch_s8(svbool_t, svint8_t, svint8_t);
17008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s16)))
17009svbool_t svmatch_s16(svbool_t, svint16_t, svint16_t);
17010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u8)))
17011svbool_t svnmatch_u8(svbool_t, svuint8_t, svuint8_t);
17012__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u16)))
17013svbool_t svnmatch_u16(svbool_t, svuint16_t, svuint16_t);
17014__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s8)))
17015svbool_t svnmatch_s8(svbool_t, svint8_t, svint8_t);
17016__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s16)))
17017svbool_t svnmatch_s16(svbool_t, svint16_t, svint16_t);
17018__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_u32)))
17019void svstnt1_scatter_u32base_index_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
17020__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_u64)))
17021void svstnt1_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17022__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_f64)))
17023void svstnt1_scatter_u64base_index_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
17024__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_f32)))
17025void svstnt1_scatter_u32base_index_f32(svbool_t, svuint32_t, int64_t, svfloat32_t);
17026__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_s32)))
17027void svstnt1_scatter_u32base_index_s32(svbool_t, svuint32_t, int64_t, svint32_t);
17028__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_s64)))
17029void svstnt1_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17030__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_u32)))
17031void svstnt1_scatter_u32base_offset_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
17032__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_u64)))
17033void svstnt1_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17034__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_f64)))
17035void svstnt1_scatter_u64base_offset_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
17036__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_f32)))
17037void svstnt1_scatter_u32base_offset_f32(svbool_t, svuint32_t, int64_t, svfloat32_t);
17038__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_s32)))
17039void svstnt1_scatter_u32base_offset_s32(svbool_t, svuint32_t, int64_t, svint32_t);
17040__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_s64)))
17041void svstnt1_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17042__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_u32)))
17043void svstnt1_scatter_u32base_u32(svbool_t, svuint32_t, svuint32_t);
17044__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_u64)))
17045void svstnt1_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
17046__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_f64)))
17047void svstnt1_scatter_u64base_f64(svbool_t, svuint64_t, svfloat64_t);
17048__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_f32)))
17049void svstnt1_scatter_u32base_f32(svbool_t, svuint32_t, svfloat32_t);
17050__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_s32)))
17051void svstnt1_scatter_u32base_s32(svbool_t, svuint32_t, svint32_t);
17052__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_s64)))
17053void svstnt1_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
17054__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_u64)))
17055void svstnt1_scatter_s64index_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
17056__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_f64)))
17057void svstnt1_scatter_s64index_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
17058__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_s64)))
17059void svstnt1_scatter_s64index_s64(svbool_t, int64_t *, svint64_t, svint64_t);
17060__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_u64)))
17061void svstnt1_scatter_u64index_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
17062__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_f64)))
17063void svstnt1_scatter_u64index_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
17064__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_s64)))
17065void svstnt1_scatter_u64index_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
17066__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_u32)))
17067void svstnt1_scatter_u32offset_u32(svbool_t, uint32_t *, svuint32_t, svuint32_t);
17068__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_f32)))
17069void svstnt1_scatter_u32offset_f32(svbool_t, float32_t *, svuint32_t, svfloat32_t);
17070__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_s32)))
17071void svstnt1_scatter_u32offset_s32(svbool_t, int32_t *, svuint32_t, svint32_t);
17072__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_u64)))
17073void svstnt1_scatter_s64offset_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
17074__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_f64)))
17075void svstnt1_scatter_s64offset_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
17076__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_s64)))
17077void svstnt1_scatter_s64offset_s64(svbool_t, int64_t *, svint64_t, svint64_t);
17078__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_u64)))
17079void svstnt1_scatter_u64offset_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
17080__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_f64)))
17081void svstnt1_scatter_u64offset_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
17082__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_s64)))
17083void svstnt1_scatter_u64offset_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
17084__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_u32)))
17085void svstnt1b_scatter_u32base_offset_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
17086__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_u64)))
17087void svstnt1b_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17088__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_s32)))
17089void svstnt1b_scatter_u32base_offset_s32(svbool_t, svuint32_t, int64_t, svint32_t);
17090__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_s64)))
17091void svstnt1b_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17092__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_u32)))
17093void svstnt1b_scatter_u32base_u32(svbool_t, svuint32_t, svuint32_t);
17094__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_u64)))
17095void svstnt1b_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
17096__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_s32)))
17097void svstnt1b_scatter_u32base_s32(svbool_t, svuint32_t, svint32_t);
17098__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_s64)))
17099void svstnt1b_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
17100__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_s32)))
17101void svstnt1b_scatter_u32offset_s32(svbool_t, int8_t *, svuint32_t, svint32_t);
17102__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_u32)))
17103void svstnt1b_scatter_u32offset_u32(svbool_t, uint8_t *, svuint32_t, svuint32_t);
17104__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_s64)))
17105void svstnt1b_scatter_s64offset_s64(svbool_t, int8_t *, svint64_t, svint64_t);
17106__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_u64)))
17107void svstnt1b_scatter_s64offset_u64(svbool_t, uint8_t *, svint64_t, svuint64_t);
17108__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_s64)))
17109void svstnt1b_scatter_u64offset_s64(svbool_t, int8_t *, svuint64_t, svint64_t);
17110__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_u64)))
17111void svstnt1b_scatter_u64offset_u64(svbool_t, uint8_t *, svuint64_t, svuint64_t);
17112__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_u32)))
17113void svstnt1h_scatter_u32base_index_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
17114__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_u64)))
17115void svstnt1h_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17116__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_s32)))
17117void svstnt1h_scatter_u32base_index_s32(svbool_t, svuint32_t, int64_t, svint32_t);
17118__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_s64)))
17119void svstnt1h_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17120__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_u32)))
17121void svstnt1h_scatter_u32base_offset_u32(svbool_t, svuint32_t, int64_t, svuint32_t);
17122__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_u64)))
17123void svstnt1h_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17124__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_s32)))
17125void svstnt1h_scatter_u32base_offset_s32(svbool_t, svuint32_t, int64_t, svint32_t);
17126__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_s64)))
17127void svstnt1h_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17128__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_u32)))
17129void svstnt1h_scatter_u32base_u32(svbool_t, svuint32_t, svuint32_t);
17130__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_u64)))
17131void svstnt1h_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
17132__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_s32)))
17133void svstnt1h_scatter_u32base_s32(svbool_t, svuint32_t, svint32_t);
17134__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_s64)))
17135void svstnt1h_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
17136__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_s64)))
17137void svstnt1h_scatter_s64index_s64(svbool_t, int16_t *, svint64_t, svint64_t);
17138__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_u64)))
17139void svstnt1h_scatter_s64index_u64(svbool_t, uint16_t *, svint64_t, svuint64_t);
17140__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_s64)))
17141void svstnt1h_scatter_u64index_s64(svbool_t, int16_t *, svuint64_t, svint64_t);
17142__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_u64)))
17143void svstnt1h_scatter_u64index_u64(svbool_t, uint16_t *, svuint64_t, svuint64_t);
17144__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_s32)))
17145void svstnt1h_scatter_u32offset_s32(svbool_t, int16_t *, svuint32_t, svint32_t);
17146__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_u32)))
17147void svstnt1h_scatter_u32offset_u32(svbool_t, uint16_t *, svuint32_t, svuint32_t);
17148__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_s64)))
17149void svstnt1h_scatter_s64offset_s64(svbool_t, int16_t *, svint64_t, svint64_t);
17150__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_u64)))
17151void svstnt1h_scatter_s64offset_u64(svbool_t, uint16_t *, svint64_t, svuint64_t);
17152__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_s64)))
17153void svstnt1h_scatter_u64offset_s64(svbool_t, int16_t *, svuint64_t, svint64_t);
17154__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_u64)))
17155void svstnt1h_scatter_u64offset_u64(svbool_t, uint16_t *, svuint64_t, svuint64_t);
17156__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_u64)))
17157void svstnt1w_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17158__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_s64)))
17159void svstnt1w_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17160__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_u64)))
17161void svstnt1w_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17162__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_s64)))
17163void svstnt1w_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17164__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_u64)))
17165void svstnt1w_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
17166__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_s64)))
17167void svstnt1w_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
17168__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_s64)))
17169void svstnt1w_scatter_s64index_s64(svbool_t, int32_t *, svint64_t, svint64_t);
17170__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_u64)))
17171void svstnt1w_scatter_s64index_u64(svbool_t, uint32_t *, svint64_t, svuint64_t);
17172__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_s64)))
17173void svstnt1w_scatter_u64index_s64(svbool_t, int32_t *, svuint64_t, svint64_t);
17174__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_u64)))
17175void svstnt1w_scatter_u64index_u64(svbool_t, uint32_t *, svuint64_t, svuint64_t);
17176__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_s64)))
17177void svstnt1w_scatter_s64offset_s64(svbool_t, int32_t *, svint64_t, svint64_t);
17178__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_u64)))
17179void svstnt1w_scatter_s64offset_u64(svbool_t, uint32_t *, svint64_t, svuint64_t);
17180__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_s64)))
17181void svstnt1w_scatter_u64offset_s64(svbool_t, int32_t *, svuint64_t, svint64_t);
17182__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_u64)))
17183void svstnt1w_scatter_u64offset_u64(svbool_t, uint32_t *, svuint64_t, svuint64_t);
17184__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u32_z)))
17185svuint32_t svhistcnt_z(svbool_t, svuint32_t, svuint32_t);
17186__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_u64_z)))
17187svuint64_t svhistcnt_z(svbool_t, svuint64_t, svuint64_t);
17188__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s32_z)))
17189svuint32_t svhistcnt_z(svbool_t, svint32_t, svint32_t);
17190__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistcnt_s64_z)))
17191svuint64_t svhistcnt_z(svbool_t, svint64_t, svint64_t);
17192__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_u8)))
17193svuint8_t svhistseg(svuint8_t, svuint8_t);
17194__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svhistseg_s8)))
17195svuint8_t svhistseg(svint8_t, svint8_t);
17196__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_u32)))
17197svuint32_t svldnt1_gather_index_u32(svbool_t, svuint32_t, int64_t);
17198__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_u64)))
17199svuint64_t svldnt1_gather_index_u64(svbool_t, svuint64_t, int64_t);
17200__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_f64)))
17201svfloat64_t svldnt1_gather_index_f64(svbool_t, svuint64_t, int64_t);
17202__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_f32)))
17203svfloat32_t svldnt1_gather_index_f32(svbool_t, svuint32_t, int64_t);
17204__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_index_s32)))
17205svint32_t svldnt1_gather_index_s32(svbool_t, svuint32_t, int64_t);
17206__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_index_s64)))
17207svint64_t svldnt1_gather_index_s64(svbool_t, svuint64_t, int64_t);
17208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_u32)))
17209svuint32_t svldnt1_gather_offset_u32(svbool_t, svuint32_t, int64_t);
17210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_u64)))
17211svuint64_t svldnt1_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_f64)))
17213svfloat64_t svldnt1_gather_offset_f64(svbool_t, svuint64_t, int64_t);
17214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_f32)))
17215svfloat32_t svldnt1_gather_offset_f32(svbool_t, svuint32_t, int64_t);
17216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_offset_s32)))
17217svint32_t svldnt1_gather_offset_s32(svbool_t, svuint32_t, int64_t);
17218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_offset_s64)))
17219svint64_t svldnt1_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_u32)))
17221svuint32_t svldnt1_gather_u32(svbool_t, svuint32_t);
17222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_u64)))
17223svuint64_t svldnt1_gather_u64(svbool_t, svuint64_t);
17224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_f64)))
17225svfloat64_t svldnt1_gather_f64(svbool_t, svuint64_t);
17226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_f32)))
17227svfloat32_t svldnt1_gather_f32(svbool_t, svuint32_t);
17228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32base_s32)))
17229svint32_t svldnt1_gather_s32(svbool_t, svuint32_t);
17230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64base_s64)))
17231svint64_t svldnt1_gather_s64(svbool_t, svuint64_t);
17232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_u64)))
17233svuint64_t svldnt1_gather_index(svbool_t, uint64_t const *, svint64_t);
17234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_f64)))
17235svfloat64_t svldnt1_gather_index(svbool_t, float64_t const *, svint64_t);
17236__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64index_s64)))
17237svint64_t svldnt1_gather_index(svbool_t, int64_t const *, svint64_t);
17238__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_u64)))
17239svuint64_t svldnt1_gather_index(svbool_t, uint64_t const *, svuint64_t);
17240__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_f64)))
17241svfloat64_t svldnt1_gather_index(svbool_t, float64_t const *, svuint64_t);
17242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64index_s64)))
17243svint64_t svldnt1_gather_index(svbool_t, int64_t const *, svuint64_t);
17244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_u32)))
17245svuint32_t svldnt1_gather_offset(svbool_t, uint32_t const *, svuint32_t);
17246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_f32)))
17247svfloat32_t svldnt1_gather_offset(svbool_t, float32_t const *, svuint32_t);
17248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u32offset_s32)))
17249svint32_t svldnt1_gather_offset(svbool_t, int32_t const *, svuint32_t);
17250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_u64)))
17251svuint64_t svldnt1_gather_offset(svbool_t, uint64_t const *, svint64_t);
17252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_f64)))
17253svfloat64_t svldnt1_gather_offset(svbool_t, float64_t const *, svint64_t);
17254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_s64offset_s64)))
17255svint64_t svldnt1_gather_offset(svbool_t, int64_t const *, svint64_t);
17256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_u64)))
17257svuint64_t svldnt1_gather_offset(svbool_t, uint64_t const *, svuint64_t);
17258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_f64)))
17259svfloat64_t svldnt1_gather_offset(svbool_t, float64_t const *, svuint64_t);
17260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_gather_u64offset_s64)))
17261svint64_t svldnt1_gather_offset(svbool_t, int64_t const *, svuint64_t);
17262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_u32)))
17263svuint32_t svldnt1sb_gather_offset_u32(svbool_t, svuint32_t, int64_t);
17264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_u64)))
17265svuint64_t svldnt1sb_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_offset_s32)))
17267svint32_t svldnt1sb_gather_offset_s32(svbool_t, svuint32_t, int64_t);
17268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_offset_s64)))
17269svint64_t svldnt1sb_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_u32)))
17271svuint32_t svldnt1sb_gather_u32(svbool_t, svuint32_t);
17272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_u64)))
17273svuint64_t svldnt1sb_gather_u64(svbool_t, svuint64_t);
17274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32base_s32)))
17275svint32_t svldnt1sb_gather_s32(svbool_t, svuint32_t);
17276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64base_s64)))
17277svint64_t svldnt1sb_gather_s64(svbool_t, svuint64_t);
17278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_u32)))
17279svuint32_t svldnt1sb_gather_offset_u32(svbool_t, int8_t const *, svuint32_t);
17280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u32offset_s32)))
17281svint32_t svldnt1sb_gather_offset_s32(svbool_t, int8_t const *, svuint32_t);
17282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_u64)))
17283svuint64_t svldnt1sb_gather_offset_u64(svbool_t, int8_t const *, svint64_t);
17284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_s64offset_s64)))
17285svint64_t svldnt1sb_gather_offset_s64(svbool_t, int8_t const *, svint64_t);
17286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_u64)))
17287svuint64_t svldnt1sb_gather_offset_u64(svbool_t, int8_t const *, svuint64_t);
17288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sb_gather_u64offset_s64)))
17289svint64_t svldnt1sb_gather_offset_s64(svbool_t, int8_t const *, svuint64_t);
17290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_u32)))
17291svuint32_t svldnt1sh_gather_index_u32(svbool_t, svuint32_t, int64_t);
17292__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_u64)))
17293svuint64_t svldnt1sh_gather_index_u64(svbool_t, svuint64_t, int64_t);
17294__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_index_s32)))
17295svint32_t svldnt1sh_gather_index_s32(svbool_t, svuint32_t, int64_t);
17296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_index_s64)))
17297svint64_t svldnt1sh_gather_index_s64(svbool_t, svuint64_t, int64_t);
17298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_u32)))
17299svuint32_t svldnt1sh_gather_offset_u32(svbool_t, svuint32_t, int64_t);
17300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_u64)))
17301svuint64_t svldnt1sh_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_offset_s32)))
17303svint32_t svldnt1sh_gather_offset_s32(svbool_t, svuint32_t, int64_t);
17304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_offset_s64)))
17305svint64_t svldnt1sh_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_u32)))
17307svuint32_t svldnt1sh_gather_u32(svbool_t, svuint32_t);
17308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_u64)))
17309svuint64_t svldnt1sh_gather_u64(svbool_t, svuint64_t);
17310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32base_s32)))
17311svint32_t svldnt1sh_gather_s32(svbool_t, svuint32_t);
17312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64base_s64)))
17313svint64_t svldnt1sh_gather_s64(svbool_t, svuint64_t);
17314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_u64)))
17315svuint64_t svldnt1sh_gather_index_u64(svbool_t, int16_t const *, svint64_t);
17316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64index_s64)))
17317svint64_t svldnt1sh_gather_index_s64(svbool_t, int16_t const *, svint64_t);
17318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_u64)))
17319svuint64_t svldnt1sh_gather_index_u64(svbool_t, int16_t const *, svuint64_t);
17320__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64index_s64)))
17321svint64_t svldnt1sh_gather_index_s64(svbool_t, int16_t const *, svuint64_t);
17322__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_u32)))
17323svuint32_t svldnt1sh_gather_offset_u32(svbool_t, int16_t const *, svuint32_t);
17324__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u32offset_s32)))
17325svint32_t svldnt1sh_gather_offset_s32(svbool_t, int16_t const *, svuint32_t);
17326__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_u64)))
17327svuint64_t svldnt1sh_gather_offset_u64(svbool_t, int16_t const *, svint64_t);
17328__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_s64offset_s64)))
17329svint64_t svldnt1sh_gather_offset_s64(svbool_t, int16_t const *, svint64_t);
17330__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_u64)))
17331svuint64_t svldnt1sh_gather_offset_u64(svbool_t, int16_t const *, svuint64_t);
17332__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sh_gather_u64offset_s64)))
17333svint64_t svldnt1sh_gather_offset_s64(svbool_t, int16_t const *, svuint64_t);
17334__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_u64)))
17335svuint64_t svldnt1sw_gather_index_u64(svbool_t, svuint64_t, int64_t);
17336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_index_s64)))
17337svint64_t svldnt1sw_gather_index_s64(svbool_t, svuint64_t, int64_t);
17338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_u64)))
17339svuint64_t svldnt1sw_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_offset_s64)))
17341svint64_t svldnt1sw_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_u64)))
17343svuint64_t svldnt1sw_gather_u64(svbool_t, svuint64_t);
17344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64base_s64)))
17345svint64_t svldnt1sw_gather_s64(svbool_t, svuint64_t);
17346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_u64)))
17347svuint64_t svldnt1sw_gather_index_u64(svbool_t, int32_t const *, svint64_t);
17348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64index_s64)))
17349svint64_t svldnt1sw_gather_index_s64(svbool_t, int32_t const *, svint64_t);
17350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_u64)))
17351svuint64_t svldnt1sw_gather_index_u64(svbool_t, int32_t const *, svuint64_t);
17352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64index_s64)))
17353svint64_t svldnt1sw_gather_index_s64(svbool_t, int32_t const *, svuint64_t);
17354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_u64)))
17355svuint64_t svldnt1sw_gather_offset_u64(svbool_t, int32_t const *, svint64_t);
17356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_s64offset_s64)))
17357svint64_t svldnt1sw_gather_offset_s64(svbool_t, int32_t const *, svint64_t);
17358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_u64)))
17359svuint64_t svldnt1sw_gather_offset_u64(svbool_t, int32_t const *, svuint64_t);
17360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1sw_gather_u64offset_s64)))
17361svint64_t svldnt1sw_gather_offset_s64(svbool_t, int32_t const *, svuint64_t);
17362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_u32)))
17363svuint32_t svldnt1ub_gather_offset_u32(svbool_t, svuint32_t, int64_t);
17364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_u64)))
17365svuint64_t svldnt1ub_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_offset_s32)))
17367svint32_t svldnt1ub_gather_offset_s32(svbool_t, svuint32_t, int64_t);
17368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_offset_s64)))
17369svint64_t svldnt1ub_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_u32)))
17371svuint32_t svldnt1ub_gather_u32(svbool_t, svuint32_t);
17372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_u64)))
17373svuint64_t svldnt1ub_gather_u64(svbool_t, svuint64_t);
17374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32base_s32)))
17375svint32_t svldnt1ub_gather_s32(svbool_t, svuint32_t);
17376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64base_s64)))
17377svint64_t svldnt1ub_gather_s64(svbool_t, svuint64_t);
17378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_u32)))
17379svuint32_t svldnt1ub_gather_offset_u32(svbool_t, uint8_t const *, svuint32_t);
17380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u32offset_s32)))
17381svint32_t svldnt1ub_gather_offset_s32(svbool_t, uint8_t const *, svuint32_t);
17382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_u64)))
17383svuint64_t svldnt1ub_gather_offset_u64(svbool_t, uint8_t const *, svint64_t);
17384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_s64offset_s64)))
17385svint64_t svldnt1ub_gather_offset_s64(svbool_t, uint8_t const *, svint64_t);
17386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_u64)))
17387svuint64_t svldnt1ub_gather_offset_u64(svbool_t, uint8_t const *, svuint64_t);
17388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1ub_gather_u64offset_s64)))
17389svint64_t svldnt1ub_gather_offset_s64(svbool_t, uint8_t const *, svuint64_t);
17390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_u32)))
17391svuint32_t svldnt1uh_gather_index_u32(svbool_t, svuint32_t, int64_t);
17392__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_u64)))
17393svuint64_t svldnt1uh_gather_index_u64(svbool_t, svuint64_t, int64_t);
17394__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_index_s32)))
17395svint32_t svldnt1uh_gather_index_s32(svbool_t, svuint32_t, int64_t);
17396__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_index_s64)))
17397svint64_t svldnt1uh_gather_index_s64(svbool_t, svuint64_t, int64_t);
17398__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_u32)))
17399svuint32_t svldnt1uh_gather_offset_u32(svbool_t, svuint32_t, int64_t);
17400__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_u64)))
17401svuint64_t svldnt1uh_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17402__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_offset_s32)))
17403svint32_t svldnt1uh_gather_offset_s32(svbool_t, svuint32_t, int64_t);
17404__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_offset_s64)))
17405svint64_t svldnt1uh_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17406__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_u32)))
17407svuint32_t svldnt1uh_gather_u32(svbool_t, svuint32_t);
17408__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_u64)))
17409svuint64_t svldnt1uh_gather_u64(svbool_t, svuint64_t);
17410__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32base_s32)))
17411svint32_t svldnt1uh_gather_s32(svbool_t, svuint32_t);
17412__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64base_s64)))
17413svint64_t svldnt1uh_gather_s64(svbool_t, svuint64_t);
17414__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_u64)))
17415svuint64_t svldnt1uh_gather_index_u64(svbool_t, uint16_t const *, svint64_t);
17416__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64index_s64)))
17417svint64_t svldnt1uh_gather_index_s64(svbool_t, uint16_t const *, svint64_t);
17418__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_u64)))
17419svuint64_t svldnt1uh_gather_index_u64(svbool_t, uint16_t const *, svuint64_t);
17420__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64index_s64)))
17421svint64_t svldnt1uh_gather_index_s64(svbool_t, uint16_t const *, svuint64_t);
17422__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_u32)))
17423svuint32_t svldnt1uh_gather_offset_u32(svbool_t, uint16_t const *, svuint32_t);
17424__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u32offset_s32)))
17425svint32_t svldnt1uh_gather_offset_s32(svbool_t, uint16_t const *, svuint32_t);
17426__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_u64)))
17427svuint64_t svldnt1uh_gather_offset_u64(svbool_t, uint16_t const *, svint64_t);
17428__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_s64offset_s64)))
17429svint64_t svldnt1uh_gather_offset_s64(svbool_t, uint16_t const *, svint64_t);
17430__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_u64)))
17431svuint64_t svldnt1uh_gather_offset_u64(svbool_t, uint16_t const *, svuint64_t);
17432__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uh_gather_u64offset_s64)))
17433svint64_t svldnt1uh_gather_offset_s64(svbool_t, uint16_t const *, svuint64_t);
17434__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_u64)))
17435svuint64_t svldnt1uw_gather_index_u64(svbool_t, svuint64_t, int64_t);
17436__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_index_s64)))
17437svint64_t svldnt1uw_gather_index_s64(svbool_t, svuint64_t, int64_t);
17438__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_u64)))
17439svuint64_t svldnt1uw_gather_offset_u64(svbool_t, svuint64_t, int64_t);
17440__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_offset_s64)))
17441svint64_t svldnt1uw_gather_offset_s64(svbool_t, svuint64_t, int64_t);
17442__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_u64)))
17443svuint64_t svldnt1uw_gather_u64(svbool_t, svuint64_t);
17444__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64base_s64)))
17445svint64_t svldnt1uw_gather_s64(svbool_t, svuint64_t);
17446__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_u64)))
17447svuint64_t svldnt1uw_gather_index_u64(svbool_t, uint32_t const *, svint64_t);
17448__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64index_s64)))
17449svint64_t svldnt1uw_gather_index_s64(svbool_t, uint32_t const *, svint64_t);
17450__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_u64)))
17451svuint64_t svldnt1uw_gather_index_u64(svbool_t, uint32_t const *, svuint64_t);
17452__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64index_s64)))
17453svint64_t svldnt1uw_gather_index_s64(svbool_t, uint32_t const *, svuint64_t);
17454__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_u64)))
17455svuint64_t svldnt1uw_gather_offset_u64(svbool_t, uint32_t const *, svint64_t);
17456__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_s64offset_s64)))
17457svint64_t svldnt1uw_gather_offset_s64(svbool_t, uint32_t const *, svint64_t);
17458__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_u64)))
17459svuint64_t svldnt1uw_gather_offset_u64(svbool_t, uint32_t const *, svuint64_t);
17460__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1uw_gather_u64offset_s64)))
17461svint64_t svldnt1uw_gather_offset_s64(svbool_t, uint32_t const *, svuint64_t);
17462__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u8)))
17463svbool_t svmatch(svbool_t, svuint8_t, svuint8_t);
17464__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_u16)))
17465svbool_t svmatch(svbool_t, svuint16_t, svuint16_t);
17466__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s8)))
17467svbool_t svmatch(svbool_t, svint8_t, svint8_t);
17468__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmatch_s16)))
17469svbool_t svmatch(svbool_t, svint16_t, svint16_t);
17470__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u8)))
17471svbool_t svnmatch(svbool_t, svuint8_t, svuint8_t);
17472__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_u16)))
17473svbool_t svnmatch(svbool_t, svuint16_t, svuint16_t);
17474__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s8)))
17475svbool_t svnmatch(svbool_t, svint8_t, svint8_t);
17476__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svnmatch_s16)))
17477svbool_t svnmatch(svbool_t, svint16_t, svint16_t);
17478__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_u32)))
17479void svstnt1_scatter_index(svbool_t, svuint32_t, int64_t, svuint32_t);
17480__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_u64)))
17481void svstnt1_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
17482__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_f64)))
17483void svstnt1_scatter_index(svbool_t, svuint64_t, int64_t, svfloat64_t);
17484__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_f32)))
17485void svstnt1_scatter_index(svbool_t, svuint32_t, int64_t, svfloat32_t);
17486__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_index_s32)))
17487void svstnt1_scatter_index(svbool_t, svuint32_t, int64_t, svint32_t);
17488__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_index_s64)))
17489void svstnt1_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
17490__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_u32)))
17491void svstnt1_scatter_offset(svbool_t, svuint32_t, int64_t, svuint32_t);
17492__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_u64)))
17493void svstnt1_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
17494__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_f64)))
17495void svstnt1_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat64_t);
17496__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_f32)))
17497void svstnt1_scatter_offset(svbool_t, svuint32_t, int64_t, svfloat32_t);
17498__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_offset_s32)))
17499void svstnt1_scatter_offset(svbool_t, svuint32_t, int64_t, svint32_t);
17500__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_offset_s64)))
17501void svstnt1_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
17502__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_u32)))
17503void svstnt1_scatter(svbool_t, svuint32_t, svuint32_t);
17504__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_u64)))
17505void svstnt1_scatter(svbool_t, svuint64_t, svuint64_t);
17506__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_f64)))
17507void svstnt1_scatter(svbool_t, svuint64_t, svfloat64_t);
17508__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_f32)))
17509void svstnt1_scatter(svbool_t, svuint32_t, svfloat32_t);
17510__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32base_s32)))
17511void svstnt1_scatter(svbool_t, svuint32_t, svint32_t);
17512__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64base_s64)))
17513void svstnt1_scatter(svbool_t, svuint64_t, svint64_t);
17514__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_u64)))
17515void svstnt1_scatter_index(svbool_t, uint64_t *, svint64_t, svuint64_t);
17516__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_f64)))
17517void svstnt1_scatter_index(svbool_t, float64_t *, svint64_t, svfloat64_t);
17518__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64index_s64)))
17519void svstnt1_scatter_index(svbool_t, int64_t *, svint64_t, svint64_t);
17520__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_u64)))
17521void svstnt1_scatter_index(svbool_t, uint64_t *, svuint64_t, svuint64_t);
17522__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_f64)))
17523void svstnt1_scatter_index(svbool_t, float64_t *, svuint64_t, svfloat64_t);
17524__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64index_s64)))
17525void svstnt1_scatter_index(svbool_t, int64_t *, svuint64_t, svint64_t);
17526__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_u32)))
17527void svstnt1_scatter_offset(svbool_t, uint32_t *, svuint32_t, svuint32_t);
17528__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_f32)))
17529void svstnt1_scatter_offset(svbool_t, float32_t *, svuint32_t, svfloat32_t);
17530__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u32offset_s32)))
17531void svstnt1_scatter_offset(svbool_t, int32_t *, svuint32_t, svint32_t);
17532__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_u64)))
17533void svstnt1_scatter_offset(svbool_t, uint64_t *, svint64_t, svuint64_t);
17534__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_f64)))
17535void svstnt1_scatter_offset(svbool_t, float64_t *, svint64_t, svfloat64_t);
17536__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_s64offset_s64)))
17537void svstnt1_scatter_offset(svbool_t, int64_t *, svint64_t, svint64_t);
17538__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_u64)))
17539void svstnt1_scatter_offset(svbool_t, uint64_t *, svuint64_t, svuint64_t);
17540__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_f64)))
17541void svstnt1_scatter_offset(svbool_t, float64_t *, svuint64_t, svfloat64_t);
17542__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_scatter_u64offset_s64)))
17543void svstnt1_scatter_offset(svbool_t, int64_t *, svuint64_t, svint64_t);
17544__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_u32)))
17545void svstnt1b_scatter_offset(svbool_t, svuint32_t, int64_t, svuint32_t);
17546__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_u64)))
17547void svstnt1b_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
17548__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_offset_s32)))
17549void svstnt1b_scatter_offset(svbool_t, svuint32_t, int64_t, svint32_t);
17550__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_offset_s64)))
17551void svstnt1b_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
17552__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_u32)))
17553void svstnt1b_scatter(svbool_t, svuint32_t, svuint32_t);
17554__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_u64)))
17555void svstnt1b_scatter(svbool_t, svuint64_t, svuint64_t);
17556__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32base_s32)))
17557void svstnt1b_scatter(svbool_t, svuint32_t, svint32_t);
17558__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64base_s64)))
17559void svstnt1b_scatter(svbool_t, svuint64_t, svint64_t);
17560__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_s32)))
17561void svstnt1b_scatter_offset(svbool_t, int8_t *, svuint32_t, svint32_t);
17562__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u32offset_u32)))
17563void svstnt1b_scatter_offset(svbool_t, uint8_t *, svuint32_t, svuint32_t);
17564__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_s64)))
17565void svstnt1b_scatter_offset(svbool_t, int8_t *, svint64_t, svint64_t);
17566__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_s64offset_u64)))
17567void svstnt1b_scatter_offset(svbool_t, uint8_t *, svint64_t, svuint64_t);
17568__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_s64)))
17569void svstnt1b_scatter_offset(svbool_t, int8_t *, svuint64_t, svint64_t);
17570__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1b_scatter_u64offset_u64)))
17571void svstnt1b_scatter_offset(svbool_t, uint8_t *, svuint64_t, svuint64_t);
17572__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_u32)))
17573void svstnt1h_scatter_index(svbool_t, svuint32_t, int64_t, svuint32_t);
17574__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_u64)))
17575void svstnt1h_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
17576__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_index_s32)))
17577void svstnt1h_scatter_index(svbool_t, svuint32_t, int64_t, svint32_t);
17578__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_index_s64)))
17579void svstnt1h_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
17580__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_u32)))
17581void svstnt1h_scatter_offset(svbool_t, svuint32_t, int64_t, svuint32_t);
17582__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_u64)))
17583void svstnt1h_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
17584__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_offset_s32)))
17585void svstnt1h_scatter_offset(svbool_t, svuint32_t, int64_t, svint32_t);
17586__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_offset_s64)))
17587void svstnt1h_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
17588__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_u32)))
17589void svstnt1h_scatter(svbool_t, svuint32_t, svuint32_t);
17590__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_u64)))
17591void svstnt1h_scatter(svbool_t, svuint64_t, svuint64_t);
17592__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32base_s32)))
17593void svstnt1h_scatter(svbool_t, svuint32_t, svint32_t);
17594__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64base_s64)))
17595void svstnt1h_scatter(svbool_t, svuint64_t, svint64_t);
17596__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_s64)))
17597void svstnt1h_scatter_index(svbool_t, int16_t *, svint64_t, svint64_t);
17598__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64index_u64)))
17599void svstnt1h_scatter_index(svbool_t, uint16_t *, svint64_t, svuint64_t);
17600__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_s64)))
17601void svstnt1h_scatter_index(svbool_t, int16_t *, svuint64_t, svint64_t);
17602__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64index_u64)))
17603void svstnt1h_scatter_index(svbool_t, uint16_t *, svuint64_t, svuint64_t);
17604__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_s32)))
17605void svstnt1h_scatter_offset(svbool_t, int16_t *, svuint32_t, svint32_t);
17606__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u32offset_u32)))
17607void svstnt1h_scatter_offset(svbool_t, uint16_t *, svuint32_t, svuint32_t);
17608__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_s64)))
17609void svstnt1h_scatter_offset(svbool_t, int16_t *, svint64_t, svint64_t);
17610__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_s64offset_u64)))
17611void svstnt1h_scatter_offset(svbool_t, uint16_t *, svint64_t, svuint64_t);
17612__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_s64)))
17613void svstnt1h_scatter_offset(svbool_t, int16_t *, svuint64_t, svint64_t);
17614__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1h_scatter_u64offset_u64)))
17615void svstnt1h_scatter_offset(svbool_t, uint16_t *, svuint64_t, svuint64_t);
17616__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_u64)))
17617void svstnt1w_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
17618__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_index_s64)))
17619void svstnt1w_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
17620__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_u64)))
17621void svstnt1w_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
17622__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_offset_s64)))
17623void svstnt1w_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
17624__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_u64)))
17625void svstnt1w_scatter(svbool_t, svuint64_t, svuint64_t);
17626__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64base_s64)))
17627void svstnt1w_scatter(svbool_t, svuint64_t, svint64_t);
17628__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_s64)))
17629void svstnt1w_scatter_index(svbool_t, int32_t *, svint64_t, svint64_t);
17630__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64index_u64)))
17631void svstnt1w_scatter_index(svbool_t, uint32_t *, svint64_t, svuint64_t);
17632__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_s64)))
17633void svstnt1w_scatter_index(svbool_t, int32_t *, svuint64_t, svint64_t);
17634__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64index_u64)))
17635void svstnt1w_scatter_index(svbool_t, uint32_t *, svuint64_t, svuint64_t);
17636__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_s64)))
17637void svstnt1w_scatter_offset(svbool_t, int32_t *, svint64_t, svint64_t);
17638__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_s64offset_u64)))
17639void svstnt1w_scatter_offset(svbool_t, uint32_t *, svint64_t, svuint64_t);
17640__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_s64)))
17641void svstnt1w_scatter_offset(svbool_t, int32_t *, svuint64_t, svint64_t);
17642__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1w_scatter_u64offset_u64)))
17643void svstnt1w_scatter_offset(svbool_t, uint32_t *, svuint64_t, svuint64_t);
17644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f16_mf8_fpm)))
17645svfloat16_t svmmla_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17646__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f16_mf8_fpm)))
17647svfloat16_t svmmla_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17648__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32_mf8_fpm)))
17649svfloat32_t svmmla_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17650__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f32_mf8_fpm)))
17651svfloat32_t svmmla_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17652__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f16_mf8_fpm)))
17653svfloat16_t svdot_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17654__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f16_mf8_fpm)))
17655svfloat16_t svdot_n_f16_mf8_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
17656__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f16_mf8_fpm)))
17657svfloat16_t svdot_lane_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17658__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f16_mf8_fpm)))
17659svfloat16_t svdot_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17660__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f16_mf8_fpm)))
17661svfloat16_t svdot_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
17662__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f16_mf8_fpm)))
17663svfloat16_t svdot_lane_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17664__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f32_mf8_fpm)))
17665svfloat32_t svdot_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17666__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f32_mf8_fpm)))
17667svfloat32_t svdot_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17668__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f32_mf8_fpm)))
17669svfloat32_t svdot_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17670__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f32_mf8_fpm)))
17671svfloat32_t svdot_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17672__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f32_mf8_fpm)))
17673svfloat32_t svdot_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17674__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_f32_mf8_fpm)))
17675svfloat32_t svdot_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17676__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_f16_mf8_fpm)))
17677svfloat16_t svmlalb_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17678__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_n_f16_mf8_fpm)))
17679svfloat16_t svmlalb_n_f16_mf8_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
17680__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_lane_f16_mf8_fpm)))
17681svfloat16_t svmlalb_lane_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17682__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_f32_mf8_fpm)))
17683svfloat32_t svmlallbb_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17684__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_n_f32_mf8_fpm)))
17685svfloat32_t svmlallbb_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17686__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_lane_f32_mf8_fpm)))
17687svfloat32_t svmlallbb_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17688__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_f32_mf8_fpm)))
17689svfloat32_t svmlallbt_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17690__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_n_f32_mf8_fpm)))
17691svfloat32_t svmlallbt_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17692__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_lane_f32_mf8_fpm)))
17693svfloat32_t svmlallbt_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17694__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_f32_mf8_fpm)))
17695svfloat32_t svmlalltb_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17696__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_n_f32_mf8_fpm)))
17697svfloat32_t svmlalltb_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17698__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_lane_f32_mf8_fpm)))
17699svfloat32_t svmlalltb_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17700__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_f32_mf8_fpm)))
17701svfloat32_t svmlalltt_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17702__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_n_f32_mf8_fpm)))
17703svfloat32_t svmlalltt_n_f32_mf8_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17704__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_lane_f32_mf8_fpm)))
17705svfloat32_t svmlalltt_lane_f32_mf8_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17706__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_f16_mf8_fpm)))
17707svfloat16_t svmlalt_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17708__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_n_f16_mf8_fpm)))
17709svfloat16_t svmlalt_n_f16_mf8_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
17710__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_lane_f16_mf8_fpm)))
17711svfloat16_t svmlalt_lane_f16_mf8_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17712__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_f16_mf8_fpm)))
17713svfloat16_t svmlalb_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17714__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_n_f16_mf8_fpm)))
17715svfloat16_t svmlalb_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
17716__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalb_lane_f16_mf8_fpm)))
17717svfloat16_t svmlalb_lane_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17718__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_f32_mf8_fpm)))
17719svfloat32_t svmlallbb_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17720__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_n_f32_mf8_fpm)))
17721svfloat32_t svmlallbb_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17722__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbb_lane_f32_mf8_fpm)))
17723svfloat32_t svmlallbb_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17724__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_f32_mf8_fpm)))
17725svfloat32_t svmlallbt_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17726__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_n_f32_mf8_fpm)))
17727svfloat32_t svmlallbt_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17728__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlallbt_lane_f32_mf8_fpm)))
17729svfloat32_t svmlallbt_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17730__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_f32_mf8_fpm)))
17731svfloat32_t svmlalltb_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17732__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_n_f32_mf8_fpm)))
17733svfloat32_t svmlalltb_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17734__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltb_lane_f32_mf8_fpm)))
17735svfloat32_t svmlalltb_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17736__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_f32_mf8_fpm)))
17737svfloat32_t svmlalltt_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, fpm_t);
17738__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_n_f32_mf8_fpm)))
17739svfloat32_t svmlalltt_fpm(svfloat32_t, svmfloat8_t, mfloat8_t, fpm_t);
17740__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalltt_lane_f32_mf8_fpm)))
17741svfloat32_t svmlalltt_lane_fpm(svfloat32_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17742__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_f16_mf8_fpm)))
17743svfloat16_t svmlalt_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, fpm_t);
17744__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_n_f16_mf8_fpm)))
17745svfloat16_t svmlalt_fpm(svfloat16_t, svmfloat8_t, mfloat8_t, fpm_t);
17746__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmlalt_lane_f16_mf8_fpm)))
17747svfloat16_t svmlalt_lane_fpm(svfloat16_t, svmfloat8_t, svmfloat8_t, uint64_t, fpm_t);
17748__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u32)))
17749svuint32_t svld1q_gather_u64base_index_u32(svbool_t, svuint64_t, int64_t);
17750__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u64)))
17751svuint64_t svld1q_gather_u64base_index_u64(svbool_t, svuint64_t, int64_t);
17752__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u16)))
17753svuint16_t svld1q_gather_u64base_index_u16(svbool_t, svuint64_t, int64_t);
17754__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_bf16)))
17755svbfloat16_t svld1q_gather_u64base_index_bf16(svbool_t, svuint64_t, int64_t);
17756__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f64)))
17757svfloat64_t svld1q_gather_u64base_index_f64(svbool_t, svuint64_t, int64_t);
17758__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f32)))
17759svfloat32_t svld1q_gather_u64base_index_f32(svbool_t, svuint64_t, int64_t);
17760__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f16)))
17761svfloat16_t svld1q_gather_u64base_index_f16(svbool_t, svuint64_t, int64_t);
17762__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s32)))
17763svint32_t svld1q_gather_u64base_index_s32(svbool_t, svuint64_t, int64_t);
17764__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s64)))
17765svint64_t svld1q_gather_u64base_index_s64(svbool_t, svuint64_t, int64_t);
17766__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s16)))
17767svint16_t svld1q_gather_u64base_index_s16(svbool_t, svuint64_t, int64_t);
17768__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u8)))
17769svuint8_t svld1q_gather_u64base_offset_u8(svbool_t, svuint64_t, int64_t);
17770__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u32)))
17771svuint32_t svld1q_gather_u64base_offset_u32(svbool_t, svuint64_t, int64_t);
17772__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u64)))
17773svuint64_t svld1q_gather_u64base_offset_u64(svbool_t, svuint64_t, int64_t);
17774__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u16)))
17775svuint16_t svld1q_gather_u64base_offset_u16(svbool_t, svuint64_t, int64_t);
17776__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_bf16)))
17777svbfloat16_t svld1q_gather_u64base_offset_bf16(svbool_t, svuint64_t, int64_t);
17778__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s8)))
17779svint8_t svld1q_gather_u64base_offset_s8(svbool_t, svuint64_t, int64_t);
17780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f64)))
17781svfloat64_t svld1q_gather_u64base_offset_f64(svbool_t, svuint64_t, int64_t);
17782__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f32)))
17783svfloat32_t svld1q_gather_u64base_offset_f32(svbool_t, svuint64_t, int64_t);
17784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f16)))
17785svfloat16_t svld1q_gather_u64base_offset_f16(svbool_t, svuint64_t, int64_t);
17786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s32)))
17787svint32_t svld1q_gather_u64base_offset_s32(svbool_t, svuint64_t, int64_t);
17788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s64)))
17789svint64_t svld1q_gather_u64base_offset_s64(svbool_t, svuint64_t, int64_t);
17790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_mf8)))
17791svmfloat8_t svld1q_gather_u64base_offset_mf8(svbool_t, svuint64_t, int64_t);
17792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s16)))
17793svint16_t svld1q_gather_u64base_offset_s16(svbool_t, svuint64_t, int64_t);
17794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u8)))
17795svuint8_t svld1q_gather_u64base_u8(svbool_t, svuint64_t);
17796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u32)))
17797svuint32_t svld1q_gather_u64base_u32(svbool_t, svuint64_t);
17798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u64)))
17799svuint64_t svld1q_gather_u64base_u64(svbool_t, svuint64_t);
17800__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u16)))
17801svuint16_t svld1q_gather_u64base_u16(svbool_t, svuint64_t);
17802__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_bf16)))
17803svbfloat16_t svld1q_gather_u64base_bf16(svbool_t, svuint64_t);
17804__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s8)))
17805svint8_t svld1q_gather_u64base_s8(svbool_t, svuint64_t);
17806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f64)))
17807svfloat64_t svld1q_gather_u64base_f64(svbool_t, svuint64_t);
17808__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f32)))
17809svfloat32_t svld1q_gather_u64base_f32(svbool_t, svuint64_t);
17810__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f16)))
17811svfloat16_t svld1q_gather_u64base_f16(svbool_t, svuint64_t);
17812__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s32)))
17813svint32_t svld1q_gather_u64base_s32(svbool_t, svuint64_t);
17814__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s64)))
17815svint64_t svld1q_gather_u64base_s64(svbool_t, svuint64_t);
17816__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_mf8)))
17817svmfloat8_t svld1q_gather_u64base_mf8(svbool_t, svuint64_t);
17818__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s16)))
17819svint16_t svld1q_gather_u64base_s16(svbool_t, svuint64_t);
17820__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u32)))
17821svuint32_t svld1q_gather_u64index_u32(svbool_t, uint32_t const *, svuint64_t);
17822__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u64)))
17823svuint64_t svld1q_gather_u64index_u64(svbool_t, uint64_t const *, svuint64_t);
17824__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u16)))
17825svuint16_t svld1q_gather_u64index_u16(svbool_t, uint16_t const *, svuint64_t);
17826__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_bf16)))
17827svbfloat16_t svld1q_gather_u64index_bf16(svbool_t, bfloat16_t const *, svuint64_t);
17828__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f64)))
17829svfloat64_t svld1q_gather_u64index_f64(svbool_t, float64_t const *, svuint64_t);
17830__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f32)))
17831svfloat32_t svld1q_gather_u64index_f32(svbool_t, float32_t const *, svuint64_t);
17832__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f16)))
17833svfloat16_t svld1q_gather_u64index_f16(svbool_t, float16_t const *, svuint64_t);
17834__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s32)))
17835svint32_t svld1q_gather_u64index_s32(svbool_t, int32_t const *, svuint64_t);
17836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s64)))
17837svint64_t svld1q_gather_u64index_s64(svbool_t, int64_t const *, svuint64_t);
17838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s16)))
17839svint16_t svld1q_gather_u64index_s16(svbool_t, int16_t const *, svuint64_t);
17840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u8)))
17841svuint8_t svld1q_gather_u64offset_u8(svbool_t, uint8_t const *, svuint64_t);
17842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u32)))
17843svuint32_t svld1q_gather_u64offset_u32(svbool_t, uint32_t const *, svuint64_t);
17844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u64)))
17845svuint64_t svld1q_gather_u64offset_u64(svbool_t, uint64_t const *, svuint64_t);
17846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u16)))
17847svuint16_t svld1q_gather_u64offset_u16(svbool_t, uint16_t const *, svuint64_t);
17848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_bf16)))
17849svbfloat16_t svld1q_gather_u64offset_bf16(svbool_t, bfloat16_t const *, svuint64_t);
17850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s8)))
17851svint8_t svld1q_gather_u64offset_s8(svbool_t, int8_t const *, svuint64_t);
17852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f64)))
17853svfloat64_t svld1q_gather_u64offset_f64(svbool_t, float64_t const *, svuint64_t);
17854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f32)))
17855svfloat32_t svld1q_gather_u64offset_f32(svbool_t, float32_t const *, svuint64_t);
17856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f16)))
17857svfloat16_t svld1q_gather_u64offset_f16(svbool_t, float16_t const *, svuint64_t);
17858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s32)))
17859svint32_t svld1q_gather_u64offset_s32(svbool_t, int32_t const *, svuint64_t);
17860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s64)))
17861svint64_t svld1q_gather_u64offset_s64(svbool_t, int64_t const *, svuint64_t);
17862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_mf8)))
17863svmfloat8_t svld1q_gather_u64offset_mf8(svbool_t, mfloat8_t const *, svuint64_t);
17864__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s16)))
17865svint16_t svld1q_gather_u64offset_s16(svbool_t, int16_t const *, svuint64_t);
17866__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_u64)))
17867svuint64_t svld1udq_u64(svbool_t, uint64_t const *);
17868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_f64)))
17869svfloat64_t svld1udq_f64(svbool_t, float64_t const *);
17870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_s64)))
17871svint64_t svld1udq_s64(svbool_t, int64_t const *);
17872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_u64)))
17873svuint64_t svld1udq_vnum_u64(svbool_t, uint64_t const *, int64_t);
17874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_f64)))
17875svfloat64_t svld1udq_vnum_f64(svbool_t, float64_t const *, int64_t);
17876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_s64)))
17877svint64_t svld1udq_vnum_s64(svbool_t, int64_t const *, int64_t);
17878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_u32)))
17879svuint32_t svld1uwq_u32(svbool_t, uint32_t const *);
17880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_f32)))
17881svfloat32_t svld1uwq_f32(svbool_t, float32_t const *);
17882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_s32)))
17883svint32_t svld1uwq_s32(svbool_t, int32_t const *);
17884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_u32)))
17885svuint32_t svld1uwq_vnum_u32(svbool_t, uint32_t const *, int64_t);
17886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_f32)))
17887svfloat32_t svld1uwq_vnum_f32(svbool_t, float32_t const *, int64_t);
17888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_s32)))
17889svint32_t svld1uwq_vnum_s32(svbool_t, int32_t const *, int64_t);
17890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_u64)))
17891void svst1dq_u64(svbool_t, uint64_t *, svuint64_t);
17892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_f64)))
17893void svst1dq_f64(svbool_t, float64_t *, svfloat64_t);
17894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_s64)))
17895void svst1dq_s64(svbool_t, int64_t *, svint64_t);
17896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_u64)))
17897void svst1dq_vnum_u64(svbool_t, uint64_t *, int64_t, svuint64_t);
17898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_f64)))
17899void svst1dq_vnum_f64(svbool_t, float64_t *, int64_t, svfloat64_t);
17900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_s64)))
17901void svst1dq_vnum_s64(svbool_t, int64_t *, int64_t, svint64_t);
17902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u8)))
17903void svst1q_scatter_u64base_u8(svbool_t, svuint64_t, svuint8_t);
17904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u32)))
17905void svst1q_scatter_u64base_u32(svbool_t, svuint64_t, svuint32_t);
17906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u64)))
17907void svst1q_scatter_u64base_u64(svbool_t, svuint64_t, svuint64_t);
17908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u16)))
17909void svst1q_scatter_u64base_u16(svbool_t, svuint64_t, svuint16_t);
17910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_bf16)))
17911void svst1q_scatter_u64base_bf16(svbool_t, svuint64_t, svbfloat16_t);
17912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s8)))
17913void svst1q_scatter_u64base_s8(svbool_t, svuint64_t, svint8_t);
17914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f64)))
17915void svst1q_scatter_u64base_f64(svbool_t, svuint64_t, svfloat64_t);
17916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f32)))
17917void svst1q_scatter_u64base_f32(svbool_t, svuint64_t, svfloat32_t);
17918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f16)))
17919void svst1q_scatter_u64base_f16(svbool_t, svuint64_t, svfloat16_t);
17920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s32)))
17921void svst1q_scatter_u64base_s32(svbool_t, svuint64_t, svint32_t);
17922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s64)))
17923void svst1q_scatter_u64base_s64(svbool_t, svuint64_t, svint64_t);
17924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_mf8)))
17925void svst1q_scatter_u64base_mf8(svbool_t, svuint64_t, svmfloat8_t);
17926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s16)))
17927void svst1q_scatter_u64base_s16(svbool_t, svuint64_t, svint16_t);
17928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u32)))
17929void svst1q_scatter_u64base_index_u32(svbool_t, svuint64_t, int64_t, svuint32_t);
17930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u64)))
17931void svst1q_scatter_u64base_index_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u16)))
17933void svst1q_scatter_u64base_index_u16(svbool_t, svuint64_t, int64_t, svuint16_t);
17934__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_bf16)))
17935void svst1q_scatter_u64base_index_bf16(svbool_t, svuint64_t, int64_t, svbfloat16_t);
17936__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f64)))
17937void svst1q_scatter_u64base_index_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
17938__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f32)))
17939void svst1q_scatter_u64base_index_f32(svbool_t, svuint64_t, int64_t, svfloat32_t);
17940__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f16)))
17941void svst1q_scatter_u64base_index_f16(svbool_t, svuint64_t, int64_t, svfloat16_t);
17942__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s32)))
17943void svst1q_scatter_u64base_index_s32(svbool_t, svuint64_t, int64_t, svint32_t);
17944__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s64)))
17945void svst1q_scatter_u64base_index_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17946__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s16)))
17947void svst1q_scatter_u64base_index_s16(svbool_t, svuint64_t, int64_t, svint16_t);
17948__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u8)))
17949void svst1q_scatter_u64base_offset_u8(svbool_t, svuint64_t, int64_t, svuint8_t);
17950__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u32)))
17951void svst1q_scatter_u64base_offset_u32(svbool_t, svuint64_t, int64_t, svuint32_t);
17952__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u64)))
17953void svst1q_scatter_u64base_offset_u64(svbool_t, svuint64_t, int64_t, svuint64_t);
17954__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u16)))
17955void svst1q_scatter_u64base_offset_u16(svbool_t, svuint64_t, int64_t, svuint16_t);
17956__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_bf16)))
17957void svst1q_scatter_u64base_offset_bf16(svbool_t, svuint64_t, int64_t, svbfloat16_t);
17958__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s8)))
17959void svst1q_scatter_u64base_offset_s8(svbool_t, svuint64_t, int64_t, svint8_t);
17960__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f64)))
17961void svst1q_scatter_u64base_offset_f64(svbool_t, svuint64_t, int64_t, svfloat64_t);
17962__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f32)))
17963void svst1q_scatter_u64base_offset_f32(svbool_t, svuint64_t, int64_t, svfloat32_t);
17964__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f16)))
17965void svst1q_scatter_u64base_offset_f16(svbool_t, svuint64_t, int64_t, svfloat16_t);
17966__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s32)))
17967void svst1q_scatter_u64base_offset_s32(svbool_t, svuint64_t, int64_t, svint32_t);
17968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s64)))
17969void svst1q_scatter_u64base_offset_s64(svbool_t, svuint64_t, int64_t, svint64_t);
17970__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_mf8)))
17971void svst1q_scatter_u64base_offset_mf8(svbool_t, svuint64_t, int64_t, svmfloat8_t);
17972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s16)))
17973void svst1q_scatter_u64base_offset_s16(svbool_t, svuint64_t, int64_t, svint16_t);
17974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u32)))
17975void svst1q_scatter_s64index_u32(svbool_t, uint32_t *, svint64_t, svuint32_t);
17976__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u64)))
17977void svst1q_scatter_s64index_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
17978__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u16)))
17979void svst1q_scatter_s64index_u16(svbool_t, uint16_t *, svint64_t, svuint16_t);
17980__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_bf16)))
17981void svst1q_scatter_s64index_bf16(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
17982__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f64)))
17983void svst1q_scatter_s64index_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
17984__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f32)))
17985void svst1q_scatter_s64index_f32(svbool_t, float32_t *, svint64_t, svfloat32_t);
17986__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f16)))
17987void svst1q_scatter_s64index_f16(svbool_t, float16_t *, svint64_t, svfloat16_t);
17988__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s32)))
17989void svst1q_scatter_s64index_s32(svbool_t, int32_t *, svint64_t, svint32_t);
17990__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s64)))
17991void svst1q_scatter_s64index_s64(svbool_t, int64_t *, svint64_t, svint64_t);
17992__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s16)))
17993void svst1q_scatter_s64index_s16(svbool_t, int16_t *, svint64_t, svint16_t);
17994__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u32)))
17995void svst1q_scatter_u64index_u32(svbool_t, uint32_t *, svuint64_t, svuint32_t);
17996__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u64)))
17997void svst1q_scatter_u64index_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
17998__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u16)))
17999void svst1q_scatter_u64index_u16(svbool_t, uint16_t *, svuint64_t, svuint16_t);
18000__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_bf16)))
18001void svst1q_scatter_u64index_bf16(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
18002__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f64)))
18003void svst1q_scatter_u64index_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
18004__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f32)))
18005void svst1q_scatter_u64index_f32(svbool_t, float32_t *, svuint64_t, svfloat32_t);
18006__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f16)))
18007void svst1q_scatter_u64index_f16(svbool_t, float16_t *, svuint64_t, svfloat16_t);
18008__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s32)))
18009void svst1q_scatter_u64index_s32(svbool_t, int32_t *, svuint64_t, svint32_t);
18010__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s64)))
18011void svst1q_scatter_u64index_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
18012__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s16)))
18013void svst1q_scatter_u64index_s16(svbool_t, int16_t *, svuint64_t, svint16_t);
18014__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u8)))
18015void svst1q_scatter_s64offset_u8(svbool_t, uint8_t *, svint64_t, svuint8_t);
18016__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u32)))
18017void svst1q_scatter_s64offset_u32(svbool_t, uint32_t *, svint64_t, svuint32_t);
18018__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u64)))
18019void svst1q_scatter_s64offset_u64(svbool_t, uint64_t *, svint64_t, svuint64_t);
18020__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u16)))
18021void svst1q_scatter_s64offset_u16(svbool_t, uint16_t *, svint64_t, svuint16_t);
18022__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_bf16)))
18023void svst1q_scatter_s64offset_bf16(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
18024__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s8)))
18025void svst1q_scatter_s64offset_s8(svbool_t, int8_t *, svint64_t, svint8_t);
18026__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f64)))
18027void svst1q_scatter_s64offset_f64(svbool_t, float64_t *, svint64_t, svfloat64_t);
18028__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f32)))
18029void svst1q_scatter_s64offset_f32(svbool_t, float32_t *, svint64_t, svfloat32_t);
18030__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f16)))
18031void svst1q_scatter_s64offset_f16(svbool_t, float16_t *, svint64_t, svfloat16_t);
18032__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s32)))
18033void svst1q_scatter_s64offset_s32(svbool_t, int32_t *, svint64_t, svint32_t);
18034__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s64)))
18035void svst1q_scatter_s64offset_s64(svbool_t, int64_t *, svint64_t, svint64_t);
18036__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_mf8)))
18037void svst1q_scatter_s64offset_mf8(svbool_t, mfloat8_t *, svint64_t, svmfloat8_t);
18038__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s16)))
18039void svst1q_scatter_s64offset_s16(svbool_t, int16_t *, svint64_t, svint16_t);
18040__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u8)))
18041void svst1q_scatter_u64offset_u8(svbool_t, uint8_t *, svuint64_t, svuint8_t);
18042__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u32)))
18043void svst1q_scatter_u64offset_u32(svbool_t, uint32_t *, svuint64_t, svuint32_t);
18044__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u64)))
18045void svst1q_scatter_u64offset_u64(svbool_t, uint64_t *, svuint64_t, svuint64_t);
18046__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u16)))
18047void svst1q_scatter_u64offset_u16(svbool_t, uint16_t *, svuint64_t, svuint16_t);
18048__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_bf16)))
18049void svst1q_scatter_u64offset_bf16(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
18050__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s8)))
18051void svst1q_scatter_u64offset_s8(svbool_t, int8_t *, svuint64_t, svint8_t);
18052__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f64)))
18053void svst1q_scatter_u64offset_f64(svbool_t, float64_t *, svuint64_t, svfloat64_t);
18054__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f32)))
18055void svst1q_scatter_u64offset_f32(svbool_t, float32_t *, svuint64_t, svfloat32_t);
18056__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f16)))
18057void svst1q_scatter_u64offset_f16(svbool_t, float16_t *, svuint64_t, svfloat16_t);
18058__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s32)))
18059void svst1q_scatter_u64offset_s32(svbool_t, int32_t *, svuint64_t, svint32_t);
18060__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s64)))
18061void svst1q_scatter_u64offset_s64(svbool_t, int64_t *, svuint64_t, svint64_t);
18062__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_mf8)))
18063void svst1q_scatter_u64offset_mf8(svbool_t, mfloat8_t *, svuint64_t, svmfloat8_t);
18064__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s16)))
18065void svst1q_scatter_u64offset_s16(svbool_t, int16_t *, svuint64_t, svint16_t);
18066__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_u32)))
18067void svst1wq_u32(svbool_t, uint32_t *, svuint32_t);
18068__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_f32)))
18069void svst1wq_f32(svbool_t, float32_t *, svfloat32_t);
18070__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_s32)))
18071void svst1wq_s32(svbool_t, int32_t *, svint32_t);
18072__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_u32)))
18073void svst1wq_vnum_u32(svbool_t, uint32_t *, int64_t, svuint32_t);
18074__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_f32)))
18075void svst1wq_vnum_f32(svbool_t, float32_t *, int64_t, svfloat32_t);
18076__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_s32)))
18077void svst1wq_vnum_s32(svbool_t, int32_t *, int64_t, svint32_t);
18078__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u32)))
18079svuint32_t svld1q_gather_index_u32(svbool_t, svuint64_t, int64_t);
18080__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u64)))
18081svuint64_t svld1q_gather_index_u64(svbool_t, svuint64_t, int64_t);
18082__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_u16)))
18083svuint16_t svld1q_gather_index_u16(svbool_t, svuint64_t, int64_t);
18084__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_bf16)))
18085svbfloat16_t svld1q_gather_index_bf16(svbool_t, svuint64_t, int64_t);
18086__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f64)))
18087svfloat64_t svld1q_gather_index_f64(svbool_t, svuint64_t, int64_t);
18088__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f32)))
18089svfloat32_t svld1q_gather_index_f32(svbool_t, svuint64_t, int64_t);
18090__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_f16)))
18091svfloat16_t svld1q_gather_index_f16(svbool_t, svuint64_t, int64_t);
18092__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s32)))
18093svint32_t svld1q_gather_index_s32(svbool_t, svuint64_t, int64_t);
18094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s64)))
18095svint64_t svld1q_gather_index_s64(svbool_t, svuint64_t, int64_t);
18096__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_index_s16)))
18097svint16_t svld1q_gather_index_s16(svbool_t, svuint64_t, int64_t);
18098__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u8)))
18099svuint8_t svld1q_gather_offset_u8(svbool_t, svuint64_t, int64_t);
18100__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u32)))
18101svuint32_t svld1q_gather_offset_u32(svbool_t, svuint64_t, int64_t);
18102__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u64)))
18103svuint64_t svld1q_gather_offset_u64(svbool_t, svuint64_t, int64_t);
18104__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_u16)))
18105svuint16_t svld1q_gather_offset_u16(svbool_t, svuint64_t, int64_t);
18106__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_bf16)))
18107svbfloat16_t svld1q_gather_offset_bf16(svbool_t, svuint64_t, int64_t);
18108__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s8)))
18109svint8_t svld1q_gather_offset_s8(svbool_t, svuint64_t, int64_t);
18110__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f64)))
18111svfloat64_t svld1q_gather_offset_f64(svbool_t, svuint64_t, int64_t);
18112__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f32)))
18113svfloat32_t svld1q_gather_offset_f32(svbool_t, svuint64_t, int64_t);
18114__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_f16)))
18115svfloat16_t svld1q_gather_offset_f16(svbool_t, svuint64_t, int64_t);
18116__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s32)))
18117svint32_t svld1q_gather_offset_s32(svbool_t, svuint64_t, int64_t);
18118__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s64)))
18119svint64_t svld1q_gather_offset_s64(svbool_t, svuint64_t, int64_t);
18120__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_mf8)))
18121svmfloat8_t svld1q_gather_offset_mf8(svbool_t, svuint64_t, int64_t);
18122__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_offset_s16)))
18123svint16_t svld1q_gather_offset_s16(svbool_t, svuint64_t, int64_t);
18124__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u8)))
18125svuint8_t svld1q_gather_u8(svbool_t, svuint64_t);
18126__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u32)))
18127svuint32_t svld1q_gather_u32(svbool_t, svuint64_t);
18128__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u64)))
18129svuint64_t svld1q_gather_u64(svbool_t, svuint64_t);
18130__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_u16)))
18131svuint16_t svld1q_gather_u16(svbool_t, svuint64_t);
18132__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_bf16)))
18133svbfloat16_t svld1q_gather_bf16(svbool_t, svuint64_t);
18134__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s8)))
18135svint8_t svld1q_gather_s8(svbool_t, svuint64_t);
18136__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f64)))
18137svfloat64_t svld1q_gather_f64(svbool_t, svuint64_t);
18138__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f32)))
18139svfloat32_t svld1q_gather_f32(svbool_t, svuint64_t);
18140__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_f16)))
18141svfloat16_t svld1q_gather_f16(svbool_t, svuint64_t);
18142__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s32)))
18143svint32_t svld1q_gather_s32(svbool_t, svuint64_t);
18144__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s64)))
18145svint64_t svld1q_gather_s64(svbool_t, svuint64_t);
18146__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_mf8)))
18147svmfloat8_t svld1q_gather_mf8(svbool_t, svuint64_t);
18148__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64base_s16)))
18149svint16_t svld1q_gather_s16(svbool_t, svuint64_t);
18150__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u32)))
18151svuint32_t svld1q_gather_index(svbool_t, uint32_t const *, svuint64_t);
18152__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u64)))
18153svuint64_t svld1q_gather_index(svbool_t, uint64_t const *, svuint64_t);
18154__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_u16)))
18155svuint16_t svld1q_gather_index(svbool_t, uint16_t const *, svuint64_t);
18156__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_bf16)))
18157svbfloat16_t svld1q_gather_index(svbool_t, bfloat16_t const *, svuint64_t);
18158__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f64)))
18159svfloat64_t svld1q_gather_index(svbool_t, float64_t const *, svuint64_t);
18160__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f32)))
18161svfloat32_t svld1q_gather_index(svbool_t, float32_t const *, svuint64_t);
18162__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_f16)))
18163svfloat16_t svld1q_gather_index(svbool_t, float16_t const *, svuint64_t);
18164__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s32)))
18165svint32_t svld1q_gather_index(svbool_t, int32_t const *, svuint64_t);
18166__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s64)))
18167svint64_t svld1q_gather_index(svbool_t, int64_t const *, svuint64_t);
18168__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64index_s16)))
18169svint16_t svld1q_gather_index(svbool_t, int16_t const *, svuint64_t);
18170__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u8)))
18171svuint8_t svld1q_gather_offset(svbool_t, uint8_t const *, svuint64_t);
18172__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u32)))
18173svuint32_t svld1q_gather_offset(svbool_t, uint32_t const *, svuint64_t);
18174__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u64)))
18175svuint64_t svld1q_gather_offset(svbool_t, uint64_t const *, svuint64_t);
18176__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_u16)))
18177svuint16_t svld1q_gather_offset(svbool_t, uint16_t const *, svuint64_t);
18178__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_bf16)))
18179svbfloat16_t svld1q_gather_offset(svbool_t, bfloat16_t const *, svuint64_t);
18180__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s8)))
18181svint8_t svld1q_gather_offset(svbool_t, int8_t const *, svuint64_t);
18182__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f64)))
18183svfloat64_t svld1q_gather_offset(svbool_t, float64_t const *, svuint64_t);
18184__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f32)))
18185svfloat32_t svld1q_gather_offset(svbool_t, float32_t const *, svuint64_t);
18186__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_f16)))
18187svfloat16_t svld1q_gather_offset(svbool_t, float16_t const *, svuint64_t);
18188__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s32)))
18189svint32_t svld1q_gather_offset(svbool_t, int32_t const *, svuint64_t);
18190__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s64)))
18191svint64_t svld1q_gather_offset(svbool_t, int64_t const *, svuint64_t);
18192__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_mf8)))
18193svmfloat8_t svld1q_gather_offset(svbool_t, mfloat8_t const *, svuint64_t);
18194__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1q_gather_u64offset_s16)))
18195svint16_t svld1q_gather_offset(svbool_t, int16_t const *, svuint64_t);
18196__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_u64)))
18197svuint64_t svld1udq(svbool_t, uint64_t const *);
18198__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_f64)))
18199svfloat64_t svld1udq(svbool_t, float64_t const *);
18200__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_s64)))
18201svint64_t svld1udq(svbool_t, int64_t const *);
18202__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_u64)))
18203svuint64_t svld1udq_vnum(svbool_t, uint64_t const *, int64_t);
18204__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_f64)))
18205svfloat64_t svld1udq_vnum(svbool_t, float64_t const *, int64_t);
18206__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1udq_vnum_s64)))
18207svint64_t svld1udq_vnum(svbool_t, int64_t const *, int64_t);
18208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_u32)))
18209svuint32_t svld1uwq(svbool_t, uint32_t const *);
18210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_f32)))
18211svfloat32_t svld1uwq(svbool_t, float32_t const *);
18212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_s32)))
18213svint32_t svld1uwq(svbool_t, int32_t const *);
18214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_u32)))
18215svuint32_t svld1uwq_vnum(svbool_t, uint32_t const *, int64_t);
18216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_f32)))
18217svfloat32_t svld1uwq_vnum(svbool_t, float32_t const *, int64_t);
18218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1uwq_vnum_s32)))
18219svint32_t svld1uwq_vnum(svbool_t, int32_t const *, int64_t);
18220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_u64)))
18221void svst1dq(svbool_t, uint64_t *, svuint64_t);
18222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_f64)))
18223void svst1dq(svbool_t, float64_t *, svfloat64_t);
18224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_s64)))
18225void svst1dq(svbool_t, int64_t *, svint64_t);
18226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_u64)))
18227void svst1dq_vnum(svbool_t, uint64_t *, int64_t, svuint64_t);
18228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_f64)))
18229void svst1dq_vnum(svbool_t, float64_t *, int64_t, svfloat64_t);
18230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1dq_vnum_s64)))
18231void svst1dq_vnum(svbool_t, int64_t *, int64_t, svint64_t);
18232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u8)))
18233void svst1q_scatter(svbool_t, svuint64_t, svuint8_t);
18234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u32)))
18235void svst1q_scatter(svbool_t, svuint64_t, svuint32_t);
18236__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u64)))
18237void svst1q_scatter(svbool_t, svuint64_t, svuint64_t);
18238__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_u16)))
18239void svst1q_scatter(svbool_t, svuint64_t, svuint16_t);
18240__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_bf16)))
18241void svst1q_scatter(svbool_t, svuint64_t, svbfloat16_t);
18242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s8)))
18243void svst1q_scatter(svbool_t, svuint64_t, svint8_t);
18244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f64)))
18245void svst1q_scatter(svbool_t, svuint64_t, svfloat64_t);
18246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f32)))
18247void svst1q_scatter(svbool_t, svuint64_t, svfloat32_t);
18248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_f16)))
18249void svst1q_scatter(svbool_t, svuint64_t, svfloat16_t);
18250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s32)))
18251void svst1q_scatter(svbool_t, svuint64_t, svint32_t);
18252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s64)))
18253void svst1q_scatter(svbool_t, svuint64_t, svint64_t);
18254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_mf8)))
18255void svst1q_scatter(svbool_t, svuint64_t, svmfloat8_t);
18256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_s16)))
18257void svst1q_scatter(svbool_t, svuint64_t, svint16_t);
18258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u32)))
18259void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svuint32_t);
18260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u64)))
18261void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svuint64_t);
18262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_u16)))
18263void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svuint16_t);
18264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_bf16)))
18265void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svbfloat16_t);
18266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f64)))
18267void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svfloat64_t);
18268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f32)))
18269void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svfloat32_t);
18270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_f16)))
18271void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svfloat16_t);
18272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s32)))
18273void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svint32_t);
18274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s64)))
18275void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svint64_t);
18276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_index_s16)))
18277void svst1q_scatter_index(svbool_t, svuint64_t, int64_t, svint16_t);
18278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u8)))
18279void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint8_t);
18280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u32)))
18281void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint32_t);
18282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u64)))
18283void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint64_t);
18284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_u16)))
18285void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svuint16_t);
18286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_bf16)))
18287void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svbfloat16_t);
18288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s8)))
18289void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint8_t);
18290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f64)))
18291void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat64_t);
18292__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f32)))
18293void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat32_t);
18294__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_f16)))
18295void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svfloat16_t);
18296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s32)))
18297void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint32_t);
18298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s64)))
18299void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint64_t);
18300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_mf8)))
18301void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svmfloat8_t);
18302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64base_offset_s16)))
18303void svst1q_scatter_offset(svbool_t, svuint64_t, int64_t, svint16_t);
18304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u32)))
18305void svst1q_scatter_index(svbool_t, uint32_t *, svint64_t, svuint32_t);
18306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u64)))
18307void svst1q_scatter_index(svbool_t, uint64_t *, svint64_t, svuint64_t);
18308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_u16)))
18309void svst1q_scatter_index(svbool_t, uint16_t *, svint64_t, svuint16_t);
18310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_bf16)))
18311void svst1q_scatter_index(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
18312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f64)))
18313void svst1q_scatter_index(svbool_t, float64_t *, svint64_t, svfloat64_t);
18314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f32)))
18315void svst1q_scatter_index(svbool_t, float32_t *, svint64_t, svfloat32_t);
18316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_f16)))
18317void svst1q_scatter_index(svbool_t, float16_t *, svint64_t, svfloat16_t);
18318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s32)))
18319void svst1q_scatter_index(svbool_t, int32_t *, svint64_t, svint32_t);
18320__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s64)))
18321void svst1q_scatter_index(svbool_t, int64_t *, svint64_t, svint64_t);
18322__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64index_s16)))
18323void svst1q_scatter_index(svbool_t, int16_t *, svint64_t, svint16_t);
18324__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u32)))
18325void svst1q_scatter_index(svbool_t, uint32_t *, svuint64_t, svuint32_t);
18326__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u64)))
18327void svst1q_scatter_index(svbool_t, uint64_t *, svuint64_t, svuint64_t);
18328__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_u16)))
18329void svst1q_scatter_index(svbool_t, uint16_t *, svuint64_t, svuint16_t);
18330__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_bf16)))
18331void svst1q_scatter_index(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
18332__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f64)))
18333void svst1q_scatter_index(svbool_t, float64_t *, svuint64_t, svfloat64_t);
18334__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f32)))
18335void svst1q_scatter_index(svbool_t, float32_t *, svuint64_t, svfloat32_t);
18336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_f16)))
18337void svst1q_scatter_index(svbool_t, float16_t *, svuint64_t, svfloat16_t);
18338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s32)))
18339void svst1q_scatter_index(svbool_t, int32_t *, svuint64_t, svint32_t);
18340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s64)))
18341void svst1q_scatter_index(svbool_t, int64_t *, svuint64_t, svint64_t);
18342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64index_s16)))
18343void svst1q_scatter_index(svbool_t, int16_t *, svuint64_t, svint16_t);
18344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u8)))
18345void svst1q_scatter_offset(svbool_t, uint8_t *, svint64_t, svuint8_t);
18346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u32)))
18347void svst1q_scatter_offset(svbool_t, uint32_t *, svint64_t, svuint32_t);
18348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u64)))
18349void svst1q_scatter_offset(svbool_t, uint64_t *, svint64_t, svuint64_t);
18350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_u16)))
18351void svst1q_scatter_offset(svbool_t, uint16_t *, svint64_t, svuint16_t);
18352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_bf16)))
18353void svst1q_scatter_offset(svbool_t, bfloat16_t *, svint64_t, svbfloat16_t);
18354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s8)))
18355void svst1q_scatter_offset(svbool_t, int8_t *, svint64_t, svint8_t);
18356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f64)))
18357void svst1q_scatter_offset(svbool_t, float64_t *, svint64_t, svfloat64_t);
18358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f32)))
18359void svst1q_scatter_offset(svbool_t, float32_t *, svint64_t, svfloat32_t);
18360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_f16)))
18361void svst1q_scatter_offset(svbool_t, float16_t *, svint64_t, svfloat16_t);
18362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s32)))
18363void svst1q_scatter_offset(svbool_t, int32_t *, svint64_t, svint32_t);
18364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s64)))
18365void svst1q_scatter_offset(svbool_t, int64_t *, svint64_t, svint64_t);
18366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_mf8)))
18367void svst1q_scatter_offset(svbool_t, mfloat8_t *, svint64_t, svmfloat8_t);
18368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_s64offset_s16)))
18369void svst1q_scatter_offset(svbool_t, int16_t *, svint64_t, svint16_t);
18370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u8)))
18371void svst1q_scatter_offset(svbool_t, uint8_t *, svuint64_t, svuint8_t);
18372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u32)))
18373void svst1q_scatter_offset(svbool_t, uint32_t *, svuint64_t, svuint32_t);
18374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u64)))
18375void svst1q_scatter_offset(svbool_t, uint64_t *, svuint64_t, svuint64_t);
18376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_u16)))
18377void svst1q_scatter_offset(svbool_t, uint16_t *, svuint64_t, svuint16_t);
18378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_bf16)))
18379void svst1q_scatter_offset(svbool_t, bfloat16_t *, svuint64_t, svbfloat16_t);
18380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s8)))
18381void svst1q_scatter_offset(svbool_t, int8_t *, svuint64_t, svint8_t);
18382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f64)))
18383void svst1q_scatter_offset(svbool_t, float64_t *, svuint64_t, svfloat64_t);
18384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f32)))
18385void svst1q_scatter_offset(svbool_t, float32_t *, svuint64_t, svfloat32_t);
18386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_f16)))
18387void svst1q_scatter_offset(svbool_t, float16_t *, svuint64_t, svfloat16_t);
18388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s32)))
18389void svst1q_scatter_offset(svbool_t, int32_t *, svuint64_t, svint32_t);
18390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s64)))
18391void svst1q_scatter_offset(svbool_t, int64_t *, svuint64_t, svint64_t);
18392__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_mf8)))
18393void svst1q_scatter_offset(svbool_t, mfloat8_t *, svuint64_t, svmfloat8_t);
18394__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1q_scatter_u64offset_s16)))
18395void svst1q_scatter_offset(svbool_t, int16_t *, svuint64_t, svint16_t);
18396__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_u32)))
18397void svst1wq(svbool_t, uint32_t *, svuint32_t);
18398__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_f32)))
18399void svst1wq(svbool_t, float32_t *, svfloat32_t);
18400__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_s32)))
18401void svst1wq(svbool_t, int32_t *, svint32_t);
18402__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_u32)))
18403void svst1wq_vnum(svbool_t, uint32_t *, int64_t, svuint32_t);
18404__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_f32)))
18405void svst1wq_vnum(svbool_t, float32_t *, int64_t, svfloat32_t);
18406__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1wq_vnum_s32)))
18407void svst1wq_vnum(svbool_t, int32_t *, int64_t, svint32_t);
18408__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c8)))
18409uint64_t svcntp_c8(svcount_t, uint64_t);
18410__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c32)))
18411uint64_t svcntp_c32(svcount_t, uint64_t);
18412__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c64)))
18413uint64_t svcntp_c64(svcount_t, uint64_t);
18414__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcntp_c16)))
18415uint64_t svcntp_c16(svcount_t, uint64_t);
18416__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x2)))
18417svuint8x2_t svld1_u8_x2(svcount_t, uint8_t const *);
18418__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x2)))
18419svint8x2_t svld1_s8_x2(svcount_t, int8_t const *);
18420__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x2)))
18421svmfloat8x2_t svld1_mf8_x2(svcount_t, mfloat8_t const *);
18422__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x2)))
18423svuint64x2_t svld1_u64_x2(svcount_t, uint64_t const *);
18424__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x2)))
18425svfloat64x2_t svld1_f64_x2(svcount_t, float64_t const *);
18426__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x2)))
18427svint64x2_t svld1_s64_x2(svcount_t, int64_t const *);
18428__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x2)))
18429svuint16x2_t svld1_u16_x2(svcount_t, uint16_t const *);
18430__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x2)))
18431svbfloat16x2_t svld1_bf16_x2(svcount_t, bfloat16_t const *);
18432__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x2)))
18433svfloat16x2_t svld1_f16_x2(svcount_t, float16_t const *);
18434__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x2)))
18435svint16x2_t svld1_s16_x2(svcount_t, int16_t const *);
18436__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x2)))
18437svuint32x2_t svld1_u32_x2(svcount_t, uint32_t const *);
18438__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x2)))
18439svfloat32x2_t svld1_f32_x2(svcount_t, float32_t const *);
18440__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x2)))
18441svint32x2_t svld1_s32_x2(svcount_t, int32_t const *);
18442__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x4)))
18443svuint8x4_t svld1_u8_x4(svcount_t, uint8_t const *);
18444__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x4)))
18445svint8x4_t svld1_s8_x4(svcount_t, int8_t const *);
18446__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x4)))
18447svmfloat8x4_t svld1_mf8_x4(svcount_t, mfloat8_t const *);
18448__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x4)))
18449svuint64x4_t svld1_u64_x4(svcount_t, uint64_t const *);
18450__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x4)))
18451svfloat64x4_t svld1_f64_x4(svcount_t, float64_t const *);
18452__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x4)))
18453svint64x4_t svld1_s64_x4(svcount_t, int64_t const *);
18454__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x4)))
18455svuint16x4_t svld1_u16_x4(svcount_t, uint16_t const *);
18456__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x4)))
18457svbfloat16x4_t svld1_bf16_x4(svcount_t, bfloat16_t const *);
18458__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x4)))
18459svfloat16x4_t svld1_f16_x4(svcount_t, float16_t const *);
18460__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x4)))
18461svint16x4_t svld1_s16_x4(svcount_t, int16_t const *);
18462__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x4)))
18463svuint32x4_t svld1_u32_x4(svcount_t, uint32_t const *);
18464__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x4)))
18465svfloat32x4_t svld1_f32_x4(svcount_t, float32_t const *);
18466__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x4)))
18467svint32x4_t svld1_s32_x4(svcount_t, int32_t const *);
18468__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x2)))
18469svuint8x2_t svld1_vnum_u8_x2(svcount_t, uint8_t const *, int64_t);
18470__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x2)))
18471svint8x2_t svld1_vnum_s8_x2(svcount_t, int8_t const *, int64_t);
18472__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x2)))
18473svmfloat8x2_t svld1_vnum_mf8_x2(svcount_t, mfloat8_t const *, int64_t);
18474__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x2)))
18475svuint64x2_t svld1_vnum_u64_x2(svcount_t, uint64_t const *, int64_t);
18476__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x2)))
18477svfloat64x2_t svld1_vnum_f64_x2(svcount_t, float64_t const *, int64_t);
18478__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x2)))
18479svint64x2_t svld1_vnum_s64_x2(svcount_t, int64_t const *, int64_t);
18480__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x2)))
18481svuint16x2_t svld1_vnum_u16_x2(svcount_t, uint16_t const *, int64_t);
18482__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x2)))
18483svbfloat16x2_t svld1_vnum_bf16_x2(svcount_t, bfloat16_t const *, int64_t);
18484__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x2)))
18485svfloat16x2_t svld1_vnum_f16_x2(svcount_t, float16_t const *, int64_t);
18486__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x2)))
18487svint16x2_t svld1_vnum_s16_x2(svcount_t, int16_t const *, int64_t);
18488__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x2)))
18489svuint32x2_t svld1_vnum_u32_x2(svcount_t, uint32_t const *, int64_t);
18490__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x2)))
18491svfloat32x2_t svld1_vnum_f32_x2(svcount_t, float32_t const *, int64_t);
18492__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x2)))
18493svint32x2_t svld1_vnum_s32_x2(svcount_t, int32_t const *, int64_t);
18494__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x4)))
18495svuint8x4_t svld1_vnum_u8_x4(svcount_t, uint8_t const *, int64_t);
18496__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x4)))
18497svint8x4_t svld1_vnum_s8_x4(svcount_t, int8_t const *, int64_t);
18498__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x4)))
18499svmfloat8x4_t svld1_vnum_mf8_x4(svcount_t, mfloat8_t const *, int64_t);
18500__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x4)))
18501svuint64x4_t svld1_vnum_u64_x4(svcount_t, uint64_t const *, int64_t);
18502__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x4)))
18503svfloat64x4_t svld1_vnum_f64_x4(svcount_t, float64_t const *, int64_t);
18504__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x4)))
18505svint64x4_t svld1_vnum_s64_x4(svcount_t, int64_t const *, int64_t);
18506__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x4)))
18507svuint16x4_t svld1_vnum_u16_x4(svcount_t, uint16_t const *, int64_t);
18508__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x4)))
18509svbfloat16x4_t svld1_vnum_bf16_x4(svcount_t, bfloat16_t const *, int64_t);
18510__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x4)))
18511svfloat16x4_t svld1_vnum_f16_x4(svcount_t, float16_t const *, int64_t);
18512__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x4)))
18513svint16x4_t svld1_vnum_s16_x4(svcount_t, int16_t const *, int64_t);
18514__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x4)))
18515svuint32x4_t svld1_vnum_u32_x4(svcount_t, uint32_t const *, int64_t);
18516__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x4)))
18517svfloat32x4_t svld1_vnum_f32_x4(svcount_t, float32_t const *, int64_t);
18518__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x4)))
18519svint32x4_t svld1_vnum_s32_x4(svcount_t, int32_t const *, int64_t);
18520__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x2)))
18521svuint8x2_t svldnt1_u8_x2(svcount_t, uint8_t const *);
18522__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x2)))
18523svint8x2_t svldnt1_s8_x2(svcount_t, int8_t const *);
18524__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x2)))
18525svmfloat8x2_t svldnt1_mf8_x2(svcount_t, mfloat8_t const *);
18526__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x2)))
18527svuint64x2_t svldnt1_u64_x2(svcount_t, uint64_t const *);
18528__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x2)))
18529svfloat64x2_t svldnt1_f64_x2(svcount_t, float64_t const *);
18530__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x2)))
18531svint64x2_t svldnt1_s64_x2(svcount_t, int64_t const *);
18532__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x2)))
18533svuint16x2_t svldnt1_u16_x2(svcount_t, uint16_t const *);
18534__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x2)))
18535svbfloat16x2_t svldnt1_bf16_x2(svcount_t, bfloat16_t const *);
18536__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x2)))
18537svfloat16x2_t svldnt1_f16_x2(svcount_t, float16_t const *);
18538__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x2)))
18539svint16x2_t svldnt1_s16_x2(svcount_t, int16_t const *);
18540__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x2)))
18541svuint32x2_t svldnt1_u32_x2(svcount_t, uint32_t const *);
18542__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x2)))
18543svfloat32x2_t svldnt1_f32_x2(svcount_t, float32_t const *);
18544__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x2)))
18545svint32x2_t svldnt1_s32_x2(svcount_t, int32_t const *);
18546__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x4)))
18547svuint8x4_t svldnt1_u8_x4(svcount_t, uint8_t const *);
18548__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x4)))
18549svint8x4_t svldnt1_s8_x4(svcount_t, int8_t const *);
18550__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x4)))
18551svmfloat8x4_t svldnt1_mf8_x4(svcount_t, mfloat8_t const *);
18552__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x4)))
18553svuint64x4_t svldnt1_u64_x4(svcount_t, uint64_t const *);
18554__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x4)))
18555svfloat64x4_t svldnt1_f64_x4(svcount_t, float64_t const *);
18556__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x4)))
18557svint64x4_t svldnt1_s64_x4(svcount_t, int64_t const *);
18558__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x4)))
18559svuint16x4_t svldnt1_u16_x4(svcount_t, uint16_t const *);
18560__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x4)))
18561svbfloat16x4_t svldnt1_bf16_x4(svcount_t, bfloat16_t const *);
18562__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x4)))
18563svfloat16x4_t svldnt1_f16_x4(svcount_t, float16_t const *);
18564__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x4)))
18565svint16x4_t svldnt1_s16_x4(svcount_t, int16_t const *);
18566__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x4)))
18567svuint32x4_t svldnt1_u32_x4(svcount_t, uint32_t const *);
18568__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x4)))
18569svfloat32x4_t svldnt1_f32_x4(svcount_t, float32_t const *);
18570__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x4)))
18571svint32x4_t svldnt1_s32_x4(svcount_t, int32_t const *);
18572__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x2)))
18573svuint8x2_t svldnt1_vnum_u8_x2(svcount_t, uint8_t const *, int64_t);
18574__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x2)))
18575svint8x2_t svldnt1_vnum_s8_x2(svcount_t, int8_t const *, int64_t);
18576__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x2)))
18577svmfloat8x2_t svldnt1_vnum_mf8_x2(svcount_t, mfloat8_t const *, int64_t);
18578__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x2)))
18579svuint64x2_t svldnt1_vnum_u64_x2(svcount_t, uint64_t const *, int64_t);
18580__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x2)))
18581svfloat64x2_t svldnt1_vnum_f64_x2(svcount_t, float64_t const *, int64_t);
18582__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x2)))
18583svint64x2_t svldnt1_vnum_s64_x2(svcount_t, int64_t const *, int64_t);
18584__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x2)))
18585svuint16x2_t svldnt1_vnum_u16_x2(svcount_t, uint16_t const *, int64_t);
18586__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x2)))
18587svbfloat16x2_t svldnt1_vnum_bf16_x2(svcount_t, bfloat16_t const *, int64_t);
18588__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x2)))
18589svfloat16x2_t svldnt1_vnum_f16_x2(svcount_t, float16_t const *, int64_t);
18590__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x2)))
18591svint16x2_t svldnt1_vnum_s16_x2(svcount_t, int16_t const *, int64_t);
18592__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x2)))
18593svuint32x2_t svldnt1_vnum_u32_x2(svcount_t, uint32_t const *, int64_t);
18594__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x2)))
18595svfloat32x2_t svldnt1_vnum_f32_x2(svcount_t, float32_t const *, int64_t);
18596__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x2)))
18597svint32x2_t svldnt1_vnum_s32_x2(svcount_t, int32_t const *, int64_t);
18598__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x4)))
18599svuint8x4_t svldnt1_vnum_u8_x4(svcount_t, uint8_t const *, int64_t);
18600__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x4)))
18601svint8x4_t svldnt1_vnum_s8_x4(svcount_t, int8_t const *, int64_t);
18602__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x4)))
18603svmfloat8x4_t svldnt1_vnum_mf8_x4(svcount_t, mfloat8_t const *, int64_t);
18604__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x4)))
18605svuint64x4_t svldnt1_vnum_u64_x4(svcount_t, uint64_t const *, int64_t);
18606__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x4)))
18607svfloat64x4_t svldnt1_vnum_f64_x4(svcount_t, float64_t const *, int64_t);
18608__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x4)))
18609svint64x4_t svldnt1_vnum_s64_x4(svcount_t, int64_t const *, int64_t);
18610__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x4)))
18611svuint16x4_t svldnt1_vnum_u16_x4(svcount_t, uint16_t const *, int64_t);
18612__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x4)))
18613svbfloat16x4_t svldnt1_vnum_bf16_x4(svcount_t, bfloat16_t const *, int64_t);
18614__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x4)))
18615svfloat16x4_t svldnt1_vnum_f16_x4(svcount_t, float16_t const *, int64_t);
18616__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x4)))
18617svint16x4_t svldnt1_vnum_s16_x4(svcount_t, int16_t const *, int64_t);
18618__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x4)))
18619svuint32x4_t svldnt1_vnum_u32_x4(svcount_t, uint32_t const *, int64_t);
18620__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x4)))
18621svfloat32x4_t svldnt1_vnum_f32_x4(svcount_t, float32_t const *, int64_t);
18622__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x4)))
18623svint32x4_t svldnt1_vnum_s32_x4(svcount_t, int32_t const *, int64_t);
18624__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c8)))
18625svbool_t svpext_lane_c8(svcount_t, uint64_t);
18626__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c32)))
18627svbool_t svpext_lane_c32(svcount_t, uint64_t);
18628__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c64)))
18629svbool_t svpext_lane_c64(svcount_t, uint64_t);
18630__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c16)))
18631svbool_t svpext_lane_c16(svcount_t, uint64_t);
18632__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c8_x2)))
18633svboolx2_t svpext_lane_c8_x2(svcount_t, uint64_t);
18634__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c32_x2)))
18635svboolx2_t svpext_lane_c32_x2(svcount_t, uint64_t);
18636__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c64_x2)))
18637svboolx2_t svpext_lane_c64_x2(svcount_t, uint64_t);
18638__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpext_lane_c16_x2)))
18639svboolx2_t svpext_lane_c16_x2(svcount_t, uint64_t);
18640__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpfalse_c)))
18641svcount_t svpfalse_c(void);
18642__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c16)))
18643svcount_t svpsel_lane_c16(svcount_t, svbool_t, uint32_t);
18644__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c32)))
18645svcount_t svpsel_lane_c32(svcount_t, svbool_t, uint32_t);
18646__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c64)))
18647svcount_t svpsel_lane_c64(svcount_t, svbool_t, uint32_t);
18648__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpsel_lane_c8)))
18649svcount_t svpsel_lane_c8(svcount_t, svbool_t, uint32_t);
18650__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c8)))
18651svcount_t svptrue_c8(void);
18652__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c32)))
18653svcount_t svptrue_c32(void);
18654__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c64)))
18655svcount_t svptrue_c64(void);
18656__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svptrue_c16)))
18657svcount_t svptrue_c16(void);
18658__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_b)))
18659svbool_t svreinterpret_b(svcount_t);
18660__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_c)))
18661svcount_t svreinterpret_c(svbool_t);
18662__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x2)))
18663void svst1_u8_x2(svcount_t, uint8_t *, svuint8x2_t);
18664__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x2)))
18665void svst1_s8_x2(svcount_t, int8_t *, svint8x2_t);
18666__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x2)))
18667void svst1_mf8_x2(svcount_t, mfloat8_t *, svmfloat8x2_t);
18668__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x2)))
18669void svst1_u64_x2(svcount_t, uint64_t *, svuint64x2_t);
18670__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x2)))
18671void svst1_f64_x2(svcount_t, float64_t *, svfloat64x2_t);
18672__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x2)))
18673void svst1_s64_x2(svcount_t, int64_t *, svint64x2_t);
18674__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x2)))
18675void svst1_u16_x2(svcount_t, uint16_t *, svuint16x2_t);
18676__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x2)))
18677void svst1_bf16_x2(svcount_t, bfloat16_t *, svbfloat16x2_t);
18678__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x2)))
18679void svst1_f16_x2(svcount_t, float16_t *, svfloat16x2_t);
18680__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x2)))
18681void svst1_s16_x2(svcount_t, int16_t *, svint16x2_t);
18682__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x2)))
18683void svst1_u32_x2(svcount_t, uint32_t *, svuint32x2_t);
18684__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x2)))
18685void svst1_f32_x2(svcount_t, float32_t *, svfloat32x2_t);
18686__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x2)))
18687void svst1_s32_x2(svcount_t, int32_t *, svint32x2_t);
18688__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x4)))
18689void svst1_u8_x4(svcount_t, uint8_t *, svuint8x4_t);
18690__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x4)))
18691void svst1_s8_x4(svcount_t, int8_t *, svint8x4_t);
18692__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x4)))
18693void svst1_mf8_x4(svcount_t, mfloat8_t *, svmfloat8x4_t);
18694__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x4)))
18695void svst1_u64_x4(svcount_t, uint64_t *, svuint64x4_t);
18696__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x4)))
18697void svst1_f64_x4(svcount_t, float64_t *, svfloat64x4_t);
18698__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x4)))
18699void svst1_s64_x4(svcount_t, int64_t *, svint64x4_t);
18700__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x4)))
18701void svst1_u16_x4(svcount_t, uint16_t *, svuint16x4_t);
18702__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x4)))
18703void svst1_bf16_x4(svcount_t, bfloat16_t *, svbfloat16x4_t);
18704__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x4)))
18705void svst1_f16_x4(svcount_t, float16_t *, svfloat16x4_t);
18706__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x4)))
18707void svst1_s16_x4(svcount_t, int16_t *, svint16x4_t);
18708__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x4)))
18709void svst1_u32_x4(svcount_t, uint32_t *, svuint32x4_t);
18710__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x4)))
18711void svst1_f32_x4(svcount_t, float32_t *, svfloat32x4_t);
18712__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x4)))
18713void svst1_s32_x4(svcount_t, int32_t *, svint32x4_t);
18714__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x2)))
18715void svst1_vnum_u8_x2(svcount_t, uint8_t *, int64_t, svuint8x2_t);
18716__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x2)))
18717void svst1_vnum_s8_x2(svcount_t, int8_t *, int64_t, svint8x2_t);
18718__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x2)))
18719void svst1_vnum_mf8_x2(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
18720__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x2)))
18721void svst1_vnum_u64_x2(svcount_t, uint64_t *, int64_t, svuint64x2_t);
18722__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x2)))
18723void svst1_vnum_f64_x2(svcount_t, float64_t *, int64_t, svfloat64x2_t);
18724__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x2)))
18725void svst1_vnum_s64_x2(svcount_t, int64_t *, int64_t, svint64x2_t);
18726__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x2)))
18727void svst1_vnum_u16_x2(svcount_t, uint16_t *, int64_t, svuint16x2_t);
18728__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x2)))
18729void svst1_vnum_bf16_x2(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
18730__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x2)))
18731void svst1_vnum_f16_x2(svcount_t, float16_t *, int64_t, svfloat16x2_t);
18732__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x2)))
18733void svst1_vnum_s16_x2(svcount_t, int16_t *, int64_t, svint16x2_t);
18734__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x2)))
18735void svst1_vnum_u32_x2(svcount_t, uint32_t *, int64_t, svuint32x2_t);
18736__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x2)))
18737void svst1_vnum_f32_x2(svcount_t, float32_t *, int64_t, svfloat32x2_t);
18738__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x2)))
18739void svst1_vnum_s32_x2(svcount_t, int32_t *, int64_t, svint32x2_t);
18740__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x4)))
18741void svst1_vnum_u8_x4(svcount_t, uint8_t *, int64_t, svuint8x4_t);
18742__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x4)))
18743void svst1_vnum_s8_x4(svcount_t, int8_t *, int64_t, svint8x4_t);
18744__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x4)))
18745void svst1_vnum_mf8_x4(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
18746__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x4)))
18747void svst1_vnum_u64_x4(svcount_t, uint64_t *, int64_t, svuint64x4_t);
18748__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x4)))
18749void svst1_vnum_f64_x4(svcount_t, float64_t *, int64_t, svfloat64x4_t);
18750__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x4)))
18751void svst1_vnum_s64_x4(svcount_t, int64_t *, int64_t, svint64x4_t);
18752__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x4)))
18753void svst1_vnum_u16_x4(svcount_t, uint16_t *, int64_t, svuint16x4_t);
18754__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x4)))
18755void svst1_vnum_bf16_x4(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
18756__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x4)))
18757void svst1_vnum_f16_x4(svcount_t, float16_t *, int64_t, svfloat16x4_t);
18758__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x4)))
18759void svst1_vnum_s16_x4(svcount_t, int16_t *, int64_t, svint16x4_t);
18760__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x4)))
18761void svst1_vnum_u32_x4(svcount_t, uint32_t *, int64_t, svuint32x4_t);
18762__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x4)))
18763void svst1_vnum_f32_x4(svcount_t, float32_t *, int64_t, svfloat32x4_t);
18764__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x4)))
18765void svst1_vnum_s32_x4(svcount_t, int32_t *, int64_t, svint32x4_t);
18766__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x2)))
18767void svstnt1_u8_x2(svcount_t, uint8_t *, svuint8x2_t);
18768__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x2)))
18769void svstnt1_s8_x2(svcount_t, int8_t *, svint8x2_t);
18770__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x2)))
18771void svstnt1_mf8_x2(svcount_t, mfloat8_t *, svmfloat8x2_t);
18772__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x2)))
18773void svstnt1_u64_x2(svcount_t, uint64_t *, svuint64x2_t);
18774__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x2)))
18775void svstnt1_f64_x2(svcount_t, float64_t *, svfloat64x2_t);
18776__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x2)))
18777void svstnt1_s64_x2(svcount_t, int64_t *, svint64x2_t);
18778__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x2)))
18779void svstnt1_u16_x2(svcount_t, uint16_t *, svuint16x2_t);
18780__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x2)))
18781void svstnt1_bf16_x2(svcount_t, bfloat16_t *, svbfloat16x2_t);
18782__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x2)))
18783void svstnt1_f16_x2(svcount_t, float16_t *, svfloat16x2_t);
18784__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x2)))
18785void svstnt1_s16_x2(svcount_t, int16_t *, svint16x2_t);
18786__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x2)))
18787void svstnt1_u32_x2(svcount_t, uint32_t *, svuint32x2_t);
18788__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x2)))
18789void svstnt1_f32_x2(svcount_t, float32_t *, svfloat32x2_t);
18790__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x2)))
18791void svstnt1_s32_x2(svcount_t, int32_t *, svint32x2_t);
18792__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x4)))
18793void svstnt1_u8_x4(svcount_t, uint8_t *, svuint8x4_t);
18794__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x4)))
18795void svstnt1_s8_x4(svcount_t, int8_t *, svint8x4_t);
18796__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x4)))
18797void svstnt1_mf8_x4(svcount_t, mfloat8_t *, svmfloat8x4_t);
18798__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x4)))
18799void svstnt1_u64_x4(svcount_t, uint64_t *, svuint64x4_t);
18800__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x4)))
18801void svstnt1_f64_x4(svcount_t, float64_t *, svfloat64x4_t);
18802__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x4)))
18803void svstnt1_s64_x4(svcount_t, int64_t *, svint64x4_t);
18804__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x4)))
18805void svstnt1_u16_x4(svcount_t, uint16_t *, svuint16x4_t);
18806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x4)))
18807void svstnt1_bf16_x4(svcount_t, bfloat16_t *, svbfloat16x4_t);
18808__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x4)))
18809void svstnt1_f16_x4(svcount_t, float16_t *, svfloat16x4_t);
18810__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x4)))
18811void svstnt1_s16_x4(svcount_t, int16_t *, svint16x4_t);
18812__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x4)))
18813void svstnt1_u32_x4(svcount_t, uint32_t *, svuint32x4_t);
18814__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x4)))
18815void svstnt1_f32_x4(svcount_t, float32_t *, svfloat32x4_t);
18816__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x4)))
18817void svstnt1_s32_x4(svcount_t, int32_t *, svint32x4_t);
18818__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x2)))
18819void svstnt1_vnum_u8_x2(svcount_t, uint8_t *, int64_t, svuint8x2_t);
18820__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x2)))
18821void svstnt1_vnum_s8_x2(svcount_t, int8_t *, int64_t, svint8x2_t);
18822__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x2)))
18823void svstnt1_vnum_mf8_x2(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
18824__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x2)))
18825void svstnt1_vnum_u64_x2(svcount_t, uint64_t *, int64_t, svuint64x2_t);
18826__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x2)))
18827void svstnt1_vnum_f64_x2(svcount_t, float64_t *, int64_t, svfloat64x2_t);
18828__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x2)))
18829void svstnt1_vnum_s64_x2(svcount_t, int64_t *, int64_t, svint64x2_t);
18830__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x2)))
18831void svstnt1_vnum_u16_x2(svcount_t, uint16_t *, int64_t, svuint16x2_t);
18832__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x2)))
18833void svstnt1_vnum_bf16_x2(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
18834__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x2)))
18835void svstnt1_vnum_f16_x2(svcount_t, float16_t *, int64_t, svfloat16x2_t);
18836__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x2)))
18837void svstnt1_vnum_s16_x2(svcount_t, int16_t *, int64_t, svint16x2_t);
18838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x2)))
18839void svstnt1_vnum_u32_x2(svcount_t, uint32_t *, int64_t, svuint32x2_t);
18840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x2)))
18841void svstnt1_vnum_f32_x2(svcount_t, float32_t *, int64_t, svfloat32x2_t);
18842__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x2)))
18843void svstnt1_vnum_s32_x2(svcount_t, int32_t *, int64_t, svint32x2_t);
18844__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x4)))
18845void svstnt1_vnum_u8_x4(svcount_t, uint8_t *, int64_t, svuint8x4_t);
18846__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x4)))
18847void svstnt1_vnum_s8_x4(svcount_t, int8_t *, int64_t, svint8x4_t);
18848__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x4)))
18849void svstnt1_vnum_mf8_x4(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
18850__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x4)))
18851void svstnt1_vnum_u64_x4(svcount_t, uint64_t *, int64_t, svuint64x4_t);
18852__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x4)))
18853void svstnt1_vnum_f64_x4(svcount_t, float64_t *, int64_t, svfloat64x4_t);
18854__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x4)))
18855void svstnt1_vnum_s64_x4(svcount_t, int64_t *, int64_t, svint64x4_t);
18856__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x4)))
18857void svstnt1_vnum_u16_x4(svcount_t, uint16_t *, int64_t, svuint16x4_t);
18858__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x4)))
18859void svstnt1_vnum_bf16_x4(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
18860__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x4)))
18861void svstnt1_vnum_f16_x4(svcount_t, float16_t *, int64_t, svfloat16x4_t);
18862__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x4)))
18863void svstnt1_vnum_s16_x4(svcount_t, int16_t *, int64_t, svint16x4_t);
18864__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x4)))
18865void svstnt1_vnum_u32_x4(svcount_t, uint32_t *, int64_t, svuint32x4_t);
18866__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x4)))
18867void svstnt1_vnum_f32_x4(svcount_t, float32_t *, int64_t, svfloat32x4_t);
18868__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x4)))
18869void svstnt1_vnum_s32_x4(svcount_t, int32_t *, int64_t, svint32x4_t);
18870__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_s64)))
18871svcount_t svwhilege_c8_s64(int64_t, int64_t, uint64_t);
18872__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_s64)))
18873svcount_t svwhilege_c32_s64(int64_t, int64_t, uint64_t);
18874__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_s64)))
18875svcount_t svwhilege_c64_s64(int64_t, int64_t, uint64_t);
18876__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_s64)))
18877svcount_t svwhilege_c16_s64(int64_t, int64_t, uint64_t);
18878__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_u64)))
18879svcount_t svwhilege_c8_u64(uint64_t, uint64_t, uint64_t);
18880__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_u64)))
18881svcount_t svwhilege_c32_u64(uint64_t, uint64_t, uint64_t);
18882__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_u64)))
18883svcount_t svwhilege_c64_u64(uint64_t, uint64_t, uint64_t);
18884__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_u64)))
18885svcount_t svwhilege_c16_u64(uint64_t, uint64_t, uint64_t);
18886__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_s64)))
18887svcount_t svwhilegt_c8_s64(int64_t, int64_t, uint64_t);
18888__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_s64)))
18889svcount_t svwhilegt_c32_s64(int64_t, int64_t, uint64_t);
18890__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_s64)))
18891svcount_t svwhilegt_c64_s64(int64_t, int64_t, uint64_t);
18892__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_s64)))
18893svcount_t svwhilegt_c16_s64(int64_t, int64_t, uint64_t);
18894__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_u64)))
18895svcount_t svwhilegt_c8_u64(uint64_t, uint64_t, uint64_t);
18896__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_u64)))
18897svcount_t svwhilegt_c32_u64(uint64_t, uint64_t, uint64_t);
18898__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_u64)))
18899svcount_t svwhilegt_c64_u64(uint64_t, uint64_t, uint64_t);
18900__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_u64)))
18901svcount_t svwhilegt_c16_u64(uint64_t, uint64_t, uint64_t);
18902__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_s64)))
18903svcount_t svwhilele_c8_s64(int64_t, int64_t, uint64_t);
18904__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_s64)))
18905svcount_t svwhilele_c32_s64(int64_t, int64_t, uint64_t);
18906__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_s64)))
18907svcount_t svwhilele_c64_s64(int64_t, int64_t, uint64_t);
18908__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_s64)))
18909svcount_t svwhilele_c16_s64(int64_t, int64_t, uint64_t);
18910__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_u64)))
18911svcount_t svwhilele_c8_u64(uint64_t, uint64_t, uint64_t);
18912__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_u64)))
18913svcount_t svwhilele_c32_u64(uint64_t, uint64_t, uint64_t);
18914__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_u64)))
18915svcount_t svwhilele_c64_u64(uint64_t, uint64_t, uint64_t);
18916__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_u64)))
18917svcount_t svwhilele_c16_u64(uint64_t, uint64_t, uint64_t);
18918__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_u64)))
18919svcount_t svwhilelt_c8_u64(uint64_t, uint64_t, uint64_t);
18920__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_u64)))
18921svcount_t svwhilelt_c32_u64(uint64_t, uint64_t, uint64_t);
18922__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_u64)))
18923svcount_t svwhilelt_c64_u64(uint64_t, uint64_t, uint64_t);
18924__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_u64)))
18925svcount_t svwhilelt_c16_u64(uint64_t, uint64_t, uint64_t);
18926__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_s64)))
18927svcount_t svwhilelt_c8_s64(int64_t, int64_t, uint64_t);
18928__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_s64)))
18929svcount_t svwhilelt_c32_s64(int64_t, int64_t, uint64_t);
18930__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_s64)))
18931svcount_t svwhilelt_c64_s64(int64_t, int64_t, uint64_t);
18932__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_s64)))
18933svcount_t svwhilelt_c16_s64(int64_t, int64_t, uint64_t);
18934__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x2)))
18935svuint8x2_t svld1_x2(svcount_t, uint8_t const *);
18936__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x2)))
18937svint8x2_t svld1_x2(svcount_t, int8_t const *);
18938__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x2)))
18939svmfloat8x2_t svld1_x2(svcount_t, mfloat8_t const *);
18940__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x2)))
18941svuint64x2_t svld1_x2(svcount_t, uint64_t const *);
18942__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x2)))
18943svfloat64x2_t svld1_x2(svcount_t, float64_t const *);
18944__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x2)))
18945svint64x2_t svld1_x2(svcount_t, int64_t const *);
18946__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x2)))
18947svuint16x2_t svld1_x2(svcount_t, uint16_t const *);
18948__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x2)))
18949svbfloat16x2_t svld1_x2(svcount_t, bfloat16_t const *);
18950__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x2)))
18951svfloat16x2_t svld1_x2(svcount_t, float16_t const *);
18952__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x2)))
18953svint16x2_t svld1_x2(svcount_t, int16_t const *);
18954__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x2)))
18955svuint32x2_t svld1_x2(svcount_t, uint32_t const *);
18956__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x2)))
18957svfloat32x2_t svld1_x2(svcount_t, float32_t const *);
18958__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x2)))
18959svint32x2_t svld1_x2(svcount_t, int32_t const *);
18960__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u8_x4)))
18961svuint8x4_t svld1_x4(svcount_t, uint8_t const *);
18962__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s8_x4)))
18963svint8x4_t svld1_x4(svcount_t, int8_t const *);
18964__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_mf8_x4)))
18965svmfloat8x4_t svld1_x4(svcount_t, mfloat8_t const *);
18966__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u64_x4)))
18967svuint64x4_t svld1_x4(svcount_t, uint64_t const *);
18968__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f64_x4)))
18969svfloat64x4_t svld1_x4(svcount_t, float64_t const *);
18970__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s64_x4)))
18971svint64x4_t svld1_x4(svcount_t, int64_t const *);
18972__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u16_x4)))
18973svuint16x4_t svld1_x4(svcount_t, uint16_t const *);
18974__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_bf16_x4)))
18975svbfloat16x4_t svld1_x4(svcount_t, bfloat16_t const *);
18976__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f16_x4)))
18977svfloat16x4_t svld1_x4(svcount_t, float16_t const *);
18978__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s16_x4)))
18979svint16x4_t svld1_x4(svcount_t, int16_t const *);
18980__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_u32_x4)))
18981svuint32x4_t svld1_x4(svcount_t, uint32_t const *);
18982__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_f32_x4)))
18983svfloat32x4_t svld1_x4(svcount_t, float32_t const *);
18984__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_s32_x4)))
18985svint32x4_t svld1_x4(svcount_t, int32_t const *);
18986__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x2)))
18987svuint8x2_t svld1_vnum_x2(svcount_t, uint8_t const *, int64_t);
18988__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x2)))
18989svint8x2_t svld1_vnum_x2(svcount_t, int8_t const *, int64_t);
18990__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x2)))
18991svmfloat8x2_t svld1_vnum_x2(svcount_t, mfloat8_t const *, int64_t);
18992__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x2)))
18993svuint64x2_t svld1_vnum_x2(svcount_t, uint64_t const *, int64_t);
18994__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x2)))
18995svfloat64x2_t svld1_vnum_x2(svcount_t, float64_t const *, int64_t);
18996__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x2)))
18997svint64x2_t svld1_vnum_x2(svcount_t, int64_t const *, int64_t);
18998__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x2)))
18999svuint16x2_t svld1_vnum_x2(svcount_t, uint16_t const *, int64_t);
19000__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x2)))
19001svbfloat16x2_t svld1_vnum_x2(svcount_t, bfloat16_t const *, int64_t);
19002__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x2)))
19003svfloat16x2_t svld1_vnum_x2(svcount_t, float16_t const *, int64_t);
19004__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x2)))
19005svint16x2_t svld1_vnum_x2(svcount_t, int16_t const *, int64_t);
19006__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x2)))
19007svuint32x2_t svld1_vnum_x2(svcount_t, uint32_t const *, int64_t);
19008__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x2)))
19009svfloat32x2_t svld1_vnum_x2(svcount_t, float32_t const *, int64_t);
19010__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x2)))
19011svint32x2_t svld1_vnum_x2(svcount_t, int32_t const *, int64_t);
19012__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u8_x4)))
19013svuint8x4_t svld1_vnum_x4(svcount_t, uint8_t const *, int64_t);
19014__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s8_x4)))
19015svint8x4_t svld1_vnum_x4(svcount_t, int8_t const *, int64_t);
19016__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_mf8_x4)))
19017svmfloat8x4_t svld1_vnum_x4(svcount_t, mfloat8_t const *, int64_t);
19018__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u64_x4)))
19019svuint64x4_t svld1_vnum_x4(svcount_t, uint64_t const *, int64_t);
19020__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f64_x4)))
19021svfloat64x4_t svld1_vnum_x4(svcount_t, float64_t const *, int64_t);
19022__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s64_x4)))
19023svint64x4_t svld1_vnum_x4(svcount_t, int64_t const *, int64_t);
19024__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u16_x4)))
19025svuint16x4_t svld1_vnum_x4(svcount_t, uint16_t const *, int64_t);
19026__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_bf16_x4)))
19027svbfloat16x4_t svld1_vnum_x4(svcount_t, bfloat16_t const *, int64_t);
19028__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f16_x4)))
19029svfloat16x4_t svld1_vnum_x4(svcount_t, float16_t const *, int64_t);
19030__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s16_x4)))
19031svint16x4_t svld1_vnum_x4(svcount_t, int16_t const *, int64_t);
19032__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_u32_x4)))
19033svuint32x4_t svld1_vnum_x4(svcount_t, uint32_t const *, int64_t);
19034__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_f32_x4)))
19035svfloat32x4_t svld1_vnum_x4(svcount_t, float32_t const *, int64_t);
19036__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svld1_vnum_s32_x4)))
19037svint32x4_t svld1_vnum_x4(svcount_t, int32_t const *, int64_t);
19038__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x2)))
19039svuint8x2_t svldnt1_x2(svcount_t, uint8_t const *);
19040__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x2)))
19041svint8x2_t svldnt1_x2(svcount_t, int8_t const *);
19042__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x2)))
19043svmfloat8x2_t svldnt1_x2(svcount_t, mfloat8_t const *);
19044__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x2)))
19045svuint64x2_t svldnt1_x2(svcount_t, uint64_t const *);
19046__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x2)))
19047svfloat64x2_t svldnt1_x2(svcount_t, float64_t const *);
19048__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x2)))
19049svint64x2_t svldnt1_x2(svcount_t, int64_t const *);
19050__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x2)))
19051svuint16x2_t svldnt1_x2(svcount_t, uint16_t const *);
19052__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x2)))
19053svbfloat16x2_t svldnt1_x2(svcount_t, bfloat16_t const *);
19054__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x2)))
19055svfloat16x2_t svldnt1_x2(svcount_t, float16_t const *);
19056__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x2)))
19057svint16x2_t svldnt1_x2(svcount_t, int16_t const *);
19058__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x2)))
19059svuint32x2_t svldnt1_x2(svcount_t, uint32_t const *);
19060__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x2)))
19061svfloat32x2_t svldnt1_x2(svcount_t, float32_t const *);
19062__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x2)))
19063svint32x2_t svldnt1_x2(svcount_t, int32_t const *);
19064__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u8_x4)))
19065svuint8x4_t svldnt1_x4(svcount_t, uint8_t const *);
19066__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s8_x4)))
19067svint8x4_t svldnt1_x4(svcount_t, int8_t const *);
19068__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_mf8_x4)))
19069svmfloat8x4_t svldnt1_x4(svcount_t, mfloat8_t const *);
19070__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u64_x4)))
19071svuint64x4_t svldnt1_x4(svcount_t, uint64_t const *);
19072__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f64_x4)))
19073svfloat64x4_t svldnt1_x4(svcount_t, float64_t const *);
19074__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s64_x4)))
19075svint64x4_t svldnt1_x4(svcount_t, int64_t const *);
19076__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u16_x4)))
19077svuint16x4_t svldnt1_x4(svcount_t, uint16_t const *);
19078__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_bf16_x4)))
19079svbfloat16x4_t svldnt1_x4(svcount_t, bfloat16_t const *);
19080__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f16_x4)))
19081svfloat16x4_t svldnt1_x4(svcount_t, float16_t const *);
19082__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s16_x4)))
19083svint16x4_t svldnt1_x4(svcount_t, int16_t const *);
19084__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_u32_x4)))
19085svuint32x4_t svldnt1_x4(svcount_t, uint32_t const *);
19086__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_f32_x4)))
19087svfloat32x4_t svldnt1_x4(svcount_t, float32_t const *);
19088__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_s32_x4)))
19089svint32x4_t svldnt1_x4(svcount_t, int32_t const *);
19090__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x2)))
19091svuint8x2_t svldnt1_vnum_x2(svcount_t, uint8_t const *, int64_t);
19092__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x2)))
19093svint8x2_t svldnt1_vnum_x2(svcount_t, int8_t const *, int64_t);
19094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x2)))
19095svmfloat8x2_t svldnt1_vnum_x2(svcount_t, mfloat8_t const *, int64_t);
19096__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x2)))
19097svuint64x2_t svldnt1_vnum_x2(svcount_t, uint64_t const *, int64_t);
19098__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x2)))
19099svfloat64x2_t svldnt1_vnum_x2(svcount_t, float64_t const *, int64_t);
19100__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x2)))
19101svint64x2_t svldnt1_vnum_x2(svcount_t, int64_t const *, int64_t);
19102__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x2)))
19103svuint16x2_t svldnt1_vnum_x2(svcount_t, uint16_t const *, int64_t);
19104__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x2)))
19105svbfloat16x2_t svldnt1_vnum_x2(svcount_t, bfloat16_t const *, int64_t);
19106__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x2)))
19107svfloat16x2_t svldnt1_vnum_x2(svcount_t, float16_t const *, int64_t);
19108__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x2)))
19109svint16x2_t svldnt1_vnum_x2(svcount_t, int16_t const *, int64_t);
19110__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x2)))
19111svuint32x2_t svldnt1_vnum_x2(svcount_t, uint32_t const *, int64_t);
19112__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x2)))
19113svfloat32x2_t svldnt1_vnum_x2(svcount_t, float32_t const *, int64_t);
19114__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x2)))
19115svint32x2_t svldnt1_vnum_x2(svcount_t, int32_t const *, int64_t);
19116__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u8_x4)))
19117svuint8x4_t svldnt1_vnum_x4(svcount_t, uint8_t const *, int64_t);
19118__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s8_x4)))
19119svint8x4_t svldnt1_vnum_x4(svcount_t, int8_t const *, int64_t);
19120__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_mf8_x4)))
19121svmfloat8x4_t svldnt1_vnum_x4(svcount_t, mfloat8_t const *, int64_t);
19122__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u64_x4)))
19123svuint64x4_t svldnt1_vnum_x4(svcount_t, uint64_t const *, int64_t);
19124__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f64_x4)))
19125svfloat64x4_t svldnt1_vnum_x4(svcount_t, float64_t const *, int64_t);
19126__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s64_x4)))
19127svint64x4_t svldnt1_vnum_x4(svcount_t, int64_t const *, int64_t);
19128__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u16_x4)))
19129svuint16x4_t svldnt1_vnum_x4(svcount_t, uint16_t const *, int64_t);
19130__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_bf16_x4)))
19131svbfloat16x4_t svldnt1_vnum_x4(svcount_t, bfloat16_t const *, int64_t);
19132__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f16_x4)))
19133svfloat16x4_t svldnt1_vnum_x4(svcount_t, float16_t const *, int64_t);
19134__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s16_x4)))
19135svint16x4_t svldnt1_vnum_x4(svcount_t, int16_t const *, int64_t);
19136__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_u32_x4)))
19137svuint32x4_t svldnt1_vnum_x4(svcount_t, uint32_t const *, int64_t);
19138__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_f32_x4)))
19139svfloat32x4_t svldnt1_vnum_x4(svcount_t, float32_t const *, int64_t);
19140__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svldnt1_vnum_s32_x4)))
19141svint32x4_t svldnt1_vnum_x4(svcount_t, int32_t const *, int64_t);
19142__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_b)))
19143svbool_t svreinterpret(svcount_t);
19144__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svreinterpret_c)))
19145svcount_t svreinterpret(svbool_t);
19146__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x2)))
19147void svst1(svcount_t, uint8_t *, svuint8x2_t);
19148__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x2)))
19149void svst1(svcount_t, int8_t *, svint8x2_t);
19150__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x2)))
19151void svst1(svcount_t, mfloat8_t *, svmfloat8x2_t);
19152__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x2)))
19153void svst1(svcount_t, uint64_t *, svuint64x2_t);
19154__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x2)))
19155void svst1(svcount_t, float64_t *, svfloat64x2_t);
19156__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x2)))
19157void svst1(svcount_t, int64_t *, svint64x2_t);
19158__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x2)))
19159void svst1(svcount_t, uint16_t *, svuint16x2_t);
19160__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x2)))
19161void svst1(svcount_t, bfloat16_t *, svbfloat16x2_t);
19162__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x2)))
19163void svst1(svcount_t, float16_t *, svfloat16x2_t);
19164__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x2)))
19165void svst1(svcount_t, int16_t *, svint16x2_t);
19166__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x2)))
19167void svst1(svcount_t, uint32_t *, svuint32x2_t);
19168__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x2)))
19169void svst1(svcount_t, float32_t *, svfloat32x2_t);
19170__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x2)))
19171void svst1(svcount_t, int32_t *, svint32x2_t);
19172__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u8_x4)))
19173void svst1(svcount_t, uint8_t *, svuint8x4_t);
19174__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s8_x4)))
19175void svst1(svcount_t, int8_t *, svint8x4_t);
19176__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_mf8_x4)))
19177void svst1(svcount_t, mfloat8_t *, svmfloat8x4_t);
19178__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u64_x4)))
19179void svst1(svcount_t, uint64_t *, svuint64x4_t);
19180__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f64_x4)))
19181void svst1(svcount_t, float64_t *, svfloat64x4_t);
19182__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s64_x4)))
19183void svst1(svcount_t, int64_t *, svint64x4_t);
19184__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u16_x4)))
19185void svst1(svcount_t, uint16_t *, svuint16x4_t);
19186__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_bf16_x4)))
19187void svst1(svcount_t, bfloat16_t *, svbfloat16x4_t);
19188__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f16_x4)))
19189void svst1(svcount_t, float16_t *, svfloat16x4_t);
19190__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s16_x4)))
19191void svst1(svcount_t, int16_t *, svint16x4_t);
19192__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_u32_x4)))
19193void svst1(svcount_t, uint32_t *, svuint32x4_t);
19194__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_f32_x4)))
19195void svst1(svcount_t, float32_t *, svfloat32x4_t);
19196__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_s32_x4)))
19197void svst1(svcount_t, int32_t *, svint32x4_t);
19198__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x2)))
19199void svst1_vnum(svcount_t, uint8_t *, int64_t, svuint8x2_t);
19200__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x2)))
19201void svst1_vnum(svcount_t, int8_t *, int64_t, svint8x2_t);
19202__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x2)))
19203void svst1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
19204__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x2)))
19205void svst1_vnum(svcount_t, uint64_t *, int64_t, svuint64x2_t);
19206__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x2)))
19207void svst1_vnum(svcount_t, float64_t *, int64_t, svfloat64x2_t);
19208__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x2)))
19209void svst1_vnum(svcount_t, int64_t *, int64_t, svint64x2_t);
19210__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x2)))
19211void svst1_vnum(svcount_t, uint16_t *, int64_t, svuint16x2_t);
19212__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x2)))
19213void svst1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
19214__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x2)))
19215void svst1_vnum(svcount_t, float16_t *, int64_t, svfloat16x2_t);
19216__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x2)))
19217void svst1_vnum(svcount_t, int16_t *, int64_t, svint16x2_t);
19218__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x2)))
19219void svst1_vnum(svcount_t, uint32_t *, int64_t, svuint32x2_t);
19220__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x2)))
19221void svst1_vnum(svcount_t, float32_t *, int64_t, svfloat32x2_t);
19222__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x2)))
19223void svst1_vnum(svcount_t, int32_t *, int64_t, svint32x2_t);
19224__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u8_x4)))
19225void svst1_vnum(svcount_t, uint8_t *, int64_t, svuint8x4_t);
19226__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s8_x4)))
19227void svst1_vnum(svcount_t, int8_t *, int64_t, svint8x4_t);
19228__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_mf8_x4)))
19229void svst1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
19230__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u64_x4)))
19231void svst1_vnum(svcount_t, uint64_t *, int64_t, svuint64x4_t);
19232__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f64_x4)))
19233void svst1_vnum(svcount_t, float64_t *, int64_t, svfloat64x4_t);
19234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s64_x4)))
19235void svst1_vnum(svcount_t, int64_t *, int64_t, svint64x4_t);
19236__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u16_x4)))
19237void svst1_vnum(svcount_t, uint16_t *, int64_t, svuint16x4_t);
19238__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_bf16_x4)))
19239void svst1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
19240__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f16_x4)))
19241void svst1_vnum(svcount_t, float16_t *, int64_t, svfloat16x4_t);
19242__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s16_x4)))
19243void svst1_vnum(svcount_t, int16_t *, int64_t, svint16x4_t);
19244__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_u32_x4)))
19245void svst1_vnum(svcount_t, uint32_t *, int64_t, svuint32x4_t);
19246__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_f32_x4)))
19247void svst1_vnum(svcount_t, float32_t *, int64_t, svfloat32x4_t);
19248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svst1_vnum_s32_x4)))
19249void svst1_vnum(svcount_t, int32_t *, int64_t, svint32x4_t);
19250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x2)))
19251void svstnt1(svcount_t, uint8_t *, svuint8x2_t);
19252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x2)))
19253void svstnt1(svcount_t, int8_t *, svint8x2_t);
19254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x2)))
19255void svstnt1(svcount_t, mfloat8_t *, svmfloat8x2_t);
19256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x2)))
19257void svstnt1(svcount_t, uint64_t *, svuint64x2_t);
19258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x2)))
19259void svstnt1(svcount_t, float64_t *, svfloat64x2_t);
19260__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x2)))
19261void svstnt1(svcount_t, int64_t *, svint64x2_t);
19262__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x2)))
19263void svstnt1(svcount_t, uint16_t *, svuint16x2_t);
19264__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x2)))
19265void svstnt1(svcount_t, bfloat16_t *, svbfloat16x2_t);
19266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x2)))
19267void svstnt1(svcount_t, float16_t *, svfloat16x2_t);
19268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x2)))
19269void svstnt1(svcount_t, int16_t *, svint16x2_t);
19270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x2)))
19271void svstnt1(svcount_t, uint32_t *, svuint32x2_t);
19272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x2)))
19273void svstnt1(svcount_t, float32_t *, svfloat32x2_t);
19274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x2)))
19275void svstnt1(svcount_t, int32_t *, svint32x2_t);
19276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u8_x4)))
19277void svstnt1(svcount_t, uint8_t *, svuint8x4_t);
19278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s8_x4)))
19279void svstnt1(svcount_t, int8_t *, svint8x4_t);
19280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_mf8_x4)))
19281void svstnt1(svcount_t, mfloat8_t *, svmfloat8x4_t);
19282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u64_x4)))
19283void svstnt1(svcount_t, uint64_t *, svuint64x4_t);
19284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f64_x4)))
19285void svstnt1(svcount_t, float64_t *, svfloat64x4_t);
19286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s64_x4)))
19287void svstnt1(svcount_t, int64_t *, svint64x4_t);
19288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u16_x4)))
19289void svstnt1(svcount_t, uint16_t *, svuint16x4_t);
19290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_bf16_x4)))
19291void svstnt1(svcount_t, bfloat16_t *, svbfloat16x4_t);
19292__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f16_x4)))
19293void svstnt1(svcount_t, float16_t *, svfloat16x4_t);
19294__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s16_x4)))
19295void svstnt1(svcount_t, int16_t *, svint16x4_t);
19296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_u32_x4)))
19297void svstnt1(svcount_t, uint32_t *, svuint32x4_t);
19298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_f32_x4)))
19299void svstnt1(svcount_t, float32_t *, svfloat32x4_t);
19300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_s32_x4)))
19301void svstnt1(svcount_t, int32_t *, svint32x4_t);
19302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x2)))
19303void svstnt1_vnum(svcount_t, uint8_t *, int64_t, svuint8x2_t);
19304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x2)))
19305void svstnt1_vnum(svcount_t, int8_t *, int64_t, svint8x2_t);
19306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x2)))
19307void svstnt1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x2_t);
19308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x2)))
19309void svstnt1_vnum(svcount_t, uint64_t *, int64_t, svuint64x2_t);
19310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x2)))
19311void svstnt1_vnum(svcount_t, float64_t *, int64_t, svfloat64x2_t);
19312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x2)))
19313void svstnt1_vnum(svcount_t, int64_t *, int64_t, svint64x2_t);
19314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x2)))
19315void svstnt1_vnum(svcount_t, uint16_t *, int64_t, svuint16x2_t);
19316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x2)))
19317void svstnt1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x2_t);
19318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x2)))
19319void svstnt1_vnum(svcount_t, float16_t *, int64_t, svfloat16x2_t);
19320__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x2)))
19321void svstnt1_vnum(svcount_t, int16_t *, int64_t, svint16x2_t);
19322__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x2)))
19323void svstnt1_vnum(svcount_t, uint32_t *, int64_t, svuint32x2_t);
19324__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x2)))
19325void svstnt1_vnum(svcount_t, float32_t *, int64_t, svfloat32x2_t);
19326__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x2)))
19327void svstnt1_vnum(svcount_t, int32_t *, int64_t, svint32x2_t);
19328__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u8_x4)))
19329void svstnt1_vnum(svcount_t, uint8_t *, int64_t, svuint8x4_t);
19330__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s8_x4)))
19331void svstnt1_vnum(svcount_t, int8_t *, int64_t, svint8x4_t);
19332__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_mf8_x4)))
19333void svstnt1_vnum(svcount_t, mfloat8_t *, int64_t, svmfloat8x4_t);
19334__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u64_x4)))
19335void svstnt1_vnum(svcount_t, uint64_t *, int64_t, svuint64x4_t);
19336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f64_x4)))
19337void svstnt1_vnum(svcount_t, float64_t *, int64_t, svfloat64x4_t);
19338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s64_x4)))
19339void svstnt1_vnum(svcount_t, int64_t *, int64_t, svint64x4_t);
19340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u16_x4)))
19341void svstnt1_vnum(svcount_t, uint16_t *, int64_t, svuint16x4_t);
19342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_bf16_x4)))
19343void svstnt1_vnum(svcount_t, bfloat16_t *, int64_t, svbfloat16x4_t);
19344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f16_x4)))
19345void svstnt1_vnum(svcount_t, float16_t *, int64_t, svfloat16x4_t);
19346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s16_x4)))
19347void svstnt1_vnum(svcount_t, int16_t *, int64_t, svint16x4_t);
19348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_u32_x4)))
19349void svstnt1_vnum(svcount_t, uint32_t *, int64_t, svuint32x4_t);
19350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_f32_x4)))
19351void svstnt1_vnum(svcount_t, float32_t *, int64_t, svfloat32x4_t);
19352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svstnt1_vnum_s32_x4)))
19353void svstnt1_vnum(svcount_t, int32_t *, int64_t, svint32x4_t);
19354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_s64)))
19355svcount_t svwhilege_c8(int64_t, int64_t, uint64_t);
19356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_s64)))
19357svcount_t svwhilege_c32(int64_t, int64_t, uint64_t);
19358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_s64)))
19359svcount_t svwhilege_c64(int64_t, int64_t, uint64_t);
19360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_s64)))
19361svcount_t svwhilege_c16(int64_t, int64_t, uint64_t);
19362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c8_u64)))
19363svcount_t svwhilege_c8(uint64_t, uint64_t, uint64_t);
19364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c32_u64)))
19365svcount_t svwhilege_c32(uint64_t, uint64_t, uint64_t);
19366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c64_u64)))
19367svcount_t svwhilege_c64(uint64_t, uint64_t, uint64_t);
19368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilege_c16_u64)))
19369svcount_t svwhilege_c16(uint64_t, uint64_t, uint64_t);
19370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_s64)))
19371svcount_t svwhilegt_c8(int64_t, int64_t, uint64_t);
19372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_s64)))
19373svcount_t svwhilegt_c32(int64_t, int64_t, uint64_t);
19374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_s64)))
19375svcount_t svwhilegt_c64(int64_t, int64_t, uint64_t);
19376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_s64)))
19377svcount_t svwhilegt_c16(int64_t, int64_t, uint64_t);
19378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c8_u64)))
19379svcount_t svwhilegt_c8(uint64_t, uint64_t, uint64_t);
19380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c32_u64)))
19381svcount_t svwhilegt_c32(uint64_t, uint64_t, uint64_t);
19382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c64_u64)))
19383svcount_t svwhilegt_c64(uint64_t, uint64_t, uint64_t);
19384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilegt_c16_u64)))
19385svcount_t svwhilegt_c16(uint64_t, uint64_t, uint64_t);
19386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_s64)))
19387svcount_t svwhilele_c8(int64_t, int64_t, uint64_t);
19388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_s64)))
19389svcount_t svwhilele_c32(int64_t, int64_t, uint64_t);
19390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_s64)))
19391svcount_t svwhilele_c64(int64_t, int64_t, uint64_t);
19392__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_s64)))
19393svcount_t svwhilele_c16(int64_t, int64_t, uint64_t);
19394__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c8_u64)))
19395svcount_t svwhilele_c8(uint64_t, uint64_t, uint64_t);
19396__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c32_u64)))
19397svcount_t svwhilele_c32(uint64_t, uint64_t, uint64_t);
19398__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c64_u64)))
19399svcount_t svwhilele_c64(uint64_t, uint64_t, uint64_t);
19400__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilele_c16_u64)))
19401svcount_t svwhilele_c16(uint64_t, uint64_t, uint64_t);
19402__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_u64)))
19403svcount_t svwhilelt_c8(uint64_t, uint64_t, uint64_t);
19404__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_u64)))
19405svcount_t svwhilelt_c32(uint64_t, uint64_t, uint64_t);
19406__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_u64)))
19407svcount_t svwhilelt_c64(uint64_t, uint64_t, uint64_t);
19408__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_u64)))
19409svcount_t svwhilelt_c16(uint64_t, uint64_t, uint64_t);
19410__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c8_s64)))
19411svcount_t svwhilelt_c8(int64_t, int64_t, uint64_t);
19412__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c32_s64)))
19413svcount_t svwhilelt_c32(int64_t, int64_t, uint64_t);
19414__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_s64)))
19415svcount_t svwhilelt_c64(int64_t, int64_t, uint64_t);
19416__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_s64)))
19417svcount_t svwhilelt_c16(int64_t, int64_t, uint64_t);
1906219418__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabd_n_f64_m)))
1906319419svfloat64_t svabd_n_f64_m(svbool_t, svfloat64_t, float64_t);
1906419420__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabd_n_f32_m)))
......@@ -31877,6 +32233,30 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpa_f32)))
3187732233svfloat32_t svexpa(svuint32_t);
3187832234__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpa_f16)))
3187932235svfloat16_t svexpa(svuint16_t);
32236__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u32)))
32237svuint32_t svcompact_u32(svbool_t, svuint32_t);
32238__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u64)))
32239svuint64_t svcompact_u64(svbool_t, svuint64_t);
32240__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f64)))
32241svfloat64_t svcompact_f64(svbool_t, svfloat64_t);
32242__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f32)))
32243svfloat32_t svcompact_f32(svbool_t, svfloat32_t);
32244__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s32)))
32245svint32_t svcompact_s32(svbool_t, svint32_t);
32246__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s64)))
32247svint64_t svcompact_s64(svbool_t, svint64_t);
32248__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u32)))
32249svuint32_t svcompact(svbool_t, svuint32_t);
32250__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_u64)))
32251svuint64_t svcompact(svbool_t, svuint64_t);
32252__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f64)))
32253svfloat64_t svcompact(svbool_t, svfloat64_t);
32254__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_f32)))
32255svfloat32_t svcompact(svbool_t, svfloat32_t);
32256__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s32)))
32257svint32_t svcompact(svbool_t, svint32_t);
32258__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcompact_s64)))
32259svint64_t svcompact(svbool_t, svint64_t);
3188032260#define svcvtnt_bf16_x svcvtnt_bf16_m
3188132261#define svcvtnt_bf16_f32_x svcvtnt_bf16_f32_m
3188232262#define svcvtnt_f16_x svcvtnt_f16_m
lib/include/avx10_2_512bf16intrin.h+19-12
......@@ -21,9 +21,15 @@ typedef __bf16 __m512bh_u __attribute__((__vector_size__(64), __aligned__(1)));
2121
2222/* Define the default attributes for the functions in this file. */
2323#define __DEFAULT_FN_ATTRS512 \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-512"), \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2525 __min_vector_width__(512)))
2626
27#if defined(__cplusplus) && (__cplusplus >= 201103L)
28#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
29#else
30#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
31#endif
32
2733static __inline __m512bh __DEFAULT_FN_ATTRS512 _mm512_setzero_pbh(void) {
2834 return __builtin_bit_cast(__m512bh, _mm512_setzero_ps());
2935}
......@@ -167,13 +173,13 @@ _mm512_mask_blend_pbh(__mmask32 __U, __m512bh __A, __m512bh __W) {
167173 (__v32bf)__A);
168174}
169175
170static __inline__ __m512bh __DEFAULT_FN_ATTRS512
176static __inline__ __m512bh __DEFAULT_FN_ATTRS512_CONSTEXPR
171177_mm512_permutex2var_pbh(__m512bh __A, __m512i __I, __m512bh __B) {
172178 return (__m512bh)__builtin_ia32_vpermi2varhi512((__v32hi)__A, (__v32hi)__I,
173179 (__v32hi)__B);
174180}
175181
176static __inline__ __m512bh __DEFAULT_FN_ATTRS512
182static __inline__ __m512bh __DEFAULT_FN_ATTRS512_CONSTEXPR
177183_mm512_permutexvar_pbh(__m512i __A, __m512bh __B) {
178184 return (__m512bh)__builtin_ia32_permvarhi512((__v32hi)__B, (__v32hi)__A);
179185}
......@@ -423,7 +429,7 @@ _mm512_maskz_rsqrt_pbh(__mmask32 __U, __m512bh __A) {
423429 (__v32bf)_mm512_setzero_pbh(), (__mmask32)(__U)))
424430
425431static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_sqrt_pbh(__m512bh __A) {
426 return (__m512bh)__builtin_ia32_vsqrtbf16512((__v32bf)__A);
432 return __builtin_elementwise_sqrt(__A);
427433}
428434
429435static __inline__ __m512bh __DEFAULT_FN_ATTRS512
......@@ -441,8 +447,8 @@ _mm512_maskz_sqrt_pbh(__mmask32 __U, __m512bh __A) {
441447
442448static __inline__ __m512bh __DEFAULT_FN_ATTRS512
443449_mm512_fmadd_pbh(__m512bh __A, __m512bh __B, __m512bh __C) {
444 return (__m512bh)__builtin_ia32_vfmaddbf16512((__v32bf)__A, (__v32bf)__B,
445 (__v32bf)__C);
450 return (__m512bh)__builtin_elementwise_fma((__v32bf)__A, (__v32bf)__B,
451 (__v32bf)__C);
446452}
447453
448454static __inline__ __m512bh __DEFAULT_FN_ATTRS512
......@@ -469,8 +475,8 @@ static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_maskz_fmadd_pbh(
469475
470476static __inline__ __m512bh __DEFAULT_FN_ATTRS512
471477_mm512_fmsub_pbh(__m512bh __A, __m512bh __B, __m512bh __C) {
472 return (__m512bh)__builtin_ia32_vfmaddbf16512((__v32bf)__A, (__v32bf)__B,
473 -(__v32bf)__C);
478 return (__m512bh)__builtin_elementwise_fma((__v32bf)__A, (__v32bf)__B,
479 -(__v32bf)__C);
474480}
475481
476482static __inline__ __m512bh __DEFAULT_FN_ATTRS512
......@@ -497,8 +503,8 @@ static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_maskz_fmsub_pbh(
497503
498504static __inline__ __m512bh __DEFAULT_FN_ATTRS512
499505_mm512_fnmadd_pbh(__m512bh __A, __m512bh __B, __m512bh __C) {
500 return (__m512bh)__builtin_ia32_vfmaddbf16512((__v32bf)__A, -(__v32bf)__B,
501 (__v32bf)__C);
506 return (__m512bh)__builtin_elementwise_fma((__v32bf)__A, -(__v32bf)__B,
507 (__v32bf)__C);
502508}
503509
504510static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_mask_fnmadd_pbh(
......@@ -527,8 +533,8 @@ static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_maskz_fnmadd_pbh(
527533
528534static __inline__ __m512bh __DEFAULT_FN_ATTRS512
529535_mm512_fnmsub_pbh(__m512bh __A, __m512bh __B, __m512bh __C) {
530 return (__m512bh)__builtin_ia32_vfmaddbf16512((__v32bf)__A, -(__v32bf)__B,
531 -(__v32bf)__C);
536 return (__m512bh)__builtin_elementwise_fma((__v32bf)__A, -(__v32bf)__B,
537 -(__v32bf)__C);
532538}
533539
534540static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_mask_fnmsub_pbh(
......@@ -555,6 +561,7 @@ static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_maskz_fnmsub_pbh(
555561 (__v32bf)_mm512_setzero_pbh());
556562}
557563
564#undef __DEFAULT_FN_ATTRS512_CONSTEXPR
558565#undef __DEFAULT_FN_ATTRS512
559566
560567#endif
lib/include/avx10_2_512convertintrin.h+1-1
......@@ -18,7 +18,7 @@
1818
1919/* Define the default attributes for the functions in this file. */
2020#define __DEFAULT_FN_ATTRS512 \
21 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-512"), \
21 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2222 __min_vector_width__(512)))
2323
2424static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_cvtx2ps_ph(__m512 __A,
lib/include/avx10_2_512niintrin.h+31-31
......@@ -17,7 +17,7 @@
1717#define __AVX10_2_512NIINTRIN_H
1818
1919#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-512"), \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2121 __min_vector_width__(512)))
2222
2323/* VNNI FP16 */
......@@ -64,8 +64,8 @@ static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_dpph_ps(__mmask16 __U,
6464static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbssd_epi32(__m512i __W,
6565 __m512i __A,
6666 __m512i __B) {
67 return (__m512i)__builtin_ia32_vpdpbssd512((__v16si)__W, (__v16si)__A,
68 (__v16si)__B);
67 return (__m512i)__builtin_ia32_vpdpbssd512((__v16si)__W, (__v64qi)__A,
68 (__v64qi)__B);
6969}
7070
7171static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -84,8 +84,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbssd_epi32(
8484static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbssds_epi32(__m512i __W,
8585 __m512i __A,
8686 __m512i __B) {
87 return (__m512i)__builtin_ia32_vpdpbssds512((__v16si)__W, (__v16si)__A,
88 (__v16si)__B);
87 return (__m512i)__builtin_ia32_vpdpbssds512((__v16si)__W, (__v64qi)__A,
88 (__v64qi)__B);
8989}
9090
9191static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpbssds_epi32(
......@@ -104,8 +104,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbssds_epi32(
104104static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbsud_epi32(__m512i __W,
105105 __m512i __A,
106106 __m512i __B) {
107 return (__m512i)__builtin_ia32_vpdpbsud512((__v16si)__W, (__v16si)__A,
108 (__v16si)__B);
107 return (__m512i)__builtin_ia32_vpdpbsud512((__v16si)__W, (__v64qi)__A,
108 (__v64qu)__B);
109109}
110110
111111static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -124,8 +124,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbsud_epi32(
124124static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbsuds_epi32(__m512i __W,
125125 __m512i __A,
126126 __m512i __B) {
127 return (__m512i)__builtin_ia32_vpdpbsuds512((__v16si)__W, (__v16si)__A,
128 (__v16si)__B);
127 return (__m512i)__builtin_ia32_vpdpbsuds512((__v16si)__W, (__v64qi)__A,
128 (__v64qu)__B);
129129}
130130
131131static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpbsuds_epi32(
......@@ -144,8 +144,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbsuds_epi32(
144144static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbuud_epi32(__m512i __W,
145145 __m512i __A,
146146 __m512i __B) {
147 return (__m512i)__builtin_ia32_vpdpbuud512((__v16si)__W, (__v16si)__A,
148 (__v16si)__B);
147 return (__m512i)__builtin_ia32_vpdpbuud512((__v16si)__W, (__v64qu)__A,
148 (__v64qu)__B);
149149}
150150
151151static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -164,8 +164,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbuud_epi32(
164164static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbuuds_epi32(__m512i __W,
165165 __m512i __A,
166166 __m512i __B) {
167 return (__m512i)__builtin_ia32_vpdpbuuds512((__v16si)__W, (__v16si)__A,
168 (__v16si)__B);
167 return (__m512i)__builtin_ia32_vpdpbuuds512((__v16si)__W, (__v64qu)__A,
168 (__v64qu)__B);
169169}
170170
171171static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpbuuds_epi32(
......@@ -185,8 +185,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbuuds_epi32(
185185static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwsud_epi32(__m512i __A,
186186 __m512i __B,
187187 __m512i __C) {
188 return (__m512i)__builtin_ia32_vpdpwsud512((__v16si)__A, (__v16si)__B,
189 (__v16si)__C);
188 return (__m512i)__builtin_ia32_vpdpwsud512((__v16si)__A, (__v32hi)__B,
189 (__v32hu)__C);
190190}
191191
192192static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -197,7 +197,7 @@ _mm512_mask_dpwsud_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
197197}
198198
199199static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwsud_epi32(
200 __m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
200 __mmask16 __U, __m512i __A, __m512i __B, __m512i __C) {
201201 return (__m512i)__builtin_ia32_selectd_512(
202202 (__mmask16)__U, (__v16si)_mm512_dpwsud_epi32(__A, __B, __C),
203203 (__v16si)_mm512_setzero_si512());
......@@ -206,8 +206,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwsud_epi32(
206206static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwsuds_epi32(__m512i __A,
207207 __m512i __B,
208208 __m512i __C) {
209 return (__m512i)__builtin_ia32_vpdpwsuds512((__v16si)__A, (__v16si)__B,
210 (__v16si)__C);
209 return (__m512i)__builtin_ia32_vpdpwsuds512((__v16si)__A, (__v32hi)__B,
210 (__v32hu)__C);
211211}
212212
213213static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwsuds_epi32(
......@@ -218,7 +218,7 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwsuds_epi32(
218218}
219219
220220static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwsuds_epi32(
221 __m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
221 __mmask16 __U, __m512i __A, __m512i __B, __m512i __C) {
222222 return (__m512i)__builtin_ia32_selectd_512(
223223 (__mmask16)__U, (__v16si)_mm512_dpwsuds_epi32(__A, __B, __C),
224224 (__v16si)_mm512_setzero_si512());
......@@ -227,8 +227,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwsuds_epi32(
227227static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwusd_epi32(__m512i __A,
228228 __m512i __B,
229229 __m512i __C) {
230 return (__m512i)__builtin_ia32_vpdpwusd512((__v16si)__A, (__v16si)__B,
231 (__v16si)__C);
230 return (__m512i)__builtin_ia32_vpdpwusd512((__v16si)__A, (__v32hu)__B,
231 (__v32hi)__C);
232232}
233233
234234static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -239,7 +239,7 @@ _mm512_mask_dpwusd_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
239239}
240240
241241static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwusd_epi32(
242 __m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
242 __mmask16 __U, __m512i __A, __m512i __B, __m512i __C) {
243243 return (__m512i)__builtin_ia32_selectd_512(
244244 (__mmask16)__U, (__v16si)_mm512_dpwusd_epi32(__A, __B, __C),
245245 (__v16si)_mm512_setzero_si512());
......@@ -248,8 +248,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwusd_epi32(
248248static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwusds_epi32(__m512i __A,
249249 __m512i __B,
250250 __m512i __C) {
251 return (__m512i)__builtin_ia32_vpdpwusds512((__v16si)__A, (__v16si)__B,
252 (__v16si)__C);
251 return (__m512i)__builtin_ia32_vpdpwusds512((__v16si)__A, (__v32hu)__B,
252 (__v32hi)__C);
253253}
254254
255255static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwusds_epi32(
......@@ -260,7 +260,7 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwusds_epi32(
260260}
261261
262262static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwusds_epi32(
263 __m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
263 __mmask16 __U, __m512i __A, __m512i __B, __m512i __C) {
264264 return (__m512i)__builtin_ia32_selectd_512(
265265 (__mmask16)__U, (__v16si)_mm512_dpwusds_epi32(__A, __B, __C),
266266 (__v16si)_mm512_setzero_si512());
......@@ -269,8 +269,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwusds_epi32(
269269static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwuud_epi32(__m512i __A,
270270 __m512i __B,
271271 __m512i __C) {
272 return (__m512i)__builtin_ia32_vpdpwuud512((__v16si)__A, (__v16si)__B,
273 (__v16si)__C);
272 return (__m512i)__builtin_ia32_vpdpwuud512((__v16si)__A, (__v32hu)__B,
273 (__v32hu)__C);
274274}
275275
276276static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -281,7 +281,7 @@ _mm512_mask_dpwuud_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
281281}
282282
283283static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwuud_epi32(
284 __m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
284 __mmask16 __U, __m512i __A, __m512i __B, __m512i __C) {
285285 return (__m512i)__builtin_ia32_selectd_512(
286286 (__mmask16)__U, (__v16si)_mm512_dpwuud_epi32(__A, __B, __C),
287287 (__v16si)_mm512_setzero_si512());
......@@ -290,8 +290,8 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwuud_epi32(
290290static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwuuds_epi32(__m512i __A,
291291 __m512i __B,
292292 __m512i __C) {
293 return (__m512i)__builtin_ia32_vpdpwuuds512((__v16si)__A, (__v16si)__B,
294 (__v16si)__C);
293 return (__m512i)__builtin_ia32_vpdpwuuds512((__v16si)__A, (__v32hu)__B,
294 (__v32hu)__C);
295295}
296296
297297static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwuuds_epi32(
......@@ -302,7 +302,7 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwuuds_epi32(
302302}
303303
304304static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwuuds_epi32(
305 __m512i __A, __mmask16 __U, __m512i __B, __m512i __C) {
305 __mmask16 __U, __m512i __A, __m512i __B, __m512i __C) {
306306 return (__m512i)__builtin_ia32_selectd_512(
307307 (__mmask16)__U, (__v16si)_mm512_dpwuuds_epi32(__A, __B, __C),
308308 (__v16si)_mm512_setzero_si512());
lib/include/avx10_2_512satcvtdsintrin.h+1-1
......@@ -16,7 +16,7 @@
1616
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-512"), \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2020 __min_vector_width__(512)))
2121
2222// 512 bit : Double -> Int
lib/include/avx10_2bf16intrin.h+54-45
......@@ -21,12 +21,20 @@ typedef __bf16 __m256bh_u __attribute__((__vector_size__(32), __aligned__(1)));
2121
2222/* Define the default attributes for the functions in this file. */
2323#define __DEFAULT_FN_ATTRS256 \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2525 __min_vector_width__(256)))
2626#define __DEFAULT_FN_ATTRS128 \
27 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
27 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2828 __min_vector_width__(128)))
2929
30#if defined(__cplusplus) && (__cplusplus >= 201103L)
31#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
32#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
33#else
34#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
35#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
36#endif
37
3038static __inline __m256bh __DEFAULT_FN_ATTRS256 _mm256_setzero_pbh(void) {
3139 return __builtin_bit_cast(__m256bh, _mm256_setzero_ps());
3240}
......@@ -213,12 +221,12 @@ static __inline__ __m128bh __DEFAULT_FN_ATTRS128 _mm_move_sbh(__m128bh __a,
213221 return __a;
214222}
215223
216static __inline__ __m128bh __DEFAULT_FN_ATTRS128
224static __inline__ __m128bh __DEFAULT_FN_ATTRS128_CONSTEXPR
217225_mm_mask_move_sbh(__m128bh __W, __mmask8 __U, __m128bh __A, __m128bh __B) {
218226 return __builtin_ia32_selectsbf_128(__U, _mm_move_sbh(__A, __B), __W);
219227}
220228
221static __inline__ __m128bh __DEFAULT_FN_ATTRS128
229static __inline__ __m128bh __DEFAULT_FN_ATTRS128_CONSTEXPR
222230_mm_maskz_move_sbh(__mmask8 __U, __m128bh __A, __m128bh __B) {
223231 return __builtin_ia32_selectsbf_128(__U, _mm_move_sbh(__A, __B),
224232 _mm_setzero_pbh());
......@@ -287,24 +295,24 @@ _mm256_mask_blend_pbh(__mmask16 __U, __m256bh __A, __m256bh __W) {
287295 (__v16bf)__A);
288296}
289297
290static __inline__ __m128bh __DEFAULT_FN_ATTRS128
298static __inline__ __m128bh __DEFAULT_FN_ATTRS128_CONSTEXPR
291299_mm_permutex2var_pbh(__m128bh __A, __m128i __I, __m128bh __B) {
292300 return (__m128bh)__builtin_ia32_vpermi2varhi128((__v8hi)__A, (__v8hi)__I,
293301 (__v8hi)__B);
294302}
295303
296static __inline__ __m256bh __DEFAULT_FN_ATTRS256
304static __inline__ __m256bh __DEFAULT_FN_ATTRS256_CONSTEXPR
297305_mm256_permutex2var_pbh(__m256bh __A, __m256i __I, __m256bh __B) {
298306 return (__m256bh)__builtin_ia32_vpermi2varhi256((__v16hi)__A, (__v16hi)__I,
299307 (__v16hi)__B);
300308}
301309
302static __inline__ __m128bh __DEFAULT_FN_ATTRS128
310static __inline__ __m128bh __DEFAULT_FN_ATTRS128_CONSTEXPR
303311_mm_permutexvar_pbh(__m128i __A, __m128bh __B) {
304312 return (__m128bh)__builtin_ia32_permvarhi128((__v8hi)__B, (__v8hi)__A);
305313}
306314
307static __inline__ __m256bh __DEFAULT_FN_ATTRS256
315static __inline__ __m256bh __DEFAULT_FN_ATTRS256_CONSTEXPR
308316_mm256_permutexvar_pbh(__m256i __A, __m256bh __B) {
309317 return (__m256bh)__builtin_ia32_permvarhi256((__v16hi)__B, (__v16hi)__A);
310318}
......@@ -519,34 +527,34 @@ _mm_maskz_min_pbh(__mmask8 __U, __m128bh __A, __m128bh __B) {
519527 (__mmask8)__U, (__v8bf)_mm_min_pbh(__A, __B), (__v8bf)_mm_setzero_pbh());
520528}
521529
522static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comieq_sbh(__m128bh A,
523 __m128bh B) {
524 return __builtin_ia32_vcomisbf16eq((__v8bf)A, (__v8bf)B);
530static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comieq_sbh(__m128bh __A,
531 __m128bh __B) {
532 return __builtin_ia32_vcomisbf16eq((__v8bf)__A, (__v8bf)__B);
525533}
526534
527static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comilt_sbh(__m128bh A,
528 __m128bh B) {
529 return __builtin_ia32_vcomisbf16lt((__v8bf)A, (__v8bf)B);
535static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comilt_sbh(__m128bh __A,
536 __m128bh __B) {
537 return __builtin_ia32_vcomisbf16lt((__v8bf)__A, (__v8bf)__B);
530538}
531539
532static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comile_sbh(__m128bh A,
533 __m128bh B) {
534 return __builtin_ia32_vcomisbf16le((__v8bf)A, (__v8bf)B);
540static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comile_sbh(__m128bh __A,
541 __m128bh __B) {
542 return __builtin_ia32_vcomisbf16le((__v8bf)__A, (__v8bf)__B);
535543}
536544
537static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comigt_sbh(__m128bh A,
538 __m128bh B) {
539 return __builtin_ia32_vcomisbf16gt((__v8bf)A, (__v8bf)B);
545static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comigt_sbh(__m128bh __A,
546 __m128bh __B) {
547 return __builtin_ia32_vcomisbf16gt((__v8bf)__A, (__v8bf)__B);
540548}
541549
542static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comige_sbh(__m128bh A,
543 __m128bh B) {
544 return __builtin_ia32_vcomisbf16ge((__v8bf)A, (__v8bf)B);
550static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comige_sbh(__m128bh __A,
551 __m128bh __B) {
552 return __builtin_ia32_vcomisbf16ge((__v8bf)__A, (__v8bf)__B);
545553}
546554
547static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comineq_sbh(__m128bh A,
548 __m128bh B) {
549 return __builtin_ia32_vcomisbf16neq((__v8bf)A, (__v8bf)B);
555static __inline__ int __DEFAULT_FN_ATTRS128 _mm_comineq_sbh(__m128bh __A,
556 __m128bh __B) {
557 return __builtin_ia32_vcomisbf16neq((__v8bf)__A, (__v8bf)__B);
550558}
551559
552560#define _mm256_cmp_pbh_mask(__A, __B, __P) \
......@@ -818,7 +826,7 @@ _mm_maskz_rsqrt_pbh(__mmask8 __U, __m128bh __A) {
818826 (__v8bf)_mm_setzero_pbh(), (__mmask8)(__U)))
819827
820828static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_sqrt_pbh(__m256bh __A) {
821 return (__m256bh)__builtin_ia32_vsqrtbf16256((__v16bf)__A);
829 return __builtin_elementwise_sqrt(__A);
822830}
823831
824832static __inline__ __m256bh __DEFAULT_FN_ATTRS256
......@@ -835,7 +843,7 @@ _mm256_maskz_sqrt_pbh(__mmask16 __U, __m256bh __A) {
835843}
836844
837845static __inline__ __m128bh __DEFAULT_FN_ATTRS128 _mm_sqrt_pbh(__m128bh __A) {
838 return (__m128bh)__builtin_ia32_vsqrtbf16((__v8bf)__A);
846 return __builtin_elementwise_sqrt(__A);
839847}
840848
841849static __inline__ __m128bh __DEFAULT_FN_ATTRS128
......@@ -852,8 +860,8 @@ _mm_maskz_sqrt_pbh(__mmask8 __U, __m128bh __A) {
852860
853861static __inline__ __m256bh __DEFAULT_FN_ATTRS256
854862_mm256_fmadd_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
855 return (__m256bh)__builtin_ia32_vfmaddbf16256((__v16bf)__A, (__v16bf)__B,
856 (__v16bf)__C);
863 return (__m256bh)__builtin_elementwise_fma((__v16bf)__A, (__v16bf)__B,
864 (__v16bf)__C);
857865}
858866
859867static __inline__ __m256bh __DEFAULT_FN_ATTRS256
......@@ -880,8 +888,8 @@ static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_maskz_fmadd_pbh(
880888
881889static __inline__ __m256bh __DEFAULT_FN_ATTRS256
882890_mm256_fmsub_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
883 return (__m256bh)__builtin_ia32_vfmaddbf16256((__v16bf)__A, (__v16bf)__B,
884 -(__v16bf)__C);
891 return (__m256bh)__builtin_elementwise_fma((__v16bf)__A, (__v16bf)__B,
892 -(__v16bf)__C);
885893}
886894
887895static __inline__ __m256bh __DEFAULT_FN_ATTRS256
......@@ -908,8 +916,8 @@ static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_maskz_fmsub_pbh(
908916
909917static __inline__ __m256bh __DEFAULT_FN_ATTRS256
910918_mm256_fnmadd_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
911 return (__m256bh)__builtin_ia32_vfmaddbf16256((__v16bf)__A, -(__v16bf)__B,
912 (__v16bf)__C);
919 return (__m256bh)__builtin_elementwise_fma((__v16bf)__A, -(__v16bf)__B,
920 (__v16bf)__C);
913921}
914922
915923static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_mask_fnmadd_pbh(
......@@ -938,8 +946,8 @@ static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_maskz_fnmadd_pbh(
938946
939947static __inline__ __m256bh __DEFAULT_FN_ATTRS256
940948_mm256_fnmsub_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
941 return (__m256bh)__builtin_ia32_vfmaddbf16256((__v16bf)__A, -(__v16bf)__B,
942 -(__v16bf)__C);
949 return (__m256bh)__builtin_elementwise_fma((__v16bf)__A, -(__v16bf)__B,
950 -(__v16bf)__C);
943951}
944952
945953static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_mask_fnmsub_pbh(
......@@ -969,8 +977,8 @@ static __inline__ __m256bh __DEFAULT_FN_ATTRS256 _mm256_maskz_fnmsub_pbh(
969977static __inline__ __m128bh __DEFAULT_FN_ATTRS128 _mm_fmadd_pbh(__m128bh __A,
970978 __m128bh __B,
971979 __m128bh __C) {
972 return (__m128bh)__builtin_ia32_vfmaddbf16128((__v8bf)__A, (__v8bf)__B,
973 (__v8bf)__C);
980 return (__m128bh)__builtin_elementwise_fma((__v8bf)__A, (__v8bf)__B,
981 (__v8bf)__C);
974982}
975983
976984static __inline__ __m128bh __DEFAULT_FN_ATTRS128
......@@ -997,8 +1005,8 @@ _mm_maskz_fmadd_pbh(__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
9971005static __inline__ __m128bh __DEFAULT_FN_ATTRS128 _mm_fmsub_pbh(__m128bh __A,
9981006 __m128bh __B,
9991007 __m128bh __C) {
1000 return (__m128bh)__builtin_ia32_vfmaddbf16128((__v8bf)__A, (__v8bf)__B,
1001 -(__v8bf)__C);
1008 return (__m128bh)__builtin_elementwise_fma((__v8bf)__A, (__v8bf)__B,
1009 -(__v8bf)__C);
10021010}
10031011
10041012static __inline__ __m128bh __DEFAULT_FN_ATTRS128
......@@ -1025,8 +1033,8 @@ _mm_maskz_fmsub_pbh(__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
10251033static __inline__ __m128bh __DEFAULT_FN_ATTRS128 _mm_fnmadd_pbh(__m128bh __A,
10261034 __m128bh __B,
10271035 __m128bh __C) {
1028 return (__m128bh)__builtin_ia32_vfmaddbf16128((__v8bf)__A, -(__v8bf)__B,
1029 (__v8bf)__C);
1036 return (__m128bh)__builtin_elementwise_fma((__v8bf)__A, -(__v8bf)__B,
1037 (__v8bf)__C);
10301038}
10311039
10321040static __inline__ __m128bh __DEFAULT_FN_ATTRS128
......@@ -1053,8 +1061,8 @@ _mm_maskz_fnmadd_pbh(__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
10531061static __inline__ __m128bh __DEFAULT_FN_ATTRS128 _mm_fnmsub_pbh(__m128bh __A,
10541062 __m128bh __B,
10551063 __m128bh __C) {
1056 return (__m128bh)__builtin_ia32_vfmaddbf16128((__v8bf)__A, -(__v8bf)__B,
1057 -(__v8bf)__C);
1064 return (__m128bh)__builtin_elementwise_fma((__v8bf)__A, -(__v8bf)__B,
1065 -(__v8bf)__C);
10581066}
10591067
10601068static __inline__ __m128bh __DEFAULT_FN_ATTRS128
......@@ -1080,6 +1088,7 @@ _mm_maskz_fnmsub_pbh(__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
10801088
10811089#undef __DEFAULT_FN_ATTRS128
10821090#undef __DEFAULT_FN_ATTRS256
1083
1091#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
1092#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
10841093#endif
10851094#endif
lib/include/avx10_2convertintrin.h+2-2
......@@ -18,10 +18,10 @@
1818
1919/* Define the default attributes for the functions in this file. */
2020#define __DEFAULT_FN_ATTRS128 \
21 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
21 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2222 __min_vector_width__(128)))
2323#define __DEFAULT_FN_ATTRS256 \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2525 __min_vector_width__(256)))
2626
2727// clang-format off
lib/include/avx10_2copyintrin.h+1-1
......@@ -16,7 +16,7 @@
1616
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2020 __min_vector_width__(128)))
2121
2222/// Constructs a 128-bit integer vector, setting the lower 32 bits to the
lib/include/avx10_2niintrin.h+14-14
......@@ -16,10 +16,10 @@
1616#define __AVX10_2NIINTRIN_H
1717
1818#define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2020 __min_vector_width__(128)))
2121#define __DEFAULT_FN_ATTRS256 \
22 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
22 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2323 __min_vector_width__(256)))
2424
2525/* VNNI FP16 */
......@@ -253,7 +253,7 @@ _mm_mask_dpwsud_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
253253}
254254
255255static __inline__ __m128i __DEFAULT_FN_ATTRS128
256_mm_maskz_dpwsud_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
256_mm_maskz_dpwsud_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C) {
257257 return (__m128i)__builtin_ia32_selectd_128(
258258 (__mmask8)__U, (__v4si)_mm_dpwsud_epi32(__A, __B, __C),
259259 (__v4si)_mm_setzero_si128());
......@@ -266,7 +266,7 @@ _mm256_mask_dpwsud_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
266266}
267267
268268static __inline__ __m256i __DEFAULT_FN_ATTRS256
269_mm256_maskz_dpwsud_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
269_mm256_maskz_dpwsud_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C) {
270270 return (__m256i)__builtin_ia32_selectd_256(
271271 (__mmask8)__U, (__v8si)_mm256_dpwsud_epi32(__A, __B, __C),
272272 (__v8si)_mm256_setzero_si256());
......@@ -279,7 +279,7 @@ _mm_mask_dpwsuds_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
279279}
280280
281281static __inline__ __m128i __DEFAULT_FN_ATTRS128
282_mm_maskz_dpwsuds_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
282_mm_maskz_dpwsuds_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C) {
283283 return (__m128i)__builtin_ia32_selectd_128(
284284 (__mmask8)__U, (__v4si)_mm_dpwsuds_epi32(__A, __B, __C),
285285 (__v4si)_mm_setzero_si128());
......@@ -292,7 +292,7 @@ _mm256_mask_dpwsuds_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
292292}
293293
294294static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_dpwsuds_epi32(
295 __m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
295 __mmask8 __U, __m256i __A, __m256i __B, __m256i __C) {
296296 return (__m256i)__builtin_ia32_selectd_256(
297297 (__mmask8)__U, (__v8si)_mm256_dpwsuds_epi32(__A, __B, __C),
298298 (__v8si)_mm256_setzero_si256());
......@@ -305,7 +305,7 @@ _mm_mask_dpwusd_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
305305}
306306
307307static __inline__ __m128i __DEFAULT_FN_ATTRS128
308_mm_maskz_dpwusd_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
308_mm_maskz_dpwusd_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C) {
309309 return (__m128i)__builtin_ia32_selectd_128(
310310 (__mmask8)__U, (__v4si)_mm_dpwusd_epi32(__A, __B, __C),
311311 (__v4si)_mm_setzero_si128());
......@@ -318,7 +318,7 @@ _mm256_mask_dpwusd_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
318318}
319319
320320static __inline__ __m256i __DEFAULT_FN_ATTRS256
321_mm256_maskz_dpwusd_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
321_mm256_maskz_dpwusd_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C) {
322322 return (__m256i)__builtin_ia32_selectd_256(
323323 (__mmask8)__U, (__v8si)_mm256_dpwusd_epi32(__A, __B, __C),
324324 (__v8si)_mm256_setzero_si256());
......@@ -331,7 +331,7 @@ _mm_mask_dpwusds_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
331331}
332332
333333static __inline__ __m128i __DEFAULT_FN_ATTRS128
334_mm_maskz_dpwusds_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
334_mm_maskz_dpwusds_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C) {
335335 return (__m128i)__builtin_ia32_selectd_128(
336336 (__mmask8)__U, (__v4si)_mm_dpwusds_epi32(__A, __B, __C),
337337 (__v4si)_mm_setzero_si128());
......@@ -344,7 +344,7 @@ _mm256_mask_dpwusds_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
344344}
345345
346346static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_dpwusds_epi32(
347 __m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
347 __mmask8 __U, __m256i __A, __m256i __B, __m256i __C) {
348348 return (__m256i)__builtin_ia32_selectd_256(
349349 (__mmask8)__U, (__v8si)_mm256_dpwusds_epi32(__A, __B, __C),
350350 (__v8si)_mm256_setzero_si256());
......@@ -357,7 +357,7 @@ _mm_mask_dpwuud_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
357357}
358358
359359static __inline__ __m128i __DEFAULT_FN_ATTRS128
360_mm_maskz_dpwuud_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
360_mm_maskz_dpwuud_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C) {
361361 return (__m128i)__builtin_ia32_selectd_128(
362362 (__mmask8)__U, (__v4si)_mm_dpwuud_epi32(__A, __B, __C),
363363 (__v4si)_mm_setzero_si128());
......@@ -370,7 +370,7 @@ _mm256_mask_dpwuud_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
370370}
371371
372372static __inline__ __m256i __DEFAULT_FN_ATTRS256
373_mm256_maskz_dpwuud_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
373_mm256_maskz_dpwuud_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C) {
374374 return (__m256i)__builtin_ia32_selectd_256(
375375 (__mmask8)__U, (__v8si)_mm256_dpwuud_epi32(__A, __B, __C),
376376 (__v8si)_mm256_setzero_si256());
......@@ -383,7 +383,7 @@ _mm_mask_dpwuuds_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
383383}
384384
385385static __inline__ __m128i __DEFAULT_FN_ATTRS128
386_mm_maskz_dpwuuds_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C) {
386_mm_maskz_dpwuuds_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C) {
387387 return (__m128i)__builtin_ia32_selectd_128(
388388 (__mmask8)__U, (__v4si)_mm_dpwuuds_epi32(__A, __B, __C),
389389 (__v4si)_mm_setzero_si128());
......@@ -396,7 +396,7 @@ _mm256_mask_dpwuuds_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
396396}
397397
398398static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_dpwuuds_epi32(
399 __m256i __A, __mmask8 __U, __m256i __B, __m256i __C) {
399 __mmask8 __U, __m256i __A, __m256i __B, __m256i __C) {
400400 return (__m256i)__builtin_ia32_selectd_256(
401401 (__mmask8)__U, (__v8si)_mm256_dpwuuds_epi32(__A, __B, __C),
402402 (__v8si)_mm256_setzero_si256());
lib/include/avx10_2satcvtdsintrin.h+2-2
......@@ -17,11 +17,11 @@
1717
1818/* Define the default attributes for the functions in this file. */
1919#define __DEFAULT_FN_ATTRS256 \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2121 __min_vector_width__(256)))
2222
2323#define __DEFAULT_FN_ATTRS128 \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2"), \
2525 __min_vector_width__(128)))
2626
2727#define _mm_cvtts_roundsd_i32(__A, __R) \
lib/include/avx2intrin.h+275-377
......@@ -15,20 +15,19 @@
1515#define __AVX2INTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
19#define __DEFAULT_FN_ATTRS256 \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("avx2,no-evex512"), __min_vector_width__(256)))
22#define __DEFAULT_FN_ATTRS128 \
23 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx2,no-evex512"), __min_vector_width__(128)))
25#else
2618#define __DEFAULT_FN_ATTRS256 \
2719 __attribute__((__always_inline__, __nodebug__, __target__("avx2"), \
2820 __min_vector_width__(256)))
2921#define __DEFAULT_FN_ATTRS128 \
3022 __attribute__((__always_inline__, __nodebug__, __target__("avx2"), \
3123 __min_vector_width__(128)))
24
25#if defined(__cplusplus) && (__cplusplus >= 201103L)
26#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
27#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
28#else
29#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
30#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
3231#endif
3332
3433/* SSE4 Multiple Packed Sums of Absolute Difference. */
......@@ -104,10 +103,9 @@
104103/// \param __a
105104/// A 256-bit integer vector.
106105/// \returns A 256-bit integer vector containing the result.
107static __inline__ __m256i __DEFAULT_FN_ATTRS256
108_mm256_abs_epi8(__m256i __a)
109{
110 return (__m256i)__builtin_elementwise_abs((__v32qs)__a);
106static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
107_mm256_abs_epi8(__m256i __a) {
108 return (__m256i)__builtin_elementwise_abs((__v32qs)__a);
111109}
112110
113111/// Computes the absolute value of each signed 16-bit element in the 256-bit
......@@ -121,10 +119,9 @@ _mm256_abs_epi8(__m256i __a)
121119/// \param __a
122120/// A 256-bit vector of [16 x i16].
123121/// \returns A 256-bit vector of [16 x i16] containing the result.
124static __inline__ __m256i __DEFAULT_FN_ATTRS256
125_mm256_abs_epi16(__m256i __a)
126{
127 return (__m256i)__builtin_elementwise_abs((__v16hi)__a);
122static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
123_mm256_abs_epi16(__m256i __a) {
124 return (__m256i)__builtin_elementwise_abs((__v16hi)__a);
128125}
129126
130127/// Computes the absolute value of each signed 32-bit element in the 256-bit
......@@ -138,10 +135,9 @@ _mm256_abs_epi16(__m256i __a)
138135/// \param __a
139136/// A 256-bit vector of [8 x i32].
140137/// \returns A 256-bit vector of [8 x i32] containing the result.
141static __inline__ __m256i __DEFAULT_FN_ATTRS256
142_mm256_abs_epi32(__m256i __a)
143{
144 return (__m256i)__builtin_elementwise_abs((__v8si)__a);
138static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
139_mm256_abs_epi32(__m256i __a) {
140 return (__m256i)__builtin_elementwise_abs((__v8si)__a);
145141}
146142
147143/// Converts the elements of two 256-bit vectors of [16 x i16] to 8-bit
......@@ -169,9 +165,8 @@ _mm256_abs_epi32(__m256i __a)
169165/// A 256-bit vector of [16 x i16] used to generate result[127:64] and
170166/// result[255:192].
171167/// \returns A 256-bit integer vector containing the result.
172static __inline__ __m256i __DEFAULT_FN_ATTRS256
173_mm256_packs_epi16(__m256i __a, __m256i __b)
174{
168static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
169_mm256_packs_epi16(__m256i __a, __m256i __b) {
175170 return (__m256i)__builtin_ia32_packsswb256((__v16hi)__a, (__v16hi)__b);
176171}
177172
......@@ -201,9 +196,8 @@ _mm256_packs_epi16(__m256i __a, __m256i __b)
201196/// A 256-bit vector of [8 x i32] used to generate result[127:64] and
202197/// result[255:192].
203198/// \returns A 256-bit vector of [16 x i16] containing the result.
204static __inline__ __m256i __DEFAULT_FN_ATTRS256
205_mm256_packs_epi32(__m256i __a, __m256i __b)
206{
199static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
200_mm256_packs_epi32(__m256i __a, __m256i __b) {
207201 return (__m256i)__builtin_ia32_packssdw256((__v8si)__a, (__v8si)__b);
208202}
209203
......@@ -232,9 +226,8 @@ _mm256_packs_epi32(__m256i __a, __m256i __b)
232226/// A 256-bit vector of [16 x i16] used to generate result[127:64] and
233227/// result[255:192].
234228/// \returns A 256-bit integer vector containing the result.
235static __inline__ __m256i __DEFAULT_FN_ATTRS256
236_mm256_packus_epi16(__m256i __a, __m256i __b)
237{
229static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
230_mm256_packus_epi16(__m256i __a, __m256i __b) {
238231 return (__m256i)__builtin_ia32_packuswb256((__v16hi)__a, (__v16hi)__b);
239232}
240233
......@@ -264,9 +257,8 @@ _mm256_packus_epi16(__m256i __a, __m256i __b)
264257/// A 256-bit vector of [8 x i32] used to generate result[127:64] and
265258/// result[255:192].
266259/// \returns A 256-bit vector of [16 x i16] containing the result.
267static __inline__ __m256i __DEFAULT_FN_ATTRS256
268_mm256_packus_epi32(__m256i __V1, __m256i __V2)
269{
260static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
261_mm256_packus_epi32(__m256i __V1, __m256i __V2) {
270262 return (__m256i) __builtin_ia32_packusdw256((__v8si)__V1, (__v8si)__V2);
271263}
272264
......@@ -283,9 +275,8 @@ _mm256_packus_epi32(__m256i __V1, __m256i __V2)
283275/// \param __b
284276/// A 256-bit integer vector containing one of the source operands.
285277/// \returns A 256-bit integer vector containing the sums.
286static __inline__ __m256i __DEFAULT_FN_ATTRS256
287_mm256_add_epi8(__m256i __a, __m256i __b)
288{
278static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
279_mm256_add_epi8(__m256i __a, __m256i __b) {
289280 return (__m256i)((__v32qu)__a + (__v32qu)__b);
290281}
291282
......@@ -302,9 +293,8 @@ _mm256_add_epi8(__m256i __a, __m256i __b)
302293/// \param __b
303294/// A 256-bit vector of [16 x i16] containing one of the source operands.
304295/// \returns A 256-bit vector of [16 x i16] containing the sums.
305static __inline__ __m256i __DEFAULT_FN_ATTRS256
306_mm256_add_epi16(__m256i __a, __m256i __b)
307{
296static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
297_mm256_add_epi16(__m256i __a, __m256i __b) {
308298 return (__m256i)((__v16hu)__a + (__v16hu)__b);
309299}
310300
......@@ -321,9 +311,8 @@ _mm256_add_epi16(__m256i __a, __m256i __b)
321311/// \param __b
322312/// A 256-bit vector of [8 x i32] containing one of the source operands.
323313/// \returns A 256-bit vector of [8 x i32] containing the sums.
324static __inline__ __m256i __DEFAULT_FN_ATTRS256
325_mm256_add_epi32(__m256i __a, __m256i __b)
326{
314static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
315_mm256_add_epi32(__m256i __a, __m256i __b) {
327316 return (__m256i)((__v8su)__a + (__v8su)__b);
328317}
329318
......@@ -340,9 +329,8 @@ _mm256_add_epi32(__m256i __a, __m256i __b)
340329/// \param __b
341330/// A 256-bit vector of [4 x i64] containing one of the source operands.
342331/// \returns A 256-bit vector of [4 x i64] containing the sums.
343static __inline__ __m256i __DEFAULT_FN_ATTRS256
344_mm256_add_epi64(__m256i __a, __m256i __b)
345{
332static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
333_mm256_add_epi64(__m256i __a, __m256i __b) {
346334 return (__m256i)((__v4du)__a + (__v4du)__b);
347335}
348336
......@@ -359,9 +347,8 @@ _mm256_add_epi64(__m256i __a, __m256i __b)
359347/// \param __b
360348/// A 256-bit integer vector containing one of the source operands.
361349/// \returns A 256-bit integer vector containing the sums.
362static __inline__ __m256i __DEFAULT_FN_ATTRS256
363_mm256_adds_epi8(__m256i __a, __m256i __b)
364{
350static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
351_mm256_adds_epi8(__m256i __a, __m256i __b) {
365352 return (__m256i)__builtin_elementwise_add_sat((__v32qs)__a, (__v32qs)__b);
366353}
367354
......@@ -377,9 +364,8 @@ _mm256_adds_epi8(__m256i __a, __m256i __b)
377364/// \param __b
378365/// A 256-bit vector of [16 x i16] containing one of the source operands.
379366/// \returns A 256-bit vector of [16 x i16] containing the sums.
380static __inline__ __m256i __DEFAULT_FN_ATTRS256
381_mm256_adds_epi16(__m256i __a, __m256i __b)
382{
367static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
368_mm256_adds_epi16(__m256i __a, __m256i __b) {
383369 return (__m256i)__builtin_elementwise_add_sat((__v16hi)__a, (__v16hi)__b);
384370}
385371
......@@ -396,9 +382,8 @@ _mm256_adds_epi16(__m256i __a, __m256i __b)
396382/// \param __b
397383/// A 256-bit integer vector containing one of the source operands.
398384/// \returns A 256-bit integer vector containing the sums.
399static __inline__ __m256i __DEFAULT_FN_ATTRS256
400_mm256_adds_epu8(__m256i __a, __m256i __b)
401{
385static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
386_mm256_adds_epu8(__m256i __a, __m256i __b) {
402387 return (__m256i)__builtin_elementwise_add_sat((__v32qu)__a, (__v32qu)__b);
403388}
404389
......@@ -414,9 +399,8 @@ _mm256_adds_epu8(__m256i __a, __m256i __b)
414399/// \param __b
415400/// A 256-bit vector of [16 x i16] containing one of the source operands.
416401/// \returns A 256-bit vector of [16 x i16] containing the sums.
417static __inline__ __m256i __DEFAULT_FN_ATTRS256
418_mm256_adds_epu16(__m256i __a, __m256i __b)
419{
402static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
403_mm256_adds_epu16(__m256i __a, __m256i __b) {
420404 return (__m256i)__builtin_elementwise_add_sat((__v16hu)__a, (__v16hu)__b);
421405}
422406
......@@ -460,7 +444,7 @@ _mm256_adds_epu16(__m256i __a, __m256i __b)
460444/// \param __b
461445/// A 256-bit integer vector.
462446/// \returns A 256-bit integer vector containing the result.
463static __inline__ __m256i __DEFAULT_FN_ATTRS256
447static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
464448_mm256_and_si256(__m256i __a, __m256i __b)
465449{
466450 return (__m256i)((__v4du)__a & (__v4du)__b);
......@@ -478,7 +462,7 @@ _mm256_and_si256(__m256i __a, __m256i __b)
478462/// \param __b
479463/// A 256-bit integer vector.
480464/// \returns A 256-bit integer vector containing the result.
481static __inline__ __m256i __DEFAULT_FN_ATTRS256
465static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
482466_mm256_andnot_si256(__m256i __a, __m256i __b)
483467{
484468 return (__m256i)(~(__v4du)__a & (__v4du)__b);
......@@ -504,10 +488,9 @@ _mm256_andnot_si256(__m256i __a, __m256i __b)
504488/// \param __b
505489/// A 256-bit integer vector.
506490/// \returns A 256-bit integer vector containing the result.
507static __inline__ __m256i __DEFAULT_FN_ATTRS256
508_mm256_avg_epu8(__m256i __a, __m256i __b)
509{
510 return (__m256i)__builtin_ia32_pavgb256((__v32qi)__a, (__v32qi)__b);
491static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
492_mm256_avg_epu8(__m256i __a, __m256i __b) {
493 return (__m256i)__builtin_ia32_pavgb256((__v32qu)__a, (__v32qu)__b);
511494}
512495
513496/// Computes the averages of the corresponding unsigned 16-bit integers in
......@@ -530,10 +513,9 @@ _mm256_avg_epu8(__m256i __a, __m256i __b)
530513/// \param __b
531514/// A 256-bit vector of [16 x i16].
532515/// \returns A 256-bit vector of [16 x i16] containing the result.
533static __inline__ __m256i __DEFAULT_FN_ATTRS256
534_mm256_avg_epu16(__m256i __a, __m256i __b)
535{
536 return (__m256i)__builtin_ia32_pavgw256((__v16hi)__a, (__v16hi)__b);
516static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
517_mm256_avg_epu16(__m256i __a, __m256i __b) {
518 return (__m256i)__builtin_ia32_pavgw256((__v16hu)__a, (__v16hu)__b);
537519}
538520
539521/// Merges 8-bit integer values from either of the two 256-bit vectors
......@@ -565,9 +547,8 @@ _mm256_avg_epu16(__m256i __a, __m256i __b)
565547/// is 0, the byte is copied from \a __V1; otherwise, it is copied from
566548/// \a __V2.
567549/// \returns A 256-bit integer vector containing the result.
568static __inline__ __m256i __DEFAULT_FN_ATTRS256
569_mm256_blendv_epi8(__m256i __V1, __m256i __V2, __m256i __M)
570{
550static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
551_mm256_blendv_epi8(__m256i __V1, __m256i __V2, __m256i __M) {
571552 return (__m256i)__builtin_ia32_pblendvb256((__v32qi)__V1, (__v32qi)__V2,
572553 (__v32qi)__M);
573554}
......@@ -633,7 +614,7 @@ _mm256_blendv_epi8(__m256i __V1, __m256i __V2, __m256i __M)
633614/// \param __b
634615/// A 256-bit integer vector containing one of the inputs.
635616/// \returns A 256-bit integer vector containing the result.
636static __inline__ __m256i __DEFAULT_FN_ATTRS256
617static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
637618_mm256_cmpeq_epi8(__m256i __a, __m256i __b)
638619{
639620 return (__m256i)((__v32qi)__a == (__v32qi)__b);
......@@ -659,7 +640,7 @@ _mm256_cmpeq_epi8(__m256i __a, __m256i __b)
659640/// \param __b
660641/// A 256-bit vector of [16 x i16] containing one of the inputs.
661642/// \returns A 256-bit vector of [16 x i16] containing the result.
662static __inline__ __m256i __DEFAULT_FN_ATTRS256
643static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
663644_mm256_cmpeq_epi16(__m256i __a, __m256i __b)
664645{
665646 return (__m256i)((__v16hi)__a == (__v16hi)__b);
......@@ -685,7 +666,7 @@ _mm256_cmpeq_epi16(__m256i __a, __m256i __b)
685666/// \param __b
686667/// A 256-bit vector of [8 x i32] containing one of the inputs.
687668/// \returns A 256-bit vector of [8 x i32] containing the result.
688static __inline__ __m256i __DEFAULT_FN_ATTRS256
669static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
689670_mm256_cmpeq_epi32(__m256i __a, __m256i __b)
690671{
691672 return (__m256i)((__v8si)__a == (__v8si)__b);
......@@ -711,7 +692,7 @@ _mm256_cmpeq_epi32(__m256i __a, __m256i __b)
711692/// \param __b
712693/// A 256-bit vector of [4 x i64] containing one of the inputs.
713694/// \returns A 256-bit vector of [4 x i64] containing the result.
714static __inline__ __m256i __DEFAULT_FN_ATTRS256
695static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
715696_mm256_cmpeq_epi64(__m256i __a, __m256i __b)
716697{
717698 return (__m256i)((__v4di)__a == (__v4di)__b);
......@@ -737,7 +718,7 @@ _mm256_cmpeq_epi64(__m256i __a, __m256i __b)
737718/// \param __b
738719/// A 256-bit integer vector containing one of the inputs.
739720/// \returns A 256-bit integer vector containing the result.
740static __inline__ __m256i __DEFAULT_FN_ATTRS256
721static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
741722_mm256_cmpgt_epi8(__m256i __a, __m256i __b)
742723{
743724 /* This function always performs a signed comparison, but __v32qi is a char
......@@ -765,7 +746,7 @@ _mm256_cmpgt_epi8(__m256i __a, __m256i __b)
765746/// \param __b
766747/// A 256-bit vector of [16 x i16] containing one of the inputs.
767748/// \returns A 256-bit vector of [16 x i16] containing the result.
768static __inline__ __m256i __DEFAULT_FN_ATTRS256
749static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
769750_mm256_cmpgt_epi16(__m256i __a, __m256i __b)
770751{
771752 return (__m256i)((__v16hi)__a > (__v16hi)__b);
......@@ -791,7 +772,7 @@ _mm256_cmpgt_epi16(__m256i __a, __m256i __b)
791772/// \param __b
792773/// A 256-bit vector of [8 x i32] containing one of the inputs.
793774/// \returns A 256-bit vector of [8 x i32] containing the result.
794static __inline__ __m256i __DEFAULT_FN_ATTRS256
775static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
795776_mm256_cmpgt_epi32(__m256i __a, __m256i __b)
796777{
797778 return (__m256i)((__v8si)__a > (__v8si)__b);
......@@ -817,7 +798,7 @@ _mm256_cmpgt_epi32(__m256i __a, __m256i __b)
817798/// \param __b
818799/// A 256-bit vector of [4 x i64] containing one of the inputs.
819800/// \returns A 256-bit vector of [4 x i64] containing the result.
820static __inline__ __m256i __DEFAULT_FN_ATTRS256
801static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
821802_mm256_cmpgt_epi64(__m256i __a, __m256i __b)
822803{
823804 return (__m256i)((__v4di)__a > (__v4di)__b);
......@@ -853,10 +834,9 @@ _mm256_cmpgt_epi64(__m256i __a, __m256i __b)
853834/// \param __b
854835/// A 256-bit vector of [16 x i16] containing one of the source operands.
855836/// \returns A 256-bit vector of [16 x i16] containing the sums.
856static __inline__ __m256i __DEFAULT_FN_ATTRS256
857_mm256_hadd_epi16(__m256i __a, __m256i __b)
858{
859 return (__m256i)__builtin_ia32_phaddw256((__v16hi)__a, (__v16hi)__b);
837static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
838_mm256_hadd_epi16(__m256i __a, __m256i __b) {
839 return (__m256i)__builtin_ia32_phaddw256((__v16hi)__a, (__v16hi)__b);
860840}
861841
862842/// Horizontally adds the adjacent pairs of 32-bit integers from two 256-bit
......@@ -885,10 +865,9 @@ _mm256_hadd_epi16(__m256i __a, __m256i __b)
885865/// \param __b
886866/// A 256-bit vector of [8 x i32] containing one of the source operands.
887867/// \returns A 256-bit vector of [8 x i32] containing the sums.
888static __inline__ __m256i __DEFAULT_FN_ATTRS256
889_mm256_hadd_epi32(__m256i __a, __m256i __b)
890{
891 return (__m256i)__builtin_ia32_phaddd256((__v8si)__a, (__v8si)__b);
868static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
869_mm256_hadd_epi32(__m256i __a, __m256i __b) {
870 return (__m256i)__builtin_ia32_phaddd256((__v8si)__a, (__v8si)__b);
892871}
893872
894873/// Horizontally adds the adjacent pairs of 16-bit integers from two 256-bit
......@@ -920,10 +899,9 @@ _mm256_hadd_epi32(__m256i __a, __m256i __b)
920899/// \param __b
921900/// A 256-bit vector of [16 x i16] containing one of the source operands.
922901/// \returns A 256-bit vector of [16 x i16] containing the sums.
923static __inline__ __m256i __DEFAULT_FN_ATTRS256
924_mm256_hadds_epi16(__m256i __a, __m256i __b)
925{
926 return (__m256i)__builtin_ia32_phaddsw256((__v16hi)__a, (__v16hi)__b);
902static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
903_mm256_hadds_epi16(__m256i __a, __m256i __b) {
904 return (__m256i)__builtin_ia32_phaddsw256((__v16hi)__a, (__v16hi)__b);
927905}
928906
929907/// Horizontally subtracts adjacent pairs of 16-bit integers from two 256-bit
......@@ -956,10 +934,9 @@ _mm256_hadds_epi16(__m256i __a, __m256i __b)
956934/// \param __b
957935/// A 256-bit vector of [16 x i16] containing one of the source operands.
958936/// \returns A 256-bit vector of [16 x i16] containing the differences.
959static __inline__ __m256i __DEFAULT_FN_ATTRS256
960_mm256_hsub_epi16(__m256i __a, __m256i __b)
961{
962 return (__m256i)__builtin_ia32_phsubw256((__v16hi)__a, (__v16hi)__b);
937static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
938_mm256_hsub_epi16(__m256i __a, __m256i __b) {
939 return (__m256i)__builtin_ia32_phsubw256((__v16hi)__a, (__v16hi)__b);
963940}
964941
965942/// Horizontally subtracts adjacent pairs of 32-bit integers from two 256-bit
......@@ -988,10 +965,9 @@ _mm256_hsub_epi16(__m256i __a, __m256i __b)
988965/// \param __b
989966/// A 256-bit vector of [8 x i32] containing one of the source operands.
990967/// \returns A 256-bit vector of [8 x i32] containing the differences.
991static __inline__ __m256i __DEFAULT_FN_ATTRS256
992_mm256_hsub_epi32(__m256i __a, __m256i __b)
993{
994 return (__m256i)__builtin_ia32_phsubd256((__v8si)__a, (__v8si)__b);
968static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
969_mm256_hsub_epi32(__m256i __a, __m256i __b) {
970 return (__m256i)__builtin_ia32_phsubd256((__v8si)__a, (__v8si)__b);
995971}
996972
997973/// Horizontally subtracts adjacent pairs of 16-bit integers from two 256-bit
......@@ -1024,10 +1000,9 @@ _mm256_hsub_epi32(__m256i __a, __m256i __b)
10241000/// \param __b
10251001/// A 256-bit vector of [16 x i16] containing one of the source operands.
10261002/// \returns A 256-bit vector of [16 x i16] containing the differences.
1027static __inline__ __m256i __DEFAULT_FN_ATTRS256
1028_mm256_hsubs_epi16(__m256i __a, __m256i __b)
1029{
1030 return (__m256i)__builtin_ia32_phsubsw256((__v16hi)__a, (__v16hi)__b);
1003static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1004_mm256_hsubs_epi16(__m256i __a, __m256i __b) {
1005 return (__m256i)__builtin_ia32_phsubsw256((__v16hi)__a, (__v16hi)__b);
10311006}
10321007
10331008/// Multiplies each unsigned byte from the 256-bit integer vector in \a __a
......@@ -1054,10 +1029,9 @@ _mm256_hsubs_epi16(__m256i __a, __m256i __b)
10541029/// \param __b
10551030/// A 256-bit vector containing one of the source operands.
10561031/// \returns A 256-bit vector of [16 x i16] containing the result.
1057static __inline__ __m256i __DEFAULT_FN_ATTRS256
1058_mm256_maddubs_epi16(__m256i __a, __m256i __b)
1059{
1060 return (__m256i)__builtin_ia32_pmaddubsw256((__v32qi)__a, (__v32qi)__b);
1032static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1033_mm256_maddubs_epi16(__m256i __a, __m256i __b) {
1034 return (__m256i)__builtin_ia32_pmaddubsw256((__v32qi)__a, (__v32qi)__b);
10611035}
10621036
10631037/// Multiplies corresponding 16-bit elements of two 256-bit vectors of
......@@ -1086,9 +1060,8 @@ _mm256_maddubs_epi16(__m256i __a, __m256i __b)
10861060/// \param __b
10871061/// A 256-bit vector of [16 x i16] containing one of the source operands.
10881062/// \returns A 256-bit vector of [8 x i32] containing the result.
1089static __inline__ __m256i __DEFAULT_FN_ATTRS256
1090_mm256_madd_epi16(__m256i __a, __m256i __b)
1091{
1063static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1064_mm256_madd_epi16(__m256i __a, __m256i __b) {
10921065 return (__m256i)__builtin_ia32_pmaddwd256((__v16hi)__a, (__v16hi)__b);
10931066}
10941067
......@@ -1105,9 +1078,8 @@ _mm256_madd_epi16(__m256i __a, __m256i __b)
11051078/// \param __b
11061079/// A 256-bit integer vector.
11071080/// \returns A 256-bit integer vector containing the result.
1108static __inline__ __m256i __DEFAULT_FN_ATTRS256
1109_mm256_max_epi8(__m256i __a, __m256i __b)
1110{
1081static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1082_mm256_max_epi8(__m256i __a, __m256i __b) {
11111083 return (__m256i)__builtin_elementwise_max((__v32qs)__a, (__v32qs)__b);
11121084}
11131085
......@@ -1124,9 +1096,8 @@ _mm256_max_epi8(__m256i __a, __m256i __b)
11241096/// \param __b
11251097/// A 256-bit vector of [16 x i16].
11261098/// \returns A 256-bit vector of [16 x i16] containing the result.
1127static __inline__ __m256i __DEFAULT_FN_ATTRS256
1128_mm256_max_epi16(__m256i __a, __m256i __b)
1129{
1099static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1100_mm256_max_epi16(__m256i __a, __m256i __b) {
11301101 return (__m256i)__builtin_elementwise_max((__v16hi)__a, (__v16hi)__b);
11311102}
11321103
......@@ -1143,9 +1114,8 @@ _mm256_max_epi16(__m256i __a, __m256i __b)
11431114/// \param __b
11441115/// A 256-bit vector of [8 x i32].
11451116/// \returns A 256-bit vector of [8 x i32] containing the result.
1146static __inline__ __m256i __DEFAULT_FN_ATTRS256
1147_mm256_max_epi32(__m256i __a, __m256i __b)
1148{
1117static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1118_mm256_max_epi32(__m256i __a, __m256i __b) {
11491119 return (__m256i)__builtin_elementwise_max((__v8si)__a, (__v8si)__b);
11501120}
11511121
......@@ -1162,9 +1132,8 @@ _mm256_max_epi32(__m256i __a, __m256i __b)
11621132/// \param __b
11631133/// A 256-bit integer vector.
11641134/// \returns A 256-bit integer vector containing the result.
1165static __inline__ __m256i __DEFAULT_FN_ATTRS256
1166_mm256_max_epu8(__m256i __a, __m256i __b)
1167{
1135static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1136_mm256_max_epu8(__m256i __a, __m256i __b) {
11681137 return (__m256i)__builtin_elementwise_max((__v32qu)__a, (__v32qu)__b);
11691138}
11701139
......@@ -1181,9 +1150,8 @@ _mm256_max_epu8(__m256i __a, __m256i __b)
11811150/// \param __b
11821151/// A 256-bit vector of [16 x i16].
11831152/// \returns A 256-bit vector of [16 x i16] containing the result.
1184static __inline__ __m256i __DEFAULT_FN_ATTRS256
1185_mm256_max_epu16(__m256i __a, __m256i __b)
1186{
1153static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1154_mm256_max_epu16(__m256i __a, __m256i __b) {
11871155 return (__m256i)__builtin_elementwise_max((__v16hu)__a, (__v16hu)__b);
11881156}
11891157
......@@ -1200,9 +1168,8 @@ _mm256_max_epu16(__m256i __a, __m256i __b)
12001168/// \param __b
12011169/// A 256-bit vector of [8 x i32].
12021170/// \returns A 256-bit vector of [8 x i32] containing the result.
1203static __inline__ __m256i __DEFAULT_FN_ATTRS256
1204_mm256_max_epu32(__m256i __a, __m256i __b)
1205{
1171static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1172_mm256_max_epu32(__m256i __a, __m256i __b) {
12061173 return (__m256i)__builtin_elementwise_max((__v8su)__a, (__v8su)__b);
12071174}
12081175
......@@ -1219,9 +1186,8 @@ _mm256_max_epu32(__m256i __a, __m256i __b)
12191186/// \param __b
12201187/// A 256-bit integer vector.
12211188/// \returns A 256-bit integer vector containing the result.
1222static __inline__ __m256i __DEFAULT_FN_ATTRS256
1223_mm256_min_epi8(__m256i __a, __m256i __b)
1224{
1189static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1190_mm256_min_epi8(__m256i __a, __m256i __b) {
12251191 return (__m256i)__builtin_elementwise_min((__v32qs)__a, (__v32qs)__b);
12261192}
12271193
......@@ -1238,9 +1204,8 @@ _mm256_min_epi8(__m256i __a, __m256i __b)
12381204/// \param __b
12391205/// A 256-bit vector of [16 x i16].
12401206/// \returns A 256-bit vector of [16 x i16] containing the result.
1241static __inline__ __m256i __DEFAULT_FN_ATTRS256
1242_mm256_min_epi16(__m256i __a, __m256i __b)
1243{
1207static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1208_mm256_min_epi16(__m256i __a, __m256i __b) {
12441209 return (__m256i)__builtin_elementwise_min((__v16hi)__a, (__v16hi)__b);
12451210}
12461211
......@@ -1257,9 +1222,8 @@ _mm256_min_epi16(__m256i __a, __m256i __b)
12571222/// \param __b
12581223/// A 256-bit vector of [8 x i32].
12591224/// \returns A 256-bit vector of [8 x i32] containing the result.
1260static __inline__ __m256i __DEFAULT_FN_ATTRS256
1261_mm256_min_epi32(__m256i __a, __m256i __b)
1262{
1225static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1226_mm256_min_epi32(__m256i __a, __m256i __b) {
12631227 return (__m256i)__builtin_elementwise_min((__v8si)__a, (__v8si)__b);
12641228}
12651229
......@@ -1276,9 +1240,8 @@ _mm256_min_epi32(__m256i __a, __m256i __b)
12761240/// \param __b
12771241/// A 256-bit integer vector.
12781242/// \returns A 256-bit integer vector containing the result.
1279static __inline__ __m256i __DEFAULT_FN_ATTRS256
1280_mm256_min_epu8(__m256i __a, __m256i __b)
1281{
1243static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1244_mm256_min_epu8(__m256i __a, __m256i __b) {
12821245 return (__m256i)__builtin_elementwise_min((__v32qu)__a, (__v32qu)__b);
12831246}
12841247
......@@ -1295,9 +1258,8 @@ _mm256_min_epu8(__m256i __a, __m256i __b)
12951258/// \param __b
12961259/// A 256-bit vector of [16 x i16].
12971260/// \returns A 256-bit vector of [16 x i16] containing the result.
1298static __inline__ __m256i __DEFAULT_FN_ATTRS256
1299_mm256_min_epu16(__m256i __a, __m256i __b)
1300{
1261static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1262_mm256_min_epu16(__m256i __a, __m256i __b) {
13011263 return (__m256i)__builtin_elementwise_min((__v16hu)__a, (__v16hu)__b);
13021264}
13031265
......@@ -1314,9 +1276,8 @@ _mm256_min_epu16(__m256i __a, __m256i __b)
13141276/// \param __b
13151277/// A 256-bit vector of [8 x i32].
13161278/// \returns A 256-bit vector of [8 x i32] containing the result.
1317static __inline__ __m256i __DEFAULT_FN_ATTRS256
1318_mm256_min_epu32(__m256i __a, __m256i __b)
1319{
1279static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1280_mm256_min_epu32(__m256i __a, __m256i __b) {
13201281 return (__m256i)__builtin_elementwise_min((__v8su)__a, (__v8su)__b);
13211282}
13221283
......@@ -1337,9 +1298,8 @@ _mm256_min_epu32(__m256i __a, __m256i __b)
13371298/// \param __a
13381299/// A 256-bit integer vector containing the source bytes.
13391300/// \returns The 32-bit integer mask.
1340static __inline__ int __DEFAULT_FN_ATTRS256
1341_mm256_movemask_epi8(__m256i __a)
1342{
1301static __inline__ int __DEFAULT_FN_ATTRS256_CONSTEXPR
1302_mm256_movemask_epi8(__m256i __a) {
13431303 return __builtin_ia32_pmovmskb256((__v32qi)__a);
13441304}
13451305
......@@ -1363,9 +1323,8 @@ _mm256_movemask_epi8(__m256i __a)
13631323/// A 128-bit integer vector containing the source bytes.
13641324/// \returns A 256-bit vector of [16 x i16] containing the sign-extended
13651325/// values.
1366static __inline__ __m256i __DEFAULT_FN_ATTRS256
1367_mm256_cvtepi8_epi16(__m128i __V)
1368{
1326static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1327_mm256_cvtepi8_epi16(__m128i __V) {
13691328 /* This function always performs a signed extension, but __v16qi is a char
13701329 which may be signed or unsigned, so use __v16qs. */
13711330 return (__m256i)__builtin_convertvector((__v16qs)__V, __v16hi);
......@@ -1391,9 +1350,8 @@ _mm256_cvtepi8_epi16(__m128i __V)
13911350/// A 128-bit integer vector containing the source bytes.
13921351/// \returns A 256-bit vector of [8 x i32] containing the sign-extended
13931352/// values.
1394static __inline__ __m256i __DEFAULT_FN_ATTRS256
1395_mm256_cvtepi8_epi32(__m128i __V)
1396{
1353static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1354_mm256_cvtepi8_epi32(__m128i __V) {
13971355 /* This function always performs a signed extension, but __v16qi is a char
13981356 which may be signed or unsigned, so use __v16qs. */
13991357 return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8si);
......@@ -1418,9 +1376,8 @@ _mm256_cvtepi8_epi32(__m128i __V)
14181376/// A 128-bit integer vector containing the source bytes.
14191377/// \returns A 256-bit vector of [4 x i64] containing the sign-extended
14201378/// values.
1421static __inline__ __m256i __DEFAULT_FN_ATTRS256
1422_mm256_cvtepi8_epi64(__m128i __V)
1423{
1379static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1380_mm256_cvtepi8_epi64(__m128i __V) {
14241381 /* This function always performs a signed extension, but __v16qi is a char
14251382 which may be signed or unsigned, so use __v16qs. */
14261383 return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1, 2, 3), __v4di);
......@@ -1446,9 +1403,8 @@ _mm256_cvtepi8_epi64(__m128i __V)
14461403/// A 128-bit vector of [8 x i16] containing the source values.
14471404/// \returns A 256-bit vector of [8 x i32] containing the sign-extended
14481405/// values.
1449static __inline__ __m256i __DEFAULT_FN_ATTRS256
1450_mm256_cvtepi16_epi32(__m128i __V)
1451{
1406static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1407_mm256_cvtepi16_epi32(__m128i __V) {
14521408 return (__m256i)__builtin_convertvector((__v8hi)__V, __v8si);
14531409}
14541410
......@@ -1471,9 +1427,8 @@ _mm256_cvtepi16_epi32(__m128i __V)
14711427/// A 128-bit vector of [8 x i16] containing the source values.
14721428/// \returns A 256-bit vector of [4 x i64] containing the sign-extended
14731429/// values.
1474static __inline__ __m256i __DEFAULT_FN_ATTRS256
1475_mm256_cvtepi16_epi64(__m128i __V)
1476{
1430static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1431_mm256_cvtepi16_epi64(__m128i __V) {
14771432 return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1, 2, 3), __v4di);
14781433}
14791434
......@@ -1496,9 +1451,8 @@ _mm256_cvtepi16_epi64(__m128i __V)
14961451/// A 128-bit vector of [4 x i32] containing the source values.
14971452/// \returns A 256-bit vector of [4 x i64] containing the sign-extended
14981453/// values.
1499static __inline__ __m256i __DEFAULT_FN_ATTRS256
1500_mm256_cvtepi32_epi64(__m128i __V)
1501{
1454static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1455_mm256_cvtepi32_epi64(__m128i __V) {
15021456 return (__m256i)__builtin_convertvector((__v4si)__V, __v4di);
15031457}
15041458
......@@ -1522,9 +1476,8 @@ _mm256_cvtepi32_epi64(__m128i __V)
15221476/// A 128-bit integer vector containing the source bytes.
15231477/// \returns A 256-bit vector of [16 x i16] containing the zero-extended
15241478/// values.
1525static __inline__ __m256i __DEFAULT_FN_ATTRS256
1526_mm256_cvtepu8_epi16(__m128i __V)
1527{
1479static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1480_mm256_cvtepu8_epi16(__m128i __V) {
15281481 return (__m256i)__builtin_convertvector((__v16qu)__V, __v16hi);
15291482}
15301483
......@@ -1548,9 +1501,8 @@ _mm256_cvtepu8_epi16(__m128i __V)
15481501/// A 128-bit integer vector containing the source bytes.
15491502/// \returns A 256-bit vector of [8 x i32] containing the zero-extended
15501503/// values.
1551static __inline__ __m256i __DEFAULT_FN_ATTRS256
1552_mm256_cvtepu8_epi32(__m128i __V)
1553{
1504static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1505_mm256_cvtepu8_epi32(__m128i __V) {
15541506 return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8si);
15551507}
15561508
......@@ -1573,9 +1525,8 @@ _mm256_cvtepu8_epi32(__m128i __V)
15731525/// A 128-bit integer vector containing the source bytes.
15741526/// \returns A 256-bit vector of [4 x i64] containing the zero-extended
15751527/// values.
1576static __inline__ __m256i __DEFAULT_FN_ATTRS256
1577_mm256_cvtepu8_epi64(__m128i __V)
1578{
1528static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1529_mm256_cvtepu8_epi64(__m128i __V) {
15791530 return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3), __v4di);
15801531}
15811532
......@@ -1599,9 +1550,8 @@ _mm256_cvtepu8_epi64(__m128i __V)
15991550/// A 128-bit vector of [8 x i16] containing the source values.
16001551/// \returns A 256-bit vector of [8 x i32] containing the zero-extended
16011552/// values.
1602static __inline__ __m256i __DEFAULT_FN_ATTRS256
1603_mm256_cvtepu16_epi32(__m128i __V)
1604{
1553static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1554_mm256_cvtepu16_epi32(__m128i __V) {
16051555 return (__m256i)__builtin_convertvector((__v8hu)__V, __v8si);
16061556}
16071557
......@@ -1624,9 +1574,8 @@ _mm256_cvtepu16_epi32(__m128i __V)
16241574/// A 128-bit vector of [8 x i16] containing the source values.
16251575/// \returns A 256-bit vector of [4 x i64] containing the zero-extended
16261576/// values.
1627static __inline__ __m256i __DEFAULT_FN_ATTRS256
1628_mm256_cvtepu16_epi64(__m128i __V)
1629{
1577static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1578_mm256_cvtepu16_epi64(__m128i __V) {
16301579 return (__m256i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1, 2, 3), __v4di);
16311580}
16321581
......@@ -1649,9 +1598,8 @@ _mm256_cvtepu16_epi64(__m128i __V)
16491598/// A 128-bit vector of [4 x i32] containing the source values.
16501599/// \returns A 256-bit vector of [4 x i64] containing the zero-extended
16511600/// values.
1652static __inline__ __m256i __DEFAULT_FN_ATTRS256
1653_mm256_cvtepu32_epi64(__m128i __V)
1654{
1601static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1602_mm256_cvtepu32_epi64(__m128i __V) {
16551603 return (__m256i)__builtin_convertvector((__v4su)__V, __v4di);
16561604}
16571605
......@@ -1675,9 +1623,8 @@ _mm256_cvtepu32_epi64(__m128i __V)
16751623/// \param __b
16761624/// A 256-bit vector of [8 x i32] containing one of the source operands.
16771625/// \returns A 256-bit vector of [4 x i64] containing the products.
1678static __inline__ __m256i __DEFAULT_FN_ATTRS256
1679_mm256_mul_epi32(__m256i __a, __m256i __b)
1680{
1626static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1627_mm256_mul_epi32(__m256i __a, __m256i __b) {
16811628 return (__m256i)__builtin_ia32_pmuldq256((__v8si)__a, (__v8si)__b);
16821629}
16831630
......@@ -1702,9 +1649,8 @@ _mm256_mul_epi32(__m256i __a, __m256i __b)
17021649/// \param __b
17031650/// A 256-bit vector of [16 x i16] containing one of the source operands.
17041651/// \returns A 256-bit vector of [16 x i16] containing the rounded products.
1705static __inline__ __m256i __DEFAULT_FN_ATTRS256
1706_mm256_mulhrs_epi16(__m256i __a, __m256i __b)
1707{
1652static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1653_mm256_mulhrs_epi16(__m256i __a, __m256i __b) {
17081654 return (__m256i)__builtin_ia32_pmulhrsw256((__v16hi)__a, (__v16hi)__b);
17091655}
17101656
......@@ -1721,10 +1667,9 @@ _mm256_mulhrs_epi16(__m256i __a, __m256i __b)
17211667/// \param __b
17221668/// A 256-bit vector of [16 x i16] containing one of the source operands.
17231669/// \returns A 256-bit vector of [16 x i16] containing the products.
1724static __inline__ __m256i __DEFAULT_FN_ATTRS256
1725_mm256_mulhi_epu16(__m256i __a, __m256i __b)
1726{
1727 return (__m256i)__builtin_ia32_pmulhuw256((__v16hi)__a, (__v16hi)__b);
1670static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1671_mm256_mulhi_epu16(__m256i __a, __m256i __b) {
1672 return (__m256i)__builtin_ia32_pmulhuw256((__v16hu)__a, (__v16hu)__b);
17281673}
17291674
17301675/// Multiplies signed 16-bit integer elements of two 256-bit vectors of
......@@ -1740,7 +1685,7 @@ _mm256_mulhi_epu16(__m256i __a, __m256i __b)
17401685/// \param __b
17411686/// A 256-bit vector of [16 x i16] containing one of the source operands.
17421687/// \returns A 256-bit vector of [16 x i16] containing the products.
1743static __inline__ __m256i __DEFAULT_FN_ATTRS256
1688static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17441689_mm256_mulhi_epi16(__m256i __a, __m256i __b)
17451690{
17461691 return (__m256i)__builtin_ia32_pmulhw256((__v16hi)__a, (__v16hi)__b);
......@@ -1759,7 +1704,7 @@ _mm256_mulhi_epi16(__m256i __a, __m256i __b)
17591704/// \param __b
17601705/// A 256-bit vector of [16 x i16] containing one of the source operands.
17611706/// \returns A 256-bit vector of [16 x i16] containing the products.
1762static __inline__ __m256i __DEFAULT_FN_ATTRS256
1707static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17631708_mm256_mullo_epi16(__m256i __a, __m256i __b)
17641709{
17651710 return (__m256i)((__v16hu)__a * (__v16hu)__b);
......@@ -1778,9 +1723,8 @@ _mm256_mullo_epi16(__m256i __a, __m256i __b)
17781723/// \param __b
17791724/// A 256-bit vector of [8 x i32] containing one of the source operands.
17801725/// \returns A 256-bit vector of [8 x i32] containing the products.
1781static __inline__ __m256i __DEFAULT_FN_ATTRS256
1782_mm256_mullo_epi32 (__m256i __a, __m256i __b)
1783{
1726static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1727_mm256_mullo_epi32(__m256i __a, __m256i __b) {
17841728 return (__m256i)((__v8su)__a * (__v8su)__b);
17851729}
17861730
......@@ -1804,9 +1748,8 @@ _mm256_mullo_epi32 (__m256i __a, __m256i __b)
18041748/// \param __b
18051749/// A 256-bit vector of [8 x i32] containing one of the source operands.
18061750/// \returns A 256-bit vector of [4 x i64] containing the products.
1807static __inline__ __m256i __DEFAULT_FN_ATTRS256
1808_mm256_mul_epu32(__m256i __a, __m256i __b)
1809{
1751static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1752_mm256_mul_epu32(__m256i __a, __m256i __b) {
18101753 return __builtin_ia32_pmuludq256((__v8si)__a, (__v8si)__b);
18111754}
18121755
......@@ -1822,7 +1765,7 @@ _mm256_mul_epu32(__m256i __a, __m256i __b)
18221765/// \param __b
18231766/// A 256-bit integer vector.
18241767/// \returns A 256-bit integer vector containing the result.
1825static __inline__ __m256i __DEFAULT_FN_ATTRS256
1768static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
18261769_mm256_or_si256(__m256i __a, __m256i __b)
18271770{
18281771 return (__m256i)((__v4du)__a | (__v4du)__b);
......@@ -1906,9 +1849,8 @@ _mm256_sad_epu8(__m256i __a, __m256i __b)
19061849/// control byte specify the index (within the same 128-bit half) of \a __a
19071850/// to copy to the result byte.
19081851/// \returns A 256-bit integer vector containing the result.
1909static __inline__ __m256i __DEFAULT_FN_ATTRS256
1910_mm256_shuffle_epi8(__m256i __a, __m256i __b)
1911{
1852static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1853_mm256_shuffle_epi8(__m256i __a, __m256i __b) {
19121854 return (__m256i)__builtin_ia32_pshufb256((__v32qi)__a, (__v32qi)__b);
19131855}
19141856
......@@ -2033,10 +1975,9 @@ _mm256_shuffle_epi8(__m256i __a, __m256i __b)
20331975/// \param __b
20341976/// A 256-bit integer vector].
20351977/// \returns A 256-bit integer vector containing the result.
2036static __inline__ __m256i __DEFAULT_FN_ATTRS256
2037_mm256_sign_epi8(__m256i __a, __m256i __b)
2038{
2039 return (__m256i)__builtin_ia32_psignb256((__v32qi)__a, (__v32qi)__b);
1978static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1979_mm256_sign_epi8(__m256i __a, __m256i __b) {
1980 return (__m256i)__builtin_ia32_psignb256((__v32qi)__a, (__v32qi)__b);
20401981}
20411982
20421983/// Sets each element of the result to the corresponding element of the
......@@ -2054,10 +1995,9 @@ _mm256_sign_epi8(__m256i __a, __m256i __b)
20541995/// \param __b
20551996/// A 256-bit vector of [16 x i16].
20561997/// \returns A 256-bit vector of [16 x i16] containing the result.
2057static __inline__ __m256i __DEFAULT_FN_ATTRS256
2058_mm256_sign_epi16(__m256i __a, __m256i __b)
2059{
2060 return (__m256i)__builtin_ia32_psignw256((__v16hi)__a, (__v16hi)__b);
1998static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1999_mm256_sign_epi16(__m256i __a, __m256i __b) {
2000 return (__m256i)__builtin_ia32_psignw256((__v16hi)__a, (__v16hi)__b);
20612001}
20622002
20632003/// Sets each element of the result to the corresponding element of the
......@@ -2075,10 +2015,9 @@ _mm256_sign_epi16(__m256i __a, __m256i __b)
20752015/// \param __b
20762016/// A 256-bit vector of [8 x i32].
20772017/// \returns A 256-bit vector of [8 x i32] containing the result.
2078static __inline__ __m256i __DEFAULT_FN_ATTRS256
2079_mm256_sign_epi32(__m256i __a, __m256i __b)
2080{
2081 return (__m256i)__builtin_ia32_psignd256((__v8si)__a, (__v8si)__b);
2018static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2019_mm256_sign_epi32(__m256i __a, __m256i __b) {
2020 return (__m256i)__builtin_ia32_psignd256((__v8si)__a, (__v8si)__b);
20822021}
20832022
20842023/// Shifts each 128-bit half of the 256-bit integer vector \a a left by
......@@ -2098,8 +2037,9 @@ _mm256_sign_epi32(__m256i __a, __m256i __b)
20982037/// \param imm
20992038/// An unsigned immediate value specifying the shift count (in bytes).
21002039/// \returns A 256-bit integer vector containing the result.
2101#define _mm256_slli_si256(a, imm) \
2102 ((__m256i)__builtin_ia32_pslldqi256_byteshift((__v4di)(__m256i)(a), (int)(imm)))
2040#define _mm256_slli_si256(a, imm) \
2041 ((__m256i)__builtin_ia32_pslldqi256_byteshift((__v32qi)(__m256i)(a), \
2042 (int)(imm)))
21032043
21042044/// Shifts each 128-bit half of the 256-bit integer vector \a a left by
21052045/// \a imm bytes, shifting in zero bytes, and returns the result. If \a imm
......@@ -2118,8 +2058,9 @@ _mm256_sign_epi32(__m256i __a, __m256i __b)
21182058/// \param imm
21192059/// An unsigned immediate value specifying the shift count (in bytes).
21202060/// \returns A 256-bit integer vector containing the result.
2121#define _mm256_bslli_epi128(a, imm) \
2122 ((__m256i)__builtin_ia32_pslldqi256_byteshift((__v4di)(__m256i)(a), (int)(imm)))
2061#define _mm256_bslli_epi128(a, imm) \
2062 ((__m256i)__builtin_ia32_pslldqi256_byteshift((__v32qi)(__m256i)(a), \
2063 (int)(imm)))
21232064
21242065/// Shifts each 16-bit element of the 256-bit vector of [16 x i16] in \a __a
21252066/// left by \a __count bits, shifting in zero bits, and returns the result.
......@@ -2134,9 +2075,8 @@ _mm256_sign_epi32(__m256i __a, __m256i __b)
21342075/// \param __count
21352076/// An unsigned integer value specifying the shift count (in bits).
21362077/// \returns A 256-bit vector of [16 x i16] containing the result.
2137static __inline__ __m256i __DEFAULT_FN_ATTRS256
2138_mm256_slli_epi16(__m256i __a, int __count)
2139{
2078static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2079_mm256_slli_epi16(__m256i __a, int __count) {
21402080 return (__m256i)__builtin_ia32_psllwi256((__v16hi)__a, __count);
21412081}
21422082
......@@ -2155,9 +2095,8 @@ _mm256_slli_epi16(__m256i __a, int __count)
21552095/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
21562096/// shift count (in bits). The upper element is ignored.
21572097/// \returns A 256-bit vector of [16 x i16] containing the result.
2158static __inline__ __m256i __DEFAULT_FN_ATTRS256
2159_mm256_sll_epi16(__m256i __a, __m128i __count)
2160{
2098static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2099_mm256_sll_epi16(__m256i __a, __m128i __count) {
21612100 return (__m256i)__builtin_ia32_psllw256((__v16hi)__a, (__v8hi)__count);
21622101}
21632102
......@@ -2174,9 +2113,8 @@ _mm256_sll_epi16(__m256i __a, __m128i __count)
21742113/// \param __count
21752114/// An unsigned integer value specifying the shift count (in bits).
21762115/// \returns A 256-bit vector of [8 x i32] containing the result.
2177static __inline__ __m256i __DEFAULT_FN_ATTRS256
2178_mm256_slli_epi32(__m256i __a, int __count)
2179{
2116static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2117_mm256_slli_epi32(__m256i __a, int __count) {
21802118 return (__m256i)__builtin_ia32_pslldi256((__v8si)__a, __count);
21812119}
21822120
......@@ -2195,9 +2133,8 @@ _mm256_slli_epi32(__m256i __a, int __count)
21952133/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
21962134/// shift count (in bits). The upper element is ignored.
21972135/// \returns A 256-bit vector of [8 x i32] containing the result.
2198static __inline__ __m256i __DEFAULT_FN_ATTRS256
2199_mm256_sll_epi32(__m256i __a, __m128i __count)
2200{
2136static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2137_mm256_sll_epi32(__m256i __a, __m128i __count) {
22012138 return (__m256i)__builtin_ia32_pslld256((__v8si)__a, (__v4si)__count);
22022139}
22032140
......@@ -2214,9 +2151,8 @@ _mm256_sll_epi32(__m256i __a, __m128i __count)
22142151/// \param __count
22152152/// An unsigned integer value specifying the shift count (in bits).
22162153/// \returns A 256-bit vector of [4 x i64] containing the result.
2217static __inline__ __m256i __DEFAULT_FN_ATTRS256
2218_mm256_slli_epi64(__m256i __a, int __count)
2219{
2154static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2155_mm256_slli_epi64(__m256i __a, int __count) {
22202156 return __builtin_ia32_psllqi256((__v4di)__a, __count);
22212157}
22222158
......@@ -2235,9 +2171,8 @@ _mm256_slli_epi64(__m256i __a, int __count)
22352171/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
22362172/// shift count (in bits). The upper element is ignored.
22372173/// \returns A 256-bit vector of [4 x i64] containing the result.
2238static __inline__ __m256i __DEFAULT_FN_ATTRS256
2239_mm256_sll_epi64(__m256i __a, __m128i __count)
2240{
2174static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2175_mm256_sll_epi64(__m256i __a, __m128i __count) {
22412176 return __builtin_ia32_psllq256((__v4di)__a, __count);
22422177}
22432178
......@@ -2255,9 +2190,8 @@ _mm256_sll_epi64(__m256i __a, __m128i __count)
22552190/// \param __count
22562191/// An unsigned integer value specifying the shift count (in bits).
22572192/// \returns A 256-bit vector of [16 x i16] containing the result.
2258static __inline__ __m256i __DEFAULT_FN_ATTRS256
2259_mm256_srai_epi16(__m256i __a, int __count)
2260{
2193static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2194_mm256_srai_epi16(__m256i __a, int __count) {
22612195 return (__m256i)__builtin_ia32_psrawi256((__v16hi)__a, __count);
22622196}
22632197
......@@ -2277,9 +2211,8 @@ _mm256_srai_epi16(__m256i __a, int __count)
22772211/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
22782212/// shift count (in bits). The upper element is ignored.
22792213/// \returns A 256-bit vector of [16 x i16] containing the result.
2280static __inline__ __m256i __DEFAULT_FN_ATTRS256
2281_mm256_sra_epi16(__m256i __a, __m128i __count)
2282{
2214static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2215_mm256_sra_epi16(__m256i __a, __m128i __count) {
22832216 return (__m256i)__builtin_ia32_psraw256((__v16hi)__a, (__v8hi)__count);
22842217}
22852218
......@@ -2297,9 +2230,8 @@ _mm256_sra_epi16(__m256i __a, __m128i __count)
22972230/// \param __count
22982231/// An unsigned integer value specifying the shift count (in bits).
22992232/// \returns A 256-bit vector of [8 x i32] containing the result.
2300static __inline__ __m256i __DEFAULT_FN_ATTRS256
2301_mm256_srai_epi32(__m256i __a, int __count)
2302{
2233static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2234_mm256_srai_epi32(__m256i __a, int __count) {
23032235 return (__m256i)__builtin_ia32_psradi256((__v8si)__a, __count);
23042236}
23052237
......@@ -2319,9 +2251,8 @@ _mm256_srai_epi32(__m256i __a, int __count)
23192251/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
23202252/// shift count (in bits). The upper element is ignored.
23212253/// \returns A 256-bit vector of [8 x i32] containing the result.
2322static __inline__ __m256i __DEFAULT_FN_ATTRS256
2323_mm256_sra_epi32(__m256i __a, __m128i __count)
2324{
2254static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2255_mm256_sra_epi32(__m256i __a, __m128i __count) {
23252256 return (__m256i)__builtin_ia32_psrad256((__v8si)__a, (__v4si)__count);
23262257}
23272258
......@@ -2342,8 +2273,9 @@ _mm256_sra_epi32(__m256i __a, __m128i __count)
23422273/// \param imm
23432274/// An unsigned immediate value specifying the shift count (in bytes).
23442275/// \returns A 256-bit integer vector containing the result.
2345#define _mm256_srli_si256(a, imm) \
2346 ((__m256i)__builtin_ia32_psrldqi256_byteshift((__m256i)(a), (int)(imm)))
2276#define _mm256_srli_si256(a, imm) \
2277 ((__m256i)__builtin_ia32_psrldqi256_byteshift((__v32qi)(__m256i)(a), \
2278 (int)(imm)))
23472279
23482280/// Shifts each 128-bit half of the 256-bit integer vector in \a a right by
23492281/// \a imm bytes, shifting in zero bytes, and returns the result. If
......@@ -2362,8 +2294,9 @@ _mm256_sra_epi32(__m256i __a, __m128i __count)
23622294/// \param imm
23632295/// An unsigned immediate value specifying the shift count (in bytes).
23642296/// \returns A 256-bit integer vector containing the result.
2365#define _mm256_bsrli_epi128(a, imm) \
2366 ((__m256i)__builtin_ia32_psrldqi256_byteshift((__m256i)(a), (int)(imm)))
2297#define _mm256_bsrli_epi128(a, imm) \
2298 ((__m256i)__builtin_ia32_psrldqi256_byteshift((__v32qi)(__m256i)(a), \
2299 (int)(imm)))
23672300
23682301/// Shifts each 16-bit element of the 256-bit vector of [16 x i16] in \a __a
23692302/// right by \a __count bits, shifting in zero bits, and returns the result.
......@@ -2378,9 +2311,8 @@ _mm256_sra_epi32(__m256i __a, __m128i __count)
23782311/// \param __count
23792312/// An unsigned integer value specifying the shift count (in bits).
23802313/// \returns A 256-bit vector of [16 x i16] containing the result.
2381static __inline__ __m256i __DEFAULT_FN_ATTRS256
2382_mm256_srli_epi16(__m256i __a, int __count)
2383{
2314static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2315_mm256_srli_epi16(__m256i __a, int __count) {
23842316 return (__m256i)__builtin_ia32_psrlwi256((__v16hi)__a, __count);
23852317}
23862318
......@@ -2399,9 +2331,8 @@ _mm256_srli_epi16(__m256i __a, int __count)
23992331/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
24002332/// shift count (in bits). The upper element is ignored.
24012333/// \returns A 256-bit vector of [16 x i16] containing the result.
2402static __inline__ __m256i __DEFAULT_FN_ATTRS256
2403_mm256_srl_epi16(__m256i __a, __m128i __count)
2404{
2334static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2335_mm256_srl_epi16(__m256i __a, __m128i __count) {
24052336 return (__m256i)__builtin_ia32_psrlw256((__v16hi)__a, (__v8hi)__count);
24062337}
24072338
......@@ -2418,9 +2349,8 @@ _mm256_srl_epi16(__m256i __a, __m128i __count)
24182349/// \param __count
24192350/// An unsigned integer value specifying the shift count (in bits).
24202351/// \returns A 256-bit vector of [8 x i32] containing the result.
2421static __inline__ __m256i __DEFAULT_FN_ATTRS256
2422_mm256_srli_epi32(__m256i __a, int __count)
2423{
2352static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2353_mm256_srli_epi32(__m256i __a, int __count) {
24242354 return (__m256i)__builtin_ia32_psrldi256((__v8si)__a, __count);
24252355}
24262356
......@@ -2439,9 +2369,8 @@ _mm256_srli_epi32(__m256i __a, int __count)
24392369/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
24402370/// shift count (in bits). The upper element is ignored.
24412371/// \returns A 256-bit vector of [8 x i32] containing the result.
2442static __inline__ __m256i __DEFAULT_FN_ATTRS256
2443_mm256_srl_epi32(__m256i __a, __m128i __count)
2444{
2372static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2373_mm256_srl_epi32(__m256i __a, __m128i __count) {
24452374 return (__m256i)__builtin_ia32_psrld256((__v8si)__a, (__v4si)__count);
24462375}
24472376
......@@ -2458,9 +2387,8 @@ _mm256_srl_epi32(__m256i __a, __m128i __count)
24582387/// \param __count
24592388/// An unsigned integer value specifying the shift count (in bits).
24602389/// \returns A 256-bit vector of [4 x i64] containing the result.
2461static __inline__ __m256i __DEFAULT_FN_ATTRS256
2462_mm256_srli_epi64(__m256i __a, int __count)
2463{
2390static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2391_mm256_srli_epi64(__m256i __a, int __count) {
24642392 return __builtin_ia32_psrlqi256((__v4di)__a, __count);
24652393}
24662394
......@@ -2479,9 +2407,8 @@ _mm256_srli_epi64(__m256i __a, int __count)
24792407/// A 128-bit vector of [2 x i64] whose lower element gives the unsigned
24802408/// shift count (in bits). The upper element is ignored.
24812409/// \returns A 256-bit vector of [4 x i64] containing the result.
2482static __inline__ __m256i __DEFAULT_FN_ATTRS256
2483_mm256_srl_epi64(__m256i __a, __m128i __count)
2484{
2410static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2411_mm256_srl_epi64(__m256i __a, __m128i __count) {
24852412 return __builtin_ia32_psrlq256((__v4di)__a, __count);
24862413}
24872414
......@@ -2506,9 +2433,8 @@ _mm256_srl_epi64(__m256i __a, __m128i __count)
25062433/// \param __b
25072434/// A 256-bit integer vector containing the subtrahends.
25082435/// \returns A 256-bit integer vector containing the differences.
2509static __inline__ __m256i __DEFAULT_FN_ATTRS256
2510_mm256_sub_epi8(__m256i __a, __m256i __b)
2511{
2436static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2437_mm256_sub_epi8(__m256i __a, __m256i __b) {
25122438 return (__m256i)((__v32qu)__a - (__v32qu)__b);
25132439}
25142440
......@@ -2533,9 +2459,8 @@ _mm256_sub_epi8(__m256i __a, __m256i __b)
25332459/// \param __b
25342460/// A 256-bit vector of [16 x i16] containing the subtrahends.
25352461/// \returns A 256-bit vector of [16 x i16] containing the differences.
2536static __inline__ __m256i __DEFAULT_FN_ATTRS256
2537_mm256_sub_epi16(__m256i __a, __m256i __b)
2538{
2462static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2463_mm256_sub_epi16(__m256i __a, __m256i __b) {
25392464 return (__m256i)((__v16hu)__a - (__v16hu)__b);
25402465}
25412466
......@@ -2559,9 +2484,8 @@ _mm256_sub_epi16(__m256i __a, __m256i __b)
25592484/// \param __b
25602485/// A 256-bit vector of [8 x i32] containing the subtrahends.
25612486/// \returns A 256-bit vector of [8 x i32] containing the differences.
2562static __inline__ __m256i __DEFAULT_FN_ATTRS256
2563_mm256_sub_epi32(__m256i __a, __m256i __b)
2564{
2487static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2488_mm256_sub_epi32(__m256i __a, __m256i __b) {
25652489 return (__m256i)((__v8su)__a - (__v8su)__b);
25662490}
25672491
......@@ -2585,9 +2509,8 @@ _mm256_sub_epi32(__m256i __a, __m256i __b)
25852509/// \param __b
25862510/// A 256-bit vector of [4 x i64] containing the subtrahends.
25872511/// \returns A 256-bit vector of [4 x i64] containing the differences.
2588static __inline__ __m256i __DEFAULT_FN_ATTRS256
2589_mm256_sub_epi64(__m256i __a, __m256i __b)
2590{
2512static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2513_mm256_sub_epi64(__m256i __a, __m256i __b) {
25912514 return (__m256i)((__v4du)__a - (__v4du)__b);
25922515}
25932516
......@@ -2611,9 +2534,8 @@ _mm256_sub_epi64(__m256i __a, __m256i __b)
26112534/// \param __b
26122535/// A 256-bit integer vector containing the subtrahends.
26132536/// \returns A 256-bit integer vector containing the differences.
2614static __inline__ __m256i __DEFAULT_FN_ATTRS256
2615_mm256_subs_epi8(__m256i __a, __m256i __b)
2616{
2537static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2538_mm256_subs_epi8(__m256i __a, __m256i __b) {
26172539 return (__m256i)__builtin_elementwise_sub_sat((__v32qs)__a, (__v32qs)__b);
26182540}
26192541
......@@ -2637,9 +2559,8 @@ _mm256_subs_epi8(__m256i __a, __m256i __b)
26372559/// \param __b
26382560/// A 256-bit vector of [16 x i16] containing the subtrahends.
26392561/// \returns A 256-bit vector of [16 x i16] containing the differences.
2640static __inline__ __m256i __DEFAULT_FN_ATTRS256
2641_mm256_subs_epi16(__m256i __a, __m256i __b)
2642{
2562static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2563_mm256_subs_epi16(__m256i __a, __m256i __b) {
26432564 return (__m256i)__builtin_elementwise_sub_sat((__v16hi)__a, (__v16hi)__b);
26442565}
26452566
......@@ -2664,9 +2585,8 @@ _mm256_subs_epi16(__m256i __a, __m256i __b)
26642585/// \param __b
26652586/// A 256-bit integer vector containing the subtrahends.
26662587/// \returns A 256-bit integer vector containing the differences.
2667static __inline__ __m256i __DEFAULT_FN_ATTRS256
2668_mm256_subs_epu8(__m256i __a, __m256i __b)
2669{
2588static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2589_mm256_subs_epu8(__m256i __a, __m256i __b) {
26702590 return (__m256i)__builtin_elementwise_sub_sat((__v32qu)__a, (__v32qu)__b);
26712591}
26722592
......@@ -2690,9 +2610,8 @@ _mm256_subs_epu8(__m256i __a, __m256i __b)
26902610/// \param __b
26912611/// A 256-bit vector of [16 x i16] containing the subtrahends.
26922612/// \returns A 256-bit vector of [16 x i16] containing the differences.
2693static __inline__ __m256i __DEFAULT_FN_ATTRS256
2694_mm256_subs_epu16(__m256i __a, __m256i __b)
2695{
2613static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2614_mm256_subs_epu16(__m256i __a, __m256i __b) {
26962615 return (__m256i)__builtin_elementwise_sub_sat((__v16hu)__a, (__v16hu)__b);
26972616}
26982617
......@@ -2724,9 +2643,8 @@ _mm256_subs_epu16(__m256i __a, __m256i __b)
27242643/// A 256-bit integer vector used as the source for the odd-numbered bytes
27252644/// of the result.
27262645/// \returns A 256-bit integer vector containing the result.
2727static __inline__ __m256i __DEFAULT_FN_ATTRS256
2728_mm256_unpackhi_epi8(__m256i __a, __m256i __b)
2729{
2646static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2647_mm256_unpackhi_epi8(__m256i __a, __m256i __b) {
27302648 return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 8, 32+8, 9, 32+9, 10, 32+10, 11, 32+11, 12, 32+12, 13, 32+13, 14, 32+14, 15, 32+15, 24, 32+24, 25, 32+25, 26, 32+26, 27, 32+27, 28, 32+28, 29, 32+29, 30, 32+30, 31, 32+31);
27312649}
27322650
......@@ -2759,9 +2677,8 @@ _mm256_unpackhi_epi8(__m256i __a, __m256i __b)
27592677/// A 256-bit vector of [16 x i16] used as the source for the odd-numbered
27602678/// elements of the result.
27612679/// \returns A 256-bit vector of [16 x i16] containing the result.
2762static __inline__ __m256i __DEFAULT_FN_ATTRS256
2763_mm256_unpackhi_epi16(__m256i __a, __m256i __b)
2764{
2680static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2681_mm256_unpackhi_epi16(__m256i __a, __m256i __b) {
27652682 return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
27662683}
27672684
......@@ -2793,9 +2710,8 @@ _mm256_unpackhi_epi16(__m256i __a, __m256i __b)
27932710/// A 256-bit vector of [8 x i32] used as the source for the odd-numbered
27942711/// elements of the result.
27952712/// \returns A 256-bit vector of [8 x i32] containing the result.
2796static __inline__ __m256i __DEFAULT_FN_ATTRS256
2797_mm256_unpackhi_epi32(__m256i __a, __m256i __b)
2798{
2713static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2714_mm256_unpackhi_epi32(__m256i __a, __m256i __b) {
27992715 return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 2, 8+2, 3, 8+3, 6, 8+6, 7, 8+7);
28002716}
28012717
......@@ -2823,9 +2739,8 @@ _mm256_unpackhi_epi32(__m256i __a, __m256i __b)
28232739/// A 256-bit vector of [4 x i64] used as the source for the odd-numbered
28242740/// elements of the result.
28252741/// \returns A 256-bit vector of [4 x i64] containing the result.
2826static __inline__ __m256i __DEFAULT_FN_ATTRS256
2827_mm256_unpackhi_epi64(__m256i __a, __m256i __b)
2828{
2742static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2743_mm256_unpackhi_epi64(__m256i __a, __m256i __b) {
28292744 return (__m256i)__builtin_shufflevector((__v4di)__a, (__v4di)__b, 1, 4+1, 3, 4+3);
28302745}
28312746
......@@ -2857,9 +2772,8 @@ _mm256_unpackhi_epi64(__m256i __a, __m256i __b)
28572772/// A 256-bit integer vector used as the source for the odd-numbered bytes
28582773/// of the result.
28592774/// \returns A 256-bit integer vector containing the result.
2860static __inline__ __m256i __DEFAULT_FN_ATTRS256
2861_mm256_unpacklo_epi8(__m256i __a, __m256i __b)
2862{
2775static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2776_mm256_unpacklo_epi8(__m256i __a, __m256i __b) {
28632777 return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 0, 32+0, 1, 32+1, 2, 32+2, 3, 32+3, 4, 32+4, 5, 32+5, 6, 32+6, 7, 32+7, 16, 32+16, 17, 32+17, 18, 32+18, 19, 32+19, 20, 32+20, 21, 32+21, 22, 32+22, 23, 32+23);
28642778}
28652779
......@@ -2892,9 +2806,8 @@ _mm256_unpacklo_epi8(__m256i __a, __m256i __b)
28922806/// A 256-bit vector of [16 x i16] used as the source for the odd-numbered
28932807/// elements of the result.
28942808/// \returns A 256-bit vector of [16 x i16] containing the result.
2895static __inline__ __m256i __DEFAULT_FN_ATTRS256
2896_mm256_unpacklo_epi16(__m256i __a, __m256i __b)
2897{
2809static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2810_mm256_unpacklo_epi16(__m256i __a, __m256i __b) {
28982811 return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11);
28992812}
29002813
......@@ -2926,9 +2839,8 @@ _mm256_unpacklo_epi16(__m256i __a, __m256i __b)
29262839/// A 256-bit vector of [8 x i32] used as the source for the odd-numbered
29272840/// elements of the result.
29282841/// \returns A 256-bit vector of [8 x i32] containing the result.
2929static __inline__ __m256i __DEFAULT_FN_ATTRS256
2930_mm256_unpacklo_epi32(__m256i __a, __m256i __b)
2931{
2842static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2843_mm256_unpacklo_epi32(__m256i __a, __m256i __b) {
29322844 return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 0, 8+0, 1, 8+1, 4, 8+4, 5, 8+5);
29332845}
29342846
......@@ -2956,9 +2868,8 @@ _mm256_unpacklo_epi32(__m256i __a, __m256i __b)
29562868/// A 256-bit vector of [4 x i64] used as the source for the odd-numbered
29572869/// elements of the result.
29582870/// \returns A 256-bit vector of [4 x i64] containing the result.
2959static __inline__ __m256i __DEFAULT_FN_ATTRS256
2960_mm256_unpacklo_epi64(__m256i __a, __m256i __b)
2961{
2871static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2872_mm256_unpacklo_epi64(__m256i __a, __m256i __b) {
29622873 return (__m256i)__builtin_shufflevector((__v4di)__a, (__v4di)__b, 0, 4+0, 2, 4+2);
29632874}
29642875
......@@ -2974,7 +2885,7 @@ _mm256_unpacklo_epi64(__m256i __a, __m256i __b)
29742885/// \param __b
29752886/// A 256-bit integer vector.
29762887/// \returns A 256-bit integer vector containing the result.
2977static __inline__ __m256i __DEFAULT_FN_ATTRS256
2888static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
29782889_mm256_xor_si256(__m256i __a, __m256i __b)
29792890{
29802891 return (__m256i)((__v4du)__a ^ (__v4du)__b);
......@@ -3009,9 +2920,8 @@ _mm256_stream_load_si256(const void *__V)
30092920/// \param __X
30102921/// A 128-bit vector of [4 x float] whose low element will be broadcast.
30112922/// \returns A 128-bit vector of [4 x float] containing the result.
3012static __inline__ __m128 __DEFAULT_FN_ATTRS128
3013_mm_broadcastss_ps(__m128 __X)
3014{
2923static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2924_mm_broadcastss_ps(__m128 __X) {
30152925 return (__m128)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0);
30162926}
30172927
......@@ -3026,9 +2936,8 @@ _mm_broadcastss_ps(__m128 __X)
30262936/// \param __a
30272937/// A 128-bit vector of [2 x double] whose low element will be broadcast.
30282938/// \returns A 128-bit vector of [2 x double] containing the result.
3029static __inline__ __m128d __DEFAULT_FN_ATTRS128
3030_mm_broadcastsd_pd(__m128d __a)
3031{
2939static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2940_mm_broadcastsd_pd(__m128d __a) {
30322941 return __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0);
30332942}
30342943
......@@ -3043,9 +2952,8 @@ _mm_broadcastsd_pd(__m128d __a)
30432952/// \param __X
30442953/// A 128-bit vector of [4 x float] whose low element will be broadcast.
30452954/// \returns A 256-bit vector of [8 x float] containing the result.
3046static __inline__ __m256 __DEFAULT_FN_ATTRS256
3047_mm256_broadcastss_ps(__m128 __X)
3048{
2955static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
2956_mm256_broadcastss_ps(__m128 __X) {
30492957 return (__m256)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0, 0, 0, 0, 0);
30502958}
30512959
......@@ -3060,9 +2968,8 @@ _mm256_broadcastss_ps(__m128 __X)
30602968/// \param __X
30612969/// A 128-bit vector of [2 x double] whose low element will be broadcast.
30622970/// \returns A 256-bit vector of [4 x double] containing the result.
3063static __inline__ __m256d __DEFAULT_FN_ATTRS256
3064_mm256_broadcastsd_pd(__m128d __X)
3065{
2971static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
2972_mm256_broadcastsd_pd(__m128d __X) {
30662973 return (__m256d)__builtin_shufflevector((__v2df)__X, (__v2df)__X, 0, 0, 0, 0);
30672974}
30682975
......@@ -3076,9 +2983,8 @@ _mm256_broadcastsd_pd(__m128d __X)
30762983/// \param __X
30772984/// A 128-bit integer vector to be broadcast.
30782985/// \returns A 256-bit integer vector containing the result.
3079static __inline__ __m256i __DEFAULT_FN_ATTRS256
3080_mm256_broadcastsi128_si256(__m128i __X)
3081{
2986static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2987_mm256_broadcastsi128_si256(__m128i __X) {
30822988 return (__m256i)__builtin_shufflevector((__v2di)__X, (__v2di)__X, 0, 1, 0, 1);
30832989}
30842990
......@@ -3168,9 +3074,8 @@ _mm256_broadcastsi128_si256(__m128i __X)
31683074/// \param __X
31693075/// A 128-bit integer vector whose low byte will be broadcast.
31703076/// \returns A 256-bit integer vector containing the result.
3171static __inline__ __m256i __DEFAULT_FN_ATTRS256
3172_mm256_broadcastb_epi8(__m128i __X)
3173{
3077static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3078_mm256_broadcastb_epi8(__m128i __X) {
31743079 return (__m256i)__builtin_shufflevector((__v16qi)__X, (__v16qi)__X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
31753080}
31763081
......@@ -3184,9 +3089,8 @@ _mm256_broadcastb_epi8(__m128i __X)
31843089/// \param __X
31853090/// A 128-bit vector of [8 x i16] whose low element will be broadcast.
31863091/// \returns A 256-bit vector of [16 x i16] containing the result.
3187static __inline__ __m256i __DEFAULT_FN_ATTRS256
3188_mm256_broadcastw_epi16(__m128i __X)
3189{
3092static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3093_mm256_broadcastw_epi16(__m128i __X) {
31903094 return (__m256i)__builtin_shufflevector((__v8hi)__X, (__v8hi)__X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
31913095}
31923096
......@@ -3200,9 +3104,8 @@ _mm256_broadcastw_epi16(__m128i __X)
32003104/// \param __X
32013105/// A 128-bit vector of [4 x i32] whose low element will be broadcast.
32023106/// \returns A 256-bit vector of [8 x i32] containing the result.
3203static __inline__ __m256i __DEFAULT_FN_ATTRS256
3204_mm256_broadcastd_epi32(__m128i __X)
3205{
3107static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3108_mm256_broadcastd_epi32(__m128i __X) {
32063109 return (__m256i)__builtin_shufflevector((__v4si)__X, (__v4si)__X, 0, 0, 0, 0, 0, 0, 0, 0);
32073110}
32083111
......@@ -3216,9 +3119,8 @@ _mm256_broadcastd_epi32(__m128i __X)
32163119/// \param __X
32173120/// A 128-bit vector of [2 x i64] whose low element will be broadcast.
32183121/// \returns A 256-bit vector of [4 x i64] containing the result.
3219static __inline__ __m256i __DEFAULT_FN_ATTRS256
3220_mm256_broadcastq_epi64(__m128i __X)
3221{
3122static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3123_mm256_broadcastq_epi64(__m128i __X) {
32223124 return (__m256i)__builtin_shufflevector((__v2di)__X, (__v2di)__X, 0, 0, 0, 0);
32233125}
32243126
......@@ -3232,9 +3134,8 @@ _mm256_broadcastq_epi64(__m128i __X)
32323134/// \param __X
32333135/// A 128-bit integer vector whose low byte will be broadcast.
32343136/// \returns A 128-bit integer vector containing the result.
3235static __inline__ __m128i __DEFAULT_FN_ATTRS128
3236_mm_broadcastb_epi8(__m128i __X)
3237{
3137static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3138_mm_broadcastb_epi8(__m128i __X) {
32383139 return (__m128i)__builtin_shufflevector((__v16qi)__X, (__v16qi)__X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
32393140}
32403141
......@@ -3248,9 +3149,8 @@ _mm_broadcastb_epi8(__m128i __X)
32483149/// \param __X
32493150/// A 128-bit vector of [8 x i16] whose low element will be broadcast.
32503151/// \returns A 128-bit vector of [8 x i16] containing the result.
3251static __inline__ __m128i __DEFAULT_FN_ATTRS128
3252_mm_broadcastw_epi16(__m128i __X)
3253{
3152static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3153_mm_broadcastw_epi16(__m128i __X) {
32543154 return (__m128i)__builtin_shufflevector((__v8hi)__X, (__v8hi)__X, 0, 0, 0, 0, 0, 0, 0, 0);
32553155}
32563156
......@@ -3264,9 +3164,8 @@ _mm_broadcastw_epi16(__m128i __X)
32643164/// \param __X
32653165/// A 128-bit vector of [4 x i32] whose low element will be broadcast.
32663166/// \returns A 128-bit vector of [4 x i32] containing the result.
3267static __inline__ __m128i __DEFAULT_FN_ATTRS128
3268_mm_broadcastd_epi32(__m128i __X)
3269{
3167static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3168_mm_broadcastd_epi32(__m128i __X) {
32703169 return (__m128i)__builtin_shufflevector((__v4si)__X, (__v4si)__X, 0, 0, 0, 0);
32713170}
32723171
......@@ -3280,9 +3179,8 @@ _mm_broadcastd_epi32(__m128i __X)
32803179/// \param __X
32813180/// A 128-bit vector of [2 x i64] whose low element will be broadcast.
32823181/// \returns A 128-bit vector of [2 x i64] containing the result.
3283static __inline__ __m128i __DEFAULT_FN_ATTRS128
3284_mm_broadcastq_epi64(__m128i __X)
3285{
3182static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3183_mm_broadcastq_epi64(__m128i __X) {
32863184 return (__m128i)__builtin_shufflevector((__v2di)__X, (__v2di)__X, 0, 0);
32873185}
32883186
......@@ -3308,9 +3206,8 @@ _mm_broadcastq_epi64(__m128i __X)
33083206/// A 256-bit vector of [8 x i32] containing indexes of values to use from
33093207/// \a __a.
33103208/// \returns A 256-bit vector of [8 x i32] containing the result.
3311static __inline__ __m256i __DEFAULT_FN_ATTRS256
3312_mm256_permutevar8x32_epi32(__m256i __a, __m256i __b)
3313{
3209static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3210_mm256_permutevar8x32_epi32(__m256i __a, __m256i __b) {
33143211 return (__m256i)__builtin_ia32_permvarsi256((__v8si)__a, (__v8si)__b);
33153212}
33163213
......@@ -3366,9 +3263,8 @@ _mm256_permutevar8x32_epi32(__m256i __a, __m256i __b)
33663263/// A 256-bit vector of [8 x i32] containing indexes of values to use from
33673264/// \a __a.
33683265/// \returns A 256-bit vector of [8 x float] containing the result.
3369static __inline__ __m256 __DEFAULT_FN_ATTRS256
3370_mm256_permutevar8x32_ps(__m256 __a, __m256i __b)
3371{
3266static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
3267_mm256_permutevar8x32_ps(__m256 __a, __m256i __b) {
33723268 return (__m256)__builtin_ia32_permvarsf256((__v8sf)__a, (__v8si)__b);
33733269}
33743270
......@@ -3756,7 +3652,7 @@ _mm_maskstore_epi64(long long *__X, __m128i __M, __m128i __Y)
37563652/// A 256-bit vector of [8 x i32] containing the unsigned shift counts (in
37573653/// bits).
37583654/// \returns A 256-bit vector of [8 x i32] containing the result.
3759static __inline__ __m256i __DEFAULT_FN_ATTRS256
3655static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
37603656_mm256_sllv_epi32(__m256i __X, __m256i __Y)
37613657{
37623658 return (__m256i)__builtin_ia32_psllv8si((__v8si)__X, (__v8si)__Y);
......@@ -3778,7 +3674,7 @@ _mm256_sllv_epi32(__m256i __X, __m256i __Y)
37783674/// A 128-bit vector of [4 x i32] containing the unsigned shift counts (in
37793675/// bits).
37803676/// \returns A 128-bit vector of [4 x i32] containing the result.
3781static __inline__ __m128i __DEFAULT_FN_ATTRS128
3677static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
37823678_mm_sllv_epi32(__m128i __X, __m128i __Y)
37833679{
37843680 return (__m128i)__builtin_ia32_psllv4si((__v4si)__X, (__v4si)__Y);
......@@ -3800,7 +3696,7 @@ _mm_sllv_epi32(__m128i __X, __m128i __Y)
38003696/// A 256-bit vector of [4 x i64] containing the unsigned shift counts (in
38013697/// bits).
38023698/// \returns A 256-bit vector of [4 x i64] containing the result.
3803static __inline__ __m256i __DEFAULT_FN_ATTRS256
3699static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
38043700_mm256_sllv_epi64(__m256i __X, __m256i __Y)
38053701{
38063702 return (__m256i)__builtin_ia32_psllv4di((__v4di)__X, (__v4di)__Y);
......@@ -3822,7 +3718,7 @@ _mm256_sllv_epi64(__m256i __X, __m256i __Y)
38223718/// A 128-bit vector of [2 x i64] containing the unsigned shift counts (in
38233719/// bits).
38243720/// \returns A 128-bit vector of [2 x i64] containing the result.
3825static __inline__ __m128i __DEFAULT_FN_ATTRS128
3721static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
38263722_mm_sllv_epi64(__m128i __X, __m128i __Y)
38273723{
38283724 return (__m128i)__builtin_ia32_psllv2di((__v2di)__X, (__v2di)__Y);
......@@ -3845,7 +3741,7 @@ _mm_sllv_epi64(__m128i __X, __m128i __Y)
38453741/// A 256-bit vector of [8 x i32] containing the unsigned shift counts (in
38463742/// bits).
38473743/// \returns A 256-bit vector of [8 x i32] containing the result.
3848static __inline__ __m256i __DEFAULT_FN_ATTRS256
3744static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
38493745_mm256_srav_epi32(__m256i __X, __m256i __Y)
38503746{
38513747 return (__m256i)__builtin_ia32_psrav8si((__v8si)__X, (__v8si)__Y);
......@@ -3868,7 +3764,7 @@ _mm256_srav_epi32(__m256i __X, __m256i __Y)
38683764/// A 128-bit vector of [4 x i32] containing the unsigned shift counts (in
38693765/// bits).
38703766/// \returns A 128-bit vector of [4 x i32] containing the result.
3871static __inline__ __m128i __DEFAULT_FN_ATTRS128
3767static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
38723768_mm_srav_epi32(__m128i __X, __m128i __Y)
38733769{
38743770 return (__m128i)__builtin_ia32_psrav4si((__v4si)__X, (__v4si)__Y);
......@@ -3890,7 +3786,7 @@ _mm_srav_epi32(__m128i __X, __m128i __Y)
38903786/// A 256-bit vector of [8 x i32] containing the unsigned shift counts (in
38913787/// bits).
38923788/// \returns A 256-bit vector of [8 x i32] containing the result.
3893static __inline__ __m256i __DEFAULT_FN_ATTRS256
3789static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
38943790_mm256_srlv_epi32(__m256i __X, __m256i __Y)
38953791{
38963792 return (__m256i)__builtin_ia32_psrlv8si((__v8si)__X, (__v8si)__Y);
......@@ -3912,7 +3808,7 @@ _mm256_srlv_epi32(__m256i __X, __m256i __Y)
39123808/// A 128-bit vector of [4 x i32] containing the unsigned shift counts (in
39133809/// bits).
39143810/// \returns A 128-bit vector of [4 x i32] containing the result.
3915static __inline__ __m128i __DEFAULT_FN_ATTRS128
3811static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
39163812_mm_srlv_epi32(__m128i __X, __m128i __Y)
39173813{
39183814 return (__m128i)__builtin_ia32_psrlv4si((__v4si)__X, (__v4si)__Y);
......@@ -3934,7 +3830,7 @@ _mm_srlv_epi32(__m128i __X, __m128i __Y)
39343830/// A 256-bit vector of [4 x i64] containing the unsigned shift counts (in
39353831/// bits).
39363832/// \returns A 256-bit vector of [4 x i64] containing the result.
3937static __inline__ __m256i __DEFAULT_FN_ATTRS256
3833static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
39383834_mm256_srlv_epi64(__m256i __X, __m256i __Y)
39393835{
39403836 return (__m256i)__builtin_ia32_psrlv4di((__v4di)__X, (__v4di)__Y);
......@@ -3956,7 +3852,7 @@ _mm256_srlv_epi64(__m256i __X, __m256i __Y)
39563852/// A 128-bit vector of [2 x i64] containing the unsigned shift counts (in
39573853/// bits).
39583854/// \returns A 128-bit vector of [2 x i64] containing the result.
3959static __inline__ __m128i __DEFAULT_FN_ATTRS128
3855static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
39603856_mm_srlv_epi64(__m128i __X, __m128i __Y)
39613857{
39623858 return (__m128i)__builtin_ia32_psrlv2di((__v2di)__X, (__v2di)__Y);
......@@ -5289,5 +5185,7 @@ _mm_srlv_epi64(__m128i __X, __m128i __Y)
52895185
52905186#undef __DEFAULT_FN_ATTRS256
52915187#undef __DEFAULT_FN_ATTRS128
5188#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
5189#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
52925190
52935191#endif /* __AVX2INTRIN_H */
lib/include/avx512bf16intrin.h+25-16
......@@ -19,12 +19,19 @@ typedef __bf16 __v32bf __attribute__((__vector_size__(64), __aligned__(64)));
1919typedef __bf16 __m512bh __attribute__((__vector_size__(64), __aligned__(64)));
2020typedef __bf16 __bfloat16 __attribute__((deprecated("use __bf16 instead")));
2121
22#define __DEFAULT_FN_ATTRS512 \
23 __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16,evex512"), \
22#define __DEFAULT_FN_ATTRS512 \
23 __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16"), \
2424 __min_vector_width__(512)))
2525#define __DEFAULT_FN_ATTRS \
26 __attribute__((__always_inline__, __nodebug__, \
27 __target__("avx512bf16,no-evex512")))
26 __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16")))
27
28#if defined(__cplusplus) && (__cplusplus >= 201103L)
29#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
30#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
31#else
32#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
33#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
34#endif
2835
2936/// Convert One BF16 Data to One Single Float Data.
3037///
......@@ -36,8 +43,8 @@ typedef __bf16 __bfloat16 __attribute__((deprecated("use __bf16 instead")));
3643/// A bfloat data.
3744/// \returns A float data whose sign field and exponent field keep unchanged,
3845/// and fraction field is extended to 23 bits.
39static __inline__ float __DEFAULT_FN_ATTRS _mm_cvtsbh_ss(__bf16 __A) {
40 return __builtin_ia32_cvtsbf162ss_32(__A);
46static __inline__ float __DEFAULT_FN_ATTRS_CONSTEXPR _mm_cvtsbh_ss(__bf16 __A) {
47 return (float)(__A);
4148}
4249
4350/// Convert Two Packed Single Data to One Packed BF16 Data.
......@@ -236,9 +243,9 @@ _mm512_maskz_dpbf16_ps(__mmask16 __U, __m512 __D, __m512bh __A, __m512bh __B) {
236243/// \param __A
237244/// A 256-bit vector of [16 x bfloat].
238245/// \returns A 512-bit vector of [16 x float] come from conversion of __A
239static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_cvtpbh_ps(__m256bh __A) {
240 return _mm512_castsi512_ps((__m512i)_mm512_slli_epi32(
241 (__m512i)_mm512_cvtepi16_epi32((__m256i)__A), 16));
246static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
247_mm512_cvtpbh_ps(__m256bh __A) {
248 return (__m512) __builtin_convertvector(__A, __v16sf);
242249}
243250
244251/// Convert Packed BF16 Data to Packed float Data using zeroing mask.
......@@ -251,10 +258,11 @@ static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_cvtpbh_ps(__m256bh __A) {
251258/// \param __A
252259/// A 256-bit vector of [16 x bfloat].
253260/// \returns A 512-bit vector of [16 x float] come from conversion of __A
254static __inline__ __m512 __DEFAULT_FN_ATTRS512
261static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
255262_mm512_maskz_cvtpbh_ps(__mmask16 __U, __m256bh __A) {
256 return _mm512_castsi512_ps((__m512i)_mm512_slli_epi32(
257 (__m512i)_mm512_maskz_cvtepi16_epi32((__mmask16)__U, (__m256i)__A), 16));
263 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
264 (__v16sf)_mm512_cvtpbh_ps(__A),
265 (__v16sf)_mm512_setzero_ps());
258266}
259267
260268/// Convert Packed BF16 Data to Packed float Data using merging mask.
......@@ -269,15 +277,16 @@ _mm512_maskz_cvtpbh_ps(__mmask16 __U, __m256bh __A) {
269277/// \param __A
270278/// A 256-bit vector of [16 x bfloat].
271279/// \returns A 512-bit vector of [16 x float] come from conversion of __A
272static __inline__ __m512 __DEFAULT_FN_ATTRS512
280static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
273281_mm512_mask_cvtpbh_ps(__m512 __S, __mmask16 __U, __m256bh __A) {
274 return _mm512_castsi512_ps((__m512i)_mm512_mask_slli_epi32(
275 (__m512i)__S, (__mmask16)__U,
276 (__m512i)_mm512_cvtepi16_epi32((__m256i)__A), 16));
282 return (__m512)__builtin_ia32_selectps_512(
283 (__mmask16)__U, (__v16sf)_mm512_cvtpbh_ps(__A), (__v16sf)__S);
277284}
278285
279286#undef __DEFAULT_FN_ATTRS
287#undef __DEFAULT_FN_ATTRS_CONSTEXPR
280288#undef __DEFAULT_FN_ATTRS512
289#undef __DEFAULT_FN_ATTRS512_CONSTEXPR
281290
282291#endif
283292#endif
lib/include/avx512bitalgintrin.h+19-30
......@@ -15,53 +15,44 @@
1515#define __AVX512BITALGINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1819#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512bitalg,evex512"), \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx512bitalg"), \
21 __min_vector_width__(512))) constexpr
22#else
23#define __DEFAULT_FN_ATTRS \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx512bitalg"), \
2125 __min_vector_width__(512)))
26#endif
2227
23static __inline__ __m512i __DEFAULT_FN_ATTRS
24_mm512_popcnt_epi16(__m512i __A)
25{
28static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi16(__m512i __A) {
2629 return (__m512i)__builtin_elementwise_popcount((__v32hu)__A);
2730}
2831
2932static __inline__ __m512i __DEFAULT_FN_ATTRS
30_mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B)
31{
32 return (__m512i) __builtin_ia32_selectw_512((__mmask32) __U,
33 (__v32hi) _mm512_popcnt_epi16(__B),
34 (__v32hi) __A);
33_mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B) {
34 return (__m512i)__builtin_ia32_selectw_512(
35 (__mmask32)__U, (__v32hi)_mm512_popcnt_epi16(__B), (__v32hi)__A);
3536}
3637
3738static __inline__ __m512i __DEFAULT_FN_ATTRS
38_mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B)
39{
40 return _mm512_mask_popcnt_epi16((__m512i) _mm512_setzero_si512(),
41 __U,
42 __B);
39_mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B) {
40 return _mm512_mask_popcnt_epi16((__m512i)_mm512_setzero_si512(), __U, __B);
4341}
4442
45static __inline__ __m512i __DEFAULT_FN_ATTRS
46_mm512_popcnt_epi8(__m512i __A)
47{
43static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi8(__m512i __A) {
4844 return (__m512i)__builtin_elementwise_popcount((__v64qu)__A);
4945}
5046
5147static __inline__ __m512i __DEFAULT_FN_ATTRS
52_mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B)
53{
54 return (__m512i) __builtin_ia32_selectb_512((__mmask64) __U,
55 (__v64qi) _mm512_popcnt_epi8(__B),
56 (__v64qi) __A);
48_mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B) {
49 return (__m512i)__builtin_ia32_selectb_512(
50 (__mmask64)__U, (__v64qi)_mm512_popcnt_epi8(__B), (__v64qi)__A);
5751}
5852
5953static __inline__ __m512i __DEFAULT_FN_ATTRS
60_mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B)
61{
62 return _mm512_mask_popcnt_epi8((__m512i) _mm512_setzero_si512(),
63 __U,
64 __B);
54_mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B) {
55 return _mm512_mask_popcnt_epi8((__m512i)_mm512_setzero_si512(), __U, __B);
6556}
6657
6758static __inline__ __mmask64 __DEFAULT_FN_ATTRS
......@@ -80,7 +71,5 @@ _mm512_bitshuffle_epi64_mask(__m512i __A, __m512i __B)
8071 __B);
8172}
8273
83
8474#undef __DEFAULT_FN_ATTRS
85
8675#endif
lib/include/avx512bwintrin.h+386-505
......@@ -19,153 +19,150 @@ typedef unsigned long long __mmask64;
1919
2020/* Define the default attributes for the functions in this file. */
2121#define __DEFAULT_FN_ATTRS512 \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("avx512bw,evex512"), __min_vector_width__(512)))
22 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw"), \
23 __min_vector_width__(512)))
2424#define __DEFAULT_FN_ATTRS \
25 __attribute__((__always_inline__, __nodebug__, \
26 __target__("avx512bw,no-evex512")))
25 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw")))
26
27#if defined(__cplusplus) && (__cplusplus >= 201103L)
28#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
29#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
30#else
31#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
32#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
33#endif
2734
28static __inline __mmask32 __DEFAULT_FN_ATTRS
29_knot_mask32(__mmask32 __M)
30{
35static __inline __mmask32
36 __DEFAULT_FN_ATTRS_CONSTEXPR _knot_mask32(__mmask32 __M) {
3137 return __builtin_ia32_knotsi(__M);
3238}
3339
34static __inline __mmask64 __DEFAULT_FN_ATTRS _knot_mask64(__mmask64 __M) {
40static __inline __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
41_knot_mask64(__mmask64 __M) {
3542 return __builtin_ia32_knotdi(__M);
3643}
3744
38static __inline__ __mmask32 __DEFAULT_FN_ATTRS
39_kand_mask32(__mmask32 __A, __mmask32 __B)
40{
45static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
46_kand_mask32(__mmask32 __A, __mmask32 __B) {
4147 return (__mmask32)__builtin_ia32_kandsi((__mmask32)__A, (__mmask32)__B);
4248}
4349
44static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kand_mask64(__mmask64 __A,
45 __mmask64 __B) {
50static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
51_kand_mask64(__mmask64 __A, __mmask64 __B) {
4652 return (__mmask64)__builtin_ia32_kanddi((__mmask64)__A, (__mmask64)__B);
4753}
4854
49static __inline__ __mmask32 __DEFAULT_FN_ATTRS
50_kandn_mask32(__mmask32 __A, __mmask32 __B)
51{
55static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
56_kandn_mask32(__mmask32 __A, __mmask32 __B) {
5257 return (__mmask32)__builtin_ia32_kandnsi((__mmask32)__A, (__mmask32)__B);
5358}
5459
55static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kandn_mask64(__mmask64 __A,
56 __mmask64 __B) {
60static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
61_kandn_mask64(__mmask64 __A, __mmask64 __B) {
5762 return (__mmask64)__builtin_ia32_kandndi((__mmask64)__A, (__mmask64)__B);
5863}
5964
60static __inline__ __mmask32 __DEFAULT_FN_ATTRS
61_kor_mask32(__mmask32 __A, __mmask32 __B)
62{
65static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
66_kor_mask32(__mmask32 __A, __mmask32 __B) {
6367 return (__mmask32)__builtin_ia32_korsi((__mmask32)__A, (__mmask32)__B);
6468}
6569
66static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kor_mask64(__mmask64 __A,
67 __mmask64 __B) {
70static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
71_kor_mask64(__mmask64 __A, __mmask64 __B) {
6872 return (__mmask64)__builtin_ia32_kordi((__mmask64)__A, (__mmask64)__B);
6973}
7074
71static __inline__ __mmask32 __DEFAULT_FN_ATTRS
72_kxnor_mask32(__mmask32 __A, __mmask32 __B)
73{
75static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
76_kxnor_mask32(__mmask32 __A, __mmask32 __B) {
7477 return (__mmask32)__builtin_ia32_kxnorsi((__mmask32)__A, (__mmask32)__B);
7578}
7679
77static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kxnor_mask64(__mmask64 __A,
78 __mmask64 __B) {
80static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
81_kxnor_mask64(__mmask64 __A, __mmask64 __B) {
7982 return (__mmask64)__builtin_ia32_kxnordi((__mmask64)__A, (__mmask64)__B);
8083}
8184
82static __inline__ __mmask32 __DEFAULT_FN_ATTRS
83_kxor_mask32(__mmask32 __A, __mmask32 __B)
84{
85static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
86_kxor_mask32(__mmask32 __A, __mmask32 __B) {
8587 return (__mmask32)__builtin_ia32_kxorsi((__mmask32)__A, (__mmask32)__B);
8688}
8789
88static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kxor_mask64(__mmask64 __A,
89 __mmask64 __B) {
90static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
91_kxor_mask64(__mmask64 __A, __mmask64 __B) {
9092 return (__mmask64)__builtin_ia32_kxordi((__mmask64)__A, (__mmask64)__B);
9193}
9294
93static __inline__ unsigned char __DEFAULT_FN_ATTRS
94_kortestc_mask32_u8(__mmask32 __A, __mmask32 __B)
95{
95static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
96_kortestc_mask32_u8(__mmask32 __A, __mmask32 __B) {
9697 return (unsigned char)__builtin_ia32_kortestcsi(__A, __B);
9798}
9899
99static __inline__ unsigned char __DEFAULT_FN_ATTRS
100_kortestz_mask32_u8(__mmask32 __A, __mmask32 __B)
101{
100static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
101_kortestz_mask32_u8(__mmask32 __A, __mmask32 __B) {
102102 return (unsigned char)__builtin_ia32_kortestzsi(__A, __B);
103103}
104104
105static __inline__ unsigned char __DEFAULT_FN_ATTRS
105static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
106106_kortest_mask32_u8(__mmask32 __A, __mmask32 __B, unsigned char *__C) {
107107 *__C = (unsigned char)__builtin_ia32_kortestcsi(__A, __B);
108108 return (unsigned char)__builtin_ia32_kortestzsi(__A, __B);
109109}
110110
111static __inline__ unsigned char __DEFAULT_FN_ATTRS
111static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
112112_kortestc_mask64_u8(__mmask64 __A, __mmask64 __B) {
113113 return (unsigned char)__builtin_ia32_kortestcdi(__A, __B);
114114}
115115
116static __inline__ unsigned char __DEFAULT_FN_ATTRS
116static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
117117_kortestz_mask64_u8(__mmask64 __A, __mmask64 __B) {
118118 return (unsigned char)__builtin_ia32_kortestzdi(__A, __B);
119119}
120120
121static __inline__ unsigned char __DEFAULT_FN_ATTRS
121static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
122122_kortest_mask64_u8(__mmask64 __A, __mmask64 __B, unsigned char *__C) {
123123 *__C = (unsigned char)__builtin_ia32_kortestcdi(__A, __B);
124124 return (unsigned char)__builtin_ia32_kortestzdi(__A, __B);
125125}
126126
127static __inline__ unsigned char __DEFAULT_FN_ATTRS
128_ktestc_mask32_u8(__mmask32 __A, __mmask32 __B)
129{
127static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
128_ktestc_mask32_u8(__mmask32 __A, __mmask32 __B) {
130129 return (unsigned char)__builtin_ia32_ktestcsi(__A, __B);
131130}
132131
133static __inline__ unsigned char __DEFAULT_FN_ATTRS
134_ktestz_mask32_u8(__mmask32 __A, __mmask32 __B)
135{
132static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
133_ktestz_mask32_u8(__mmask32 __A, __mmask32 __B) {
136134 return (unsigned char)__builtin_ia32_ktestzsi(__A, __B);
137135}
138136
139static __inline__ unsigned char __DEFAULT_FN_ATTRS
137static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
140138_ktest_mask32_u8(__mmask32 __A, __mmask32 __B, unsigned char *__C) {
141139 *__C = (unsigned char)__builtin_ia32_ktestcsi(__A, __B);
142140 return (unsigned char)__builtin_ia32_ktestzsi(__A, __B);
143141}
144142
145static __inline__ unsigned char __DEFAULT_FN_ATTRS
143static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
146144_ktestc_mask64_u8(__mmask64 __A, __mmask64 __B) {
147145 return (unsigned char)__builtin_ia32_ktestcdi(__A, __B);
148146}
149147
150static __inline__ unsigned char __DEFAULT_FN_ATTRS
148static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
151149_ktestz_mask64_u8(__mmask64 __A, __mmask64 __B) {
152150 return (unsigned char)__builtin_ia32_ktestzdi(__A, __B);
153151}
154152
155static __inline__ unsigned char __DEFAULT_FN_ATTRS
153static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
156154_ktest_mask64_u8(__mmask64 __A, __mmask64 __B, unsigned char *__C) {
157155 *__C = (unsigned char)__builtin_ia32_ktestcdi(__A, __B);
158156 return (unsigned char)__builtin_ia32_ktestzdi(__A, __B);
159157}
160158
161static __inline__ __mmask32 __DEFAULT_FN_ATTRS
162_kadd_mask32(__mmask32 __A, __mmask32 __B)
163{
159static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
160_kadd_mask32(__mmask32 __A, __mmask32 __B) {
164161 return (__mmask32)__builtin_ia32_kaddsi((__mmask32)__A, (__mmask32)__B);
165162}
166163
167static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kadd_mask64(__mmask64 __A,
168 __mmask64 __B) {
164static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
165_kadd_mask64(__mmask64 __A, __mmask64 __B) {
169166 return (__mmask64)__builtin_ia32_kadddi((__mmask64)__A, (__mmask64)__B);
170167}
171168
......@@ -181,22 +178,22 @@ static __inline__ __mmask64 __DEFAULT_FN_ATTRS _kadd_mask64(__mmask64 __A,
181178#define _kshiftri_mask64(A, I) \
182179 ((__mmask64)__builtin_ia32_kshiftridi((__mmask64)(A), (unsigned int)(I)))
183180
184static __inline__ unsigned int __DEFAULT_FN_ATTRS
185_cvtmask32_u32(__mmask32 __A) {
181static __inline__ unsigned int
182 __DEFAULT_FN_ATTRS_CONSTEXPR _cvtmask32_u32(__mmask32 __A) {
186183 return (unsigned int)__builtin_ia32_kmovd((__mmask32)__A);
187184}
188185
189static __inline__ unsigned long long __DEFAULT_FN_ATTRS
186static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
190187_cvtmask64_u64(__mmask64 __A) {
191188 return (unsigned long long)__builtin_ia32_kmovq((__mmask64)__A);
192189}
193190
194static __inline__ __mmask32 __DEFAULT_FN_ATTRS
191static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
195192_cvtu32_mask32(unsigned int __A) {
196193 return (__mmask32)__builtin_ia32_kmovd((__mmask32)__A);
197194}
198195
199static __inline__ __mmask64 __DEFAULT_FN_ATTRS
196static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
200197_cvtu64_mask64(unsigned long long __A) {
201198 return (__mmask64)__builtin_ia32_kmovq((__mmask64)__A);
202199}
......@@ -362,168 +359,159 @@ static __inline__ void __DEFAULT_FN_ATTRS _store_mask64(__mmask64 *__A,
362359#define _mm512_mask_cmpneq_epu16_mask(k, A, B) \
363360 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_NE)
364361
365static __inline__ __m512i __DEFAULT_FN_ATTRS512
366_mm512_add_epi8 (__m512i __A, __m512i __B) {
362static __inline__ __m512i
363 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_add_epi8(__m512i __A, __m512i __B) {
367364 return (__m512i) ((__v64qu) __A + (__v64qu) __B);
368365}
369366
370static __inline__ __m512i __DEFAULT_FN_ATTRS512
367static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
371368_mm512_mask_add_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
372369 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
373370 (__v64qi)_mm512_add_epi8(__A, __B),
374371 (__v64qi)__W);
375372}
376373
377static __inline__ __m512i __DEFAULT_FN_ATTRS512
374static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
378375_mm512_maskz_add_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
379376 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
380377 (__v64qi)_mm512_add_epi8(__A, __B),
381378 (__v64qi)_mm512_setzero_si512());
382379}
383380
384static __inline__ __m512i __DEFAULT_FN_ATTRS512
385_mm512_sub_epi8 (__m512i __A, __m512i __B) {
381static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
382_mm512_sub_epi8(__m512i __A, __m512i __B) {
386383 return (__m512i) ((__v64qu) __A - (__v64qu) __B);
387384}
388385
389static __inline__ __m512i __DEFAULT_FN_ATTRS512
386static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
390387_mm512_mask_sub_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
391388 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
392389 (__v64qi)_mm512_sub_epi8(__A, __B),
393390 (__v64qi)__W);
394391}
395392
396static __inline__ __m512i __DEFAULT_FN_ATTRS512
393static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
397394_mm512_maskz_sub_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
398395 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
399396 (__v64qi)_mm512_sub_epi8(__A, __B),
400397 (__v64qi)_mm512_setzero_si512());
401398}
402399
403static __inline__ __m512i __DEFAULT_FN_ATTRS512
404_mm512_add_epi16 (__m512i __A, __m512i __B) {
400static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
401_mm512_add_epi16(__m512i __A, __m512i __B) {
405402 return (__m512i) ((__v32hu) __A + (__v32hu) __B);
406403}
407404
408static __inline__ __m512i __DEFAULT_FN_ATTRS512
405static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
409406_mm512_mask_add_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
410407 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
411408 (__v32hi)_mm512_add_epi16(__A, __B),
412409 (__v32hi)__W);
413410}
414411
415static __inline__ __m512i __DEFAULT_FN_ATTRS512
412static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
416413_mm512_maskz_add_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
417414 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
418415 (__v32hi)_mm512_add_epi16(__A, __B),
419416 (__v32hi)_mm512_setzero_si512());
420417}
421418
422static __inline__ __m512i __DEFAULT_FN_ATTRS512
423_mm512_sub_epi16 (__m512i __A, __m512i __B) {
419static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
420_mm512_sub_epi16(__m512i __A, __m512i __B) {
424421 return (__m512i) ((__v32hu) __A - (__v32hu) __B);
425422}
426423
427static __inline__ __m512i __DEFAULT_FN_ATTRS512
424static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
428425_mm512_mask_sub_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
429426 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
430427 (__v32hi)_mm512_sub_epi16(__A, __B),
431428 (__v32hi)__W);
432429}
433430
434static __inline__ __m512i __DEFAULT_FN_ATTRS512
431static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
435432_mm512_maskz_sub_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
436433 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
437434 (__v32hi)_mm512_sub_epi16(__A, __B),
438435 (__v32hi)_mm512_setzero_si512());
439436}
440437
441static __inline__ __m512i __DEFAULT_FN_ATTRS512
438static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
442439_mm512_mullo_epi16 (__m512i __A, __m512i __B) {
443440 return (__m512i) ((__v32hu) __A * (__v32hu) __B);
444441}
445442
446static __inline__ __m512i __DEFAULT_FN_ATTRS512
443static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
447444_mm512_mask_mullo_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
448445 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
449446 (__v32hi)_mm512_mullo_epi16(__A, __B),
450447 (__v32hi)__W);
451448}
452449
453static __inline__ __m512i __DEFAULT_FN_ATTRS512
450static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
454451_mm512_maskz_mullo_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
455452 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
456453 (__v32hi)_mm512_mullo_epi16(__A, __B),
457454 (__v32hi)_mm512_setzero_si512());
458455}
459456
460static __inline__ __m512i __DEFAULT_FN_ATTRS512
461_mm512_mask_blend_epi8 (__mmask64 __U, __m512i __A, __m512i __W)
462{
457static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
458_mm512_mask_blend_epi8(__mmask64 __U, __m512i __A, __m512i __W) {
463459 return (__m512i) __builtin_ia32_selectb_512 ((__mmask64) __U,
464460 (__v64qi) __W,
465461 (__v64qi) __A);
466462}
467463
468static __inline__ __m512i __DEFAULT_FN_ATTRS512
469_mm512_mask_blend_epi16 (__mmask32 __U, __m512i __A, __m512i __W)
470{
464static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
465_mm512_mask_blend_epi16(__mmask32 __U, __m512i __A, __m512i __W) {
471466 return (__m512i) __builtin_ia32_selectw_512 ((__mmask32) __U,
472467 (__v32hi) __W,
473468 (__v32hi) __A);
474469}
475470
476static __inline__ __m512i __DEFAULT_FN_ATTRS512
477_mm512_abs_epi8 (__m512i __A)
478{
471static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
472_mm512_abs_epi8(__m512i __A) {
479473 return (__m512i)__builtin_elementwise_abs((__v64qs)__A);
480474}
481475
482static __inline__ __m512i __DEFAULT_FN_ATTRS512
483_mm512_mask_abs_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
484{
476static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
477_mm512_mask_abs_epi8(__m512i __W, __mmask64 __U, __m512i __A) {
485478 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
486479 (__v64qi)_mm512_abs_epi8(__A),
487480 (__v64qi)__W);
488481}
489482
490static __inline__ __m512i __DEFAULT_FN_ATTRS512
491_mm512_maskz_abs_epi8 (__mmask64 __U, __m512i __A)
492{
483static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
484_mm512_maskz_abs_epi8(__mmask64 __U, __m512i __A) {
493485 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
494486 (__v64qi)_mm512_abs_epi8(__A),
495487 (__v64qi)_mm512_setzero_si512());
496488}
497489
498static __inline__ __m512i __DEFAULT_FN_ATTRS512
499_mm512_abs_epi16 (__m512i __A)
500{
490static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
491_mm512_abs_epi16(__m512i __A) {
501492 return (__m512i)__builtin_elementwise_abs((__v32hi)__A);
502493}
503494
504static __inline__ __m512i __DEFAULT_FN_ATTRS512
505_mm512_mask_abs_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
506{
495static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
496_mm512_mask_abs_epi16(__m512i __W, __mmask32 __U, __m512i __A) {
507497 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
508498 (__v32hi)_mm512_abs_epi16(__A),
509499 (__v32hi)__W);
510500}
511501
512static __inline__ __m512i __DEFAULT_FN_ATTRS512
513_mm512_maskz_abs_epi16 (__mmask32 __U, __m512i __A)
514{
502static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
503_mm512_maskz_abs_epi16(__mmask32 __U, __m512i __A) {
515504 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
516505 (__v32hi)_mm512_abs_epi16(__A),
517506 (__v32hi)_mm512_setzero_si512());
518507}
519508
520static __inline__ __m512i __DEFAULT_FN_ATTRS512
521_mm512_packs_epi32(__m512i __A, __m512i __B)
522{
509static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
510_mm512_packs_epi32(__m512i __A, __m512i __B) {
523511 return (__m512i)__builtin_ia32_packssdw512((__v16si)__A, (__v16si)__B);
524512}
525513
526static __inline__ __m512i __DEFAULT_FN_ATTRS512
514static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
527515_mm512_maskz_packs_epi32(__mmask32 __M, __m512i __A, __m512i __B)
528516{
529517 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
......@@ -531,21 +519,19 @@ _mm512_maskz_packs_epi32(__mmask32 __M, __m512i __A, __m512i __B)
531519 (__v32hi)_mm512_setzero_si512());
532520}
533521
534static __inline__ __m512i __DEFAULT_FN_ATTRS512
535_mm512_mask_packs_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
536{
522static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
523_mm512_mask_packs_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) {
537524 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
538525 (__v32hi)_mm512_packs_epi32(__A, __B),
539526 (__v32hi)__W);
540527}
541528
542static __inline__ __m512i __DEFAULT_FN_ATTRS512
543_mm512_packs_epi16(__m512i __A, __m512i __B)
544{
529static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
530_mm512_packs_epi16(__m512i __A, __m512i __B) {
545531 return (__m512i)__builtin_ia32_packsswb512((__v32hi)__A, (__v32hi) __B);
546532}
547533
548static __inline__ __m512i __DEFAULT_FN_ATTRS512
534static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
549535_mm512_mask_packs_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
550536{
551537 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
......@@ -553,7 +539,7 @@ _mm512_mask_packs_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
553539 (__v64qi)__W);
554540}
555541
556static __inline__ __m512i __DEFAULT_FN_ATTRS512
542static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
557543_mm512_maskz_packs_epi16(__mmask64 __M, __m512i __A, __m512i __B)
558544{
559545 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
......@@ -561,13 +547,12 @@ _mm512_maskz_packs_epi16(__mmask64 __M, __m512i __A, __m512i __B)
561547 (__v64qi)_mm512_setzero_si512());
562548}
563549
564static __inline__ __m512i __DEFAULT_FN_ATTRS512
565_mm512_packus_epi32(__m512i __A, __m512i __B)
566{
550static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
551_mm512_packus_epi32(__m512i __A, __m512i __B) {
567552 return (__m512i)__builtin_ia32_packusdw512((__v16si) __A, (__v16si) __B);
568553}
569554
570static __inline__ __m512i __DEFAULT_FN_ATTRS512
555static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
571556_mm512_maskz_packus_epi32(__mmask32 __M, __m512i __A, __m512i __B)
572557{
573558 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
......@@ -575,7 +560,7 @@ _mm512_maskz_packus_epi32(__mmask32 __M, __m512i __A, __m512i __B)
575560 (__v32hi)_mm512_setzero_si512());
576561}
577562
578static __inline__ __m512i __DEFAULT_FN_ATTRS512
563static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
579564_mm512_mask_packus_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
580565{
581566 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
......@@ -583,13 +568,12 @@ _mm512_mask_packus_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
583568 (__v32hi)__W);
584569}
585570
586static __inline__ __m512i __DEFAULT_FN_ATTRS512
587_mm512_packus_epi16(__m512i __A, __m512i __B)
588{
571static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
572_mm512_packus_epi16(__m512i __A, __m512i __B) {
589573 return (__m512i)__builtin_ia32_packuswb512((__v32hi) __A, (__v32hi) __B);
590574}
591575
592static __inline__ __m512i __DEFAULT_FN_ATTRS512
576static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
593577_mm512_mask_packus_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
594578{
595579 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
......@@ -597,7 +581,7 @@ _mm512_mask_packus_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
597581 (__v64qi)__W);
598582}
599583
600static __inline__ __m512i __DEFAULT_FN_ATTRS512
584static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
601585_mm512_maskz_packus_epi16(__mmask64 __M, __m512i __A, __m512i __B)
602586{
603587 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
......@@ -605,35 +589,31 @@ _mm512_maskz_packus_epi16(__mmask64 __M, __m512i __A, __m512i __B)
605589 (__v64qi)_mm512_setzero_si512());
606590}
607591
608static __inline__ __m512i __DEFAULT_FN_ATTRS512
609_mm512_adds_epi8 (__m512i __A, __m512i __B)
610{
592static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
593_mm512_adds_epi8(__m512i __A, __m512i __B) {
611594 return (__m512i)__builtin_elementwise_add_sat((__v64qs)__A, (__v64qs)__B);
612595}
613596
614static __inline__ __m512i __DEFAULT_FN_ATTRS512
615_mm512_mask_adds_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
616{
597static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
598_mm512_mask_adds_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
617599 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
618600 (__v64qi)_mm512_adds_epi8(__A, __B),
619601 (__v64qi)__W);
620602}
621603
622static __inline__ __m512i __DEFAULT_FN_ATTRS512
623_mm512_maskz_adds_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
624{
604static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
605_mm512_maskz_adds_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
625606 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
626607 (__v64qi)_mm512_adds_epi8(__A, __B),
627608 (__v64qi)_mm512_setzero_si512());
628609}
629610
630static __inline__ __m512i __DEFAULT_FN_ATTRS512
631_mm512_adds_epi16 (__m512i __A, __m512i __B)
632{
611static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
612_mm512_adds_epi16(__m512i __A, __m512i __B) {
633613 return (__m512i)__builtin_elementwise_add_sat((__v32hi)__A, (__v32hi)__B);
634614}
635615
636static __inline__ __m512i __DEFAULT_FN_ATTRS512
616static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
637617_mm512_mask_adds_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
638618{
639619 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -641,7 +621,7 @@ _mm512_mask_adds_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
641621 (__v32hi)__W);
642622}
643623
644static __inline__ __m512i __DEFAULT_FN_ATTRS512
624static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
645625_mm512_maskz_adds_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
646626{
647627 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -649,13 +629,12 @@ _mm512_maskz_adds_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
649629 (__v32hi)_mm512_setzero_si512());
650630}
651631
652static __inline__ __m512i __DEFAULT_FN_ATTRS512
653_mm512_adds_epu8 (__m512i __A, __m512i __B)
654{
632static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
633_mm512_adds_epu8(__m512i __A, __m512i __B) {
655634 return (__m512i)__builtin_elementwise_add_sat((__v64qu) __A, (__v64qu) __B);
656635}
657636
658static __inline__ __m512i __DEFAULT_FN_ATTRS512
637static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
659638_mm512_mask_adds_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
660639{
661640 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
......@@ -663,7 +642,7 @@ _mm512_mask_adds_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
663642 (__v64qi)__W);
664643}
665644
666static __inline__ __m512i __DEFAULT_FN_ATTRS512
645static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
667646_mm512_maskz_adds_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
668647{
669648 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
......@@ -671,280 +650,238 @@ _mm512_maskz_adds_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
671650 (__v64qi)_mm512_setzero_si512());
672651}
673652
674static __inline__ __m512i __DEFAULT_FN_ATTRS512
675_mm512_adds_epu16 (__m512i __A, __m512i __B)
676{
653static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
654_mm512_adds_epu16(__m512i __A, __m512i __B) {
677655 return (__m512i)__builtin_elementwise_add_sat((__v32hu) __A, (__v32hu) __B);
678656}
679657
680static __inline__ __m512i __DEFAULT_FN_ATTRS512
681_mm512_mask_adds_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
682{
658static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
659_mm512_mask_adds_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
683660 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
684661 (__v32hi)_mm512_adds_epu16(__A, __B),
685662 (__v32hi)__W);
686663}
687664
688static __inline__ __m512i __DEFAULT_FN_ATTRS512
689_mm512_maskz_adds_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
690{
665static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
666_mm512_maskz_adds_epu16(__mmask32 __U, __m512i __A, __m512i __B) {
691667 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
692668 (__v32hi)_mm512_adds_epu16(__A, __B),
693669 (__v32hi)_mm512_setzero_si512());
694670}
695671
696static __inline__ __m512i __DEFAULT_FN_ATTRS512
697_mm512_avg_epu8 (__m512i __A, __m512i __B)
698{
699 return (__m512i)__builtin_ia32_pavgb512((__v64qi)__A, (__v64qi)__B);
672static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
673_mm512_avg_epu8(__m512i __A, __m512i __B) {
674 return (__m512i)__builtin_ia32_pavgb512((__v64qu)__A, (__v64qu)__B);
700675}
701676
702static __inline__ __m512i __DEFAULT_FN_ATTRS512
703_mm512_mask_avg_epu8 (__m512i __W, __mmask64 __U, __m512i __A,
704 __m512i __B)
705{
706 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
707 (__v64qi)_mm512_avg_epu8(__A, __B),
708 (__v64qi)__W);
677static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
678_mm512_mask_avg_epu8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
679 return (__m512i)__builtin_ia32_selectb_512(
680 (__mmask64)__U, (__v64qi)_mm512_avg_epu8(__A, __B), (__v64qi)__W);
709681}
710682
711static __inline__ __m512i __DEFAULT_FN_ATTRS512
712_mm512_maskz_avg_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
713{
683static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
684_mm512_maskz_avg_epu8(__mmask64 __U, __m512i __A, __m512i __B) {
714685 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
715 (__v64qi)_mm512_avg_epu8(__A, __B),
716 (__v64qi)_mm512_setzero_si512());
686 (__v64qi)_mm512_avg_epu8(__A, __B),
687 (__v64qi)_mm512_setzero_si512());
717688}
718689
719static __inline__ __m512i __DEFAULT_FN_ATTRS512
720_mm512_avg_epu16 (__m512i __A, __m512i __B)
721{
722 return (__m512i)__builtin_ia32_pavgw512((__v32hi)__A, (__v32hi)__B);
690static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
691_mm512_avg_epu16(__m512i __A, __m512i __B) {
692 return (__m512i)__builtin_ia32_pavgw512((__v32hu)__A, (__v32hu)__B);
723693}
724694
725static __inline__ __m512i __DEFAULT_FN_ATTRS512
726_mm512_mask_avg_epu16 (__m512i __W, __mmask32 __U, __m512i __A,
727 __m512i __B)
728{
729 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
730 (__v32hi)_mm512_avg_epu16(__A, __B),
731 (__v32hi)__W);
695static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
696_mm512_mask_avg_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
697 return (__m512i)__builtin_ia32_selectw_512(
698 (__mmask32)__U, (__v32hi)_mm512_avg_epu16(__A, __B), (__v32hi)__W);
732699}
733700
734static __inline__ __m512i __DEFAULT_FN_ATTRS512
735_mm512_maskz_avg_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
736{
737 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
738 (__v32hi)_mm512_avg_epu16(__A, __B),
739 (__v32hi) _mm512_setzero_si512());
701static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
702_mm512_maskz_avg_epu16(__mmask32 __U, __m512i __A, __m512i __B) {
703 return (__m512i)__builtin_ia32_selectw_512(
704 (__mmask32)__U, (__v32hi)_mm512_avg_epu16(__A, __B),
705 (__v32hi)_mm512_setzero_si512());
740706}
741707
742static __inline__ __m512i __DEFAULT_FN_ATTRS512
743_mm512_max_epi8 (__m512i __A, __m512i __B)
744{
708static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
709_mm512_max_epi8(__m512i __A, __m512i __B) {
745710 return (__m512i)__builtin_elementwise_max((__v64qs) __A, (__v64qs) __B);
746711}
747712
748static __inline__ __m512i __DEFAULT_FN_ATTRS512
749_mm512_maskz_max_epi8 (__mmask64 __M, __m512i __A, __m512i __B)
750{
713static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
714_mm512_maskz_max_epi8(__mmask64 __M, __m512i __A, __m512i __B) {
751715 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
752716 (__v64qi)_mm512_max_epi8(__A, __B),
753717 (__v64qi)_mm512_setzero_si512());
754718}
755719
756static __inline__ __m512i __DEFAULT_FN_ATTRS512
757_mm512_mask_max_epi8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
758{
720static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
721_mm512_mask_max_epi8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) {
759722 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
760723 (__v64qi)_mm512_max_epi8(__A, __B),
761724 (__v64qi)__W);
762725}
763726
764static __inline__ __m512i __DEFAULT_FN_ATTRS512
765_mm512_max_epi16 (__m512i __A, __m512i __B)
766{
727static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
728_mm512_max_epi16(__m512i __A, __m512i __B) {
767729 return (__m512i)__builtin_elementwise_max((__v32hi) __A, (__v32hi) __B);
768730}
769731
770static __inline__ __m512i __DEFAULT_FN_ATTRS512
771_mm512_maskz_max_epi16 (__mmask32 __M, __m512i __A, __m512i __B)
772{
732static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
733_mm512_maskz_max_epi16(__mmask32 __M, __m512i __A, __m512i __B) {
773734 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
774735 (__v32hi)_mm512_max_epi16(__A, __B),
775736 (__v32hi)_mm512_setzero_si512());
776737}
777738
778static __inline__ __m512i __DEFAULT_FN_ATTRS512
779_mm512_mask_max_epi16 (__m512i __W, __mmask32 __M, __m512i __A,
780 __m512i __B)
781{
739static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
740_mm512_mask_max_epi16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) {
782741 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
783742 (__v32hi)_mm512_max_epi16(__A, __B),
784743 (__v32hi)__W);
785744}
786745
787static __inline__ __m512i __DEFAULT_FN_ATTRS512
788_mm512_max_epu8 (__m512i __A, __m512i __B)
789{
746static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
747_mm512_max_epu8(__m512i __A, __m512i __B) {
790748 return (__m512i)__builtin_elementwise_max((__v64qu)__A, (__v64qu)__B);
791749}
792750
793static __inline__ __m512i __DEFAULT_FN_ATTRS512
794_mm512_maskz_max_epu8 (__mmask64 __M, __m512i __A, __m512i __B)
795{
751static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
752_mm512_maskz_max_epu8(__mmask64 __M, __m512i __A, __m512i __B) {
796753 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
797754 (__v64qi)_mm512_max_epu8(__A, __B),
798755 (__v64qi)_mm512_setzero_si512());
799756}
800757
801static __inline__ __m512i __DEFAULT_FN_ATTRS512
802_mm512_mask_max_epu8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
803{
758static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
759_mm512_mask_max_epu8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) {
804760 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
805761 (__v64qi)_mm512_max_epu8(__A, __B),
806762 (__v64qi)__W);
807763}
808764
809static __inline__ __m512i __DEFAULT_FN_ATTRS512
810_mm512_max_epu16 (__m512i __A, __m512i __B)
811{
765static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
766_mm512_max_epu16(__m512i __A, __m512i __B) {
812767 return (__m512i)__builtin_elementwise_max((__v32hu)__A, (__v32hu)__B);
813768}
814769
815static __inline__ __m512i __DEFAULT_FN_ATTRS512
816_mm512_maskz_max_epu16 (__mmask32 __M, __m512i __A, __m512i __B)
817{
770static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
771_mm512_maskz_max_epu16(__mmask32 __M, __m512i __A, __m512i __B) {
818772 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
819773 (__v32hi)_mm512_max_epu16(__A, __B),
820774 (__v32hi)_mm512_setzero_si512());
821775}
822776
823static __inline__ __m512i __DEFAULT_FN_ATTRS512
824_mm512_mask_max_epu16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
825{
777static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
778_mm512_mask_max_epu16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) {
826779 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
827780 (__v32hi)_mm512_max_epu16(__A, __B),
828781 (__v32hi)__W);
829782}
830783
831static __inline__ __m512i __DEFAULT_FN_ATTRS512
832_mm512_min_epi8 (__m512i __A, __m512i __B)
833{
784static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
785_mm512_min_epi8(__m512i __A, __m512i __B) {
834786 return (__m512i)__builtin_elementwise_min((__v64qs) __A, (__v64qs) __B);
835787}
836788
837static __inline__ __m512i __DEFAULT_FN_ATTRS512
838_mm512_maskz_min_epi8 (__mmask64 __M, __m512i __A, __m512i __B)
839{
789static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
790_mm512_maskz_min_epi8(__mmask64 __M, __m512i __A, __m512i __B) {
840791 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
841792 (__v64qi)_mm512_min_epi8(__A, __B),
842793 (__v64qi)_mm512_setzero_si512());
843794}
844795
845static __inline__ __m512i __DEFAULT_FN_ATTRS512
846_mm512_mask_min_epi8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
847{
796static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
797_mm512_mask_min_epi8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) {
848798 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
849799 (__v64qi)_mm512_min_epi8(__A, __B),
850800 (__v64qi)__W);
851801}
852802
853static __inline__ __m512i __DEFAULT_FN_ATTRS512
854_mm512_min_epi16 (__m512i __A, __m512i __B)
855{
803static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
804_mm512_min_epi16(__m512i __A, __m512i __B) {
856805 return (__m512i)__builtin_elementwise_min((__v32hi) __A, (__v32hi) __B);
857806}
858807
859static __inline__ __m512i __DEFAULT_FN_ATTRS512
860_mm512_maskz_min_epi16 (__mmask32 __M, __m512i __A, __m512i __B)
861{
808static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
809_mm512_maskz_min_epi16(__mmask32 __M, __m512i __A, __m512i __B) {
862810 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
863811 (__v32hi)_mm512_min_epi16(__A, __B),
864812 (__v32hi)_mm512_setzero_si512());
865813}
866814
867static __inline__ __m512i __DEFAULT_FN_ATTRS512
868_mm512_mask_min_epi16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
869{
815static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
816_mm512_mask_min_epi16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) {
870817 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
871818 (__v32hi)_mm512_min_epi16(__A, __B),
872819 (__v32hi)__W);
873820}
874821
875static __inline__ __m512i __DEFAULT_FN_ATTRS512
876_mm512_min_epu8 (__m512i __A, __m512i __B)
877{
822static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
823_mm512_min_epu8(__m512i __A, __m512i __B) {
878824 return (__m512i)__builtin_elementwise_min((__v64qu)__A, (__v64qu)__B);
879825}
880826
881static __inline__ __m512i __DEFAULT_FN_ATTRS512
882_mm512_maskz_min_epu8 (__mmask64 __M, __m512i __A, __m512i __B)
883{
827static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
828_mm512_maskz_min_epu8(__mmask64 __M, __m512i __A, __m512i __B) {
884829 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
885830 (__v64qi)_mm512_min_epu8(__A, __B),
886831 (__v64qi)_mm512_setzero_si512());
887832}
888833
889static __inline__ __m512i __DEFAULT_FN_ATTRS512
890_mm512_mask_min_epu8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
891{
834static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
835_mm512_mask_min_epu8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) {
892836 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
893837 (__v64qi)_mm512_min_epu8(__A, __B),
894838 (__v64qi)__W);
895839}
896840
897static __inline__ __m512i __DEFAULT_FN_ATTRS512
898_mm512_min_epu16 (__m512i __A, __m512i __B)
899{
841static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
842_mm512_min_epu16(__m512i __A, __m512i __B) {
900843 return (__m512i)__builtin_elementwise_min((__v32hu)__A, (__v32hu)__B);
901844}
902845
903static __inline__ __m512i __DEFAULT_FN_ATTRS512
904_mm512_maskz_min_epu16 (__mmask32 __M, __m512i __A, __m512i __B)
905{
846static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
847_mm512_maskz_min_epu16(__mmask32 __M, __m512i __A, __m512i __B) {
906848 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
907849 (__v32hi)_mm512_min_epu16(__A, __B),
908850 (__v32hi)_mm512_setzero_si512());
909851}
910852
911static __inline__ __m512i __DEFAULT_FN_ATTRS512
912_mm512_mask_min_epu16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
913{
853static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
854_mm512_mask_min_epu16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) {
914855 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
915856 (__v32hi)_mm512_min_epu16(__A, __B),
916857 (__v32hi)__W);
917858}
918859
919static __inline__ __m512i __DEFAULT_FN_ATTRS512
920_mm512_shuffle_epi8(__m512i __A, __m512i __B)
921{
860static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
861_mm512_shuffle_epi8(__m512i __A, __m512i __B) {
922862 return (__m512i)__builtin_ia32_pshufb512((__v64qi)__A,(__v64qi)__B);
923863}
924864
925static __inline__ __m512i __DEFAULT_FN_ATTRS512
926_mm512_mask_shuffle_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
927{
865static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
866_mm512_mask_shuffle_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
928867 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
929868 (__v64qi)_mm512_shuffle_epi8(__A, __B),
930869 (__v64qi)__W);
931870}
932871
933static __inline__ __m512i __DEFAULT_FN_ATTRS512
934_mm512_maskz_shuffle_epi8(__mmask64 __U, __m512i __A, __m512i __B)
935{
872static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
873_mm512_maskz_shuffle_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
936874 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
937875 (__v64qi)_mm512_shuffle_epi8(__A, __B),
938876 (__v64qi)_mm512_setzero_si512());
939877}
940878
941static __inline__ __m512i __DEFAULT_FN_ATTRS512
942_mm512_subs_epi8 (__m512i __A, __m512i __B)
943{
879static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
880_mm512_subs_epi8(__m512i __A, __m512i __B) {
944881 return (__m512i)__builtin_elementwise_sub_sat((__v64qs)__A, (__v64qs)__B);
945882}
946883
947static __inline__ __m512i __DEFAULT_FN_ATTRS512
884static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
948885_mm512_mask_subs_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
949886{
950887 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
......@@ -952,7 +889,7 @@ _mm512_mask_subs_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
952889 (__v64qi)__W);
953890}
954891
955static __inline__ __m512i __DEFAULT_FN_ATTRS512
892static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
956893_mm512_maskz_subs_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
957894{
958895 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
......@@ -960,13 +897,12 @@ _mm512_maskz_subs_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
960897 (__v64qi)_mm512_setzero_si512());
961898}
962899
963static __inline__ __m512i __DEFAULT_FN_ATTRS512
964_mm512_subs_epi16 (__m512i __A, __m512i __B)
965{
900static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
901_mm512_subs_epi16(__m512i __A, __m512i __B) {
966902 return (__m512i)__builtin_elementwise_sub_sat((__v32hi)__A, (__v32hi)__B);
967903}
968904
969static __inline__ __m512i __DEFAULT_FN_ATTRS512
905static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
970906_mm512_mask_subs_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
971907{
972908 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -974,7 +910,7 @@ _mm512_mask_subs_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
974910 (__v32hi)__W);
975911}
976912
977static __inline__ __m512i __DEFAULT_FN_ATTRS512
913static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
978914_mm512_maskz_subs_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
979915{
980916 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -982,13 +918,12 @@ _mm512_maskz_subs_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
982918 (__v32hi)_mm512_setzero_si512());
983919}
984920
985static __inline__ __m512i __DEFAULT_FN_ATTRS512
986_mm512_subs_epu8 (__m512i __A, __m512i __B)
987{
921static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
922_mm512_subs_epu8(__m512i __A, __m512i __B) {
988923 return (__m512i)__builtin_elementwise_sub_sat((__v64qu) __A, (__v64qu) __B);
989924}
990925
991static __inline__ __m512i __DEFAULT_FN_ATTRS512
926static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
992927_mm512_mask_subs_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
993928{
994929 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
......@@ -996,7 +931,7 @@ _mm512_mask_subs_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
996931 (__v64qi)__W);
997932}
998933
999static __inline__ __m512i __DEFAULT_FN_ATTRS512
934static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1000935_mm512_maskz_subs_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
1001936{
1002937 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
......@@ -1004,13 +939,12 @@ _mm512_maskz_subs_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
1004939 (__v64qi)_mm512_setzero_si512());
1005940}
1006941
1007static __inline__ __m512i __DEFAULT_FN_ATTRS512
1008_mm512_subs_epu16 (__m512i __A, __m512i __B)
1009{
942static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
943_mm512_subs_epu16(__m512i __A, __m512i __B) {
1010944 return (__m512i)__builtin_elementwise_sub_sat((__v32hu) __A, (__v32hu) __B);
1011945}
1012946
1013static __inline__ __m512i __DEFAULT_FN_ATTRS512
947static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1014948_mm512_mask_subs_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1015949{
1016950 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1018,7 +952,7 @@ _mm512_mask_subs_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1018952 (__v32hi)__W);
1019953}
1020954
1021static __inline__ __m512i __DEFAULT_FN_ATTRS512
955static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1022956_mm512_maskz_subs_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
1023957{
1024958 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1026,113 +960,97 @@ _mm512_maskz_subs_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
1026960 (__v32hi)_mm512_setzero_si512());
1027961}
1028962
1029static __inline__ __m512i __DEFAULT_FN_ATTRS512
1030_mm512_permutex2var_epi16(__m512i __A, __m512i __I, __m512i __B)
1031{
963static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
964_mm512_permutex2var_epi16(__m512i __A, __m512i __I, __m512i __B) {
1032965 return (__m512i)__builtin_ia32_vpermi2varhi512((__v32hi)__A, (__v32hi)__I,
1033966 (__v32hi)__B);
1034967}
1035968
1036static __inline__ __m512i __DEFAULT_FN_ATTRS512
969static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1037970_mm512_mask_permutex2var_epi16(__m512i __A, __mmask32 __U, __m512i __I,
1038 __m512i __B)
1039{
971 __m512i __B) {
1040972 return (__m512i)__builtin_ia32_selectw_512(__U,
1041973 (__v32hi)_mm512_permutex2var_epi16(__A, __I, __B),
1042974 (__v32hi)__A);
1043975}
1044976
1045static __inline__ __m512i __DEFAULT_FN_ATTRS512
977static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1046978_mm512_mask2_permutex2var_epi16(__m512i __A, __m512i __I, __mmask32 __U,
1047 __m512i __B)
1048{
979 __m512i __B) {
1049980 return (__m512i)__builtin_ia32_selectw_512(__U,
1050981 (__v32hi)_mm512_permutex2var_epi16(__A, __I, __B),
1051982 (__v32hi)__I);
1052983}
1053984
1054static __inline__ __m512i __DEFAULT_FN_ATTRS512
985static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1055986_mm512_maskz_permutex2var_epi16(__mmask32 __U, __m512i __A, __m512i __I,
1056 __m512i __B)
1057{
987 __m512i __B) {
1058988 return (__m512i)__builtin_ia32_selectw_512(__U,
1059989 (__v32hi)_mm512_permutex2var_epi16(__A, __I, __B),
1060990 (__v32hi)_mm512_setzero_si512());
1061991}
1062992
1063static __inline__ __m512i __DEFAULT_FN_ATTRS512
1064_mm512_mulhrs_epi16(__m512i __A, __m512i __B)
1065{
993static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
994_mm512_mulhrs_epi16(__m512i __A, __m512i __B) {
1066995 return (__m512i)__builtin_ia32_pmulhrsw512((__v32hi)__A, (__v32hi)__B);
1067996}
1068997
1069static __inline__ __m512i __DEFAULT_FN_ATTRS512
1070_mm512_mask_mulhrs_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1071{
998static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
999_mm512_mask_mulhrs_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
10721000 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
10731001 (__v32hi)_mm512_mulhrs_epi16(__A, __B),
10741002 (__v32hi)__W);
10751003}
10761004
1077static __inline__ __m512i __DEFAULT_FN_ATTRS512
1078_mm512_maskz_mulhrs_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1079{
1005static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1006_mm512_maskz_mulhrs_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
10801007 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
10811008 (__v32hi)_mm512_mulhrs_epi16(__A, __B),
10821009 (__v32hi)_mm512_setzero_si512());
10831010}
10841011
1085static __inline__ __m512i __DEFAULT_FN_ATTRS512
1086_mm512_mulhi_epi16(__m512i __A, __m512i __B)
1087{
1088 return (__m512i)__builtin_ia32_pmulhw512((__v32hi) __A, (__v32hi) __B);
1012static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1013_mm512_mulhi_epi16(__m512i __A, __m512i __B) {
1014 return (__m512i)__builtin_ia32_pmulhw512((__v32hi)__A, (__v32hi)__B);
10891015}
10901016
1091static __inline__ __m512i __DEFAULT_FN_ATTRS512
1092_mm512_mask_mulhi_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1093 __m512i __B)
1094{
1095 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1096 (__v32hi)_mm512_mulhi_epi16(__A, __B),
1097 (__v32hi)__W);
1017static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1018_mm512_mask_mulhi_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
1019 return (__m512i)__builtin_ia32_selectw_512(
1020 (__mmask32)__U, (__v32hi)_mm512_mulhi_epi16(__A, __B), (__v32hi)__W);
10981021}
10991022
1100static __inline__ __m512i __DEFAULT_FN_ATTRS512
1101_mm512_maskz_mulhi_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1102{
1103 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1104 (__v32hi)_mm512_mulhi_epi16(__A, __B),
1105 (__v32hi)_mm512_setzero_si512());
1023static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1024_mm512_maskz_mulhi_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
1025 return (__m512i)__builtin_ia32_selectw_512(
1026 (__mmask32)__U, (__v32hi)_mm512_mulhi_epi16(__A, __B),
1027 (__v32hi)_mm512_setzero_si512());
11061028}
11071029
1108static __inline__ __m512i __DEFAULT_FN_ATTRS512
1109_mm512_mulhi_epu16(__m512i __A, __m512i __B)
1110{
1111 return (__m512i)__builtin_ia32_pmulhuw512((__v32hi) __A, (__v32hi) __B);
1030static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1031_mm512_mulhi_epu16(__m512i __A, __m512i __B) {
1032 return (__m512i)__builtin_ia32_pmulhuw512((__v32hu)__A, (__v32hu)__B);
11121033}
11131034
1114static __inline__ __m512i __DEFAULT_FN_ATTRS512
1115_mm512_mask_mulhi_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1116{
1117 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1118 (__v32hi)_mm512_mulhi_epu16(__A, __B),
1119 (__v32hi)__W);
1035static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1036_mm512_mask_mulhi_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
1037 return (__m512i)__builtin_ia32_selectw_512(
1038 (__mmask32)__U, (__v32hi)_mm512_mulhi_epu16(__A, __B), (__v32hi)__W);
11201039}
11211040
1122static __inline__ __m512i __DEFAULT_FN_ATTRS512
1123_mm512_maskz_mulhi_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
1124{
1125 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1126 (__v32hi)_mm512_mulhi_epu16(__A, __B),
1127 (__v32hi)_mm512_setzero_si512());
1041static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1042_mm512_maskz_mulhi_epu16(__mmask32 __U, __m512i __A, __m512i __B) {
1043 return (__m512i)__builtin_ia32_selectw_512(
1044 (__mmask32)__U, (__v32hi)_mm512_mulhi_epu16(__A, __B),
1045 (__v32hi)_mm512_setzero_si512());
11281046}
11291047
1130static __inline__ __m512i __DEFAULT_FN_ATTRS512
1048static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11311049_mm512_maddubs_epi16(__m512i __X, __m512i __Y) {
11321050 return (__m512i)__builtin_ia32_pmaddubsw512((__v64qi)__X, (__v64qi)__Y);
11331051}
11341052
1135static __inline__ __m512i __DEFAULT_FN_ATTRS512
1053static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11361054_mm512_mask_maddubs_epi16(__m512i __W, __mmask32 __U, __m512i __X,
11371055 __m512i __Y) {
11381056 return (__m512i)__builtin_ia32_selectw_512((__mmask32) __U,
......@@ -1140,26 +1058,26 @@ _mm512_mask_maddubs_epi16(__m512i __W, __mmask32 __U, __m512i __X,
11401058 (__v32hi)__W);
11411059}
11421060
1143static __inline__ __m512i __DEFAULT_FN_ATTRS512
1061static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11441062_mm512_maskz_maddubs_epi16(__mmask32 __U, __m512i __X, __m512i __Y) {
11451063 return (__m512i)__builtin_ia32_selectw_512((__mmask32) __U,
11461064 (__v32hi)_mm512_maddubs_epi16(__X, __Y),
11471065 (__v32hi)_mm512_setzero_si512());
11481066}
11491067
1150static __inline__ __m512i __DEFAULT_FN_ATTRS512
1068static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11511069_mm512_madd_epi16(__m512i __A, __m512i __B) {
11521070 return (__m512i)__builtin_ia32_pmaddwd512((__v32hi)__A, (__v32hi)__B);
11531071}
11541072
1155static __inline__ __m512i __DEFAULT_FN_ATTRS512
1073static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11561074_mm512_mask_madd_epi16(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) {
11571075 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
11581076 (__v16si)_mm512_madd_epi16(__A, __B),
11591077 (__v16si)__W);
11601078}
11611079
1162static __inline__ __m512i __DEFAULT_FN_ATTRS512
1080static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11631081_mm512_maskz_madd_epi16(__mmask16 __U, __m512i __A, __m512i __B) {
11641082 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
11651083 (__v16si)_mm512_madd_epi16(__A, __B),
......@@ -1247,7 +1165,7 @@ _mm512_mask_cvtusepi16_storeu_epi8 (void * __P, __mmask32 __M, __m512i __A)
12471165 __builtin_ia32_pmovuswb512mem_mask ((__v32qi *) __P, (__v32hi) __A, __M);
12481166}
12491167
1250static __inline__ __m512i __DEFAULT_FN_ATTRS512
1168static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
12511169_mm512_unpackhi_epi8(__m512i __A, __m512i __B) {
12521170 return (__m512i)__builtin_shufflevector((__v64qi)__A, (__v64qi)__B,
12531171 8, 64+8, 9, 64+9,
......@@ -1268,21 +1186,21 @@ _mm512_unpackhi_epi8(__m512i __A, __m512i __B) {
12681186 62, 64+62, 63, 64+63);
12691187}
12701188
1271static __inline__ __m512i __DEFAULT_FN_ATTRS512
1189static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
12721190_mm512_mask_unpackhi_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
12731191 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
12741192 (__v64qi)_mm512_unpackhi_epi8(__A, __B),
12751193 (__v64qi)__W);
12761194}
12771195
1278static __inline__ __m512i __DEFAULT_FN_ATTRS512
1196static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
12791197_mm512_maskz_unpackhi_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
12801198 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
12811199 (__v64qi)_mm512_unpackhi_epi8(__A, __B),
12821200 (__v64qi)_mm512_setzero_si512());
12831201}
12841202
1285static __inline__ __m512i __DEFAULT_FN_ATTRS512
1203static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
12861204_mm512_unpackhi_epi16(__m512i __A, __m512i __B) {
12871205 return (__m512i)__builtin_shufflevector((__v32hi)__A, (__v32hi)__B,
12881206 4, 32+4, 5, 32+5,
......@@ -1295,21 +1213,21 @@ _mm512_unpackhi_epi16(__m512i __A, __m512i __B) {
12951213 30, 32+30, 31, 32+31);
12961214}
12971215
1298static __inline__ __m512i __DEFAULT_FN_ATTRS512
1216static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
12991217_mm512_mask_unpackhi_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
13001218 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
13011219 (__v32hi)_mm512_unpackhi_epi16(__A, __B),
13021220 (__v32hi)__W);
13031221}
13041222
1305static __inline__ __m512i __DEFAULT_FN_ATTRS512
1223static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13061224_mm512_maskz_unpackhi_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
13071225 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
13081226 (__v32hi)_mm512_unpackhi_epi16(__A, __B),
13091227 (__v32hi)_mm512_setzero_si512());
13101228}
13111229
1312static __inline__ __m512i __DEFAULT_FN_ATTRS512
1230static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13131231_mm512_unpacklo_epi8(__m512i __A, __m512i __B) {
13141232 return (__m512i)__builtin_shufflevector((__v64qi)__A, (__v64qi)__B,
13151233 0, 64+0, 1, 64+1,
......@@ -1330,21 +1248,21 @@ _mm512_unpacklo_epi8(__m512i __A, __m512i __B) {
13301248 54, 64+54, 55, 64+55);
13311249}
13321250
1333static __inline__ __m512i __DEFAULT_FN_ATTRS512
1251static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13341252_mm512_mask_unpacklo_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
13351253 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
13361254 (__v64qi)_mm512_unpacklo_epi8(__A, __B),
13371255 (__v64qi)__W);
13381256}
13391257
1340static __inline__ __m512i __DEFAULT_FN_ATTRS512
1258static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13411259_mm512_maskz_unpacklo_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
13421260 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
13431261 (__v64qi)_mm512_unpacklo_epi8(__A, __B),
13441262 (__v64qi)_mm512_setzero_si512());
13451263}
13461264
1347static __inline__ __m512i __DEFAULT_FN_ATTRS512
1265static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13481266_mm512_unpacklo_epi16(__m512i __A, __m512i __B) {
13491267 return (__m512i)__builtin_shufflevector((__v32hi)__A, (__v32hi)__B,
13501268 0, 32+0, 1, 32+1,
......@@ -1357,67 +1275,60 @@ _mm512_unpacklo_epi16(__m512i __A, __m512i __B) {
13571275 26, 32+26, 27, 32+27);
13581276}
13591277
1360static __inline__ __m512i __DEFAULT_FN_ATTRS512
1278static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13611279_mm512_mask_unpacklo_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
13621280 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
13631281 (__v32hi)_mm512_unpacklo_epi16(__A, __B),
13641282 (__v32hi)__W);
13651283}
13661284
1367static __inline__ __m512i __DEFAULT_FN_ATTRS512
1285static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
13681286_mm512_maskz_unpacklo_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
13691287 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
13701288 (__v32hi)_mm512_unpacklo_epi16(__A, __B),
13711289 (__v32hi)_mm512_setzero_si512());
13721290}
13731291
1374static __inline__ __m512i __DEFAULT_FN_ATTRS512
1375_mm512_cvtepi8_epi16(__m256i __A)
1376{
1292static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1293_mm512_cvtepi8_epi16(__m256i __A) {
13771294 /* This function always performs a signed extension, but __v32qi is a char
13781295 which may be signed or unsigned, so use __v32qs. */
13791296 return (__m512i)__builtin_convertvector((__v32qs)__A, __v32hi);
13801297}
13811298
1382static __inline__ __m512i __DEFAULT_FN_ATTRS512
1383_mm512_mask_cvtepi8_epi16(__m512i __W, __mmask32 __U, __m256i __A)
1384{
1299static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1300_mm512_mask_cvtepi8_epi16(__m512i __W, __mmask32 __U, __m256i __A) {
13851301 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
13861302 (__v32hi)_mm512_cvtepi8_epi16(__A),
13871303 (__v32hi)__W);
13881304}
13891305
1390static __inline__ __m512i __DEFAULT_FN_ATTRS512
1391_mm512_maskz_cvtepi8_epi16(__mmask32 __U, __m256i __A)
1392{
1306static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1307_mm512_maskz_cvtepi8_epi16(__mmask32 __U, __m256i __A) {
13931308 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
13941309 (__v32hi)_mm512_cvtepi8_epi16(__A),
13951310 (__v32hi)_mm512_setzero_si512());
13961311}
13971312
1398static __inline__ __m512i __DEFAULT_FN_ATTRS512
1399_mm512_cvtepu8_epi16(__m256i __A)
1400{
1313static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1314_mm512_cvtepu8_epi16(__m256i __A) {
14011315 return (__m512i)__builtin_convertvector((__v32qu)__A, __v32hi);
14021316}
14031317
1404static __inline__ __m512i __DEFAULT_FN_ATTRS512
1405_mm512_mask_cvtepu8_epi16(__m512i __W, __mmask32 __U, __m256i __A)
1406{
1318static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1319_mm512_mask_cvtepu8_epi16(__m512i __W, __mmask32 __U, __m256i __A) {
14071320 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
14081321 (__v32hi)_mm512_cvtepu8_epi16(__A),
14091322 (__v32hi)__W);
14101323}
14111324
1412static __inline__ __m512i __DEFAULT_FN_ATTRS512
1413_mm512_maskz_cvtepu8_epi16(__mmask32 __U, __m256i __A)
1414{
1325static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1326_mm512_maskz_cvtepu8_epi16(__mmask32 __U, __m256i __A) {
14151327 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
14161328 (__v32hi)_mm512_cvtepu8_epi16(__A),
14171329 (__v32hi)_mm512_setzero_si512());
14181330}
14191331
1420
14211332#define _mm512_shufflehi_epi16(A, imm) \
14221333 ((__m512i)__builtin_ia32_pshufhw512((__v32hi)(__m512i)(A), (int)(imm)))
14231334
......@@ -1450,13 +1361,13 @@ _mm512_maskz_cvtepu8_epi16(__mmask32 __U, __m256i __A)
14501361 (imm)), \
14511362 (__v32hi)_mm512_setzero_si512()))
14521363
1453static __inline__ __m512i __DEFAULT_FN_ATTRS512
1364static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
14541365_mm512_sllv_epi16(__m512i __A, __m512i __B)
14551366{
14561367 return (__m512i)__builtin_ia32_psllv32hi((__v32hi) __A, (__v32hi) __B);
14571368}
14581369
1459static __inline__ __m512i __DEFAULT_FN_ATTRS512
1370static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
14601371_mm512_mask_sllv_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
14611372{
14621373 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1464,7 +1375,7 @@ _mm512_mask_sllv_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
14641375 (__v32hi)__W);
14651376}
14661377
1467static __inline__ __m512i __DEFAULT_FN_ATTRS512
1378static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
14681379_mm512_maskz_sllv_epi16(__mmask32 __U, __m512i __A, __m512i __B)
14691380{
14701381 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1472,61 +1383,56 @@ _mm512_maskz_sllv_epi16(__mmask32 __U, __m512i __A, __m512i __B)
14721383 (__v32hi)_mm512_setzero_si512());
14731384}
14741385
1475static __inline__ __m512i __DEFAULT_FN_ATTRS512
1476_mm512_sll_epi16(__m512i __A, __m128i __B)
1477{
1386static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1387_mm512_sll_epi16(__m512i __A, __m128i __B) {
14781388 return (__m512i)__builtin_ia32_psllw512((__v32hi) __A, (__v8hi) __B);
14791389}
14801390
1481static __inline__ __m512i __DEFAULT_FN_ATTRS512
1482_mm512_mask_sll_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B)
1483{
1391static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1392_mm512_mask_sll_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B) {
14841393 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
14851394 (__v32hi)_mm512_sll_epi16(__A, __B),
14861395 (__v32hi)__W);
14871396}
14881397
1489static __inline__ __m512i __DEFAULT_FN_ATTRS512
1490_mm512_maskz_sll_epi16(__mmask32 __U, __m512i __A, __m128i __B)
1491{
1398static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1399_mm512_maskz_sll_epi16(__mmask32 __U, __m512i __A, __m128i __B) {
14921400 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
14931401 (__v32hi)_mm512_sll_epi16(__A, __B),
14941402 (__v32hi)_mm512_setzero_si512());
14951403}
14961404
1497static __inline__ __m512i __DEFAULT_FN_ATTRS512
1498_mm512_slli_epi16(__m512i __A, unsigned int __B)
1499{
1405static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1406_mm512_slli_epi16(__m512i __A, unsigned int __B) {
15001407 return (__m512i)__builtin_ia32_psllwi512((__v32hi)__A, (int)__B);
15011408}
15021409
1503static __inline__ __m512i __DEFAULT_FN_ATTRS512
1410static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15041411_mm512_mask_slli_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1505 unsigned int __B)
1506{
1412 unsigned int __B) {
15071413 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
15081414 (__v32hi)_mm512_slli_epi16(__A, __B),
15091415 (__v32hi)__W);
15101416}
15111417
1512static __inline__ __m512i __DEFAULT_FN_ATTRS512
1513_mm512_maskz_slli_epi16(__mmask32 __U, __m512i __A, unsigned int __B)
1514{
1418static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1419_mm512_maskz_slli_epi16(__mmask32 __U, __m512i __A, unsigned int __B) {
15151420 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
15161421 (__v32hi)_mm512_slli_epi16(__A, __B),
15171422 (__v32hi)_mm512_setzero_si512());
15181423}
15191424
1520#define _mm512_bslli_epi128(a, imm) \
1521 ((__m512i)__builtin_ia32_pslldqi512_byteshift((__v8di)(__m512i)(a), (int)(imm)))
1425#define _mm512_bslli_epi128(a, imm) \
1426 ((__m512i)__builtin_ia32_pslldqi512_byteshift((__v64qi)(__m512i)(a), \
1427 (int)(imm)))
15221428
1523static __inline__ __m512i __DEFAULT_FN_ATTRS512
1429static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15241430_mm512_srlv_epi16(__m512i __A, __m512i __B)
15251431{
15261432 return (__m512i)__builtin_ia32_psrlv32hi((__v32hi)__A, (__v32hi)__B);
15271433}
15281434
1529static __inline__ __m512i __DEFAULT_FN_ATTRS512
1435static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15301436_mm512_mask_srlv_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
15311437{
15321438 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1534,7 +1440,7 @@ _mm512_mask_srlv_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
15341440 (__v32hi)__W);
15351441}
15361442
1537static __inline__ __m512i __DEFAULT_FN_ATTRS512
1443static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15381444_mm512_maskz_srlv_epi16(__mmask32 __U, __m512i __A, __m512i __B)
15391445{
15401446 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1542,13 +1448,13 @@ _mm512_maskz_srlv_epi16(__mmask32 __U, __m512i __A, __m512i __B)
15421448 (__v32hi)_mm512_setzero_si512());
15431449}
15441450
1545static __inline__ __m512i __DEFAULT_FN_ATTRS512
1451static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15461452_mm512_srav_epi16(__m512i __A, __m512i __B)
15471453{
15481454 return (__m512i)__builtin_ia32_psrav32hi((__v32hi)__A, (__v32hi)__B);
15491455}
15501456
1551static __inline__ __m512i __DEFAULT_FN_ATTRS512
1457static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15521458_mm512_mask_srav_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
15531459{
15541460 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1556,7 +1462,7 @@ _mm512_mask_srav_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
15561462 (__v32hi)__W);
15571463}
15581464
1559static __inline__ __m512i __DEFAULT_FN_ATTRS512
1465static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15601466_mm512_maskz_srav_epi16(__mmask32 __U, __m512i __A, __m512i __B)
15611467{
15621468 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
......@@ -1564,100 +1470,89 @@ _mm512_maskz_srav_epi16(__mmask32 __U, __m512i __A, __m512i __B)
15641470 (__v32hi)_mm512_setzero_si512());
15651471}
15661472
1567static __inline__ __m512i __DEFAULT_FN_ATTRS512
1568_mm512_sra_epi16(__m512i __A, __m128i __B)
1569{
1473static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1474_mm512_sra_epi16(__m512i __A, __m128i __B) {
15701475 return (__m512i)__builtin_ia32_psraw512((__v32hi) __A, (__v8hi) __B);
15711476}
15721477
1573static __inline__ __m512i __DEFAULT_FN_ATTRS512
1574_mm512_mask_sra_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B)
1575{
1478static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1479_mm512_mask_sra_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B) {
15761480 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
15771481 (__v32hi)_mm512_sra_epi16(__A, __B),
15781482 (__v32hi)__W);
15791483}
15801484
1581static __inline__ __m512i __DEFAULT_FN_ATTRS512
1582_mm512_maskz_sra_epi16(__mmask32 __U, __m512i __A, __m128i __B)
1583{
1485static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1486_mm512_maskz_sra_epi16(__mmask32 __U, __m512i __A, __m128i __B) {
15841487 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
15851488 (__v32hi)_mm512_sra_epi16(__A, __B),
15861489 (__v32hi)_mm512_setzero_si512());
15871490}
15881491
1589static __inline__ __m512i __DEFAULT_FN_ATTRS512
1590_mm512_srai_epi16(__m512i __A, unsigned int __B)
1591{
1492static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1493_mm512_srai_epi16(__m512i __A, unsigned int __B) {
15921494 return (__m512i)__builtin_ia32_psrawi512((__v32hi)__A, (int)__B);
15931495}
15941496
1595static __inline__ __m512i __DEFAULT_FN_ATTRS512
1497static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15961498_mm512_mask_srai_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1597 unsigned int __B)
1598{
1499 unsigned int __B) {
15991500 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
16001501 (__v32hi)_mm512_srai_epi16(__A, __B),
16011502 (__v32hi)__W);
16021503}
16031504
1604static __inline__ __m512i __DEFAULT_FN_ATTRS512
1605_mm512_maskz_srai_epi16(__mmask32 __U, __m512i __A, unsigned int __B)
1606{
1505static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1506_mm512_maskz_srai_epi16(__mmask32 __U, __m512i __A, unsigned int __B) {
16071507 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
16081508 (__v32hi)_mm512_srai_epi16(__A, __B),
16091509 (__v32hi)_mm512_setzero_si512());
16101510}
16111511
1612static __inline__ __m512i __DEFAULT_FN_ATTRS512
1613_mm512_srl_epi16(__m512i __A, __m128i __B)
1614{
1512static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1513_mm512_srl_epi16(__m512i __A, __m128i __B) {
16151514 return (__m512i)__builtin_ia32_psrlw512((__v32hi) __A, (__v8hi) __B);
16161515}
16171516
1618static __inline__ __m512i __DEFAULT_FN_ATTRS512
1619_mm512_mask_srl_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B)
1620{
1517static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1518_mm512_mask_srl_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B) {
16211519 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
16221520 (__v32hi)_mm512_srl_epi16(__A, __B),
16231521 (__v32hi)__W);
16241522}
16251523
1626static __inline__ __m512i __DEFAULT_FN_ATTRS512
1627_mm512_maskz_srl_epi16(__mmask32 __U, __m512i __A, __m128i __B)
1628{
1524static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1525_mm512_maskz_srl_epi16(__mmask32 __U, __m512i __A, __m128i __B) {
16291526 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
16301527 (__v32hi)_mm512_srl_epi16(__A, __B),
16311528 (__v32hi)_mm512_setzero_si512());
16321529}
16331530
1634static __inline__ __m512i __DEFAULT_FN_ATTRS512
1635_mm512_srli_epi16(__m512i __A, unsigned int __B)
1636{
1531static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1532_mm512_srli_epi16(__m512i __A, unsigned int __B) {
16371533 return (__m512i)__builtin_ia32_psrlwi512((__v32hi)__A, (int)__B);
16381534}
16391535
1640static __inline__ __m512i __DEFAULT_FN_ATTRS512
1536static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
16411537_mm512_mask_srli_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1642 unsigned int __B)
1643{
1538 unsigned int __B) {
16441539 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
16451540 (__v32hi)_mm512_srli_epi16(__A, __B),
16461541 (__v32hi)__W);
16471542}
16481543
1649static __inline__ __m512i __DEFAULT_FN_ATTRS512
1650_mm512_maskz_srli_epi16(__mmask32 __U, __m512i __A, int __B)
1651{
1544static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1545_mm512_maskz_srli_epi16(__mmask32 __U, __m512i __A, int __B) {
16521546 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
16531547 (__v32hi)_mm512_srli_epi16(__A, (unsigned int)__B),
16541548 (__v32hi)_mm512_setzero_si512());
16551549}
16561550
1657#define _mm512_bsrli_epi128(a, imm) \
1658 ((__m512i)__builtin_ia32_psrldqi512_byteshift((__v8di)(__m512i)(a), (int)(imm)))
1551#define _mm512_bsrli_epi128(a, imm) \
1552 ((__m512i)__builtin_ia32_psrldqi512_byteshift((__v64qi)(__m512i)(a), \
1553 (int)(imm)))
16591554
1660static __inline__ __m512i __DEFAULT_FN_ATTRS512
1555static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
16611556_mm512_mask_mov_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
16621557{
16631558 return (__m512i) __builtin_ia32_selectw_512 ((__mmask32) __U,
......@@ -1665,23 +1560,21 @@ _mm512_mask_mov_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
16651560 (__v32hi) __W);
16661561}
16671562
1668static __inline__ __m512i __DEFAULT_FN_ATTRS512
1669_mm512_maskz_mov_epi16 (__mmask32 __U, __m512i __A)
1670{
1563static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1564_mm512_maskz_mov_epi16(__mmask32 __U, __m512i __A) {
16711565 return (__m512i) __builtin_ia32_selectw_512 ((__mmask32) __U,
16721566 (__v32hi) __A,
16731567 (__v32hi) _mm512_setzero_si512 ());
16741568}
16751569
1676static __inline__ __m512i __DEFAULT_FN_ATTRS512
1677_mm512_mask_mov_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
1678{
1570static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1571_mm512_mask_mov_epi8(__m512i __W, __mmask64 __U, __m512i __A) {
16791572 return (__m512i) __builtin_ia32_selectb_512 ((__mmask64) __U,
16801573 (__v64qi) __A,
16811574 (__v64qi) __W);
16821575}
16831576
1684static __inline__ __m512i __DEFAULT_FN_ATTRS512
1577static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
16851578_mm512_maskz_mov_epi8 (__mmask64 __U, __m512i __A)
16861579{
16871580 return (__m512i) __builtin_ia32_selectb_512 ((__mmask64) __U,
......@@ -1689,7 +1582,7 @@ _mm512_maskz_mov_epi8 (__mmask64 __U, __m512i __A)
16891582 (__v64qi) _mm512_setzero_si512 ());
16901583}
16911584
1692static __inline__ __m512i __DEFAULT_FN_ATTRS512
1585static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
16931586_mm512_mask_set1_epi8 (__m512i __O, __mmask64 __M, char __A)
16941587{
16951588 return (__m512i) __builtin_ia32_selectb_512(__M,
......@@ -1697,23 +1590,21 @@ _mm512_mask_set1_epi8 (__m512i __O, __mmask64 __M, char __A)
16971590 (__v64qi) __O);
16981591}
16991592
1700static __inline__ __m512i __DEFAULT_FN_ATTRS512
1701_mm512_maskz_set1_epi8 (__mmask64 __M, char __A)
1702{
1593static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1594_mm512_maskz_set1_epi8(__mmask64 __M, char __A) {
17031595 return (__m512i) __builtin_ia32_selectb_512(__M,
17041596 (__v64qi) _mm512_set1_epi8(__A),
17051597 (__v64qi) _mm512_setzero_si512());
17061598}
17071599
1708static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_kunpackd(__mmask64 __A,
1709 __mmask64 __B) {
1600static __inline__ __mmask64 __DEFAULT_FN_ATTRS_CONSTEXPR
1601_mm512_kunpackd(__mmask64 __A, __mmask64 __B) {
17101602 return (__mmask64) __builtin_ia32_kunpckdi ((__mmask64) __A,
17111603 (__mmask64) __B);
17121604}
17131605
1714static __inline__ __mmask32 __DEFAULT_FN_ATTRS
1715_mm512_kunpackw (__mmask32 __A, __mmask32 __B)
1716{
1606static __inline__ __mmask32 __DEFAULT_FN_ATTRS_CONSTEXPR
1607_mm512_kunpackw(__mmask32 __A, __mmask32 __B) {
17171608 return (__mmask32) __builtin_ia32_kunpcksi ((__mmask32) __A,
17181609 (__mmask32) __B);
17191610}
......@@ -1859,33 +1750,28 @@ _mm512_mask_testn_epi16_mask (__mmask32 __U, __m512i __A, __m512i __B)
18591750 _mm512_setzero_si512());
18601751}
18611752
1862static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1863_mm512_movepi8_mask (__m512i __A)
1864{
1753static __inline__ __mmask64 __DEFAULT_FN_ATTRS512_CONSTEXPR
1754_mm512_movepi8_mask(__m512i __A) {
18651755 return (__mmask64) __builtin_ia32_cvtb2mask512 ((__v64qi) __A);
18661756}
18671757
1868static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1869_mm512_movepi16_mask (__m512i __A)
1870{
1758static __inline__ __mmask32 __DEFAULT_FN_ATTRS512_CONSTEXPR
1759_mm512_movepi16_mask(__m512i __A) {
18711760 return (__mmask32) __builtin_ia32_cvtw2mask512 ((__v32hi) __A);
18721761}
18731762
1874static __inline__ __m512i __DEFAULT_FN_ATTRS512
1875_mm512_movm_epi8 (__mmask64 __A)
1876{
1763static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1764_mm512_movm_epi8(__mmask64 __A) {
18771765 return (__m512i) __builtin_ia32_cvtmask2b512 (__A);
18781766}
18791767
1880static __inline__ __m512i __DEFAULT_FN_ATTRS512
1881_mm512_movm_epi16 (__mmask32 __A)
1882{
1768static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1769_mm512_movm_epi16(__mmask32 __A) {
18831770 return (__m512i) __builtin_ia32_cvtmask2w512 (__A);
18841771}
18851772
1886static __inline__ __m512i __DEFAULT_FN_ATTRS512
1887_mm512_broadcastb_epi8 (__m128i __A)
1888{
1773static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1774_mm512_broadcastb_epi8(__m128i __A) {
18891775 return (__m512i)__builtin_shufflevector((__v16qi) __A, (__v16qi) __A,
18901776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
18911777 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -1893,7 +1779,7 @@ _mm512_broadcastb_epi8 (__m128i __A)
18931779 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
18941780}
18951781
1896static __inline__ __m512i __DEFAULT_FN_ATTRS512
1782static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
18971783_mm512_mask_broadcastb_epi8 (__m512i __O, __mmask64 __M, __m128i __A)
18981784{
18991785 return (__m512i)__builtin_ia32_selectb_512(__M,
......@@ -1901,15 +1787,14 @@ _mm512_mask_broadcastb_epi8 (__m512i __O, __mmask64 __M, __m128i __A)
19011787 (__v64qi) __O);
19021788}
19031789
1904static __inline__ __m512i __DEFAULT_FN_ATTRS512
1905_mm512_maskz_broadcastb_epi8 (__mmask64 __M, __m128i __A)
1906{
1790static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1791_mm512_maskz_broadcastb_epi8(__mmask64 __M, __m128i __A) {
19071792 return (__m512i)__builtin_ia32_selectb_512(__M,
19081793 (__v64qi) _mm512_broadcastb_epi8(__A),
19091794 (__v64qi) _mm512_setzero_si512());
19101795}
19111796
1912static __inline__ __m512i __DEFAULT_FN_ATTRS512
1797static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
19131798_mm512_mask_set1_epi16 (__m512i __O, __mmask32 __M, short __A)
19141799{
19151800 return (__m512i) __builtin_ia32_selectw_512(__M,
......@@ -1917,23 +1802,21 @@ _mm512_mask_set1_epi16 (__m512i __O, __mmask32 __M, short __A)
19171802 (__v32hi) __O);
19181803}
19191804
1920static __inline__ __m512i __DEFAULT_FN_ATTRS512
1921_mm512_maskz_set1_epi16 (__mmask32 __M, short __A)
1922{
1805static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1806_mm512_maskz_set1_epi16(__mmask32 __M, short __A) {
19231807 return (__m512i) __builtin_ia32_selectw_512(__M,
19241808 (__v32hi) _mm512_set1_epi16(__A),
19251809 (__v32hi) _mm512_setzero_si512());
19261810}
19271811
1928static __inline__ __m512i __DEFAULT_FN_ATTRS512
1929_mm512_broadcastw_epi16 (__m128i __A)
1930{
1812static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1813_mm512_broadcastw_epi16(__m128i __A) {
19311814 return (__m512i)__builtin_shufflevector((__v8hi) __A, (__v8hi) __A,
19321815 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
19331816 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
19341817}
19351818
1936static __inline__ __m512i __DEFAULT_FN_ATTRS512
1819static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
19371820_mm512_mask_broadcastw_epi16 (__m512i __O, __mmask32 __M, __m128i __A)
19381821{
19391822 return (__m512i)__builtin_ia32_selectw_512(__M,
......@@ -1941,7 +1824,7 @@ _mm512_mask_broadcastw_epi16 (__m512i __O, __mmask32 __M, __m128i __A)
19411824 (__v32hi) __O);
19421825}
19431826
1944static __inline__ __m512i __DEFAULT_FN_ATTRS512
1827static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
19451828_mm512_maskz_broadcastw_epi16 (__mmask32 __M, __m128i __A)
19461829{
19471830 return (__m512i)__builtin_ia32_selectw_512(__M,
......@@ -1949,25 +1832,21 @@ _mm512_maskz_broadcastw_epi16 (__mmask32 __M, __m128i __A)
19491832 (__v32hi) _mm512_setzero_si512());
19501833}
19511834
1952static __inline__ __m512i __DEFAULT_FN_ATTRS512
1953_mm512_permutexvar_epi16 (__m512i __A, __m512i __B)
1954{
1835static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1836_mm512_permutexvar_epi16(__m512i __A, __m512i __B) {
19551837 return (__m512i)__builtin_ia32_permvarhi512((__v32hi)__B, (__v32hi)__A);
19561838}
19571839
1958static __inline__ __m512i __DEFAULT_FN_ATTRS512
1959_mm512_maskz_permutexvar_epi16 (__mmask32 __M, __m512i __A,
1960 __m512i __B)
1961{
1840static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1841_mm512_maskz_permutexvar_epi16(__mmask32 __M, __m512i __A, __m512i __B) {
19621842 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
19631843 (__v32hi)_mm512_permutexvar_epi16(__A, __B),
19641844 (__v32hi)_mm512_setzero_si512());
19651845}
19661846
1967static __inline__ __m512i __DEFAULT_FN_ATTRS512
1968_mm512_mask_permutexvar_epi16 (__m512i __W, __mmask32 __M, __m512i __A,
1969 __m512i __B)
1970{
1847static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1848_mm512_mask_permutexvar_epi16(__m512i __W, __mmask32 __M, __m512i __A,
1849 __m512i __B) {
19711850 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
19721851 (__v32hi)_mm512_permutexvar_epi16(__A, __B),
19731852 (__v32hi)__W);
......@@ -2010,5 +1889,7 @@ _mm512_sad_epu8 (__m512i __A, __m512i __B)
20101889
20111890#undef __DEFAULT_FN_ATTRS512
20121891#undef __DEFAULT_FN_ATTRS
1892#undef __DEFAULT_FN_ATTRS512_CONSTEXPR
1893#undef __DEFAULT_FN_ATTRS_CONSTEXPR
20131894
20141895#endif
lib/include/avx512cdintrin.h+42-55
......@@ -15,109 +15,96 @@
1515#define __AVX512CDINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1819#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512cd,evex512"), __min_vector_width__(512)))
20 __attribute__((__always_inline__, __nodebug__, __target__("avx512cd"), \
21 __min_vector_width__(512))) constexpr
22#else
23#define __DEFAULT_FN_ATTRS \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx512cd"), \
25 __min_vector_width__(512)))
26#endif
2127
2228static __inline__ __m512i __DEFAULT_FN_ATTRS
23_mm512_conflict_epi64 (__m512i __A)
24{
25 return (__m512i) __builtin_ia32_vpconflictdi_512 ((__v8di) __A);
29_mm512_conflict_epi64(__m512i __A) {
30 return (__m512i)__builtin_ia32_vpconflictdi_512((__v8di)__A);
2631}
2732
2833static __inline__ __m512i __DEFAULT_FN_ATTRS
29_mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
30{
31 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
32 (__v8di)_mm512_conflict_epi64(__A),
33 (__v8di)__W);
34_mm512_mask_conflict_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
35 return (__m512i)__builtin_ia32_selectq_512(
36 (__mmask8)__U, (__v8di)_mm512_conflict_epi64(__A), (__v8di)__W);
3437}
3538
3639static __inline__ __m512i __DEFAULT_FN_ATTRS
37_mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A)
38{
40_mm512_maskz_conflict_epi64(__mmask8 __U, __m512i __A) {
3941 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
4042 (__v8di)_mm512_conflict_epi64(__A),
41 (__v8di)_mm512_setzero_si512 ());
43 (__v8di)_mm512_setzero_si512());
4244}
4345
4446static __inline__ __m512i __DEFAULT_FN_ATTRS
45_mm512_conflict_epi32 (__m512i __A)
46{
47 return (__m512i) __builtin_ia32_vpconflictsi_512 ((__v16si) __A);
47_mm512_conflict_epi32(__m512i __A) {
48 return (__m512i)__builtin_ia32_vpconflictsi_512((__v16si)__A);
4849}
4950
5051static __inline__ __m512i __DEFAULT_FN_ATTRS
51_mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
52{
53 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
54 (__v16si)_mm512_conflict_epi32(__A),
55 (__v16si)__W);
52_mm512_mask_conflict_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
53 return (__m512i)__builtin_ia32_selectd_512(
54 (__mmask16)__U, (__v16si)_mm512_conflict_epi32(__A), (__v16si)__W);
5655}
5756
5857static __inline__ __m512i __DEFAULT_FN_ATTRS
59_mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A)
60{
61 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
62 (__v16si)_mm512_conflict_epi32(__A),
63 (__v16si)_mm512_setzero_si512());
58_mm512_maskz_conflict_epi32(__mmask16 __U, __m512i __A) {
59 return (__m512i)__builtin_ia32_selectd_512(
60 (__mmask16)__U, (__v16si)_mm512_conflict_epi32(__A),
61 (__v16si)_mm512_setzero_si512());
6462}
6563
66static __inline__ __m512i __DEFAULT_FN_ATTRS
67_mm512_lzcnt_epi32 (__m512i __A)
68{
69 return (__m512i) __builtin_ia32_vplzcntd_512 ((__v16si) __A);
64static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_lzcnt_epi32(__m512i __A) {
65 return (__m512i)__builtin_elementwise_clzg((__v16si)__A,
66 (__v16si)_mm512_set1_epi32(32));
7067}
7168
7269static __inline__ __m512i __DEFAULT_FN_ATTRS
73_mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
74{
75 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
76 (__v16si)_mm512_lzcnt_epi32(__A),
77 (__v16si)__W);
70_mm512_mask_lzcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
71 return (__m512i)__builtin_ia32_selectd_512(
72 (__mmask16)__U, (__v16si)_mm512_lzcnt_epi32(__A), (__v16si)__W);
7873}
7974
8075static __inline__ __m512i __DEFAULT_FN_ATTRS
81_mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A)
82{
76_mm512_maskz_lzcnt_epi32(__mmask16 __U, __m512i __A) {
8377 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
8478 (__v16si)_mm512_lzcnt_epi32(__A),
8579 (__v16si)_mm512_setzero_si512());
8680}
8781
88static __inline__ __m512i __DEFAULT_FN_ATTRS
89_mm512_lzcnt_epi64 (__m512i __A)
90{
91 return (__m512i) __builtin_ia32_vplzcntq_512 ((__v8di) __A);
82static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_lzcnt_epi64(__m512i __A) {
83 return (__m512i)__builtin_elementwise_clzg(
84 (__v8di)__A, (__v8di)_mm512_set1_epi64((long long)64));
9285}
9386
9487static __inline__ __m512i __DEFAULT_FN_ATTRS
95_mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
96{
97 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
98 (__v8di)_mm512_lzcnt_epi64(__A),
99 (__v8di)__W);
88_mm512_mask_lzcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
89 return (__m512i)__builtin_ia32_selectq_512(
90 (__mmask8)__U, (__v8di)_mm512_lzcnt_epi64(__A), (__v8di)__W);
10091}
10192
10293static __inline__ __m512i __DEFAULT_FN_ATTRS
103_mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A)
104{
94_mm512_maskz_lzcnt_epi64(__mmask8 __U, __m512i __A) {
10595 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
10696 (__v8di)_mm512_lzcnt_epi64(__A),
10797 (__v8di)_mm512_setzero_si512());
10898}
10999
110100static __inline__ __m512i __DEFAULT_FN_ATTRS
111_mm512_broadcastmb_epi64 (__mmask8 __A)
112{
113 return (__m512i) _mm512_set1_epi64((long long) __A);
101_mm512_broadcastmb_epi64(__mmask8 __A) {
102 return (__m512i)_mm512_set1_epi64((long long)__A);
114103}
115104
116105static __inline__ __m512i __DEFAULT_FN_ATTRS
117_mm512_broadcastmw_epi32 (__mmask16 __A)
118{
119 return (__m512i) _mm512_set1_epi32((int) __A);
120
106_mm512_broadcastmw_epi32(__mmask16 __A) {
107 return (__m512i)_mm512_set1_epi32((int)__A);
121108}
122109
123110#undef __DEFAULT_FN_ATTRS
lib/include/avx512dqintrin.h+132-161
......@@ -15,110 +15,105 @@
1515#define __AVX512DQINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#define __DEFAULT_FN_ATTRS512 __attribute__((__always_inline__, __nodebug__, __target__("avx512dq,evex512"), __min_vector_width__(512)))
18#define __DEFAULT_FN_ATTRS512 \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx512dq"), \
20 __min_vector_width__(512)))
1921#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("avx512dq,no-evex512")))
22 __attribute__((__always_inline__, __nodebug__, __target__("avx512dq")))
23
24#if defined(__cplusplus) && (__cplusplus >= 201103L)
25#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
26#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
27#else
28#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
29#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
30#endif
2231
23static __inline __mmask8 __DEFAULT_FN_ATTRS
24_knot_mask8(__mmask8 __M)
25{
32static __inline __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
33_knot_mask8(__mmask8 __M) {
2634 return __builtin_ia32_knotqi(__M);
2735}
2836
29static __inline__ __mmask8 __DEFAULT_FN_ATTRS
30_kand_mask8(__mmask8 __A, __mmask8 __B)
31{
37static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
38_kand_mask8(__mmask8 __A, __mmask8 __B) {
3239 return (__mmask8)__builtin_ia32_kandqi((__mmask8)__A, (__mmask8)__B);
3340}
3441
35static __inline__ __mmask8 __DEFAULT_FN_ATTRS
36_kandn_mask8(__mmask8 __A, __mmask8 __B)
37{
42static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
43_kandn_mask8(__mmask8 __A, __mmask8 __B) {
3844 return (__mmask8)__builtin_ia32_kandnqi((__mmask8)__A, (__mmask8)__B);
3945}
4046
41static __inline__ __mmask8 __DEFAULT_FN_ATTRS
42_kor_mask8(__mmask8 __A, __mmask8 __B)
43{
47static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
48_kor_mask8(__mmask8 __A, __mmask8 __B) {
4449 return (__mmask8)__builtin_ia32_korqi((__mmask8)__A, (__mmask8)__B);
4550}
4651
47static __inline__ __mmask8 __DEFAULT_FN_ATTRS
48_kxnor_mask8(__mmask8 __A, __mmask8 __B)
49{
52static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
53_kxnor_mask8(__mmask8 __A, __mmask8 __B) {
5054 return (__mmask8)__builtin_ia32_kxnorqi((__mmask8)__A, (__mmask8)__B);
5155}
5256
53static __inline__ __mmask8 __DEFAULT_FN_ATTRS
54_kxor_mask8(__mmask8 __A, __mmask8 __B)
55{
57static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
58_kxor_mask8(__mmask8 __A, __mmask8 __B) {
5659 return (__mmask8)__builtin_ia32_kxorqi((__mmask8)__A, (__mmask8)__B);
5760}
5861
59static __inline__ unsigned char __DEFAULT_FN_ATTRS
60_kortestc_mask8_u8(__mmask8 __A, __mmask8 __B)
61{
62static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
63_kortestc_mask8_u8(__mmask8 __A, __mmask8 __B) {
6264 return (unsigned char)__builtin_ia32_kortestcqi(__A, __B);
6365}
6466
65static __inline__ unsigned char __DEFAULT_FN_ATTRS
66_kortestz_mask8_u8(__mmask8 __A, __mmask8 __B)
67{
67static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
68_kortestz_mask8_u8(__mmask8 __A, __mmask8 __B) {
6869 return (unsigned char)__builtin_ia32_kortestzqi(__A, __B);
6970}
7071
71static __inline__ unsigned char __DEFAULT_FN_ATTRS
72static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
7273_kortest_mask8_u8(__mmask8 __A, __mmask8 __B, unsigned char *__C) {
7374 *__C = (unsigned char)__builtin_ia32_kortestcqi(__A, __B);
7475 return (unsigned char)__builtin_ia32_kortestzqi(__A, __B);
7576}
7677
77static __inline__ unsigned char __DEFAULT_FN_ATTRS
78_ktestc_mask8_u8(__mmask8 __A, __mmask8 __B)
79{
78static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
79_ktestc_mask8_u8(__mmask8 __A, __mmask8 __B) {
8080 return (unsigned char)__builtin_ia32_ktestcqi(__A, __B);
8181}
8282
83static __inline__ unsigned char __DEFAULT_FN_ATTRS
84_ktestz_mask8_u8(__mmask8 __A, __mmask8 __B)
85{
83static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
84_ktestz_mask8_u8(__mmask8 __A, __mmask8 __B) {
8685 return (unsigned char)__builtin_ia32_ktestzqi(__A, __B);
8786}
8887
89static __inline__ unsigned char __DEFAULT_FN_ATTRS
88static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
9089_ktest_mask8_u8(__mmask8 __A, __mmask8 __B, unsigned char *__C) {
9190 *__C = (unsigned char)__builtin_ia32_ktestcqi(__A, __B);
9291 return (unsigned char)__builtin_ia32_ktestzqi(__A, __B);
9392}
9493
95static __inline__ unsigned char __DEFAULT_FN_ATTRS
96_ktestc_mask16_u8(__mmask16 __A, __mmask16 __B)
97{
94static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
95_ktestc_mask16_u8(__mmask16 __A, __mmask16 __B) {
9896 return (unsigned char)__builtin_ia32_ktestchi(__A, __B);
9997}
10098
101static __inline__ unsigned char __DEFAULT_FN_ATTRS
102_ktestz_mask16_u8(__mmask16 __A, __mmask16 __B)
103{
99static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
100_ktestz_mask16_u8(__mmask16 __A, __mmask16 __B) {
104101 return (unsigned char)__builtin_ia32_ktestzhi(__A, __B);
105102}
106103
107static __inline__ unsigned char __DEFAULT_FN_ATTRS
104static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
108105_ktest_mask16_u8(__mmask16 __A, __mmask16 __B, unsigned char *__C) {
109106 *__C = (unsigned char)__builtin_ia32_ktestchi(__A, __B);
110107 return (unsigned char)__builtin_ia32_ktestzhi(__A, __B);
111108}
112109
113static __inline__ __mmask8 __DEFAULT_FN_ATTRS
114_kadd_mask8(__mmask8 __A, __mmask8 __B)
115{
110static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
111_kadd_mask8(__mmask8 __A, __mmask8 __B) {
116112 return (__mmask8)__builtin_ia32_kaddqi((__mmask8)__A, (__mmask8)__B);
117113}
118114
119static __inline__ __mmask16 __DEFAULT_FN_ATTRS
120_kadd_mask16(__mmask16 __A, __mmask16 __B)
121{
115static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
116_kadd_mask16(__mmask16 __A, __mmask16 __B) {
122117 return (__mmask16)__builtin_ia32_kaddhi((__mmask16)__A, (__mmask16)__B);
123118}
124119
......@@ -128,12 +123,12 @@ _kadd_mask16(__mmask16 __A, __mmask16 __B)
128123#define _kshiftri_mask8(A, I) \
129124 ((__mmask8)__builtin_ia32_kshiftriqi((__mmask8)(A), (unsigned int)(I)))
130125
131static __inline__ unsigned int __DEFAULT_FN_ATTRS
132_cvtmask8_u32(__mmask8 __A) {
126static __inline__ unsigned int
127 __DEFAULT_FN_ATTRS_CONSTEXPR _cvtmask8_u32(__mmask8 __A) {
133128 return (unsigned int)__builtin_ia32_kmovb((__mmask8)__A);
134129}
135130
136static __inline__ __mmask8 __DEFAULT_FN_ATTRS
131static __inline__ __mmask8 __DEFAULT_FN_ATTRS_CONSTEXPR
137132_cvtu32_mask8(unsigned int __A) {
138133 return (__mmask8)__builtin_ia32_kmovb((__mmask8)__A);
139134}
......@@ -148,26 +143,26 @@ _store_mask8(__mmask8 *__A, __mmask8 __B) {
148143 *(__mmask8 *)__A = __builtin_ia32_kmovb((__mmask8)__B);
149144}
150145
151static __inline__ __m512i __DEFAULT_FN_ATTRS512
152_mm512_mullo_epi64 (__m512i __A, __m512i __B) {
146static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
147_mm512_mullo_epi64(__m512i __A, __m512i __B) {
153148 return (__m512i) ((__v8du) __A * (__v8du) __B);
154149}
155150
156static __inline__ __m512i __DEFAULT_FN_ATTRS512
151static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
157152_mm512_mask_mullo_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
158153 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
159154 (__v8di)_mm512_mullo_epi64(__A, __B),
160155 (__v8di)__W);
161156}
162157
163static __inline__ __m512i __DEFAULT_FN_ATTRS512
158static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
164159_mm512_maskz_mullo_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
165160 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
166161 (__v8di)_mm512_mullo_epi64(__A, __B),
167162 (__v8di)_mm512_setzero_si512());
168163}
169164
170static __inline__ __m512d __DEFAULT_FN_ATTRS512
165static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
171166_mm512_xor_pd(__m512d __A, __m512d __B) {
172167 return (__m512d)((__v8du)__A ^ (__v8du)__B);
173168}
......@@ -186,7 +181,7 @@ _mm512_maskz_xor_pd(__mmask8 __U, __m512d __A, __m512d __B) {
186181 (__v8df)_mm512_setzero_pd());
187182}
188183
189static __inline__ __m512 __DEFAULT_FN_ATTRS512
184static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
190185_mm512_xor_ps (__m512 __A, __m512 __B) {
191186 return (__m512)((__v16su)__A ^ (__v16su)__B);
192187}
......@@ -205,7 +200,7 @@ _mm512_maskz_xor_ps(__mmask16 __U, __m512 __A, __m512 __B) {
205200 (__v16sf)_mm512_setzero_ps());
206201}
207202
208static __inline__ __m512d __DEFAULT_FN_ATTRS512
203static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
209204_mm512_or_pd(__m512d __A, __m512d __B) {
210205 return (__m512d)((__v8du)__A | (__v8du)__B);
211206}
......@@ -224,7 +219,7 @@ _mm512_maskz_or_pd(__mmask8 __U, __m512d __A, __m512d __B) {
224219 (__v8df)_mm512_setzero_pd());
225220}
226221
227static __inline__ __m512 __DEFAULT_FN_ATTRS512
222static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
228223_mm512_or_ps(__m512 __A, __m512 __B) {
229224 return (__m512)((__v16su)__A | (__v16su)__B);
230225}
......@@ -243,7 +238,7 @@ _mm512_maskz_or_ps(__mmask16 __U, __m512 __A, __m512 __B) {
243238 (__v16sf)_mm512_setzero_ps());
244239}
245240
246static __inline__ __m512d __DEFAULT_FN_ATTRS512
241static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
247242_mm512_and_pd(__m512d __A, __m512d __B) {
248243 return (__m512d)((__v8du)__A & (__v8du)__B);
249244}
......@@ -262,7 +257,7 @@ _mm512_maskz_and_pd(__mmask8 __U, __m512d __A, __m512d __B) {
262257 (__v8df)_mm512_setzero_pd());
263258}
264259
265static __inline__ __m512 __DEFAULT_FN_ATTRS512
260static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
266261_mm512_and_ps(__m512 __A, __m512 __B) {
267262 return (__m512)((__v16su)__A & (__v16su)__B);
268263}
......@@ -281,7 +276,7 @@ _mm512_maskz_and_ps(__mmask16 __U, __m512 __A, __m512 __B) {
281276 (__v16sf)_mm512_setzero_ps());
282277}
283278
284static __inline__ __m512d __DEFAULT_FN_ATTRS512
279static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
285280_mm512_andnot_pd(__m512d __A, __m512d __B) {
286281 return (__m512d)(~(__v8du)__A & (__v8du)__B);
287282}
......@@ -300,7 +295,7 @@ _mm512_maskz_andnot_pd(__mmask8 __U, __m512d __A, __m512d __B) {
300295 (__v8df)_mm512_setzero_pd());
301296}
302297
303static __inline__ __m512 __DEFAULT_FN_ATTRS512
298static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
304299_mm512_andnot_ps(__m512 __A, __m512 __B) {
305300 return (__m512)(~(__v16su)__A & (__v16su)__B);
306301}
......@@ -475,21 +470,20 @@ _mm512_maskz_cvtps_epu64 (__mmask8 __U, __m256 __A) {
475470 (__v8di)_mm512_setzero_si512(), \
476471 (__mmask8)(U), (int)(R)))
477472
478
479static __inline__ __m512d __DEFAULT_FN_ATTRS512
480_mm512_cvtepi64_pd (__m512i __A) {
473static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
474_mm512_cvtepi64_pd(__m512i __A) {
481475 return (__m512d)__builtin_convertvector((__v8di)__A, __v8df);
482476}
483477
484static __inline__ __m512d __DEFAULT_FN_ATTRS512
485_mm512_mask_cvtepi64_pd (__m512d __W, __mmask8 __U, __m512i __A) {
478static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
479_mm512_mask_cvtepi64_pd(__m512d __W, __mmask8 __U, __m512i __A) {
486480 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
487481 (__v8df)_mm512_cvtepi64_pd(__A),
488482 (__v8df)__W);
489483}
490484
491static __inline__ __m512d __DEFAULT_FN_ATTRS512
492_mm512_maskz_cvtepi64_pd (__mmask8 __U, __m512i __A) {
485static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
486_mm512_maskz_cvtepi64_pd(__mmask8 __U, __m512i __A) {
493487 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
494488 (__v8df)_mm512_cvtepi64_pd(__A),
495489 (__v8df)_mm512_setzero_pd());
......@@ -706,20 +700,20 @@ _mm512_maskz_cvttps_epu64 (__mmask8 __U, __m256 __A) {
706700 (__v8di)_mm512_setzero_si512(), \
707701 (__mmask8)(U), (int)(R)))
708702
709static __inline__ __m512d __DEFAULT_FN_ATTRS512
710_mm512_cvtepu64_pd (__m512i __A) {
703static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
704_mm512_cvtepu64_pd(__m512i __A) {
711705 return (__m512d)__builtin_convertvector((__v8du)__A, __v8df);
712706}
713707
714static __inline__ __m512d __DEFAULT_FN_ATTRS512
715_mm512_mask_cvtepu64_pd (__m512d __W, __mmask8 __U, __m512i __A) {
708static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
709_mm512_mask_cvtepu64_pd(__m512d __W, __mmask8 __U, __m512i __A) {
716710 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
717711 (__v8df)_mm512_cvtepu64_pd(__A),
718712 (__v8df)__W);
719713}
720714
721static __inline__ __m512d __DEFAULT_FN_ATTRS512
722_mm512_maskz_cvtepu64_pd (__mmask8 __U, __m512i __A) {
715static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
716_mm512_maskz_cvtepu64_pd(__mmask8 __U, __m512i __A) {
723717 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
724718 (__v8df)_mm512_cvtepu64_pd(__A),
725719 (__v8df)_mm512_setzero_pd());
......@@ -1052,177 +1046,154 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U, __m512i __A) {
10521046 (__v2df)_mm_setzero_pd(), \
10531047 (__mmask8)(U), (int)(C), (int)(R)))
10541048
1055static __inline__ __mmask16 __DEFAULT_FN_ATTRS512
1056_mm512_movepi32_mask (__m512i __A)
1057{
1049static __inline__ __mmask16
1050 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_movepi32_mask(__m512i __A) {
10581051 return (__mmask16) __builtin_ia32_cvtd2mask512 ((__v16si) __A);
10591052}
10601053
1061static __inline__ __m512i __DEFAULT_FN_ATTRS512
1062_mm512_movm_epi32 (__mmask16 __A)
1063{
1054static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1055_mm512_movm_epi32(__mmask16 __A) {
10641056 return (__m512i) __builtin_ia32_cvtmask2d512 (__A);
10651057}
10661058
1067static __inline__ __m512i __DEFAULT_FN_ATTRS512
1068_mm512_movm_epi64 (__mmask8 __A)
1069{
1059static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1060_mm512_movm_epi64(__mmask8 __A) {
10701061 return (__m512i) __builtin_ia32_cvtmask2q512 (__A);
10711062}
10721063
1073static __inline__ __mmask8 __DEFAULT_FN_ATTRS512
1074_mm512_movepi64_mask (__m512i __A)
1075{
1064static __inline__ __mmask8 __DEFAULT_FN_ATTRS512_CONSTEXPR
1065_mm512_movepi64_mask(__m512i __A) {
10761066 return (__mmask8) __builtin_ia32_cvtq2mask512 ((__v8di) __A);
10771067}
10781068
1079
1080static __inline__ __m512 __DEFAULT_FN_ATTRS512
1081_mm512_broadcast_f32x2 (__m128 __A)
1082{
1069static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1070_mm512_broadcast_f32x2(__m128 __A) {
10831071 return (__m512)__builtin_shufflevector((__v4sf)__A, (__v4sf)__A,
10841072 0, 1, 0, 1, 0, 1, 0, 1,
10851073 0, 1, 0, 1, 0, 1, 0, 1);
10861074}
10871075
1088static __inline__ __m512 __DEFAULT_FN_ATTRS512
1089_mm512_mask_broadcast_f32x2 (__m512 __O, __mmask16 __M, __m128 __A)
1090{
1076static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1077_mm512_mask_broadcast_f32x2(__m512 __O, __mmask16 __M, __m128 __A) {
10911078 return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
10921079 (__v16sf)_mm512_broadcast_f32x2(__A),
10931080 (__v16sf)__O);
10941081}
10951082
1096static __inline__ __m512 __DEFAULT_FN_ATTRS512
1097_mm512_maskz_broadcast_f32x2 (__mmask16 __M, __m128 __A)
1098{
1083static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1084_mm512_maskz_broadcast_f32x2(__mmask16 __M, __m128 __A) {
10991085 return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
11001086 (__v16sf)_mm512_broadcast_f32x2(__A),
11011087 (__v16sf)_mm512_setzero_ps());
11021088}
11031089
1104static __inline__ __m512 __DEFAULT_FN_ATTRS512
1105_mm512_broadcast_f32x8(__m256 __A)
1106{
1090static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1091_mm512_broadcast_f32x8(__m256 __A) {
11071092 return (__m512)__builtin_shufflevector((__v8sf)__A, (__v8sf)__A,
11081093 0, 1, 2, 3, 4, 5, 6, 7,
11091094 0, 1, 2, 3, 4, 5, 6, 7);
11101095}
11111096
1112static __inline__ __m512 __DEFAULT_FN_ATTRS512
1113_mm512_mask_broadcast_f32x8(__m512 __O, __mmask16 __M, __m256 __A)
1114{
1097static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1098_mm512_mask_broadcast_f32x8(__m512 __O, __mmask16 __M, __m256 __A) {
11151099 return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
11161100 (__v16sf)_mm512_broadcast_f32x8(__A),
11171101 (__v16sf)__O);
11181102}
11191103
1120static __inline__ __m512 __DEFAULT_FN_ATTRS512
1121_mm512_maskz_broadcast_f32x8(__mmask16 __M, __m256 __A)
1122{
1104static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1105_mm512_maskz_broadcast_f32x8(__mmask16 __M, __m256 __A) {
11231106 return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
11241107 (__v16sf)_mm512_broadcast_f32x8(__A),
11251108 (__v16sf)_mm512_setzero_ps());
11261109}
11271110
1128static __inline__ __m512d __DEFAULT_FN_ATTRS512
1129_mm512_broadcast_f64x2(__m128d __A)
1130{
1111static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
1112_mm512_broadcast_f64x2(__m128d __A) {
11311113 return (__m512d)__builtin_shufflevector((__v2df)__A, (__v2df)__A,
11321114 0, 1, 0, 1, 0, 1, 0, 1);
11331115}
11341116
1135static __inline__ __m512d __DEFAULT_FN_ATTRS512
1136_mm512_mask_broadcast_f64x2(__m512d __O, __mmask8 __M, __m128d __A)
1137{
1117static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
1118_mm512_mask_broadcast_f64x2(__m512d __O, __mmask8 __M, __m128d __A) {
11381119 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__M,
11391120 (__v8df)_mm512_broadcast_f64x2(__A),
11401121 (__v8df)__O);
11411122}
11421123
1143static __inline__ __m512d __DEFAULT_FN_ATTRS512
1144_mm512_maskz_broadcast_f64x2(__mmask8 __M, __m128d __A)
1145{
1124static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
1125_mm512_maskz_broadcast_f64x2(__mmask8 __M, __m128d __A) {
11461126 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__M,
11471127 (__v8df)_mm512_broadcast_f64x2(__A),
11481128 (__v8df)_mm512_setzero_pd());
11491129}
11501130
1151static __inline__ __m512i __DEFAULT_FN_ATTRS512
1152_mm512_broadcast_i32x2 (__m128i __A)
1153{
1131static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1132_mm512_broadcast_i32x2(__m128i __A) {
11541133 return (__m512i)__builtin_shufflevector((__v4si)__A, (__v4si)__A,
11551134 0, 1, 0, 1, 0, 1, 0, 1,
11561135 0, 1, 0, 1, 0, 1, 0, 1);
11571136}
11581137
1159static __inline__ __m512i __DEFAULT_FN_ATTRS512
1160_mm512_mask_broadcast_i32x2 (__m512i __O, __mmask16 __M, __m128i __A)
1161{
1138static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1139_mm512_mask_broadcast_i32x2(__m512i __O, __mmask16 __M, __m128i __A) {
11621140 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11631141 (__v16si)_mm512_broadcast_i32x2(__A),
11641142 (__v16si)__O);
11651143}
11661144
1167static __inline__ __m512i __DEFAULT_FN_ATTRS512
1168_mm512_maskz_broadcast_i32x2 (__mmask16 __M, __m128i __A)
1169{
1145static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1146_mm512_maskz_broadcast_i32x2(__mmask16 __M, __m128i __A) {
11701147 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11711148 (__v16si)_mm512_broadcast_i32x2(__A),
11721149 (__v16si)_mm512_setzero_si512());
11731150}
11741151
1175static __inline__ __m512i __DEFAULT_FN_ATTRS512
1176_mm512_broadcast_i32x8(__m256i __A)
1177{
1152static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1153_mm512_broadcast_i32x8(__m256i __A) {
11781154 return (__m512i)__builtin_shufflevector((__v8si)__A, (__v8si)__A,
11791155 0, 1, 2, 3, 4, 5, 6, 7,
11801156 0, 1, 2, 3, 4, 5, 6, 7);
11811157}
11821158
1183static __inline__ __m512i __DEFAULT_FN_ATTRS512
1184_mm512_mask_broadcast_i32x8(__m512i __O, __mmask16 __M, __m256i __A)
1185{
1159static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1160_mm512_mask_broadcast_i32x8(__m512i __O, __mmask16 __M, __m256i __A) {
11861161 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11871162 (__v16si)_mm512_broadcast_i32x8(__A),
11881163 (__v16si)__O);
11891164}
11901165
1191static __inline__ __m512i __DEFAULT_FN_ATTRS512
1192_mm512_maskz_broadcast_i32x8(__mmask16 __M, __m256i __A)
1193{
1166static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1167_mm512_maskz_broadcast_i32x8(__mmask16 __M, __m256i __A) {
11941168 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11951169 (__v16si)_mm512_broadcast_i32x8(__A),
11961170 (__v16si)_mm512_setzero_si512());
11971171}
11981172
1199static __inline__ __m512i __DEFAULT_FN_ATTRS512
1200_mm512_broadcast_i64x2(__m128i __A)
1201{
1173static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1174_mm512_broadcast_i64x2(__m128i __A) {
12021175 return (__m512i)__builtin_shufflevector((__v2di)__A, (__v2di)__A,
12031176 0, 1, 0, 1, 0, 1, 0, 1);
12041177}
12051178
1206static __inline__ __m512i __DEFAULT_FN_ATTRS512
1207_mm512_mask_broadcast_i64x2(__m512i __O, __mmask8 __M, __m128i __A)
1208{
1179static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1180_mm512_mask_broadcast_i64x2(__m512i __O, __mmask8 __M, __m128i __A) {
12091181 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
12101182 (__v8di)_mm512_broadcast_i64x2(__A),
12111183 (__v8di)__O);
12121184}
12131185
1214static __inline__ __m512i __DEFAULT_FN_ATTRS512
1215_mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A)
1216{
1186static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1187_mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A) {
12171188 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
12181189 (__v8di)_mm512_broadcast_i64x2(__A),
12191190 (__v8di)_mm512_setzero_si512());
12201191}
12211192
1222#define _mm512_extractf32x8_ps(A, imm) \
1223 ((__m256)__builtin_ia32_extractf32x8_mask((__v16sf)(__m512)(A), (int)(imm), \
1224 (__v8sf)_mm256_undefined_ps(), \
1225 (__mmask8)-1))
1193#define _mm512_extractf32x8_ps(A, imm) \
1194 ((__m256)__builtin_ia32_extractf32x8_mask((__v16sf)(__m512)(A), (int)(imm), \
1195 (__v8sf)_mm256_setzero_ps(), \
1196 (__mmask8) - 1))
12261197
12271198#define _mm512_mask_extractf32x8_ps(W, U, A, imm) \
12281199 ((__m256)__builtin_ia32_extractf32x8_mask((__v16sf)(__m512)(A), (int)(imm), \
......@@ -1234,11 +1205,10 @@ _mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A)
12341205 (__v8sf)_mm256_setzero_ps(), \
12351206 (__mmask8)(U)))
12361207
1237#define _mm512_extractf64x2_pd(A, imm) \
1238 ((__m128d)__builtin_ia32_extractf64x2_512_mask((__v8df)(__m512d)(A), \
1239 (int)(imm), \
1240 (__v2df)_mm_undefined_pd(), \
1241 (__mmask8)-1))
1208#define _mm512_extractf64x2_pd(A, imm) \
1209 ((__m128d)__builtin_ia32_extractf64x2_512_mask( \
1210 (__v8df)(__m512d)(A), (int)(imm), (__v2df)_mm_setzero_pd(), \
1211 (__mmask8) - 1))
12421212
12431213#define _mm512_mask_extractf64x2_pd(W, U, A, imm) \
12441214 ((__m128d)__builtin_ia32_extractf64x2_512_mask((__v8df)(__m512d)(A), \
......@@ -1252,10 +1222,10 @@ _mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A)
12521222 (__v2df)_mm_setzero_pd(), \
12531223 (__mmask8)(U)))
12541224
1255#define _mm512_extracti32x8_epi32(A, imm) \
1256 ((__m256i)__builtin_ia32_extracti32x8_mask((__v16si)(__m512i)(A), (int)(imm), \
1257 (__v8si)_mm256_undefined_si256(), \
1258 (__mmask8)-1))
1225#define _mm512_extracti32x8_epi32(A, imm) \
1226 ((__m256i)__builtin_ia32_extracti32x8_mask( \
1227 (__v16si)(__m512i)(A), (int)(imm), (__v8si)_mm256_setzero_si256(), \
1228 (__mmask8) - 1))
12591229
12601230#define _mm512_mask_extracti32x8_epi32(W, U, A, imm) \
12611231 ((__m256i)__builtin_ia32_extracti32x8_mask((__v16si)(__m512i)(A), (int)(imm), \
......@@ -1267,11 +1237,10 @@ _mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A)
12671237 (__v8si)_mm256_setzero_si256(), \
12681238 (__mmask8)(U)))
12691239
1270#define _mm512_extracti64x2_epi64(A, imm) \
1271 ((__m128i)__builtin_ia32_extracti64x2_512_mask((__v8di)(__m512i)(A), \
1272 (int)(imm), \
1273 (__v2di)_mm_undefined_si128(), \
1274 (__mmask8)-1))
1240#define _mm512_extracti64x2_epi64(A, imm) \
1241 ((__m128i)__builtin_ia32_extracti64x2_512_mask( \
1242 (__v8di)(__m512i)(A), (int)(imm), (__v2di)_mm_setzero_si128(), \
1243 (__mmask8) - 1))
12751244
12761245#define _mm512_mask_extracti64x2_epi64(W, U, A, imm) \
12771246 ((__m128i)__builtin_ia32_extracti64x2_512_mask((__v8di)(__m512i)(A), \
......@@ -1375,5 +1344,7 @@ _mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A)
13751344
13761345#undef __DEFAULT_FN_ATTRS512
13771346#undef __DEFAULT_FN_ATTRS
1347#undef __DEFAULT_FN_ATTRS512_CONSTEXPR
1348#undef __DEFAULT_FN_ATTRS_CONSTEXPR
13781349
13791350#endif
lib/include/avx512fintrin.h+1015-1424
......@@ -167,22 +167,23 @@ typedef enum
167167} _MM_MANTISSA_SIGN_ENUM;
168168
169169/* Define the default attributes for the functions in this file. */
170#define __DEFAULT_FN_ATTRS512 __attribute__((__always_inline__, __nodebug__, __target__("avx512f,evex512"), __min_vector_width__(512)))
170#define __DEFAULT_FN_ATTRS512 \
171 __attribute__((__always_inline__, __nodebug__, __target__("avx512f"), \
172 __min_vector_width__(512)))
171173#define __DEFAULT_FN_ATTRS128 \
172 __attribute__((__always_inline__, __nodebug__, \
173 __target__("avx512f,no-evex512"), __min_vector_width__(128)))
174 __attribute__((__always_inline__, __nodebug__, __target__("avx512f"), \
175 __min_vector_width__(128)))
174176#define __DEFAULT_FN_ATTRS \
175 __attribute__((__always_inline__, __nodebug__, \
176 __target__("avx512f,no-evex512")))
177 __attribute__((__always_inline__, __nodebug__, __target__("avx512f")))
177178
178179#if defined(__cplusplus) && (__cplusplus >= 201103L)
179180#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
180181#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
181182#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
182183#else
183#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS128
184#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
184185#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
185#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS
186#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
186187#endif
187188
188189/* Create vectors with repeated elements */
......@@ -206,9 +207,7 @@ _mm512_undefined(void)
206207 return (__m512)__builtin_ia32_undef512();
207208}
208209
209static __inline__ __m512 __DEFAULT_FN_ATTRS512
210_mm512_undefined_ps(void)
211{
210static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_undefined_ps(void) {
212211 return (__m512)__builtin_ia32_undef512();
213212}
214213
......@@ -218,48 +217,40 @@ _mm512_undefined_epi32(void)
218217 return (__m512i)__builtin_ia32_undef512();
219218}
220219
221static __inline__ __m512i __DEFAULT_FN_ATTRS512
222_mm512_broadcastd_epi32 (__m128i __A)
223{
220static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
221_mm512_broadcastd_epi32(__m128i __A) {
224222 return (__m512i)__builtin_shufflevector((__v4si) __A, (__v4si) __A,
225223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
226224}
227225
228static __inline__ __m512i __DEFAULT_FN_ATTRS512
229_mm512_mask_broadcastd_epi32 (__m512i __O, __mmask16 __M, __m128i __A)
230{
226static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
227_mm512_mask_broadcastd_epi32(__m512i __O, __mmask16 __M, __m128i __A) {
231228 return (__m512i)__builtin_ia32_selectd_512(__M,
232229 (__v16si) _mm512_broadcastd_epi32(__A),
233230 (__v16si) __O);
234231}
235232
236static __inline__ __m512i __DEFAULT_FN_ATTRS512
237_mm512_maskz_broadcastd_epi32 (__mmask16 __M, __m128i __A)
238{
233static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
234_mm512_maskz_broadcastd_epi32(__mmask16 __M, __m128i __A) {
239235 return (__m512i)__builtin_ia32_selectd_512(__M,
240236 (__v16si) _mm512_broadcastd_epi32(__A),
241237 (__v16si) _mm512_setzero_si512());
242238}
243239
244static __inline__ __m512i __DEFAULT_FN_ATTRS512
245_mm512_broadcastq_epi64 (__m128i __A)
246{
240static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
241_mm512_broadcastq_epi64(__m128i __A) {
247242 return (__m512i)__builtin_shufflevector((__v2di) __A, (__v2di) __A,
248243 0, 0, 0, 0, 0, 0, 0, 0);
249244}
250245
251static __inline__ __m512i __DEFAULT_FN_ATTRS512
252_mm512_mask_broadcastq_epi64 (__m512i __O, __mmask8 __M, __m128i __A)
253{
254 return (__m512i)__builtin_ia32_selectq_512(__M,
255 (__v8di) _mm512_broadcastq_epi64(__A),
256 (__v8di) __O);
257
246static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
247_mm512_mask_broadcastq_epi64(__m512i __O, __mmask8 __M, __m128i __A) {
248 return (__m512i)__builtin_ia32_selectq_512(
249 __M, (__v8di)_mm512_broadcastq_epi64(__A), (__v8di)__O);
258250}
259251
260static __inline__ __m512i __DEFAULT_FN_ATTRS512
261_mm512_maskz_broadcastq_epi64 (__mmask8 __M, __m128i __A)
262{
252static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
253_mm512_maskz_broadcastq_epi64(__mmask8 __M, __m128i __A) {
263254 return (__m512i)__builtin_ia32_selectq_512(__M,
264255 (__v8di) _mm512_broadcastq_epi64(__A),
265256 (__v8di) _mm512_setzero_si512());
......@@ -277,20 +268,20 @@ _mm512_setzero_pd(void) {
277268 return __extension__(__m512d){0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
278269}
279270
280static __inline __m512 __DEFAULT_FN_ATTRS512
271static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
281272_mm512_set1_ps(float __w)
282273{
283274 return __extension__ (__m512){ __w, __w, __w, __w, __w, __w, __w, __w,
284275 __w, __w, __w, __w, __w, __w, __w, __w };
285276}
286277
287static __inline __m512d __DEFAULT_FN_ATTRS512
278static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
288279_mm512_set1_pd(double __w)
289280{
290281 return __extension__ (__m512d){ __w, __w, __w, __w, __w, __w, __w, __w };
291282}
292283
293static __inline __m512i __DEFAULT_FN_ATTRS512
284static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
294285_mm512_set1_epi8(char __w)
295286{
296287 return __extension__ (__m512i)(__v64qi){
......@@ -304,7 +295,7 @@ _mm512_set1_epi8(char __w)
304295 __w, __w, __w, __w, __w, __w, __w, __w };
305296}
306297
307static __inline __m512i __DEFAULT_FN_ATTRS512
298static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
308299_mm512_set1_epi16(short __w)
309300{
310301 return __extension__ (__m512i)(__v32hi){
......@@ -314,7 +305,7 @@ _mm512_set1_epi16(short __w)
314305 __w, __w, __w, __w, __w, __w, __w, __w };
315306}
316307
317static __inline __m512i __DEFAULT_FN_ATTRS512
308static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
318309_mm512_set1_epi32(int __s)
319310{
320311 return __extension__ (__m512i)(__v16si){
......@@ -322,81 +313,80 @@ _mm512_set1_epi32(int __s)
322313 __s, __s, __s, __s, __s, __s, __s, __s };
323314}
324315
325static __inline __m512i __DEFAULT_FN_ATTRS512
326_mm512_maskz_set1_epi32(__mmask16 __M, int __A)
327{
316static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
317_mm512_maskz_set1_epi32(__mmask16 __M, int __A) {
328318 return (__m512i)__builtin_ia32_selectd_512(__M,
329319 (__v16si)_mm512_set1_epi32(__A),
330320 (__v16si)_mm512_setzero_si512());
331321}
332322
333static __inline __m512i __DEFAULT_FN_ATTRS512
323static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
334324_mm512_set1_epi64(long long __d)
335325{
336326 return __extension__(__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d };
337327}
338328
339static __inline __m512i __DEFAULT_FN_ATTRS512
340_mm512_maskz_set1_epi64(__mmask8 __M, long long __A)
341{
329static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
330_mm512_maskz_set1_epi64(__mmask8 __M, long long __A) {
342331 return (__m512i)__builtin_ia32_selectq_512(__M,
343332 (__v8di)_mm512_set1_epi64(__A),
344333 (__v8di)_mm512_setzero_si512());
345334}
346335
347static __inline__ __m512 __DEFAULT_FN_ATTRS512
348_mm512_broadcastss_ps(__m128 __A)
349{
336static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
337_mm512_broadcastss_ps(__m128 __A) {
350338 return (__m512)__builtin_shufflevector((__v4sf) __A, (__v4sf) __A,
351339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
352340}
353341
354static __inline __m512i __DEFAULT_FN_ATTRS512
355_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
356{
342static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
343_mm512_set4_epi32(int __A, int __B, int __C, int __D) {
357344 return __extension__ (__m512i)(__v16si)
358345 { __D, __C, __B, __A, __D, __C, __B, __A,
359346 __D, __C, __B, __A, __D, __C, __B, __A };
360347}
361348
362static __inline __m512i __DEFAULT_FN_ATTRS512
363_mm512_set4_epi64 (long long __A, long long __B, long long __C,
364 long long __D)
365{
349static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
350_mm512_set4_epi64(long long __A, long long __B, long long __C, long long __D) {
366351 return __extension__ (__m512i) (__v8di)
367352 { __D, __C, __B, __A, __D, __C, __B, __A };
368353}
369354
370static __inline __m512d __DEFAULT_FN_ATTRS512
371_mm512_set4_pd (double __A, double __B, double __C, double __D)
372{
355static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
356_mm512_set4_pd(double __A, double __B, double __C, double __D) {
373357 return __extension__ (__m512d)
374358 { __D, __C, __B, __A, __D, __C, __B, __A };
375359}
376360
377static __inline __m512 __DEFAULT_FN_ATTRS512
378_mm512_set4_ps (float __A, float __B, float __C, float __D)
379{
361static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
362_mm512_set4_ps(float __A, float __B, float __C, float __D) {
380363 return __extension__ (__m512)
381364 { __D, __C, __B, __A, __D, __C, __B, __A,
382365 __D, __C, __B, __A, __D, __C, __B, __A };
383366}
384367
385#define _mm512_setr4_epi32(e0,e1,e2,e3) \
386 _mm512_set4_epi32((e3),(e2),(e1),(e0))
368static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
369_mm512_setr4_epi32(int e0, int e1, int e2, int e3) {
370 return _mm512_set4_epi32(e3, e2, e1, e0);
371}
387372
388#define _mm512_setr4_epi64(e0,e1,e2,e3) \
389 _mm512_set4_epi64((e3),(e2),(e1),(e0))
373static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
374_mm512_setr4_epi64(long long e0, long long e1, long long e2, long long e3) {
375 return _mm512_set4_epi64(e3, e2, e1, e0);
376}
390377
391#define _mm512_setr4_pd(e0,e1,e2,e3) \
392 _mm512_set4_pd((e3),(e2),(e1),(e0))
378static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
379_mm512_setr4_pd(double e0, double e1, double e2, double e3) {
380 return _mm512_set4_pd(e3, e2, e1, e0);
381}
393382
394#define _mm512_setr4_ps(e0,e1,e2,e3) \
395 _mm512_set4_ps((e3),(e2),(e1),(e0))
383static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
384_mm512_setr4_ps(float e0, float e1, float e2, float e3) {
385 return _mm512_set4_ps(e3, e2, e1, e0);
386}
396387
397static __inline__ __m512d __DEFAULT_FN_ATTRS512
398_mm512_broadcastsd_pd(__m128d __A)
399{
388static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
389_mm512_broadcastsd_pd(__m128d __A) {
400390 return (__m512d)__builtin_shufflevector((__v2df) __A, (__v2df) __A,
401391 0, 0, 0, 0, 0, 0, 0, 0);
402392}
......@@ -417,37 +407,36 @@ _mm512_castps256_ps512(__m256 __a)
417407 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
418408}
419409
420static __inline __m128d __DEFAULT_FN_ATTRS512
410static __inline __m128d __DEFAULT_FN_ATTRS512_CONSTEXPR
421411_mm512_castpd512_pd128(__m512d __a)
422412{
423413 return __builtin_shufflevector(__a, __a, 0, 1);
424414}
425415
426static __inline __m256d __DEFAULT_FN_ATTRS512
416static __inline __m256d __DEFAULT_FN_ATTRS512_CONSTEXPR
427417_mm512_castpd512_pd256 (__m512d __A)
428418{
429419 return __builtin_shufflevector(__A, __A, 0, 1, 2, 3);
430420}
431421
432static __inline __m128 __DEFAULT_FN_ATTRS512
422static __inline __m128 __DEFAULT_FN_ATTRS512_CONSTEXPR
433423_mm512_castps512_ps128(__m512 __a)
434424{
435425 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
436426}
437427
438static __inline __m256 __DEFAULT_FN_ATTRS512
439_mm512_castps512_ps256 (__m512 __A)
440{
428static __inline __m256 __DEFAULT_FN_ATTRS512_CONSTEXPR
429_mm512_castps512_ps256(__m512 __A) {
441430 return __builtin_shufflevector(__A, __A, 0, 1, 2, 3, 4, 5, 6, 7);
442431}
443432
444static __inline __m512 __DEFAULT_FN_ATTRS512
433static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
445434_mm512_castpd_ps (__m512d __A)
446435{
447436 return (__m512) (__A);
448437}
449438
450static __inline __m512i __DEFAULT_FN_ATTRS512
439static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
451440_mm512_castpd_si512 (__m512d __A)
452441{
453442 return (__m512i) (__A);
......@@ -462,13 +451,13 @@ _mm512_castpd128_pd512 (__m128d __A)
462451 __B, 0, 1, 2, 3, 4, 5, 6, 7);
463452}
464453
465static __inline __m512d __DEFAULT_FN_ATTRS512
454static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
466455_mm512_castps_pd (__m512 __A)
467456{
468457 return (__m512d) (__A);
469458}
470459
471static __inline __m512i __DEFAULT_FN_ATTRS512
460static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
472461_mm512_castps_si512 (__m512 __A)
473462{
474463 return (__m512i) (__A);
......@@ -498,39 +487,36 @@ _mm512_castsi256_si512 (__m256i __A)
498487 return __builtin_shufflevector( __A, __builtin_nondeterministic_value(__A), 0, 1, 2, 3, 4, 5, 6, 7);
499488}
500489
501static __inline __m512 __DEFAULT_FN_ATTRS512
490static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
502491_mm512_castsi512_ps (__m512i __A)
503492{
504493 return (__m512) (__A);
505494}
506495
507static __inline __m512d __DEFAULT_FN_ATTRS512
496static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
508497_mm512_castsi512_pd (__m512i __A)
509498{
510499 return (__m512d) (__A);
511500}
512501
513static __inline __m128i __DEFAULT_FN_ATTRS512
502static __inline __m128i __DEFAULT_FN_ATTRS512_CONSTEXPR
514503_mm512_castsi512_si128 (__m512i __A)
515504{
516505 return (__m128i)__builtin_shufflevector(__A, __A , 0, 1);
517506}
518507
519static __inline __m256i __DEFAULT_FN_ATTRS512
520_mm512_castsi512_si256 (__m512i __A)
521{
508static __inline __m256i __DEFAULT_FN_ATTRS512_CONSTEXPR
509_mm512_castsi512_si256(__m512i __A) {
522510 return (__m256i)__builtin_shufflevector(__A, __A , 0, 1, 2, 3);
523511}
524512
525static __inline__ __mmask16 __DEFAULT_FN_ATTRS
526_mm512_int2mask(int __a)
527{
513static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
514_mm512_int2mask(int __a) {
528515 return (__mmask16)__a;
529516}
530517
531static __inline__ int __DEFAULT_FN_ATTRS
532_mm512_mask2int(__mmask16 __a)
533{
518static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
519_mm512_mask2int(__mmask16 __a) {
534520 return (int)__a;
535521}
536522
......@@ -547,9 +533,8 @@ _mm512_mask2int(__mmask16 __a)
547533/// A 128-bit vector of [2 x double].
548534/// \returns A 512-bit floating-point vector of [8 x double]. The lower 128 bits
549535/// contain the value of the parameter. The upper 384 bits are set to zero.
550static __inline __m512d __DEFAULT_FN_ATTRS512
551_mm512_zextpd128_pd512(__m128d __a)
552{
536static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
537_mm512_zextpd128_pd512(__m128d __a) {
553538 return __builtin_shufflevector((__v2df)__a, (__v2df)_mm_setzero_pd(), 0, 1, 2, 3, 2, 3, 2, 3);
554539}
555540
......@@ -566,9 +551,8 @@ _mm512_zextpd128_pd512(__m128d __a)
566551/// A 256-bit vector of [4 x double].
567552/// \returns A 512-bit floating-point vector of [8 x double]. The lower 256 bits
568553/// contain the value of the parameter. The upper 256 bits are set to zero.
569static __inline __m512d __DEFAULT_FN_ATTRS512
570_mm512_zextpd256_pd512(__m256d __a)
571{
554static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
555_mm512_zextpd256_pd512(__m256d __a) {
572556 return __builtin_shufflevector((__v4df)__a, (__v4df)_mm256_setzero_pd(), 0, 1, 2, 3, 4, 5, 6, 7);
573557}
574558
......@@ -584,9 +568,8 @@ _mm512_zextpd256_pd512(__m256d __a)
584568/// A 128-bit vector of [4 x float].
585569/// \returns A 512-bit floating-point vector of [16 x float]. The lower 128 bits
586570/// contain the value of the parameter. The upper 384 bits are set to zero.
587static __inline __m512 __DEFAULT_FN_ATTRS512
588_mm512_zextps128_ps512(__m128 __a)
589{
571static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
572_mm512_zextps128_ps512(__m128 __a) {
590573 return __builtin_shufflevector((__v4sf)__a, (__v4sf)_mm_setzero_ps(), 0, 1, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7);
591574}
592575
......@@ -602,9 +585,8 @@ _mm512_zextps128_ps512(__m128 __a)
602585/// A 256-bit vector of [8 x float].
603586/// \returns A 512-bit floating-point vector of [16 x float]. The lower 256 bits
604587/// contain the value of the parameter. The upper 256 bits are set to zero.
605static __inline __m512 __DEFAULT_FN_ATTRS512
606_mm512_zextps256_ps512(__m256 __a)
607{
588static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
589_mm512_zextps256_ps512(__m256 __a) {
608590 return __builtin_shufflevector((__v8sf)__a, (__v8sf)_mm256_setzero_ps(), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
609591}
610592
......@@ -620,9 +602,8 @@ _mm512_zextps256_ps512(__m256 __a)
620602/// A 128-bit integer vector.
621603/// \returns A 512-bit integer vector. The lower 128 bits contain the value of
622604/// the parameter. The upper 384 bits are set to zero.
623static __inline __m512i __DEFAULT_FN_ATTRS512
624_mm512_zextsi128_si512(__m128i __a)
625{
605static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
606_mm512_zextsi128_si512(__m128i __a) {
626607 return __builtin_shufflevector((__v2di)__a, (__v2di)_mm_setzero_si128(), 0, 1, 2, 3, 2, 3, 2, 3);
627608}
628609
......@@ -638,22 +619,20 @@ _mm512_zextsi128_si512(__m128i __a)
638619/// A 256-bit integer vector.
639620/// \returns A 512-bit integer vector. The lower 256 bits contain the value of
640621/// the parameter. The upper 256 bits are set to zero.
641static __inline __m512i __DEFAULT_FN_ATTRS512
642_mm512_zextsi256_si512(__m256i __a)
643{
622static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
623_mm512_zextsi256_si512(__m256i __a) {
644624 return __builtin_shufflevector((__v4di)__a, (__v4di)_mm256_setzero_si256(), 0, 1, 2, 3, 4, 5, 6, 7);
645625}
646626
647627/* Bitwise operators */
648static __inline__ __m512i __DEFAULT_FN_ATTRS512
628static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
649629_mm512_and_epi32(__m512i __a, __m512i __b)
650630{
651631 return (__m512i)((__v16su)__a & (__v16su)__b);
652632}
653633
654static __inline__ __m512i __DEFAULT_FN_ATTRS512
655_mm512_mask_and_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b)
656{
634static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
635_mm512_mask_and_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b) {
657636 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__k,
658637 (__v16si) _mm512_and_epi32(__a, __b),
659638 (__v16si) __src);
......@@ -666,18 +645,16 @@ _mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b)
666645 __k, __a, __b);
667646}
668647
669static __inline__ __m512i __DEFAULT_FN_ATTRS512
648static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
670649_mm512_and_epi64(__m512i __a, __m512i __b)
671650{
672651 return (__m512i)((__v8du)__a & (__v8du)__b);
673652}
674653
675static __inline__ __m512i __DEFAULT_FN_ATTRS512
676_mm512_mask_and_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b)
677{
678 return (__m512i) __builtin_ia32_selectq_512 ((__mmask8) __k,
679 (__v8di) _mm512_and_epi64(__a, __b),
680 (__v8di) __src);
654static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
655_mm512_mask_and_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b) {
656 return (__m512i)__builtin_ia32_selectq_512(
657 (__mmask8)__k, (__v8di)_mm512_and_epi64(__a, __b), (__v8di)__src);
681658}
682659
683660static __inline__ __m512i __DEFAULT_FN_ATTRS512
......@@ -687,13 +664,13 @@ _mm512_maskz_and_epi64(__mmask8 __k, __m512i __a, __m512i __b)
687664 __k, __a, __b);
688665}
689666
690static __inline__ __m512i __DEFAULT_FN_ATTRS512
667static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
691668_mm512_andnot_si512 (__m512i __A, __m512i __B)
692669{
693670 return (__m512i)(~(__v8du)__A & (__v8du)__B);
694671}
695672
696static __inline__ __m512i __DEFAULT_FN_ATTRS512
673static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
697674_mm512_andnot_epi32 (__m512i __A, __m512i __B)
698675{
699676 return (__m512i)(~(__v16su)__A & (__v16su)__B);
......@@ -714,7 +691,7 @@ _mm512_maskz_andnot_epi32(__mmask16 __U, __m512i __A, __m512i __B)
714691 __U, __A, __B);
715692}
716693
717static __inline__ __m512i __DEFAULT_FN_ATTRS512
694static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
718695_mm512_andnot_epi64(__m512i __A, __m512i __B)
719696{
720697 return (__m512i)(~(__v8du)__A & (__v8du)__B);
......@@ -735,7 +712,7 @@ _mm512_maskz_andnot_epi64(__mmask8 __U, __m512i __A, __m512i __B)
735712 __U, __A, __B);
736713}
737714
738static __inline__ __m512i __DEFAULT_FN_ATTRS512
715static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
739716_mm512_or_epi32(__m512i __a, __m512i __b)
740717{
741718 return (__m512i)((__v16su)__a | (__v16su)__b);
......@@ -755,7 +732,7 @@ _mm512_maskz_or_epi32(__mmask16 __k, __m512i __a, __m512i __b)
755732 return (__m512i)_mm512_mask_or_epi32(_mm512_setzero_si512(), __k, __a, __b);
756733}
757734
758static __inline__ __m512i __DEFAULT_FN_ATTRS512
735static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
759736_mm512_or_epi64(__m512i __a, __m512i __b)
760737{
761738 return (__m512i)((__v8du)__a | (__v8du)__b);
......@@ -775,7 +752,7 @@ _mm512_maskz_or_epi64(__mmask8 __k, __m512i __a, __m512i __b)
775752 return (__m512i)_mm512_mask_or_epi64(_mm512_setzero_si512(), __k, __a, __b);
776753}
777754
778static __inline__ __m512i __DEFAULT_FN_ATTRS512
755static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
779756_mm512_xor_epi32(__m512i __a, __m512i __b)
780757{
781758 return (__m512i)((__v16su)__a ^ (__v16su)__b);
......@@ -795,7 +772,7 @@ _mm512_maskz_xor_epi32(__mmask16 __k, __m512i __a, __m512i __b)
795772 return (__m512i)_mm512_mask_xor_epi32(_mm512_setzero_si512(), __k, __a, __b);
796773}
797774
798static __inline__ __m512i __DEFAULT_FN_ATTRS512
775static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
799776_mm512_xor_epi64(__m512i __a, __m512i __b)
800777{
801778 return (__m512i)((__v8du)__a ^ (__v8du)__b);
......@@ -815,19 +792,19 @@ _mm512_maskz_xor_epi64(__mmask8 __k, __m512i __a, __m512i __b)
815792 return (__m512i)_mm512_mask_xor_epi64(_mm512_setzero_si512(), __k, __a, __b);
816793}
817794
818static __inline__ __m512i __DEFAULT_FN_ATTRS512
795static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
819796_mm512_and_si512(__m512i __a, __m512i __b)
820797{
821798 return (__m512i)((__v8du)__a & (__v8du)__b);
822799}
823800
824static __inline__ __m512i __DEFAULT_FN_ATTRS512
801static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
825802_mm512_or_si512(__m512i __a, __m512i __b)
826803{
827804 return (__m512i)((__v8du)__a | (__v8du)__b);
828805}
829806
830static __inline__ __m512i __DEFAULT_FN_ATTRS512
807static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
831808_mm512_xor_si512(__m512i __a, __m512i __b)
832809{
833810 return (__m512i)((__v8du)__a ^ (__v8du)__b);
......@@ -835,125 +812,107 @@ _mm512_xor_si512(__m512i __a, __m512i __b)
835812
836813/* Arithmetic */
837814
838static __inline __m512d __DEFAULT_FN_ATTRS512
839_mm512_add_pd(__m512d __a, __m512d __b)
840{
815static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
816_mm512_add_pd(__m512d __a, __m512d __b) {
841817 return (__m512d)((__v8df)__a + (__v8df)__b);
842818}
843819
844static __inline __m512 __DEFAULT_FN_ATTRS512
845_mm512_add_ps(__m512 __a, __m512 __b)
846{
820static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
821_mm512_add_ps(__m512 __a, __m512 __b) {
847822 return (__m512)((__v16sf)__a + (__v16sf)__b);
848823}
849824
850static __inline __m512d __DEFAULT_FN_ATTRS512
851_mm512_mul_pd(__m512d __a, __m512d __b)
852{
825static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
826_mm512_mul_pd(__m512d __a, __m512d __b) {
853827 return (__m512d)((__v8df)__a * (__v8df)__b);
854828}
855829
856static __inline __m512 __DEFAULT_FN_ATTRS512
857_mm512_mul_ps(__m512 __a, __m512 __b)
858{
830static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
831_mm512_mul_ps(__m512 __a, __m512 __b) {
859832 return (__m512)((__v16sf)__a * (__v16sf)__b);
860833}
861834
862static __inline __m512d __DEFAULT_FN_ATTRS512
863_mm512_sub_pd(__m512d __a, __m512d __b)
864{
835static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
836_mm512_sub_pd(__m512d __a, __m512d __b) {
865837 return (__m512d)((__v8df)__a - (__v8df)__b);
866838}
867839
868static __inline __m512 __DEFAULT_FN_ATTRS512
869_mm512_sub_ps(__m512 __a, __m512 __b)
870{
840static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
841_mm512_sub_ps(__m512 __a, __m512 __b) {
871842 return (__m512)((__v16sf)__a - (__v16sf)__b);
872843}
873844
874static __inline__ __m512i __DEFAULT_FN_ATTRS512
875_mm512_add_epi64 (__m512i __A, __m512i __B)
876{
845static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
846_mm512_add_epi64(__m512i __A, __m512i __B) {
877847 return (__m512i) ((__v8du) __A + (__v8du) __B);
878848}
879849
880static __inline__ __m512i __DEFAULT_FN_ATTRS512
881_mm512_mask_add_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
882{
850static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
851_mm512_mask_add_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
883852 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
884853 (__v8di)_mm512_add_epi64(__A, __B),
885854 (__v8di)__W);
886855}
887856
888static __inline__ __m512i __DEFAULT_FN_ATTRS512
889_mm512_maskz_add_epi64(__mmask8 __U, __m512i __A, __m512i __B)
890{
857static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
858_mm512_maskz_add_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
891859 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
892860 (__v8di)_mm512_add_epi64(__A, __B),
893861 (__v8di)_mm512_setzero_si512());
894862}
895863
896static __inline__ __m512i __DEFAULT_FN_ATTRS512
897_mm512_sub_epi64 (__m512i __A, __m512i __B)
898{
864static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
865_mm512_sub_epi64(__m512i __A, __m512i __B) {
899866 return (__m512i) ((__v8du) __A - (__v8du) __B);
900867}
901868
902static __inline__ __m512i __DEFAULT_FN_ATTRS512
903_mm512_mask_sub_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
904{
869static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
870_mm512_mask_sub_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
905871 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
906872 (__v8di)_mm512_sub_epi64(__A, __B),
907873 (__v8di)__W);
908874}
909875
910static __inline__ __m512i __DEFAULT_FN_ATTRS512
911_mm512_maskz_sub_epi64(__mmask8 __U, __m512i __A, __m512i __B)
912{
876static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
877_mm512_maskz_sub_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
913878 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
914879 (__v8di)_mm512_sub_epi64(__A, __B),
915880 (__v8di)_mm512_setzero_si512());
916881}
917882
918static __inline__ __m512i __DEFAULT_FN_ATTRS512
919_mm512_add_epi32 (__m512i __A, __m512i __B)
920{
883static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
884_mm512_add_epi32(__m512i __A, __m512i __B) {
921885 return (__m512i) ((__v16su) __A + (__v16su) __B);
922886}
923887
924static __inline__ __m512i __DEFAULT_FN_ATTRS512
925_mm512_mask_add_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
926{
888static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
889_mm512_mask_add_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) {
927890 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
928891 (__v16si)_mm512_add_epi32(__A, __B),
929892 (__v16si)__W);
930893}
931894
932static __inline__ __m512i __DEFAULT_FN_ATTRS512
933_mm512_maskz_add_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
934{
895static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
896_mm512_maskz_add_epi32(__mmask16 __U, __m512i __A, __m512i __B) {
935897 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
936898 (__v16si)_mm512_add_epi32(__A, __B),
937899 (__v16si)_mm512_setzero_si512());
938900}
939901
940static __inline__ __m512i __DEFAULT_FN_ATTRS512
941_mm512_sub_epi32 (__m512i __A, __m512i __B)
942{
902static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
903_mm512_sub_epi32(__m512i __A, __m512i __B) {
943904 return (__m512i) ((__v16su) __A - (__v16su) __B);
944905}
945906
946static __inline__ __m512i __DEFAULT_FN_ATTRS512
947_mm512_mask_sub_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
948{
907static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
908_mm512_mask_sub_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) {
949909 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
950910 (__v16si)_mm512_sub_epi32(__A, __B),
951911 (__v16si)__W);
952912}
953913
954static __inline__ __m512i __DEFAULT_FN_ATTRS512
955_mm512_maskz_sub_epi32(__mmask16 __U, __m512i __A, __m512i __B)
956{
914static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
915_mm512_maskz_sub_epi32(__mmask16 __U, __m512i __A, __m512i __B) {
957916 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
958917 (__v16si)_mm512_sub_epi32(__A, __B),
959918 (__v16si)_mm512_setzero_si512());
......@@ -973,24 +932,21 @@ _mm512_maskz_sub_epi32(__mmask16 __U, __m512i __A, __m512i __B)
973932 (__v8df)_mm512_max_round_pd((A), (B), (R)), \
974933 (__v8df)_mm512_setzero_pd()))
975934
976static __inline__ __m512d __DEFAULT_FN_ATTRS512
977_mm512_max_pd(__m512d __A, __m512d __B)
978{
935static __inline__ __m512d
936 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_max_pd(__m512d __A, __m512d __B) {
979937 return (__m512d) __builtin_ia32_maxpd512((__v8df) __A, (__v8df) __B,
980938 _MM_FROUND_CUR_DIRECTION);
981939}
982940
983static __inline__ __m512d __DEFAULT_FN_ATTRS512
984_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B)
985{
941static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
942_mm512_mask_max_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
986943 return (__m512d)__builtin_ia32_selectpd_512(__U,
987944 (__v8df)_mm512_max_pd(__A, __B),
988945 (__v8df)__W);
989946}
990947
991static __inline__ __m512d __DEFAULT_FN_ATTRS512
992_mm512_maskz_max_pd (__mmask8 __U, __m512d __A, __m512d __B)
993{
948static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
949_mm512_maskz_max_pd(__mmask8 __U, __m512d __A, __m512d __B) {
994950 return (__m512d)__builtin_ia32_selectpd_512(__U,
995951 (__v8df)_mm512_max_pd(__A, __B),
996952 (__v8df)_mm512_setzero_pd());
......@@ -1010,31 +966,30 @@ _mm512_maskz_max_pd (__mmask8 __U, __m512d __A, __m512d __B)
1010966 (__v16sf)_mm512_max_round_ps((A), (B), (R)), \
1011967 (__v16sf)_mm512_setzero_ps()))
1012968
1013static __inline__ __m512 __DEFAULT_FN_ATTRS512
1014_mm512_max_ps(__m512 __A, __m512 __B)
1015{
969static __inline__ __m512
970 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_max_ps(__m512 __A, __m512 __B) {
1016971 return (__m512) __builtin_ia32_maxps512((__v16sf) __A, (__v16sf) __B,
1017972 _MM_FROUND_CUR_DIRECTION);
1018973}
1019974
1020static __inline__ __m512 __DEFAULT_FN_ATTRS512
1021_mm512_mask_max_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B)
1022{
975static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
976_mm512_mask_max_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
1023977 return (__m512)__builtin_ia32_selectps_512(__U,
1024978 (__v16sf)_mm512_max_ps(__A, __B),
1025979 (__v16sf)__W);
1026980}
1027981
1028static __inline__ __m512 __DEFAULT_FN_ATTRS512
1029_mm512_maskz_max_ps (__mmask16 __U, __m512 __A, __m512 __B)
1030{
982static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
983_mm512_maskz_max_ps(__mmask16 __U, __m512 __A, __m512 __B) {
1031984 return (__m512)__builtin_ia32_selectps_512(__U,
1032985 (__v16sf)_mm512_max_ps(__A, __B),
1033986 (__v16sf)_mm512_setzero_ps());
1034987}
1035988
1036static __inline__ __m128 __DEFAULT_FN_ATTRS128
1037_mm_mask_max_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
989static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_mask_max_ss(__m128 __W,
990 __mmask8 __U,
991 __m128 __A,
992 __m128 __B) {
1038993 return (__m128) __builtin_ia32_maxss_round_mask ((__v4sf) __A,
1039994 (__v4sf) __B,
1040995 (__v4sf) __W,
......@@ -1042,8 +997,9 @@ _mm_mask_max_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
1042997 _MM_FROUND_CUR_DIRECTION);
1043998}
1044999
1045static __inline__ __m128 __DEFAULT_FN_ATTRS128
1046_mm_maskz_max_ss(__mmask8 __U,__m128 __A, __m128 __B) {
1000static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_maskz_max_ss(__mmask8 __U,
1001 __m128 __A,
1002 __m128 __B) {
10471003 return (__m128) __builtin_ia32_maxss_round_mask ((__v4sf) __A,
10481004 (__v4sf) __B,
10491005 (__v4sf) _mm_setzero_ps (),
......@@ -1069,8 +1025,10 @@ _mm_maskz_max_ss(__mmask8 __U,__m128 __A, __m128 __B) {
10691025 (__v4sf)_mm_setzero_ps(), \
10701026 (__mmask8)(U), (int)(R)))
10711027
1072static __inline__ __m128d __DEFAULT_FN_ATTRS128
1073_mm_mask_max_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
1028static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_mask_max_sd(__m128d __W,
1029 __mmask8 __U,
1030 __m128d __A,
1031 __m128d __B) {
10741032 return (__m128d) __builtin_ia32_maxsd_round_mask ((__v2df) __A,
10751033 (__v2df) __B,
10761034 (__v2df) __W,
......@@ -1078,8 +1036,9 @@ _mm_mask_max_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
10781036 _MM_FROUND_CUR_DIRECTION);
10791037}
10801038
1081static __inline__ __m128d __DEFAULT_FN_ATTRS128
1082_mm_maskz_max_sd(__mmask8 __U,__m128d __A, __m128d __B) {
1039static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_maskz_max_sd(__mmask8 __U,
1040 __m128d __A,
1041 __m128d __B) {
10831042 return (__m128d) __builtin_ia32_maxsd_round_mask ((__v2df) __A,
10841043 (__v2df) __B,
10851044 (__v2df) _mm_setzero_pd (),
......@@ -1106,89 +1065,76 @@ _mm_maskz_max_sd(__mmask8 __U,__m128d __A, __m128d __B) {
11061065 (__mmask8)(U), (int)(R)))
11071066
11081067static __inline __m512i
1109__DEFAULT_FN_ATTRS512
1110_mm512_max_epi32(__m512i __A, __m512i __B)
1111{
1068 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_max_epi32(__m512i __A, __m512i __B) {
11121069 return (__m512i)__builtin_elementwise_max((__v16si)__A, (__v16si)__B);
11131070}
11141071
1115static __inline__ __m512i __DEFAULT_FN_ATTRS512
1116_mm512_mask_max_epi32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B)
1117{
1072static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1073_mm512_mask_max_epi32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) {
11181074 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11191075 (__v16si)_mm512_max_epi32(__A, __B),
11201076 (__v16si)__W);
11211077}
11221078
1123static __inline__ __m512i __DEFAULT_FN_ATTRS512
1124_mm512_maskz_max_epi32 (__mmask16 __M, __m512i __A, __m512i __B)
1125{
1079static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1080_mm512_maskz_max_epi32(__mmask16 __M, __m512i __A, __m512i __B) {
11261081 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11271082 (__v16si)_mm512_max_epi32(__A, __B),
11281083 (__v16si)_mm512_setzero_si512());
11291084}
11301085
1131static __inline __m512i __DEFAULT_FN_ATTRS512
1132_mm512_max_epu32(__m512i __A, __m512i __B)
1133{
1086static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1087_mm512_max_epu32(__m512i __A, __m512i __B) {
11341088 return (__m512i)__builtin_elementwise_max((__v16su)__A, (__v16su)__B);
11351089}
11361090
1137static __inline__ __m512i __DEFAULT_FN_ATTRS512
1138_mm512_mask_max_epu32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B)
1139{
1091static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1092_mm512_mask_max_epu32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) {
11401093 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11411094 (__v16si)_mm512_max_epu32(__A, __B),
11421095 (__v16si)__W);
11431096}
11441097
1145static __inline__ __m512i __DEFAULT_FN_ATTRS512
1146_mm512_maskz_max_epu32 (__mmask16 __M, __m512i __A, __m512i __B)
1147{
1098static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1099_mm512_maskz_max_epu32(__mmask16 __M, __m512i __A, __m512i __B) {
11481100 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
11491101 (__v16si)_mm512_max_epu32(__A, __B),
11501102 (__v16si)_mm512_setzero_si512());
11511103}
11521104
1153static __inline __m512i __DEFAULT_FN_ATTRS512
1154_mm512_max_epi64(__m512i __A, __m512i __B)
1155{
1105static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1106_mm512_max_epi64(__m512i __A, __m512i __B) {
11561107 return (__m512i)__builtin_elementwise_max((__v8di)__A, (__v8di)__B);
11571108}
11581109
1159static __inline__ __m512i __DEFAULT_FN_ATTRS512
1160_mm512_mask_max_epi64 (__m512i __W, __mmask8 __M, __m512i __A, __m512i __B)
1161{
1110static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1111_mm512_mask_max_epi64(__m512i __W, __mmask8 __M, __m512i __A, __m512i __B) {
11621112 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
11631113 (__v8di)_mm512_max_epi64(__A, __B),
11641114 (__v8di)__W);
11651115}
11661116
1167static __inline__ __m512i __DEFAULT_FN_ATTRS512
1168_mm512_maskz_max_epi64 (__mmask8 __M, __m512i __A, __m512i __B)
1169{
1117static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1118_mm512_maskz_max_epi64(__mmask8 __M, __m512i __A, __m512i __B) {
11701119 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
11711120 (__v8di)_mm512_max_epi64(__A, __B),
11721121 (__v8di)_mm512_setzero_si512());
11731122}
11741123
1175static __inline __m512i __DEFAULT_FN_ATTRS512
1176_mm512_max_epu64(__m512i __A, __m512i __B)
1177{
1124static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1125_mm512_max_epu64(__m512i __A, __m512i __B) {
11781126 return (__m512i)__builtin_elementwise_max((__v8du)__A, (__v8du)__B);
11791127}
11801128
1181static __inline__ __m512i __DEFAULT_FN_ATTRS512
1182_mm512_mask_max_epu64 (__m512i __W, __mmask8 __M, __m512i __A, __m512i __B)
1183{
1129static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1130_mm512_mask_max_epu64(__m512i __W, __mmask8 __M, __m512i __A, __m512i __B) {
11841131 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
11851132 (__v8di)_mm512_max_epu64(__A, __B),
11861133 (__v8di)__W);
11871134}
11881135
1189static __inline__ __m512i __DEFAULT_FN_ATTRS512
1190_mm512_maskz_max_epu64 (__mmask8 __M, __m512i __A, __m512i __B)
1191{
1136static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1137_mm512_maskz_max_epu64(__mmask8 __M, __m512i __A, __m512i __B) {
11921138 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
11931139 (__v8di)_mm512_max_epu64(__A, __B),
11941140 (__v8di)_mm512_setzero_si512());
......@@ -1208,24 +1154,21 @@ _mm512_maskz_max_epu64 (__mmask8 __M, __m512i __A, __m512i __B)
12081154 (__v8df)_mm512_min_round_pd((A), (B), (R)), \
12091155 (__v8df)_mm512_setzero_pd()))
12101156
1211static __inline__ __m512d __DEFAULT_FN_ATTRS512
1212_mm512_min_pd(__m512d __A, __m512d __B)
1213{
1157static __inline__ __m512d
1158 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_min_pd(__m512d __A, __m512d __B) {
12141159 return (__m512d) __builtin_ia32_minpd512((__v8df) __A, (__v8df) __B,
12151160 _MM_FROUND_CUR_DIRECTION);
12161161}
12171162
1218static __inline__ __m512d __DEFAULT_FN_ATTRS512
1219_mm512_mask_min_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B)
1220{
1163static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
1164_mm512_mask_min_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
12211165 return (__m512d)__builtin_ia32_selectpd_512(__U,
12221166 (__v8df)_mm512_min_pd(__A, __B),
12231167 (__v8df)__W);
12241168}
12251169
1226static __inline__ __m512d __DEFAULT_FN_ATTRS512
1227_mm512_maskz_min_pd (__mmask8 __U, __m512d __A, __m512d __B)
1228{
1170static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
1171_mm512_maskz_min_pd(__mmask8 __U, __m512d __A, __m512d __B) {
12291172 return (__m512d)__builtin_ia32_selectpd_512(__U,
12301173 (__v8df)_mm512_min_pd(__A, __B),
12311174 (__v8df)_mm512_setzero_pd());
......@@ -1245,31 +1188,30 @@ _mm512_maskz_min_pd (__mmask8 __U, __m512d __A, __m512d __B)
12451188 (__v16sf)_mm512_min_round_ps((A), (B), (R)), \
12461189 (__v16sf)_mm512_setzero_ps()))
12471190
1248static __inline__ __m512 __DEFAULT_FN_ATTRS512
1249_mm512_min_ps(__m512 __A, __m512 __B)
1250{
1191static __inline__ __m512
1192 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_min_ps(__m512 __A, __m512 __B) {
12511193 return (__m512) __builtin_ia32_minps512((__v16sf) __A, (__v16sf) __B,
12521194 _MM_FROUND_CUR_DIRECTION);
12531195}
12541196
1255static __inline__ __m512 __DEFAULT_FN_ATTRS512
1256_mm512_mask_min_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B)
1257{
1197static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1198_mm512_mask_min_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
12581199 return (__m512)__builtin_ia32_selectps_512(__U,
12591200 (__v16sf)_mm512_min_ps(__A, __B),
12601201 (__v16sf)__W);
12611202}
12621203
1263static __inline__ __m512 __DEFAULT_FN_ATTRS512
1264_mm512_maskz_min_ps (__mmask16 __U, __m512 __A, __m512 __B)
1265{
1204static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
1205_mm512_maskz_min_ps(__mmask16 __U, __m512 __A, __m512 __B) {
12661206 return (__m512)__builtin_ia32_selectps_512(__U,
12671207 (__v16sf)_mm512_min_ps(__A, __B),
12681208 (__v16sf)_mm512_setzero_ps());
12691209}
12701210
1271static __inline__ __m128 __DEFAULT_FN_ATTRS128
1272_mm_mask_min_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
1211static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_mask_min_ss(__m128 __W,
1212 __mmask8 __U,
1213 __m128 __A,
1214 __m128 __B) {
12731215 return (__m128) __builtin_ia32_minss_round_mask ((__v4sf) __A,
12741216 (__v4sf) __B,
12751217 (__v4sf) __W,
......@@ -1277,8 +1219,9 @@ _mm_mask_min_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
12771219 _MM_FROUND_CUR_DIRECTION);
12781220}
12791221
1280static __inline__ __m128 __DEFAULT_FN_ATTRS128
1281_mm_maskz_min_ss(__mmask8 __U,__m128 __A, __m128 __B) {
1222static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_maskz_min_ss(__mmask8 __U,
1223 __m128 __A,
1224 __m128 __B) {
12821225 return (__m128) __builtin_ia32_minss_round_mask ((__v4sf) __A,
12831226 (__v4sf) __B,
12841227 (__v4sf) _mm_setzero_ps (),
......@@ -1304,8 +1247,10 @@ _mm_maskz_min_ss(__mmask8 __U,__m128 __A, __m128 __B) {
13041247 (__v4sf)_mm_setzero_ps(), \
13051248 (__mmask8)(U), (int)(R)))
13061249
1307static __inline__ __m128d __DEFAULT_FN_ATTRS128
1308_mm_mask_min_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
1250static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_mask_min_sd(__m128d __W,
1251 __mmask8 __U,
1252 __m128d __A,
1253 __m128d __B) {
13091254 return (__m128d) __builtin_ia32_minsd_round_mask ((__v2df) __A,
13101255 (__v2df) __B,
13111256 (__v2df) __W,
......@@ -1313,8 +1258,9 @@ _mm_mask_min_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
13131258 _MM_FROUND_CUR_DIRECTION);
13141259}
13151260
1316static __inline__ __m128d __DEFAULT_FN_ATTRS128
1317_mm_maskz_min_sd(__mmask8 __U,__m128d __A, __m128d __B) {
1261static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_maskz_min_sd(__mmask8 __U,
1262 __m128d __A,
1263 __m128d __B) {
13181264 return (__m128d) __builtin_ia32_minsd_round_mask ((__v2df) __A,
13191265 (__v2df) __B,
13201266 (__v2df) _mm_setzero_pd (),
......@@ -1341,166 +1287,144 @@ _mm_maskz_min_sd(__mmask8 __U,__m128d __A, __m128d __B) {
13411287 (__mmask8)(U), (int)(R)))
13421288
13431289static __inline __m512i
1344__DEFAULT_FN_ATTRS512
1345_mm512_min_epi32(__m512i __A, __m512i __B)
1346{
1290 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_min_epi32(__m512i __A, __m512i __B) {
13471291 return (__m512i)__builtin_elementwise_min((__v16si)__A, (__v16si)__B);
13481292}
13491293
1350static __inline__ __m512i __DEFAULT_FN_ATTRS512
1351_mm512_mask_min_epi32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B)
1352{
1294static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1295_mm512_mask_min_epi32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) {
13531296 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
13541297 (__v16si)_mm512_min_epi32(__A, __B),
13551298 (__v16si)__W);
13561299}
13571300
1358static __inline__ __m512i __DEFAULT_FN_ATTRS512
1359_mm512_maskz_min_epi32 (__mmask16 __M, __m512i __A, __m512i __B)
1360{
1301static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1302_mm512_maskz_min_epi32(__mmask16 __M, __m512i __A, __m512i __B) {
13611303 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
13621304 (__v16si)_mm512_min_epi32(__A, __B),
13631305 (__v16si)_mm512_setzero_si512());
13641306}
13651307
1366static __inline __m512i __DEFAULT_FN_ATTRS512
1367_mm512_min_epu32(__m512i __A, __m512i __B)
1368{
1308static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1309_mm512_min_epu32(__m512i __A, __m512i __B) {
13691310 return (__m512i)__builtin_elementwise_min((__v16su)__A, (__v16su)__B);
13701311}
13711312
1372static __inline__ __m512i __DEFAULT_FN_ATTRS512
1373_mm512_mask_min_epu32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B)
1374{
1313static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1314_mm512_mask_min_epu32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) {
13751315 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
13761316 (__v16si)_mm512_min_epu32(__A, __B),
13771317 (__v16si)__W);
13781318}
13791319
1380static __inline__ __m512i __DEFAULT_FN_ATTRS512
1381_mm512_maskz_min_epu32 (__mmask16 __M, __m512i __A, __m512i __B)
1382{
1320static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1321_mm512_maskz_min_epu32(__mmask16 __M, __m512i __A, __m512i __B) {
13831322 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
13841323 (__v16si)_mm512_min_epu32(__A, __B),
13851324 (__v16si)_mm512_setzero_si512());
13861325}
13871326
1388static __inline __m512i __DEFAULT_FN_ATTRS512
1389_mm512_min_epi64(__m512i __A, __m512i __B)
1390{
1327static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1328_mm512_min_epi64(__m512i __A, __m512i __B) {
13911329 return (__m512i)__builtin_elementwise_min((__v8di)__A, (__v8di)__B);
13921330}
13931331
1394static __inline__ __m512i __DEFAULT_FN_ATTRS512
1395_mm512_mask_min_epi64 (__m512i __W, __mmask8 __M, __m512i __A, __m512i __B)
1396{
1332static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1333_mm512_mask_min_epi64(__m512i __W, __mmask8 __M, __m512i __A, __m512i __B) {
13971334 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
13981335 (__v8di)_mm512_min_epi64(__A, __B),
13991336 (__v8di)__W);
14001337}
14011338
1402static __inline__ __m512i __DEFAULT_FN_ATTRS512
1403_mm512_maskz_min_epi64 (__mmask8 __M, __m512i __A, __m512i __B)
1404{
1339static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1340_mm512_maskz_min_epi64(__mmask8 __M, __m512i __A, __m512i __B) {
14051341 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14061342 (__v8di)_mm512_min_epi64(__A, __B),
14071343 (__v8di)_mm512_setzero_si512());
14081344}
14091345
1410static __inline __m512i __DEFAULT_FN_ATTRS512
1411_mm512_min_epu64(__m512i __A, __m512i __B)
1412{
1346static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1347_mm512_min_epu64(__m512i __A, __m512i __B) {
14131348 return (__m512i)__builtin_elementwise_min((__v8du)__A, (__v8du)__B);
14141349}
14151350
1416static __inline__ __m512i __DEFAULT_FN_ATTRS512
1417_mm512_mask_min_epu64 (__m512i __W, __mmask8 __M, __m512i __A, __m512i __B)
1418{
1351static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1352_mm512_mask_min_epu64(__m512i __W, __mmask8 __M, __m512i __A, __m512i __B) {
14191353 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14201354 (__v8di)_mm512_min_epu64(__A, __B),
14211355 (__v8di)__W);
14221356}
14231357
1424static __inline__ __m512i __DEFAULT_FN_ATTRS512
1425_mm512_maskz_min_epu64 (__mmask8 __M, __m512i __A, __m512i __B)
1426{
1358static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1359_mm512_maskz_min_epu64(__mmask8 __M, __m512i __A, __m512i __B) {
14271360 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14281361 (__v8di)_mm512_min_epu64(__A, __B),
14291362 (__v8di)_mm512_setzero_si512());
14301363}
14311364
1432static __inline __m512i __DEFAULT_FN_ATTRS512
1433_mm512_mul_epi32(__m512i __X, __m512i __Y)
1434{
1365static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1366_mm512_mul_epi32(__m512i __X, __m512i __Y) {
14351367 return (__m512i)__builtin_ia32_pmuldq512((__v16si)__X, (__v16si) __Y);
14361368}
14371369
1438static __inline __m512i __DEFAULT_FN_ATTRS512
1439_mm512_mask_mul_epi32(__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
1440{
1370static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1371_mm512_mask_mul_epi32(__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) {
14411372 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14421373 (__v8di)_mm512_mul_epi32(__X, __Y),
14431374 (__v8di)__W);
14441375}
14451376
1446static __inline __m512i __DEFAULT_FN_ATTRS512
1447_mm512_maskz_mul_epi32(__mmask8 __M, __m512i __X, __m512i __Y)
1448{
1377static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1378_mm512_maskz_mul_epi32(__mmask8 __M, __m512i __X, __m512i __Y) {
14491379 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14501380 (__v8di)_mm512_mul_epi32(__X, __Y),
14511381 (__v8di)_mm512_setzero_si512 ());
14521382}
14531383
1454static __inline __m512i __DEFAULT_FN_ATTRS512
1455_mm512_mul_epu32(__m512i __X, __m512i __Y)
1456{
1384static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1385_mm512_mul_epu32(__m512i __X, __m512i __Y) {
14571386 return (__m512i)__builtin_ia32_pmuludq512((__v16si)__X, (__v16si)__Y);
14581387}
14591388
1460static __inline __m512i __DEFAULT_FN_ATTRS512
1461_mm512_mask_mul_epu32(__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
1462{
1389static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1390_mm512_mask_mul_epu32(__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) {
14631391 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14641392 (__v8di)_mm512_mul_epu32(__X, __Y),
14651393 (__v8di)__W);
14661394}
14671395
1468static __inline __m512i __DEFAULT_FN_ATTRS512
1469_mm512_maskz_mul_epu32(__mmask8 __M, __m512i __X, __m512i __Y)
1470{
1396static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1397_mm512_maskz_mul_epu32(__mmask8 __M, __m512i __X, __m512i __Y) {
14711398 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
14721399 (__v8di)_mm512_mul_epu32(__X, __Y),
14731400 (__v8di)_mm512_setzero_si512 ());
14741401}
14751402
1476static __inline __m512i __DEFAULT_FN_ATTRS512
1477_mm512_mullo_epi32 (__m512i __A, __m512i __B)
1478{
1403static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1404_mm512_mullo_epi32(__m512i __A, __m512i __B) {
14791405 return (__m512i) ((__v16su) __A * (__v16su) __B);
14801406}
14811407
1482static __inline __m512i __DEFAULT_FN_ATTRS512
1483_mm512_maskz_mullo_epi32(__mmask16 __M, __m512i __A, __m512i __B)
1484{
1408static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1409_mm512_maskz_mullo_epi32(__mmask16 __M, __m512i __A, __m512i __B) {
14851410 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
14861411 (__v16si)_mm512_mullo_epi32(__A, __B),
14871412 (__v16si)_mm512_setzero_si512());
14881413}
14891414
1490static __inline __m512i __DEFAULT_FN_ATTRS512
1491_mm512_mask_mullo_epi32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B)
1492{
1415static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1416_mm512_mask_mullo_epi32(__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) {
14931417 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
14941418 (__v16si)_mm512_mullo_epi32(__A, __B),
14951419 (__v16si)__W);
14961420}
14971421
1498static __inline__ __m512i __DEFAULT_FN_ATTRS512
1499_mm512_mullox_epi64 (__m512i __A, __m512i __B) {
1422static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1423_mm512_mullox_epi64(__m512i __A, __m512i __B) {
15001424 return (__m512i) ((__v8du) __A * (__v8du) __B);
15011425}
15021426
1503static __inline__ __m512i __DEFAULT_FN_ATTRS512
1427static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
15041428_mm512_mask_mullox_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
15051429 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
15061430 (__v8di)_mm512_mullox_epi64(__A, __B),
......@@ -1520,26 +1444,19 @@ _mm512_mask_mullox_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
15201444 (__v8df)_mm512_sqrt_round_pd((A), (R)), \
15211445 (__v8df)_mm512_setzero_pd()))
15221446
1523static __inline__ __m512d __DEFAULT_FN_ATTRS512
1524_mm512_sqrt_pd(__m512d __A)
1525{
1526 return (__m512d)__builtin_ia32_sqrtpd512((__v8df)__A,
1527 _MM_FROUND_CUR_DIRECTION);
1447static __inline__ __m512d __DEFAULT_FN_ATTRS512 _mm512_sqrt_pd(__m512d __A) {
1448 return (__m512d)__builtin_elementwise_sqrt((__v8df)__A);
15281449}
15291450
15301451static __inline__ __m512d __DEFAULT_FN_ATTRS512
1531_mm512_mask_sqrt_pd (__m512d __W, __mmask8 __U, __m512d __A)
1532{
1533 return (__m512d)__builtin_ia32_selectpd_512(__U,
1534 (__v8df)_mm512_sqrt_pd(__A),
1452_mm512_mask_sqrt_pd(__m512d __W, __mmask8 __U, __m512d __A) {
1453 return (__m512d)__builtin_ia32_selectpd_512(__U, (__v8df)_mm512_sqrt_pd(__A),
15351454 (__v8df)__W);
15361455}
15371456
15381457static __inline__ __m512d __DEFAULT_FN_ATTRS512
1539_mm512_maskz_sqrt_pd (__mmask8 __U, __m512d __A)
1540{
1541 return (__m512d)__builtin_ia32_selectpd_512(__U,
1542 (__v8df)_mm512_sqrt_pd(__A),
1458_mm512_maskz_sqrt_pd(__mmask8 __U, __m512d __A) {
1459 return (__m512d)__builtin_ia32_selectpd_512(__U, (__v8df)_mm512_sqrt_pd(__A),
15431460 (__v8df)_mm512_setzero_pd());
15441461}
15451462
......@@ -1556,26 +1473,19 @@ _mm512_maskz_sqrt_pd (__mmask8 __U, __m512d __A)
15561473 (__v16sf)_mm512_sqrt_round_ps((A), (R)), \
15571474 (__v16sf)_mm512_setzero_ps()))
15581475
1559static __inline__ __m512 __DEFAULT_FN_ATTRS512
1560_mm512_sqrt_ps(__m512 __A)
1561{
1562 return (__m512)__builtin_ia32_sqrtps512((__v16sf)__A,
1563 _MM_FROUND_CUR_DIRECTION);
1476static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_sqrt_ps(__m512 __A) {
1477 return (__m512)__builtin_elementwise_sqrt((__v16sf)__A);
15641478}
15651479
1566static __inline__ __m512 __DEFAULT_FN_ATTRS512
1567_mm512_mask_sqrt_ps(__m512 __W, __mmask16 __U, __m512 __A)
1568{
1569 return (__m512)__builtin_ia32_selectps_512(__U,
1570 (__v16sf)_mm512_sqrt_ps(__A),
1480static __inline__ __m512 __DEFAULT_FN_ATTRS512
1481_mm512_mask_sqrt_ps(__m512 __W, __mmask16 __U, __m512 __A) {
1482 return (__m512)__builtin_ia32_selectps_512(__U, (__v16sf)_mm512_sqrt_ps(__A),
15711483 (__v16sf)__W);
15721484}
15731485
1574static __inline__ __m512 __DEFAULT_FN_ATTRS512
1575_mm512_maskz_sqrt_ps( __mmask16 __U, __m512 __A)
1576{
1577 return (__m512)__builtin_ia32_selectps_512(__U,
1578 (__v16sf)_mm512_sqrt_ps(__A),
1486static __inline__ __m512 __DEFAULT_FN_ATTRS512
1487_mm512_maskz_sqrt_ps(__mmask16 __U, __m512 __A) {
1488 return (__m512)__builtin_ia32_selectps_512(__U, (__v16sf)_mm512_sqrt_ps(__A),
15791489 (__v16sf)_mm512_setzero_ps());
15801490}
15811491
......@@ -1866,58 +1776,52 @@ _mm512_mask_ceil_pd (__m512d __W, __mmask8 __U, __m512d __A)
18661776 _MM_FROUND_CUR_DIRECTION);
18671777}
18681778
1869static __inline __m512i __DEFAULT_FN_ATTRS512
1870_mm512_abs_epi64(__m512i __A)
1871{
1779static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1780_mm512_abs_epi64(__m512i __A) {
18721781 return (__m512i)__builtin_elementwise_abs((__v8di)__A);
18731782}
18741783
1875static __inline__ __m512i __DEFAULT_FN_ATTRS512
1876_mm512_mask_abs_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
1877{
1784static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1785_mm512_mask_abs_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
18781786 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
18791787 (__v8di)_mm512_abs_epi64(__A),
18801788 (__v8di)__W);
18811789}
18821790
1883static __inline__ __m512i __DEFAULT_FN_ATTRS512
1884_mm512_maskz_abs_epi64 (__mmask8 __U, __m512i __A)
1885{
1791static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1792_mm512_maskz_abs_epi64(__mmask8 __U, __m512i __A) {
18861793 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
18871794 (__v8di)_mm512_abs_epi64(__A),
18881795 (__v8di)_mm512_setzero_si512());
18891796}
18901797
1891static __inline __m512i __DEFAULT_FN_ATTRS512
1892_mm512_abs_epi32(__m512i __A)
1893{
1798static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1799_mm512_abs_epi32(__m512i __A) {
18941800 return (__m512i)__builtin_elementwise_abs((__v16si) __A);
18951801}
18961802
1897static __inline__ __m512i __DEFAULT_FN_ATTRS512
1898_mm512_mask_abs_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
1899{
1803static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1804_mm512_mask_abs_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
19001805 return (__m512i)__builtin_ia32_selectd_512(__U,
19011806 (__v16si)_mm512_abs_epi32(__A),
19021807 (__v16si)__W);
19031808}
19041809
1905static __inline__ __m512i __DEFAULT_FN_ATTRS512
1906_mm512_maskz_abs_epi32 (__mmask16 __U, __m512i __A)
1907{
1810static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
1811_mm512_maskz_abs_epi32(__mmask16 __U, __m512i __A) {
19081812 return (__m512i)__builtin_ia32_selectd_512(__U,
19091813 (__v16si)_mm512_abs_epi32(__A),
19101814 (__v16si)_mm512_setzero_si512());
19111815}
19121816
1913static __inline__ __m128 __DEFAULT_FN_ATTRS128
1914_mm_mask_add_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
1817static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1818_mm_mask_add_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
19151819 __A = _mm_add_ss(__A, __B);
19161820 return __builtin_ia32_selectss_128(__U, __A, __W);
19171821}
19181822
1919static __inline__ __m128 __DEFAULT_FN_ATTRS128
1920_mm_maskz_add_ss(__mmask8 __U,__m128 __A, __m128 __B) {
1823static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1824_mm_maskz_add_ss(__mmask8 __U, __m128 __A, __m128 __B) {
19211825 __A = _mm_add_ss(__A, __B);
19221826 return __builtin_ia32_selectss_128(__U, __A, _mm_setzero_ps());
19231827}
......@@ -1940,14 +1844,14 @@ _mm_maskz_add_ss(__mmask8 __U,__m128 __A, __m128 __B) {
19401844 (__v4sf)_mm_setzero_ps(), \
19411845 (__mmask8)(U), (int)(R)))
19421846
1943static __inline__ __m128d __DEFAULT_FN_ATTRS128
1944_mm_mask_add_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
1847static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1848_mm_mask_add_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
19451849 __A = _mm_add_sd(__A, __B);
19461850 return __builtin_ia32_selectsd_128(__U, __A, __W);
19471851}
19481852
1949static __inline__ __m128d __DEFAULT_FN_ATTRS128
1950_mm_maskz_add_sd(__mmask8 __U,__m128d __A, __m128d __B) {
1853static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1854_mm_maskz_add_sd(__mmask8 __U, __m128d __A, __m128d __B) {
19511855 __A = _mm_add_sd(__A, __B);
19521856 return __builtin_ia32_selectsd_128(__U, __A, _mm_setzero_pd());
19531857}
......@@ -1969,28 +1873,28 @@ _mm_maskz_add_sd(__mmask8 __U,__m128d __A, __m128d __B) {
19691873 (__v2df)_mm_setzero_pd(), \
19701874 (__mmask8)(U), (int)(R)))
19711875
1972static __inline__ __m512d __DEFAULT_FN_ATTRS512
1876static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
19731877_mm512_mask_add_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
19741878 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
19751879 (__v8df)_mm512_add_pd(__A, __B),
19761880 (__v8df)__W);
19771881}
19781882
1979static __inline__ __m512d __DEFAULT_FN_ATTRS512
1883static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
19801884_mm512_maskz_add_pd(__mmask8 __U, __m512d __A, __m512d __B) {
19811885 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
19821886 (__v8df)_mm512_add_pd(__A, __B),
19831887 (__v8df)_mm512_setzero_pd());
19841888}
19851889
1986static __inline__ __m512 __DEFAULT_FN_ATTRS512
1890static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
19871891_mm512_mask_add_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
19881892 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
19891893 (__v16sf)_mm512_add_ps(__A, __B),
19901894 (__v16sf)__W);
19911895}
19921896
1993static __inline__ __m512 __DEFAULT_FN_ATTRS512
1897static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
19941898_mm512_maskz_add_ps(__mmask16 __U, __m512 __A, __m512 __B) {
19951899 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
19961900 (__v16sf)_mm512_add_ps(__A, __B),
......@@ -2025,14 +1929,14 @@ _mm512_maskz_add_ps(__mmask16 __U, __m512 __A, __m512 __B) {
20251929 (__v16sf)_mm512_add_round_ps((A), (B), (R)), \
20261930 (__v16sf)_mm512_setzero_ps()))
20271931
2028static __inline__ __m128 __DEFAULT_FN_ATTRS128
2029_mm_mask_sub_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
1932static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1933_mm_mask_sub_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
20301934 __A = _mm_sub_ss(__A, __B);
20311935 return __builtin_ia32_selectss_128(__U, __A, __W);
20321936}
20331937
2034static __inline__ __m128 __DEFAULT_FN_ATTRS128
2035_mm_maskz_sub_ss(__mmask8 __U,__m128 __A, __m128 __B) {
1938static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1939_mm_maskz_sub_ss(__mmask8 __U, __m128 __A, __m128 __B) {
20361940 __A = _mm_sub_ss(__A, __B);
20371941 return __builtin_ia32_selectss_128(__U, __A, _mm_setzero_ps());
20381942}
......@@ -2054,14 +1958,14 @@ _mm_maskz_sub_ss(__mmask8 __U,__m128 __A, __m128 __B) {
20541958 (__v4sf)_mm_setzero_ps(), \
20551959 (__mmask8)(U), (int)(R)))
20561960
2057static __inline__ __m128d __DEFAULT_FN_ATTRS128
2058_mm_mask_sub_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
1961static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1962_mm_mask_sub_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
20591963 __A = _mm_sub_sd(__A, __B);
20601964 return __builtin_ia32_selectsd_128(__U, __A, __W);
20611965}
20621966
2063static __inline__ __m128d __DEFAULT_FN_ATTRS128
2064_mm_maskz_sub_sd(__mmask8 __U,__m128d __A, __m128d __B) {
1967static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1968_mm_maskz_sub_sd(__mmask8 __U, __m128d __A, __m128d __B) {
20651969 __A = _mm_sub_sd(__A, __B);
20661970 return __builtin_ia32_selectsd_128(__U, __A, _mm_setzero_pd());
20671971}
......@@ -2084,28 +1988,28 @@ _mm_maskz_sub_sd(__mmask8 __U,__m128d __A, __m128d __B) {
20841988 (__v2df)_mm_setzero_pd(), \
20851989 (__mmask8)(U), (int)(R)))
20861990
2087static __inline__ __m512d __DEFAULT_FN_ATTRS512
1991static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
20881992_mm512_mask_sub_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
20891993 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
20901994 (__v8df)_mm512_sub_pd(__A, __B),
20911995 (__v8df)__W);
20921996}
20931997
2094static __inline__ __m512d __DEFAULT_FN_ATTRS512
1998static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
20951999_mm512_maskz_sub_pd(__mmask8 __U, __m512d __A, __m512d __B) {
20962000 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
20972001 (__v8df)_mm512_sub_pd(__A, __B),
20982002 (__v8df)_mm512_setzero_pd());
20992003}
21002004
2101static __inline__ __m512 __DEFAULT_FN_ATTRS512
2005static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
21022006_mm512_mask_sub_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
21032007 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
21042008 (__v16sf)_mm512_sub_ps(__A, __B),
21052009 (__v16sf)__W);
21062010}
21072011
2108static __inline__ __m512 __DEFAULT_FN_ATTRS512
2012static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
21092013_mm512_maskz_sub_ps(__mmask16 __U, __m512 __A, __m512 __B) {
21102014 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
21112015 (__v16sf)_mm512_sub_ps(__A, __B),
......@@ -2140,14 +2044,14 @@ _mm512_maskz_sub_ps(__mmask16 __U, __m512 __A, __m512 __B) {
21402044 (__v16sf)_mm512_sub_round_ps((A), (B), (R)), \
21412045 (__v16sf)_mm512_setzero_ps()))
21422046
2143static __inline__ __m128 __DEFAULT_FN_ATTRS128
2144_mm_mask_mul_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
2047static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2048_mm_mask_mul_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
21452049 __A = _mm_mul_ss(__A, __B);
21462050 return __builtin_ia32_selectss_128(__U, __A, __W);
21472051}
21482052
2149static __inline__ __m128 __DEFAULT_FN_ATTRS128
2150_mm_maskz_mul_ss(__mmask8 __U,__m128 __A, __m128 __B) {
2053static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2054_mm_maskz_mul_ss(__mmask8 __U, __m128 __A, __m128 __B) {
21512055 __A = _mm_mul_ss(__A, __B);
21522056 return __builtin_ia32_selectss_128(__U, __A, _mm_setzero_ps());
21532057}
......@@ -2169,14 +2073,14 @@ _mm_maskz_mul_ss(__mmask8 __U,__m128 __A, __m128 __B) {
21692073 (__v4sf)_mm_setzero_ps(), \
21702074 (__mmask8)(U), (int)(R)))
21712075
2172static __inline__ __m128d __DEFAULT_FN_ATTRS128
2173_mm_mask_mul_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
2076static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2077_mm_mask_mul_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
21742078 __A = _mm_mul_sd(__A, __B);
21752079 return __builtin_ia32_selectsd_128(__U, __A, __W);
21762080}
21772081
2178static __inline__ __m128d __DEFAULT_FN_ATTRS128
2179_mm_maskz_mul_sd(__mmask8 __U,__m128d __A, __m128d __B) {
2082static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2083_mm_maskz_mul_sd(__mmask8 __U, __m128d __A, __m128d __B) {
21802084 __A = _mm_mul_sd(__A, __B);
21812085 return __builtin_ia32_selectsd_128(__U, __A, _mm_setzero_pd());
21822086}
......@@ -2199,28 +2103,28 @@ _mm_maskz_mul_sd(__mmask8 __U,__m128d __A, __m128d __B) {
21992103 (__v2df)_mm_setzero_pd(), \
22002104 (__mmask8)(U), (int)(R)))
22012105
2202static __inline__ __m512d __DEFAULT_FN_ATTRS512
2106static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
22032107_mm512_mask_mul_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
22042108 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
22052109 (__v8df)_mm512_mul_pd(__A, __B),
22062110 (__v8df)__W);
22072111}
22082112
2209static __inline__ __m512d __DEFAULT_FN_ATTRS512
2113static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
22102114_mm512_maskz_mul_pd(__mmask8 __U, __m512d __A, __m512d __B) {
22112115 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
22122116 (__v8df)_mm512_mul_pd(__A, __B),
22132117 (__v8df)_mm512_setzero_pd());
22142118}
22152119
2216static __inline__ __m512 __DEFAULT_FN_ATTRS512
2120static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
22172121_mm512_mask_mul_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
22182122 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
22192123 (__v16sf)_mm512_mul_ps(__A, __B),
22202124 (__v16sf)__W);
22212125}
22222126
2223static __inline__ __m512 __DEFAULT_FN_ATTRS512
2127static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
22242128_mm512_maskz_mul_ps(__mmask16 __U, __m512 __A, __m512 __B) {
22252129 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
22262130 (__v16sf)_mm512_mul_ps(__A, __B),
......@@ -2255,14 +2159,14 @@ _mm512_maskz_mul_ps(__mmask16 __U, __m512 __A, __m512 __B) {
22552159 (__v16sf)_mm512_mul_round_ps((A), (B), (R)), \
22562160 (__v16sf)_mm512_setzero_ps()))
22572161
2258static __inline__ __m128 __DEFAULT_FN_ATTRS128
2259_mm_mask_div_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
2162static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2163_mm_mask_div_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
22602164 __A = _mm_div_ss(__A, __B);
22612165 return __builtin_ia32_selectss_128(__U, __A, __W);
22622166}
22632167
2264static __inline__ __m128 __DEFAULT_FN_ATTRS128
2265_mm_maskz_div_ss(__mmask8 __U,__m128 __A, __m128 __B) {
2168static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2169_mm_maskz_div_ss(__mmask8 __U, __m128 __A, __m128 __B) {
22662170 __A = _mm_div_ss(__A, __B);
22672171 return __builtin_ia32_selectss_128(__U, __A, _mm_setzero_ps());
22682172}
......@@ -2285,14 +2189,14 @@ _mm_maskz_div_ss(__mmask8 __U,__m128 __A, __m128 __B) {
22852189 (__v4sf)_mm_setzero_ps(), \
22862190 (__mmask8)(U), (int)(R)))
22872191
2288static __inline__ __m128d __DEFAULT_FN_ATTRS128
2289_mm_mask_div_sd(__m128d __W, __mmask8 __U,__m128d __A, __m128d __B) {
2192static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2193_mm_mask_div_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
22902194 __A = _mm_div_sd(__A, __B);
22912195 return __builtin_ia32_selectsd_128(__U, __A, __W);
22922196}
22932197
2294static __inline__ __m128d __DEFAULT_FN_ATTRS128
2295_mm_maskz_div_sd(__mmask8 __U,__m128d __A, __m128d __B) {
2198static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2199_mm_maskz_div_sd(__mmask8 __U, __m128d __A, __m128d __B) {
22962200 __A = _mm_div_sd(__A, __B);
22972201 return __builtin_ia32_selectsd_128(__U, __A, _mm_setzero_pd());
22982202}
......@@ -2315,40 +2219,38 @@ _mm_maskz_div_sd(__mmask8 __U,__m128d __A, __m128d __B) {
23152219 (__v2df)_mm_setzero_pd(), \
23162220 (__mmask8)(U), (int)(R)))
23172221
2318static __inline __m512d __DEFAULT_FN_ATTRS512
2319_mm512_div_pd(__m512d __a, __m512d __b)
2320{
2222static __inline __m512d
2223 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_div_pd(__m512d __a, __m512d __b) {
23212224 return (__m512d)((__v8df)__a/(__v8df)__b);
23222225}
23232226
2324static __inline__ __m512d __DEFAULT_FN_ATTRS512
2227static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
23252228_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
23262229 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
23272230 (__v8df)_mm512_div_pd(__A, __B),
23282231 (__v8df)__W);
23292232}
23302233
2331static __inline__ __m512d __DEFAULT_FN_ATTRS512
2234static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
23322235_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) {
23332236 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
23342237 (__v8df)_mm512_div_pd(__A, __B),
23352238 (__v8df)_mm512_setzero_pd());
23362239}
23372240
2338static __inline __m512 __DEFAULT_FN_ATTRS512
2339_mm512_div_ps(__m512 __a, __m512 __b)
2340{
2241static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2242_mm512_div_ps(__m512 __a, __m512 __b) {
23412243 return (__m512)((__v16sf)__a/(__v16sf)__b);
23422244}
23432245
2344static __inline__ __m512 __DEFAULT_FN_ATTRS512
2246static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
23452247_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
23462248 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
23472249 (__v16sf)_mm512_div_ps(__A, __B),
23482250 (__v16sf)__W);
23492251}
23502252
2351static __inline__ __m512 __DEFAULT_FN_ATTRS512
2253static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
23522254_mm512_maskz_div_ps(__mmask16 __U, __m512 __A, __m512 __B) {
23532255 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
23542256 (__v16sf)_mm512_div_ps(__A, __B),
......@@ -2530,125 +2432,104 @@ _mm512_maskz_div_ps(__mmask16 __U, __m512 __A, __m512 __B) {
25302432 -(__v8df)(__m512d)(C), \
25312433 (__mmask8)(U), (int)(R)))
25322434
2435static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2436_mm512_fmadd_pd(__m512d __A, __m512d __B, __m512d __C) {
2437 return (__m512d)__builtin_elementwise_fma((__v8df)__A, (__v8df)__B,
2438 (__v8df)__C);
2439}
25332440
2534static __inline__ __m512d __DEFAULT_FN_ATTRS512
2535_mm512_fmadd_pd(__m512d __A, __m512d __B, __m512d __C)
2536{
2537 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
2538 (__v8df) __B,
2539 (__v8df) __C,
2540 (__mmask8) -1,
2541 _MM_FROUND_CUR_DIRECTION);
2441static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2442_mm512_mask_fmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) {
2443 return (__m512d)__builtin_ia32_selectpd_512(
2444 (__mmask8)__U, (__v8df)_mm512_fmadd_pd(__A, __B, __C), (__v8df)__A);
25422445}
25432446
2544static __inline__ __m512d __DEFAULT_FN_ATTRS512
2545_mm512_mask_fmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
2546{
2547 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
2548 (__v8df) __B,
2549 (__v8df) __C,
2550 (__mmask8) __U,
2551 _MM_FROUND_CUR_DIRECTION);
2447static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2448_mm512_mask3_fmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) {
2449 return (__m512d)__builtin_ia32_selectpd_512(
2450 (__mmask8)__U, (__v8df)_mm512_fmadd_pd(__A, __B, __C), (__v8df)__C);
25522451}
25532452
2554static __inline__ __m512d __DEFAULT_FN_ATTRS512
2555_mm512_mask3_fmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
2556{
2557 return (__m512d) __builtin_ia32_vfmaddpd512_mask3 ((__v8df) __A,
2558 (__v8df) __B,
2559 (__v8df) __C,
2560 (__mmask8) __U,
2561 _MM_FROUND_CUR_DIRECTION);
2453static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2454_mm512_maskz_fmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) {
2455 return (__m512d)__builtin_ia32_selectpd_512(
2456 (__mmask8)__U, (__v8df)_mm512_fmadd_pd(__A, __B, __C),
2457 (__v8df)_mm512_setzero_pd());
25622458}
25632459
2564static __inline__ __m512d __DEFAULT_FN_ATTRS512
2565_mm512_maskz_fmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
2566{
2567 return (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) __A,
2568 (__v8df) __B,
2569 (__v8df) __C,
2570 (__mmask8) __U,
2571 _MM_FROUND_CUR_DIRECTION);
2460static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2461_mm512_fmsub_pd(__m512d __A, __m512d __B, __m512d __C) {
2462 return (__m512d)__builtin_elementwise_fma((__v8df)__A, (__v8df)__B,
2463 -(__v8df)__C);
25722464}
25732465
2574static __inline__ __m512d __DEFAULT_FN_ATTRS512
2575_mm512_fmsub_pd(__m512d __A, __m512d __B, __m512d __C)
2576{
2577 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
2578 (__v8df) __B,
2579 -(__v8df) __C,
2580 (__mmask8) -1,
2581 _MM_FROUND_CUR_DIRECTION);
2466static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2467_mm512_mask_fmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) {
2468 return (__m512d)__builtin_ia32_selectpd_512(
2469 (__mmask8)__U, (__v8df)_mm512_fmsub_pd(__A, __B, __C), (__v8df)__A);
25822470}
25832471
2584static __inline__ __m512d __DEFAULT_FN_ATTRS512
2585_mm512_mask_fmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
2586{
2587 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
2588 (__v8df) __B,
2589 -(__v8df) __C,
2590 (__mmask8) __U,
2591 _MM_FROUND_CUR_DIRECTION);
2472static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2473_mm512_mask3_fmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) {
2474 return (__m512d)__builtin_ia32_selectpd_512(
2475 (__mmask8)__U, (__v8df)_mm512_fmsub_pd(__A, __B, __C), (__v8df)__C);
25922476}
25932477
2594static __inline__ __m512d __DEFAULT_FN_ATTRS512
2595_mm512_maskz_fmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
2596{
2597 return (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) __A,
2598 (__v8df) __B,
2599 -(__v8df) __C,
2600 (__mmask8) __U,
2601 _MM_FROUND_CUR_DIRECTION);
2478static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2479_mm512_maskz_fmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) {
2480 return (__m512d)__builtin_ia32_selectpd_512(
2481 (__mmask8)__U, (__v8df)_mm512_fmsub_pd(__A, __B, __C),
2482 (__v8df)_mm512_setzero_pd());
26022483}
26032484
2604static __inline__ __m512d __DEFAULT_FN_ATTRS512
2605_mm512_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C)
2606{
2607 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
2608 -(__v8df) __B,
2609 (__v8df) __C,
2610 (__mmask8) -1,
2611 _MM_FROUND_CUR_DIRECTION);
2485static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2486_mm512_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C) {
2487 return (__m512d)__builtin_elementwise_fma(-(__v8df)__A, (__v8df)__B,
2488 (__v8df)__C);
26122489}
26132490
2614static __inline__ __m512d __DEFAULT_FN_ATTRS512
2615_mm512_mask3_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
2616{
2617 return (__m512d) __builtin_ia32_vfmaddpd512_mask3 (-(__v8df) __A,
2618 (__v8df) __B,
2619 (__v8df) __C,
2620 (__mmask8) __U,
2621 _MM_FROUND_CUR_DIRECTION);
2491static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2492_mm512_mask_fnmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) {
2493 return (__m512d)__builtin_ia32_selectpd_512(
2494 (__mmask8)__U, (__v8df)_mm512_fnmadd_pd(__A, __B, __C), (__v8df)__A);
26222495}
26232496
2624static __inline__ __m512d __DEFAULT_FN_ATTRS512
2625_mm512_maskz_fnmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
2626{
2627 return (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) __A,
2628 (__v8df) __B,
2629 (__v8df) __C,
2630 (__mmask8) __U,
2631 _MM_FROUND_CUR_DIRECTION);
2497static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2498_mm512_mask3_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) {
2499 return (__m512d)__builtin_ia32_selectpd_512(
2500 (__mmask8)__U, (__v8df)_mm512_fnmadd_pd(__A, __B, __C), (__v8df)__C);
26322501}
26332502
2634static __inline__ __m512d __DEFAULT_FN_ATTRS512
2635_mm512_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C)
2636{
2637 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
2638 -(__v8df) __B,
2639 -(__v8df) __C,
2640 (__mmask8) -1,
2641 _MM_FROUND_CUR_DIRECTION);
2503static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2504_mm512_maskz_fnmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) {
2505 return (__m512d)__builtin_ia32_selectpd_512(
2506 (__mmask8)__U, (__v8df)_mm512_fnmadd_pd(__A, __B, __C),
2507 (__v8df)_mm512_setzero_pd());
26422508}
26432509
2644static __inline__ __m512d __DEFAULT_FN_ATTRS512
2645_mm512_maskz_fnmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
2646{
2647 return (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) __A,
2648 (__v8df) __B,
2649 -(__v8df) __C,
2650 (__mmask8) __U,
2651 _MM_FROUND_CUR_DIRECTION);
2510static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2511_mm512_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C) {
2512 return (__m512d)__builtin_elementwise_fma(-(__v8df)__A, (__v8df)__B,
2513 -(__v8df)__C);
2514}
2515
2516static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2517_mm512_mask_fnmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) {
2518 return (__m512d)__builtin_ia32_selectpd_512(
2519 (__mmask8)__U, (__v8df)_mm512_fnmsub_pd(__A, __B, __C), (__v8df)__A);
2520}
2521
2522static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2523_mm512_mask3_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) {
2524 return (__m512d)__builtin_ia32_selectpd_512(
2525 (__mmask8)__U, (__v8df)_mm512_fnmsub_pd(__A, __B, __C), (__v8df)__C);
2526}
2527
2528static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
2529_mm512_maskz_fnmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) {
2530 return (__m512d)__builtin_ia32_selectpd_512(
2531 (__mmask8)__U, (__v8df)_mm512_fnmsub_pd(__A, __B, __C),
2532 (__v8df)_mm512_setzero_pd());
26522533}
26532534
26542535#define _mm512_fmadd_round_ps(A, B, C, R) \
......@@ -2734,125 +2615,104 @@ _mm512_maskz_fnmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
27342615 -(__v16sf)(__m512)(C), \
27352616 (__mmask16)(U), (int)(R)))
27362617
2618static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2619_mm512_fmadd_ps(__m512 __A, __m512 __B, __m512 __C) {
2620 return (__m512)__builtin_elementwise_fma((__v16sf)__A, (__v16sf)__B,
2621 (__v16sf)__C);
2622}
27372623
2738static __inline__ __m512 __DEFAULT_FN_ATTRS512
2739_mm512_fmadd_ps(__m512 __A, __m512 __B, __m512 __C)
2740{
2741 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
2742 (__v16sf) __B,
2743 (__v16sf) __C,
2744 (__mmask16) -1,
2745 _MM_FROUND_CUR_DIRECTION);
2624static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2625_mm512_mask_fmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) {
2626 return (__m512)__builtin_ia32_selectps_512(
2627 (__mmask16)__U, (__v16sf)_mm512_fmadd_ps(__A, __B, __C), (__v16sf)__A);
27462628}
27472629
2748static __inline__ __m512 __DEFAULT_FN_ATTRS512
2749_mm512_mask_fmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
2750{
2751 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
2752 (__v16sf) __B,
2753 (__v16sf) __C,
2754 (__mmask16) __U,
2755 _MM_FROUND_CUR_DIRECTION);
2630static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2631_mm512_mask3_fmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) {
2632 return (__m512)__builtin_ia32_selectps_512(
2633 (__mmask16)__U, (__v16sf)_mm512_fmadd_ps(__A, __B, __C), (__v16sf)__C);
27562634}
27572635
2758static __inline__ __m512 __DEFAULT_FN_ATTRS512
2759_mm512_mask3_fmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
2760{
2761 return (__m512) __builtin_ia32_vfmaddps512_mask3 ((__v16sf) __A,
2762 (__v16sf) __B,
2763 (__v16sf) __C,
2764 (__mmask16) __U,
2765 _MM_FROUND_CUR_DIRECTION);
2636static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2637_mm512_maskz_fmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) {
2638 return (__m512)__builtin_ia32_selectps_512(
2639 (__mmask16)__U, (__v16sf)_mm512_fmadd_ps(__A, __B, __C),
2640 (__v16sf)_mm512_setzero_ps());
27662641}
27672642
2768static __inline__ __m512 __DEFAULT_FN_ATTRS512
2769_mm512_maskz_fmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
2770{
2771 return (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) __A,
2772 (__v16sf) __B,
2773 (__v16sf) __C,
2774 (__mmask16) __U,
2775 _MM_FROUND_CUR_DIRECTION);
2643static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2644_mm512_fmsub_ps(__m512 __A, __m512 __B, __m512 __C) {
2645 return (__m512)__builtin_elementwise_fma((__v16sf)__A, (__v16sf)__B,
2646 -(__v16sf)__C);
27762647}
27772648
2778static __inline__ __m512 __DEFAULT_FN_ATTRS512
2779_mm512_fmsub_ps(__m512 __A, __m512 __B, __m512 __C)
2780{
2781 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
2782 (__v16sf) __B,
2783 -(__v16sf) __C,
2784 (__mmask16) -1,
2785 _MM_FROUND_CUR_DIRECTION);
2649static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2650_mm512_mask_fmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) {
2651 return (__m512)__builtin_ia32_selectps_512(
2652 (__mmask16)__U, (__v16sf)_mm512_fmsub_ps(__A, __B, __C), (__v16sf)__A);
27862653}
27872654
2788static __inline__ __m512 __DEFAULT_FN_ATTRS512
2789_mm512_mask_fmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
2790{
2791 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
2792 (__v16sf) __B,
2793 -(__v16sf) __C,
2794 (__mmask16) __U,
2795 _MM_FROUND_CUR_DIRECTION);
2655static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2656_mm512_mask3_fmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) {
2657 return (__m512)__builtin_ia32_selectps_512(
2658 (__mmask16)__U, (__v16sf)_mm512_fmsub_ps(__A, __B, __C), (__v16sf)__C);
2659}
2660
2661static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2662_mm512_maskz_fmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) {
2663 return (__m512)__builtin_ia32_selectps_512(
2664 (__mmask16)__U, (__v16sf)_mm512_fmsub_ps(__A, __B, __C),
2665 (__v16sf)_mm512_setzero_ps());
2666}
2667
2668static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2669_mm512_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C) {
2670 return (__m512)__builtin_elementwise_fma(-(__v16sf)__A, (__v16sf)__B,
2671 (__v16sf)__C);
27962672}
27972673
2798static __inline__ __m512 __DEFAULT_FN_ATTRS512
2799_mm512_maskz_fmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
2800{
2801 return (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) __A,
2802 (__v16sf) __B,
2803 -(__v16sf) __C,
2804 (__mmask16) __U,
2805 _MM_FROUND_CUR_DIRECTION);
2674static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2675_mm512_mask_fnmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) {
2676 return (__m512)__builtin_ia32_selectps_512(
2677 (__mmask16)__U, (__v16sf)_mm512_fnmadd_ps(__A, __B, __C), (__v16sf)__A);
28062678}
28072679
2808static __inline__ __m512 __DEFAULT_FN_ATTRS512
2809_mm512_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C)
2810{
2811 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
2812 -(__v16sf) __B,
2813 (__v16sf) __C,
2814 (__mmask16) -1,
2815 _MM_FROUND_CUR_DIRECTION);
2680static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2681_mm512_mask3_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) {
2682 return (__m512)__builtin_ia32_selectps_512(
2683 (__mmask16)__U, (__v16sf)_mm512_fnmadd_ps(__A, __B, __C), (__v16sf)__C);
28162684}
28172685
2818static __inline__ __m512 __DEFAULT_FN_ATTRS512
2819_mm512_mask3_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
2820{
2821 return (__m512) __builtin_ia32_vfmaddps512_mask3 (-(__v16sf) __A,
2822 (__v16sf) __B,
2823 (__v16sf) __C,
2824 (__mmask16) __U,
2825 _MM_FROUND_CUR_DIRECTION);
2686static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2687_mm512_maskz_fnmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) {
2688 return (__m512)__builtin_ia32_selectps_512(
2689 (__mmask16)__U, (__v16sf)_mm512_fnmadd_ps(__A, __B, __C),
2690 (__v16sf)_mm512_setzero_ps());
28262691}
28272692
2828static __inline__ __m512 __DEFAULT_FN_ATTRS512
2829_mm512_maskz_fnmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
2830{
2831 return (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) __A,
2832 (__v16sf) __B,
2833 (__v16sf) __C,
2834 (__mmask16) __U,
2835 _MM_FROUND_CUR_DIRECTION);
2693static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2694_mm512_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C) {
2695 return (__m512)__builtin_elementwise_fma(-(__v16sf)__A, (__v16sf)__B,
2696 -(__v16sf)__C);
28362697}
28372698
2838static __inline__ __m512 __DEFAULT_FN_ATTRS512
2839_mm512_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C)
2840{
2841 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
2842 -(__v16sf) __B,
2843 -(__v16sf) __C,
2844 (__mmask16) -1,
2845 _MM_FROUND_CUR_DIRECTION);
2699static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2700_mm512_mask_fnmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) {
2701 return (__m512)__builtin_ia32_selectps_512(
2702 (__mmask16)__U, (__v16sf)_mm512_fnmsub_ps(__A, __B, __C), (__v16sf)__A);
28462703}
28472704
2848static __inline__ __m512 __DEFAULT_FN_ATTRS512
2849_mm512_maskz_fnmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
2850{
2851 return (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) __A,
2852 (__v16sf) __B,
2853 -(__v16sf) __C,
2854 (__mmask16) __U,
2855 _MM_FROUND_CUR_DIRECTION);
2705static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2706_mm512_mask3_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) {
2707 return (__m512)__builtin_ia32_selectps_512(
2708 (__mmask16)__U, (__v16sf)_mm512_fnmsub_ps(__A, __B, __C), (__v16sf)__C);
2709}
2710
2711static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
2712_mm512_maskz_fnmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) {
2713 return (__m512)__builtin_ia32_selectps_512(
2714 (__mmask16)__U, (__v16sf)_mm512_fnmsub_ps(__A, __B, __C),
2715 (__v16sf)_mm512_setzero_ps());
28562716}
28572717
28582718#define _mm512_fmaddsub_round_pd(A, B, C, R) \
......@@ -3099,33 +2959,12 @@ _mm512_maskz_fmsubadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
30992959 (__v8df)(__m512d)(C), \
31002960 (__mmask8)(U), (int)(R)))
31012961
3102
3103static __inline__ __m512d __DEFAULT_FN_ATTRS512
3104_mm512_mask3_fmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
3105{
3106 return (__m512d)__builtin_ia32_vfmsubpd512_mask3 ((__v8df) __A,
3107 (__v8df) __B,
3108 (__v8df) __C,
3109 (__mmask8) __U,
3110 _MM_FROUND_CUR_DIRECTION);
3111}
3112
31132962#define _mm512_mask3_fmsub_round_ps(A, B, C, U, R) \
31142963 ((__m512)__builtin_ia32_vfmsubps512_mask3((__v16sf)(__m512)(A), \
31152964 (__v16sf)(__m512)(B), \
31162965 (__v16sf)(__m512)(C), \
31172966 (__mmask16)(U), (int)(R)))
31182967
3119static __inline__ __m512 __DEFAULT_FN_ATTRS512
3120_mm512_mask3_fmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
3121{
3122 return (__m512)__builtin_ia32_vfmsubps512_mask3 ((__v16sf) __A,
3123 (__v16sf) __B,
3124 (__v16sf) __C,
3125 (__mmask16) __U,
3126 _MM_FROUND_CUR_DIRECTION);
3127}
3128
31292968#define _mm512_mask3_fmsubadd_round_pd(A, B, C, U, R) \
31302969 ((__m512d)__builtin_ia32_vfmsubaddpd512_mask3((__v8df)(__m512d)(A), \
31312970 (__v8df)(__m512d)(B), \
......@@ -3166,34 +3005,12 @@ _mm512_mask3_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
31663005 (__v8df)(__m512d)(C), \
31673006 (__mmask8)(U), (int)(R)))
31683007
3169
3170static __inline__ __m512d __DEFAULT_FN_ATTRS512
3171_mm512_mask_fnmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
3172{
3173 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
3174 -(__v8df) __B,
3175 (__v8df) __C,
3176 (__mmask8) __U,
3177 _MM_FROUND_CUR_DIRECTION);
3178}
3179
31803008#define _mm512_mask_fnmadd_round_ps(A, U, B, C, R) \
31813009 ((__m512)__builtin_ia32_vfmaddps512_mask((__v16sf)(__m512)(A), \
31823010 -(__v16sf)(__m512)(B), \
31833011 (__v16sf)(__m512)(C), \
31843012 (__mmask16)(U), (int)(R)))
31853013
3186
3187static __inline__ __m512 __DEFAULT_FN_ATTRS512
3188_mm512_mask_fnmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
3189{
3190 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
3191 -(__v16sf) __B,
3192 (__v16sf) __C,
3193 (__mmask16) __U,
3194 _MM_FROUND_CUR_DIRECTION);
3195}
3196
31973014#define _mm512_mask_fnmsub_round_pd(A, U, B, C, R) \
31983015 ((__m512d)__builtin_ia32_vfmaddpd512_mask((__v8df)(__m512d)(A), \
31993016 -(__v8df)(__m512d)(B), \
......@@ -3207,27 +3024,6 @@ _mm512_mask_fnmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
32073024 (__v8df)(__m512d)(C), \
32083025 (__mmask8)(U), (int)(R)))
32093026
3210
3211static __inline__ __m512d __DEFAULT_FN_ATTRS512
3212_mm512_mask_fnmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
3213{
3214 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
3215 -(__v8df) __B,
3216 -(__v8df) __C,
3217 (__mmask8) __U,
3218 _MM_FROUND_CUR_DIRECTION);
3219}
3220
3221static __inline__ __m512d __DEFAULT_FN_ATTRS512
3222_mm512_mask3_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
3223{
3224 return (__m512d) __builtin_ia32_vfmsubpd512_mask3 (-(__v8df) __A,
3225 (__v8df) __B,
3226 (__v8df) __C,
3227 (__mmask8) __U,
3228 _MM_FROUND_CUR_DIRECTION);
3229}
3230
32313027#define _mm512_mask_fnmsub_round_ps(A, U, B, C, R) \
32323028 ((__m512)__builtin_ia32_vfmaddps512_mask((__v16sf)(__m512)(A), \
32333029 -(__v16sf)(__m512)(B), \
......@@ -3241,94 +3037,63 @@ _mm512_mask3_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
32413037 (__v16sf)(__m512)(C), \
32423038 (__mmask16)(U), (int)(R)))
32433039
3244
3245static __inline__ __m512 __DEFAULT_FN_ATTRS512
3246_mm512_mask_fnmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
3247{
3248 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
3249 -(__v16sf) __B,
3250 -(__v16sf) __C,
3251 (__mmask16) __U,
3252 _MM_FROUND_CUR_DIRECTION);
3253}
3254
3255static __inline__ __m512 __DEFAULT_FN_ATTRS512
3256_mm512_mask3_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
3257{
3258 return (__m512) __builtin_ia32_vfmsubps512_mask3 (-(__v16sf) __A,
3259 (__v16sf) __B,
3260 (__v16sf) __C,
3261 (__mmask16) __U,
3262 _MM_FROUND_CUR_DIRECTION);
3263}
3264
3265
3266
32673040/* Vector permutations */
32683041
3269static __inline __m512i __DEFAULT_FN_ATTRS512
3270_mm512_permutex2var_epi32(__m512i __A, __m512i __I, __m512i __B)
3271{
3042static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
3043_mm512_permutex2var_epi32(__m512i __A, __m512i __I, __m512i __B) {
32723044 return (__m512i)__builtin_ia32_vpermi2vard512((__v16si)__A, (__v16si) __I,
32733045 (__v16si) __B);
32743046}
32753047
3276static __inline__ __m512i __DEFAULT_FN_ATTRS512
3048static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
32773049_mm512_mask_permutex2var_epi32(__m512i __A, __mmask16 __U, __m512i __I,
3278 __m512i __B)
3279{
3050 __m512i __B) {
32803051 return (__m512i)__builtin_ia32_selectd_512(__U,
32813052 (__v16si)_mm512_permutex2var_epi32(__A, __I, __B),
32823053 (__v16si)__A);
32833054}
32843055
3285static __inline__ __m512i __DEFAULT_FN_ATTRS512
3056static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
32863057_mm512_mask2_permutex2var_epi32(__m512i __A, __m512i __I, __mmask16 __U,
3287 __m512i __B)
3288{
3058 __m512i __B) {
32893059 return (__m512i)__builtin_ia32_selectd_512(__U,
32903060 (__v16si)_mm512_permutex2var_epi32(__A, __I, __B),
32913061 (__v16si)__I);
32923062}
32933063
3294static __inline__ __m512i __DEFAULT_FN_ATTRS512
3064static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
32953065_mm512_maskz_permutex2var_epi32(__mmask16 __U, __m512i __A, __m512i __I,
3296 __m512i __B)
3297{
3066 __m512i __B) {
32983067 return (__m512i)__builtin_ia32_selectd_512(__U,
32993068 (__v16si)_mm512_permutex2var_epi32(__A, __I, __B),
33003069 (__v16si)_mm512_setzero_si512());
33013070}
33023071
3303static __inline __m512i __DEFAULT_FN_ATTRS512
3304_mm512_permutex2var_epi64(__m512i __A, __m512i __I, __m512i __B)
3305{
3072static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
3073_mm512_permutex2var_epi64(__m512i __A, __m512i __I, __m512i __B) {
33063074 return (__m512i)__builtin_ia32_vpermi2varq512((__v8di)__A, (__v8di) __I,
33073075 (__v8di) __B);
33083076}
33093077
3310static __inline__ __m512i __DEFAULT_FN_ATTRS512
3078static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
33113079_mm512_mask_permutex2var_epi64(__m512i __A, __mmask8 __U, __m512i __I,
3312 __m512i __B)
3313{
3080 __m512i __B) {
33143081 return (__m512i)__builtin_ia32_selectq_512(__U,
33153082 (__v8di)_mm512_permutex2var_epi64(__A, __I, __B),
33163083 (__v8di)__A);
33173084}
33183085
3319static __inline__ __m512i __DEFAULT_FN_ATTRS512
3086static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
33203087_mm512_mask2_permutex2var_epi64(__m512i __A, __m512i __I, __mmask8 __U,
3321 __m512i __B)
3322{
3088 __m512i __B) {
33233089 return (__m512i)__builtin_ia32_selectq_512(__U,
33243090 (__v8di)_mm512_permutex2var_epi64(__A, __I, __B),
33253091 (__v8di)__I);
33263092}
33273093
3328static __inline__ __m512i __DEFAULT_FN_ATTRS512
3094static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
33293095_mm512_maskz_permutex2var_epi64(__mmask8 __U, __m512i __A, __m512i __I,
3330 __m512i __B)
3331{
3096 __m512i __B) {
33323097 return (__m512i)__builtin_ia32_selectq_512(__U,
33333098 (__v8di)_mm512_permutex2var_epi64(__A, __I, __B),
33343099 (__v8di)_mm512_setzero_si512());
......@@ -3363,10 +3128,10 @@ _mm512_maskz_permutex2var_epi64(__mmask8 __U, __m512i __A, __m512i __I,
33633128 (__v16si)_mm512_setzero_si512()))
33643129/* Vector Extract */
33653130
3366#define _mm512_extractf64x4_pd(A, I) \
3367 ((__m256d)__builtin_ia32_extractf64x4_mask((__v8df)(__m512d)(A), (int)(I), \
3368 (__v4df)_mm256_undefined_pd(), \
3369 (__mmask8)-1))
3131#define _mm512_extractf64x4_pd(A, I) \
3132 ((__m256d)__builtin_ia32_extractf64x4_mask((__v8df)(__m512d)(A), (int)(I), \
3133 (__v4df)_mm256_setzero_pd(), \
3134 (__mmask8) - 1))
33703135
33713136#define _mm512_mask_extractf64x4_pd(W, U, A, imm) \
33723137 ((__m256d)__builtin_ia32_extractf64x4_mask((__v8df)(__m512d)(A), (int)(imm), \
......@@ -3378,10 +3143,10 @@ _mm512_maskz_permutex2var_epi64(__mmask8 __U, __m512i __A, __m512i __I,
33783143 (__v4df)_mm256_setzero_pd(), \
33793144 (__mmask8)(U)))
33803145
3381#define _mm512_extractf32x4_ps(A, I) \
3382 ((__m128)__builtin_ia32_extractf32x4_mask((__v16sf)(__m512)(A), (int)(I), \
3383 (__v4sf)_mm_undefined_ps(), \
3384 (__mmask8)-1))
3146#define _mm512_extractf32x4_ps(A, I) \
3147 ((__m128)__builtin_ia32_extractf32x4_mask((__v16sf)(__m512)(A), (int)(I), \
3148 (__v4sf)_mm_setzero_ps(), \
3149 (__mmask8) - 1))
33853150
33863151#define _mm512_mask_extractf32x4_ps(W, U, A, imm) \
33873152 ((__m128)__builtin_ia32_extractf32x4_mask((__v16sf)(__m512)(A), (int)(imm), \
......@@ -3395,33 +3160,29 @@ _mm512_maskz_permutex2var_epi64(__mmask8 __U, __m512i __A, __m512i __I,
33953160
33963161/* Vector Blend */
33973162
3398static __inline __m512d __DEFAULT_FN_ATTRS512
3399_mm512_mask_blend_pd(__mmask8 __U, __m512d __A, __m512d __W)
3400{
3163static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3164_mm512_mask_blend_pd(__mmask8 __U, __m512d __A, __m512d __W) {
34013165 return (__m512d) __builtin_ia32_selectpd_512 ((__mmask8) __U,
34023166 (__v8df) __W,
34033167 (__v8df) __A);
34043168}
34053169
3406static __inline __m512 __DEFAULT_FN_ATTRS512
3407_mm512_mask_blend_ps(__mmask16 __U, __m512 __A, __m512 __W)
3408{
3170static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3171_mm512_mask_blend_ps(__mmask16 __U, __m512 __A, __m512 __W) {
34093172 return (__m512) __builtin_ia32_selectps_512 ((__mmask16) __U,
34103173 (__v16sf) __W,
34113174 (__v16sf) __A);
34123175}
34133176
3414static __inline __m512i __DEFAULT_FN_ATTRS512
3415_mm512_mask_blend_epi64(__mmask8 __U, __m512i __A, __m512i __W)
3416{
3177static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
3178_mm512_mask_blend_epi64(__mmask8 __U, __m512i __A, __m512i __W) {
34173179 return (__m512i) __builtin_ia32_selectq_512 ((__mmask8) __U,
34183180 (__v8di) __W,
34193181 (__v8di) __A);
34203182}
34213183
3422static __inline __m512i __DEFAULT_FN_ATTRS512
3423_mm512_mask_blend_epi32(__mmask16 __U, __m512i __A, __m512i __W)
3424{
3184static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
3185_mm512_mask_blend_epi32(__mmask16 __U, __m512i __A, __m512i __W) {
34253186 return (__m512i) __builtin_ia32_selectd_512 ((__mmask16) __U,
34263187 (__v16si) __W,
34273188 (__v16si) __A);
......@@ -3615,115 +3376,99 @@ _mm512_maskz_cvttps_epu32 (__mmask16 __U, __m512 __A)
36153376 (__v16sf)_mm512_setzero_ps(), \
36163377 (__mmask16)(U), (int)(R)))
36173378
3618static __inline__ __m512 __DEFAULT_FN_ATTRS512
3619_mm512_cvtepu32_ps (__m512i __A)
3620{
3379static __inline__ __m512
3380 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_cvtepu32_ps(__m512i __A) {
36213381 return (__m512)__builtin_convertvector((__v16su)__A, __v16sf);
36223382}
36233383
3624static __inline__ __m512 __DEFAULT_FN_ATTRS512
3625_mm512_mask_cvtepu32_ps (__m512 __W, __mmask16 __U, __m512i __A)
3626{
3384static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3385_mm512_mask_cvtepu32_ps(__m512 __W, __mmask16 __U, __m512i __A) {
36273386 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
36283387 (__v16sf)_mm512_cvtepu32_ps(__A),
36293388 (__v16sf)__W);
36303389}
36313390
3632static __inline__ __m512 __DEFAULT_FN_ATTRS512
3633_mm512_maskz_cvtepu32_ps (__mmask16 __U, __m512i __A)
3634{
3391static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3392_mm512_maskz_cvtepu32_ps(__mmask16 __U, __m512i __A) {
36353393 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
36363394 (__v16sf)_mm512_cvtepu32_ps(__A),
36373395 (__v16sf)_mm512_setzero_ps());
36383396}
36393397
3640static __inline __m512d __DEFAULT_FN_ATTRS512
3641_mm512_cvtepi32_pd(__m256i __A)
3642{
3398static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3399_mm512_cvtepi32_pd(__m256i __A) {
36433400 return (__m512d)__builtin_convertvector((__v8si)__A, __v8df);
36443401}
36453402
3646static __inline__ __m512d __DEFAULT_FN_ATTRS512
3647_mm512_mask_cvtepi32_pd (__m512d __W, __mmask8 __U, __m256i __A)
3648{
3403static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3404_mm512_mask_cvtepi32_pd(__m512d __W, __mmask8 __U, __m256i __A) {
36493405 return (__m512d)__builtin_ia32_selectpd_512((__mmask8) __U,
36503406 (__v8df)_mm512_cvtepi32_pd(__A),
36513407 (__v8df)__W);
36523408}
36533409
3654static __inline__ __m512d __DEFAULT_FN_ATTRS512
3655_mm512_maskz_cvtepi32_pd (__mmask8 __U, __m256i __A)
3656{
3410static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3411_mm512_maskz_cvtepi32_pd(__mmask8 __U, __m256i __A) {
36573412 return (__m512d)__builtin_ia32_selectpd_512((__mmask8) __U,
36583413 (__v8df)_mm512_cvtepi32_pd(__A),
36593414 (__v8df)_mm512_setzero_pd());
36603415}
36613416
3662static __inline__ __m512d __DEFAULT_FN_ATTRS512
3663_mm512_cvtepi32lo_pd(__m512i __A)
3664{
3417static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3418_mm512_cvtepi32lo_pd(__m512i __A) {
36653419 return (__m512d) _mm512_cvtepi32_pd(_mm512_castsi512_si256(__A));
36663420}
36673421
3668static __inline__ __m512d __DEFAULT_FN_ATTRS512
3669_mm512_mask_cvtepi32lo_pd(__m512d __W, __mmask8 __U,__m512i __A)
3670{
3422static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3423_mm512_mask_cvtepi32lo_pd(__m512d __W, __mmask8 __U, __m512i __A) {
36713424 return (__m512d) _mm512_mask_cvtepi32_pd(__W, __U, _mm512_castsi512_si256(__A));
36723425}
36733426
3674static __inline__ __m512 __DEFAULT_FN_ATTRS512
3675_mm512_cvtepi32_ps (__m512i __A)
3676{
3427static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3428_mm512_cvtepi32_ps(__m512i __A) {
36773429 return (__m512)__builtin_convertvector((__v16si)__A, __v16sf);
36783430}
36793431
3680static __inline__ __m512 __DEFAULT_FN_ATTRS512
3681_mm512_mask_cvtepi32_ps (__m512 __W, __mmask16 __U, __m512i __A)
3682{
3432static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3433_mm512_mask_cvtepi32_ps(__m512 __W, __mmask16 __U, __m512i __A) {
36833434 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
36843435 (__v16sf)_mm512_cvtepi32_ps(__A),
36853436 (__v16sf)__W);
36863437}
36873438
3688static __inline__ __m512 __DEFAULT_FN_ATTRS512
3689_mm512_maskz_cvtepi32_ps (__mmask16 __U, __m512i __A)
3690{
3439static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3440_mm512_maskz_cvtepi32_ps(__mmask16 __U, __m512i __A) {
36913441 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
36923442 (__v16sf)_mm512_cvtepi32_ps(__A),
36933443 (__v16sf)_mm512_setzero_ps());
36943444}
36953445
3696static __inline __m512d __DEFAULT_FN_ATTRS512
3697_mm512_cvtepu32_pd(__m256i __A)
3698{
3446static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3447_mm512_cvtepu32_pd(__m256i __A) {
36993448 return (__m512d)__builtin_convertvector((__v8su)__A, __v8df);
37003449}
37013450
3702static __inline__ __m512d __DEFAULT_FN_ATTRS512
3703_mm512_mask_cvtepu32_pd (__m512d __W, __mmask8 __U, __m256i __A)
3704{
3451static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3452_mm512_mask_cvtepu32_pd(__m512d __W, __mmask8 __U, __m256i __A) {
37053453 return (__m512d)__builtin_ia32_selectpd_512((__mmask8) __U,
37063454 (__v8df)_mm512_cvtepu32_pd(__A),
37073455 (__v8df)__W);
37083456}
37093457
3710static __inline__ __m512d __DEFAULT_FN_ATTRS512
3711_mm512_maskz_cvtepu32_pd (__mmask8 __U, __m256i __A)
3712{
3458static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3459_mm512_maskz_cvtepu32_pd(__mmask8 __U, __m256i __A) {
37133460 return (__m512d)__builtin_ia32_selectpd_512((__mmask8) __U,
37143461 (__v8df)_mm512_cvtepu32_pd(__A),
37153462 (__v8df)_mm512_setzero_pd());
37163463}
37173464
3718static __inline__ __m512d __DEFAULT_FN_ATTRS512
3719_mm512_cvtepu32lo_pd(__m512i __A)
3720{
3465static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3466_mm512_cvtepu32lo_pd(__m512i __A) {
37213467 return (__m512d) _mm512_cvtepu32_pd(_mm512_castsi512_si256(__A));
37223468}
37233469
3724static __inline__ __m512d __DEFAULT_FN_ATTRS512
3725_mm512_mask_cvtepu32lo_pd(__m512d __W, __mmask8 __U,__m512i __A)
3726{
3470static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3471_mm512_mask_cvtepu32lo_pd(__m512d __W, __mmask8 __U, __m512i __A) {
37273472 return (__m512d) _mm512_mask_cvtepu32_pd(__W, __U, _mm512_castsi512_si256(__A));
37283473}
37293474
......@@ -3742,44 +3487,38 @@ _mm512_mask_cvtepu32lo_pd(__m512d __W, __mmask8 __U,__m512i __A)
37423487 (__v8sf)_mm256_setzero_ps(), \
37433488 (__mmask8)(U), (int)(R)))
37443489
3745static __inline__ __m256 __DEFAULT_FN_ATTRS512
3746_mm512_cvtpd_ps (__m512d __A)
3747{
3748 return (__m256) __builtin_ia32_cvtpd2ps512_mask ((__v8df) __A,
3749 (__v8sf) _mm256_undefined_ps (),
3750 (__mmask8) -1,
3751 _MM_FROUND_CUR_DIRECTION);
3490static __inline__ __m256
3491 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_cvtpd_ps(__m512d __A) {
3492 return (__m256)__builtin_ia32_cvtpd2ps512_mask(
3493 (__v8df)__A, (__v8sf)_mm256_setzero_ps(), (__mmask8)-1,
3494 _MM_FROUND_CUR_DIRECTION);
37523495}
37533496
3754static __inline__ __m256 __DEFAULT_FN_ATTRS512
3755_mm512_mask_cvtpd_ps (__m256 __W, __mmask8 __U, __m512d __A)
3756{
3497static __inline__ __m256 __DEFAULT_FN_ATTRS512_CONSTEXPR
3498_mm512_mask_cvtpd_ps(__m256 __W, __mmask8 __U, __m512d __A) {
37573499 return (__m256) __builtin_ia32_cvtpd2ps512_mask ((__v8df) __A,
37583500 (__v8sf) __W,
37593501 (__mmask8) __U,
37603502 _MM_FROUND_CUR_DIRECTION);
37613503}
37623504
3763static __inline__ __m256 __DEFAULT_FN_ATTRS512
3764_mm512_maskz_cvtpd_ps (__mmask8 __U, __m512d __A)
3765{
3505static __inline__ __m256 __DEFAULT_FN_ATTRS512_CONSTEXPR
3506_mm512_maskz_cvtpd_ps(__mmask8 __U, __m512d __A) {
37663507 return (__m256) __builtin_ia32_cvtpd2ps512_mask ((__v8df) __A,
37673508 (__v8sf) _mm256_setzero_ps (),
37683509 (__mmask8) __U,
37693510 _MM_FROUND_CUR_DIRECTION);
37703511}
37713512
3772static __inline__ __m512 __DEFAULT_FN_ATTRS512
3773_mm512_cvtpd_pslo (__m512d __A)
3774{
3513static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3514_mm512_cvtpd_pslo(__m512d __A) {
37753515 return (__m512) __builtin_shufflevector((__v8sf) _mm512_cvtpd_ps(__A),
37763516 (__v8sf) _mm256_setzero_ps (),
37773517 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
37783518}
37793519
3780static __inline__ __m512 __DEFAULT_FN_ATTRS512
3781_mm512_mask_cvtpd_pslo (__m512 __W, __mmask8 __U,__m512d __A)
3782{
3520static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3521_mm512_mask_cvtpd_pslo(__m512 __W, __mmask8 __U, __m512d __A) {
37833522 return (__m512) __builtin_shufflevector (
37843523 (__v8sf) _mm512_mask_cvtpd_ps (_mm512_castps512_ps256(__W),
37853524 __U, __A),
......@@ -4123,9 +3862,8 @@ _mm512_cvtss_f32(__m512 __a)
41233862
41243863/* Unpack and Interleave */
41253864
4126static __inline __m512d __DEFAULT_FN_ATTRS512
4127_mm512_unpackhi_pd(__m512d __a, __m512d __b)
4128{
3865static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3866_mm512_unpackhi_pd(__m512d __a, __m512d __b) {
41293867 return (__m512d)__builtin_shufflevector((__v8df)__a, (__v8df)__b,
41303868 1, 9, 1+2, 9+2, 1+4, 9+4, 1+6, 9+6);
41313869}
......@@ -4146,9 +3884,8 @@ _mm512_maskz_unpackhi_pd(__mmask8 __U, __m512d __A, __m512d __B)
41463884 (__v8df)_mm512_setzero_pd());
41473885}
41483886
4149static __inline __m512d __DEFAULT_FN_ATTRS512
4150_mm512_unpacklo_pd(__m512d __a, __m512d __b)
4151{
3887static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
3888_mm512_unpacklo_pd(__m512d __a, __m512d __b) {
41523889 return (__m512d)__builtin_shufflevector((__v8df)__a, (__v8df)__b,
41533890 0, 8, 0+2, 8+2, 0+4, 8+4, 0+6, 8+6);
41543891}
......@@ -4169,9 +3906,8 @@ _mm512_maskz_unpacklo_pd (__mmask8 __U, __m512d __A, __m512d __B)
41693906 (__v8df)_mm512_setzero_pd());
41703907}
41713908
4172static __inline __m512 __DEFAULT_FN_ATTRS512
4173_mm512_unpackhi_ps(__m512 __a, __m512 __b)
4174{
3909static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3910_mm512_unpackhi_ps(__m512 __a, __m512 __b) {
41753911 return (__m512)__builtin_shufflevector((__v16sf)__a, (__v16sf)__b,
41763912 2, 18, 3, 19,
41773913 2+4, 18+4, 3+4, 19+4,
......@@ -4195,9 +3931,8 @@ _mm512_maskz_unpackhi_ps (__mmask16 __U, __m512 __A, __m512 __B)
41953931 (__v16sf)_mm512_setzero_ps());
41963932}
41973933
4198static __inline __m512 __DEFAULT_FN_ATTRS512
4199_mm512_unpacklo_ps(__m512 __a, __m512 __b)
4200{
3934static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
3935_mm512_unpacklo_ps(__m512 __a, __m512 __b) {
42013936 return (__m512)__builtin_shufflevector((__v16sf)__a, (__v16sf)__b,
42023937 0, 16, 1, 17,
42033938 0+4, 16+4, 1+4, 17+4,
......@@ -4221,9 +3956,8 @@ _mm512_maskz_unpacklo_ps (__mmask16 __U, __m512 __A, __m512 __B)
42213956 (__v16sf)_mm512_setzero_ps());
42223957}
42233958
4224static __inline__ __m512i __DEFAULT_FN_ATTRS512
4225_mm512_unpackhi_epi32(__m512i __A, __m512i __B)
4226{
3959static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
3960_mm512_unpackhi_epi32(__m512i __A, __m512i __B) {
42273961 return (__m512i)__builtin_shufflevector((__v16si)__A, (__v16si)__B,
42283962 2, 18, 3, 19,
42293963 2+4, 18+4, 3+4, 19+4,
......@@ -4247,9 +3981,8 @@ _mm512_maskz_unpackhi_epi32(__mmask16 __U, __m512i __A, __m512i __B)
42473981 (__v16si)_mm512_setzero_si512());
42483982}
42493983
4250static __inline__ __m512i __DEFAULT_FN_ATTRS512
4251_mm512_unpacklo_epi32(__m512i __A, __m512i __B)
4252{
3984static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
3985_mm512_unpacklo_epi32(__m512i __A, __m512i __B) {
42533986 return (__m512i)__builtin_shufflevector((__v16si)__A, (__v16si)__B,
42543987 0, 16, 1, 17,
42553988 0+4, 16+4, 1+4, 17+4,
......@@ -4273,9 +4006,8 @@ _mm512_maskz_unpacklo_epi32(__mmask16 __U, __m512i __A, __m512i __B)
42734006 (__v16si)_mm512_setzero_si512());
42744007}
42754008
4276static __inline__ __m512i __DEFAULT_FN_ATTRS512
4277_mm512_unpackhi_epi64(__m512i __A, __m512i __B)
4278{
4009static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4010_mm512_unpackhi_epi64(__m512i __A, __m512i __B) {
42794011 return (__m512i)__builtin_shufflevector((__v8di)__A, (__v8di)__B,
42804012 1, 9, 1+2, 9+2, 1+4, 9+4, 1+6, 9+6);
42814013}
......@@ -4296,9 +4028,8 @@ _mm512_maskz_unpackhi_epi64(__mmask8 __U, __m512i __A, __m512i __B)
42964028 (__v8di)_mm512_setzero_si512());
42974029}
42984030
4299static __inline__ __m512i __DEFAULT_FN_ATTRS512
4300_mm512_unpacklo_epi64 (__m512i __A, __m512i __B)
4301{
4031static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4032_mm512_unpacklo_epi64(__m512i __A, __m512i __B) {
43024033 return (__m512i)__builtin_shufflevector((__v8di)__A, (__v8di)__B,
43034034 0, 8, 0+2, 8+2, 0+4, 8+4, 0+6, 8+6);
43044035}
......@@ -4619,9 +4350,8 @@ _mm512_store_epi64 (void *__P, __m512i __A)
46194350
46204351/* Mask ops */
46214352
4622static __inline __mmask16 __DEFAULT_FN_ATTRS
4623_mm512_knot(__mmask16 __M)
4624{
4353static __inline __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
4354_mm512_knot(__mmask16 __M) {
46254355 return __builtin_ia32_knothi(__M);
46264356}
46274357
......@@ -4727,237 +4457,207 @@ _mm512_knot(__mmask16 __M)
47274457#define _mm512_mask_cmpneq_epu64_mask(k, A, B) \
47284458 _mm512_mask_cmp_epu64_mask((k), (A), (B), _MM_CMPINT_NE)
47294459
4730static __inline__ __m512i __DEFAULT_FN_ATTRS512
4731_mm512_cvtepi8_epi32(__m128i __A)
4732{
4460static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4461_mm512_cvtepi8_epi32(__m128i __A) {
47334462 /* This function always performs a signed extension, but __v16qi is a char
47344463 which may be signed or unsigned, so use __v16qs. */
47354464 return (__m512i)__builtin_convertvector((__v16qs)__A, __v16si);
47364465}
47374466
4738static __inline__ __m512i __DEFAULT_FN_ATTRS512
4739_mm512_mask_cvtepi8_epi32(__m512i __W, __mmask16 __U, __m128i __A)
4740{
4467static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4468_mm512_mask_cvtepi8_epi32(__m512i __W, __mmask16 __U, __m128i __A) {
47414469 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
47424470 (__v16si)_mm512_cvtepi8_epi32(__A),
47434471 (__v16si)__W);
47444472}
47454473
4746static __inline__ __m512i __DEFAULT_FN_ATTRS512
4747_mm512_maskz_cvtepi8_epi32(__mmask16 __U, __m128i __A)
4748{
4474static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4475_mm512_maskz_cvtepi8_epi32(__mmask16 __U, __m128i __A) {
47494476 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
47504477 (__v16si)_mm512_cvtepi8_epi32(__A),
47514478 (__v16si)_mm512_setzero_si512());
47524479}
47534480
4754static __inline__ __m512i __DEFAULT_FN_ATTRS512
4755_mm512_cvtepi8_epi64(__m128i __A)
4756{
4481static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4482_mm512_cvtepi8_epi64(__m128i __A) {
47574483 /* This function always performs a signed extension, but __v16qi is a char
47584484 which may be signed or unsigned, so use __v16qs. */
47594485 return (__m512i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__A, (__v16qs)__A, 0, 1, 2, 3, 4, 5, 6, 7), __v8di);
47604486}
47614487
4762static __inline__ __m512i __DEFAULT_FN_ATTRS512
4763_mm512_mask_cvtepi8_epi64(__m512i __W, __mmask8 __U, __m128i __A)
4764{
4488static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4489_mm512_mask_cvtepi8_epi64(__m512i __W, __mmask8 __U, __m128i __A) {
47654490 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
47664491 (__v8di)_mm512_cvtepi8_epi64(__A),
47674492 (__v8di)__W);
47684493}
47694494
4770static __inline__ __m512i __DEFAULT_FN_ATTRS512
4771_mm512_maskz_cvtepi8_epi64(__mmask8 __U, __m128i __A)
4772{
4495static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4496_mm512_maskz_cvtepi8_epi64(__mmask8 __U, __m128i __A) {
47734497 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
47744498 (__v8di)_mm512_cvtepi8_epi64(__A),
47754499 (__v8di)_mm512_setzero_si512 ());
47764500}
47774501
4778static __inline__ __m512i __DEFAULT_FN_ATTRS512
4779_mm512_cvtepi32_epi64(__m256i __X)
4780{
4502static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4503_mm512_cvtepi32_epi64(__m256i __X) {
47814504 return (__m512i)__builtin_convertvector((__v8si)__X, __v8di);
47824505}
47834506
4784static __inline__ __m512i __DEFAULT_FN_ATTRS512
4785_mm512_mask_cvtepi32_epi64(__m512i __W, __mmask8 __U, __m256i __X)
4786{
4507static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4508_mm512_mask_cvtepi32_epi64(__m512i __W, __mmask8 __U, __m256i __X) {
47874509 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
47884510 (__v8di)_mm512_cvtepi32_epi64(__X),
47894511 (__v8di)__W);
47904512}
47914513
4792static __inline__ __m512i __DEFAULT_FN_ATTRS512
4793_mm512_maskz_cvtepi32_epi64(__mmask8 __U, __m256i __X)
4794{
4514static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4515_mm512_maskz_cvtepi32_epi64(__mmask8 __U, __m256i __X) {
47954516 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
47964517 (__v8di)_mm512_cvtepi32_epi64(__X),
47974518 (__v8di)_mm512_setzero_si512());
47984519}
47994520
4800static __inline__ __m512i __DEFAULT_FN_ATTRS512
4801_mm512_cvtepi16_epi32(__m256i __A)
4802{
4521static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4522_mm512_cvtepi16_epi32(__m256i __A) {
48034523 return (__m512i)__builtin_convertvector((__v16hi)__A, __v16si);
48044524}
48054525
4806static __inline__ __m512i __DEFAULT_FN_ATTRS512
4807_mm512_mask_cvtepi16_epi32(__m512i __W, __mmask16 __U, __m256i __A)
4808{
4526static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4527_mm512_mask_cvtepi16_epi32(__m512i __W, __mmask16 __U, __m256i __A) {
48094528 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
48104529 (__v16si)_mm512_cvtepi16_epi32(__A),
48114530 (__v16si)__W);
48124531}
48134532
4814static __inline__ __m512i __DEFAULT_FN_ATTRS512
4815_mm512_maskz_cvtepi16_epi32(__mmask16 __U, __m256i __A)
4816{
4533static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4534_mm512_maskz_cvtepi16_epi32(__mmask16 __U, __m256i __A) {
48174535 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
48184536 (__v16si)_mm512_cvtepi16_epi32(__A),
48194537 (__v16si)_mm512_setzero_si512 ());
48204538}
48214539
4822static __inline__ __m512i __DEFAULT_FN_ATTRS512
4823_mm512_cvtepi16_epi64(__m128i __A)
4824{
4540static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4541_mm512_cvtepi16_epi64(__m128i __A) {
48254542 return (__m512i)__builtin_convertvector((__v8hi)__A, __v8di);
48264543}
48274544
4828static __inline__ __m512i __DEFAULT_FN_ATTRS512
4829_mm512_mask_cvtepi16_epi64(__m512i __W, __mmask8 __U, __m128i __A)
4830{
4545static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4546_mm512_mask_cvtepi16_epi64(__m512i __W, __mmask8 __U, __m128i __A) {
48314547 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
48324548 (__v8di)_mm512_cvtepi16_epi64(__A),
48334549 (__v8di)__W);
48344550}
48354551
4836static __inline__ __m512i __DEFAULT_FN_ATTRS512
4837_mm512_maskz_cvtepi16_epi64(__mmask8 __U, __m128i __A)
4838{
4552static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4553_mm512_maskz_cvtepi16_epi64(__mmask8 __U, __m128i __A) {
48394554 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
48404555 (__v8di)_mm512_cvtepi16_epi64(__A),
48414556 (__v8di)_mm512_setzero_si512());
48424557}
48434558
4844static __inline__ __m512i __DEFAULT_FN_ATTRS512
4845_mm512_cvtepu8_epi32(__m128i __A)
4846{
4559static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4560_mm512_cvtepu8_epi32(__m128i __A) {
48474561 return (__m512i)__builtin_convertvector((__v16qu)__A, __v16si);
48484562}
48494563
4850static __inline__ __m512i __DEFAULT_FN_ATTRS512
4851_mm512_mask_cvtepu8_epi32(__m512i __W, __mmask16 __U, __m128i __A)
4852{
4564static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4565_mm512_mask_cvtepu8_epi32(__m512i __W, __mmask16 __U, __m128i __A) {
48534566 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
48544567 (__v16si)_mm512_cvtepu8_epi32(__A),
48554568 (__v16si)__W);
48564569}
48574570
4858static __inline__ __m512i __DEFAULT_FN_ATTRS512
4859_mm512_maskz_cvtepu8_epi32(__mmask16 __U, __m128i __A)
4860{
4571static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4572_mm512_maskz_cvtepu8_epi32(__mmask16 __U, __m128i __A) {
48614573 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
48624574 (__v16si)_mm512_cvtepu8_epi32(__A),
48634575 (__v16si)_mm512_setzero_si512());
48644576}
48654577
4866static __inline__ __m512i __DEFAULT_FN_ATTRS512
4867_mm512_cvtepu8_epi64(__m128i __A)
4868{
4578static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4579_mm512_cvtepu8_epi64(__m128i __A) {
48694580 return (__m512i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__A, (__v16qu)__A, 0, 1, 2, 3, 4, 5, 6, 7), __v8di);
48704581}
48714582
4872static __inline__ __m512i __DEFAULT_FN_ATTRS512
4873_mm512_mask_cvtepu8_epi64(__m512i __W, __mmask8 __U, __m128i __A)
4874{
4583static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4584_mm512_mask_cvtepu8_epi64(__m512i __W, __mmask8 __U, __m128i __A) {
48754585 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
48764586 (__v8di)_mm512_cvtepu8_epi64(__A),
48774587 (__v8di)__W);
48784588}
48794589
4880static __inline__ __m512i __DEFAULT_FN_ATTRS512
4881_mm512_maskz_cvtepu8_epi64(__mmask8 __U, __m128i __A)
4882{
4590static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4591_mm512_maskz_cvtepu8_epi64(__mmask8 __U, __m128i __A) {
48834592 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
48844593 (__v8di)_mm512_cvtepu8_epi64(__A),
48854594 (__v8di)_mm512_setzero_si512());
48864595}
48874596
4888static __inline__ __m512i __DEFAULT_FN_ATTRS512
4889_mm512_cvtepu32_epi64(__m256i __X)
4890{
4597static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4598_mm512_cvtepu32_epi64(__m256i __X) {
48914599 return (__m512i)__builtin_convertvector((__v8su)__X, __v8di);
48924600}
48934601
4894static __inline__ __m512i __DEFAULT_FN_ATTRS512
4895_mm512_mask_cvtepu32_epi64(__m512i __W, __mmask8 __U, __m256i __X)
4896{
4602static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4603_mm512_mask_cvtepu32_epi64(__m512i __W, __mmask8 __U, __m256i __X) {
48974604 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
48984605 (__v8di)_mm512_cvtepu32_epi64(__X),
48994606 (__v8di)__W);
49004607}
49014608
4902static __inline__ __m512i __DEFAULT_FN_ATTRS512
4903_mm512_maskz_cvtepu32_epi64(__mmask8 __U, __m256i __X)
4904{
4609static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4610_mm512_maskz_cvtepu32_epi64(__mmask8 __U, __m256i __X) {
49054611 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
49064612 (__v8di)_mm512_cvtepu32_epi64(__X),
49074613 (__v8di)_mm512_setzero_si512());
49084614}
49094615
4910static __inline__ __m512i __DEFAULT_FN_ATTRS512
4911_mm512_cvtepu16_epi32(__m256i __A)
4912{
4616static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4617_mm512_cvtepu16_epi32(__m256i __A) {
49134618 return (__m512i)__builtin_convertvector((__v16hu)__A, __v16si);
49144619}
49154620
4916static __inline__ __m512i __DEFAULT_FN_ATTRS512
4917_mm512_mask_cvtepu16_epi32(__m512i __W, __mmask16 __U, __m256i __A)
4918{
4621static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4622_mm512_mask_cvtepu16_epi32(__m512i __W, __mmask16 __U, __m256i __A) {
49194623 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
49204624 (__v16si)_mm512_cvtepu16_epi32(__A),
49214625 (__v16si)__W);
49224626}
49234627
4924static __inline__ __m512i __DEFAULT_FN_ATTRS512
4925_mm512_maskz_cvtepu16_epi32(__mmask16 __U, __m256i __A)
4926{
4628static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4629_mm512_maskz_cvtepu16_epi32(__mmask16 __U, __m256i __A) {
49274630 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
49284631 (__v16si)_mm512_cvtepu16_epi32(__A),
49294632 (__v16si)_mm512_setzero_si512());
49304633}
49314634
4932static __inline__ __m512i __DEFAULT_FN_ATTRS512
4933_mm512_cvtepu16_epi64(__m128i __A)
4934{
4635static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4636_mm512_cvtepu16_epi64(__m128i __A) {
49354637 return (__m512i)__builtin_convertvector((__v8hu)__A, __v8di);
49364638}
49374639
4938static __inline__ __m512i __DEFAULT_FN_ATTRS512
4939_mm512_mask_cvtepu16_epi64(__m512i __W, __mmask8 __U, __m128i __A)
4940{
4640static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4641_mm512_mask_cvtepu16_epi64(__m512i __W, __mmask8 __U, __m128i __A) {
49414642 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
49424643 (__v8di)_mm512_cvtepu16_epi64(__A),
49434644 (__v8di)__W);
49444645}
49454646
4946static __inline__ __m512i __DEFAULT_FN_ATTRS512
4947_mm512_maskz_cvtepu16_epi64(__mmask8 __U, __m128i __A)
4948{
4647static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4648_mm512_maskz_cvtepu16_epi64(__mmask8 __U, __m128i __A) {
49494649 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
49504650 (__v8di)_mm512_cvtepu16_epi64(__A),
49514651 (__v8di)_mm512_setzero_si512());
49524652}
49534653
4954static __inline__ __m512i __DEFAULT_FN_ATTRS512
4654static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
49554655_mm512_rorv_epi32 (__m512i __A, __m512i __B)
49564656{
4957 return (__m512i)__builtin_ia32_prorvd512((__v16si)__A, (__v16si)__B);
4657 return (__m512i)__builtin_elementwise_fshr((__v16su)__A,(__v16su)__A, (__v16su)__B);
49584658}
49594659
4960static __inline__ __m512i __DEFAULT_FN_ATTRS512
4660static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
49614661_mm512_mask_rorv_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
49624662{
49634663 return (__m512i)__builtin_ia32_selectd_512(__U,
......@@ -4965,7 +4665,7 @@ _mm512_mask_rorv_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
49654665 (__v16si)__W);
49664666}
49674667
4968static __inline__ __m512i __DEFAULT_FN_ATTRS512
4668static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
49694669_mm512_maskz_rorv_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
49704670{
49714671 return (__m512i)__builtin_ia32_selectd_512(__U,
......@@ -4973,13 +4673,13 @@ _mm512_maskz_rorv_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
49734673 (__v16si)_mm512_setzero_si512());
49744674}
49754675
4976static __inline__ __m512i __DEFAULT_FN_ATTRS512
4676static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
49774677_mm512_rorv_epi64 (__m512i __A, __m512i __B)
49784678{
4979 return (__m512i)__builtin_ia32_prorvq512((__v8di)__A, (__v8di)__B);
4679 return (__m512i)__builtin_elementwise_fshr((__v8du)__A, (__v8du)__A, (__v8du)__B);
49804680}
49814681
4982static __inline__ __m512i __DEFAULT_FN_ATTRS512
4682static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
49834683_mm512_mask_rorv_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
49844684{
49854685 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -4987,7 +4687,7 @@ _mm512_mask_rorv_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
49874687 (__v8di)__W);
49884688}
49894689
4990static __inline__ __m512i __DEFAULT_FN_ATTRS512
4690static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
49914691_mm512_maskz_rorv_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
49924692{
49934693 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -5063,13 +4763,13 @@ _mm512_maskz_rorv_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
50634763 (__v8di)_mm512_rol_epi64((a), (b)), \
50644764 (__v8di)_mm512_setzero_si512()))
50654765
5066static __inline__ __m512i __DEFAULT_FN_ATTRS512
4766static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
50674767_mm512_rolv_epi32 (__m512i __A, __m512i __B)
50684768{
5069 return (__m512i)__builtin_ia32_prolvd512((__v16si)__A, (__v16si)__B);
4769 return (__m512i)__builtin_elementwise_fshl((__v16su)__A, (__v16su)__A, (__v16su)__B);
50704770}
50714771
5072static __inline__ __m512i __DEFAULT_FN_ATTRS512
4772static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
50734773_mm512_mask_rolv_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
50744774{
50754775 return (__m512i)__builtin_ia32_selectd_512(__U,
......@@ -5077,7 +4777,7 @@ _mm512_mask_rolv_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
50774777 (__v16si)__W);
50784778}
50794779
5080static __inline__ __m512i __DEFAULT_FN_ATTRS512
4780static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
50814781_mm512_maskz_rolv_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
50824782{
50834783 return (__m512i)__builtin_ia32_selectd_512(__U,
......@@ -5085,13 +4785,13 @@ _mm512_maskz_rolv_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
50854785 (__v16si)_mm512_setzero_si512());
50864786}
50874787
5088static __inline__ __m512i __DEFAULT_FN_ATTRS512
4788static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
50894789_mm512_rolv_epi64 (__m512i __A, __m512i __B)
50904790{
5091 return (__m512i)__builtin_ia32_prolvq512((__v8di)__A, (__v8di)__B);
4791 return (__m512i)__builtin_elementwise_fshl((__v8du)__A, (__v8du)__A, (__v8du)__B);
50924792}
50934793
5094static __inline__ __m512i __DEFAULT_FN_ATTRS512
4794static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
50954795_mm512_mask_rolv_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
50964796{
50974797 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -5099,7 +4799,7 @@ _mm512_mask_rolv_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
50994799 (__v8di)__W);
51004800}
51014801
5102static __inline__ __m512i __DEFAULT_FN_ATTRS512
4802static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
51034803_mm512_maskz_rolv_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
51044804{
51054805 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -5133,91 +4833,81 @@ _mm512_maskz_rolv_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
51334833 (__v8di)_mm512_ror_epi64((A), (B)), \
51344834 (__v8di)_mm512_setzero_si512()))
51354835
5136static __inline__ __m512i __DEFAULT_FN_ATTRS512
5137_mm512_slli_epi32(__m512i __A, unsigned int __B)
5138{
4836static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4837_mm512_slli_epi32(__m512i __A, unsigned int __B) {
51394838 return (__m512i)__builtin_ia32_pslldi512((__v16si)__A, (int)__B);
51404839}
51414840
5142static __inline__ __m512i __DEFAULT_FN_ATTRS512
4841static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
51434842_mm512_mask_slli_epi32(__m512i __W, __mmask16 __U, __m512i __A,
5144 unsigned int __B)
5145{
4843 unsigned int __B) {
51464844 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
51474845 (__v16si)_mm512_slli_epi32(__A, __B),
51484846 (__v16si)__W);
51494847}
51504848
5151static __inline__ __m512i __DEFAULT_FN_ATTRS512
4849static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
51524850_mm512_maskz_slli_epi32(__mmask16 __U, __m512i __A, unsigned int __B) {
51534851 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
51544852 (__v16si)_mm512_slli_epi32(__A, __B),
51554853 (__v16si)_mm512_setzero_si512());
51564854}
51574855
5158static __inline__ __m512i __DEFAULT_FN_ATTRS512
5159_mm512_slli_epi64(__m512i __A, unsigned int __B)
5160{
4856static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4857_mm512_slli_epi64(__m512i __A, unsigned int __B) {
51614858 return (__m512i)__builtin_ia32_psllqi512((__v8di)__A, (int)__B);
51624859}
51634860
5164static __inline__ __m512i __DEFAULT_FN_ATTRS512
5165_mm512_mask_slli_epi64(__m512i __W, __mmask8 __U, __m512i __A, unsigned int __B)
5166{
4861static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4862_mm512_mask_slli_epi64(__m512i __W, __mmask8 __U, __m512i __A,
4863 unsigned int __B) {
51674864 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
51684865 (__v8di)_mm512_slli_epi64(__A, __B),
51694866 (__v8di)__W);
51704867}
51714868
5172static __inline__ __m512i __DEFAULT_FN_ATTRS512
5173_mm512_maskz_slli_epi64(__mmask8 __U, __m512i __A, unsigned int __B)
5174{
4869static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4870_mm512_maskz_slli_epi64(__mmask8 __U, __m512i __A, unsigned int __B) {
51754871 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
51764872 (__v8di)_mm512_slli_epi64(__A, __B),
51774873 (__v8di)_mm512_setzero_si512());
51784874}
51794875
5180static __inline__ __m512i __DEFAULT_FN_ATTRS512
5181_mm512_srli_epi32(__m512i __A, unsigned int __B)
5182{
4876static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4877_mm512_srli_epi32(__m512i __A, unsigned int __B) {
51834878 return (__m512i)__builtin_ia32_psrldi512((__v16si)__A, (int)__B);
51844879}
51854880
5186static __inline__ __m512i __DEFAULT_FN_ATTRS512
4881static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
51874882_mm512_mask_srli_epi32(__m512i __W, __mmask16 __U, __m512i __A,
5188 unsigned int __B)
5189{
4883 unsigned int __B) {
51904884 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
51914885 (__v16si)_mm512_srli_epi32(__A, __B),
51924886 (__v16si)__W);
51934887}
51944888
5195static __inline__ __m512i __DEFAULT_FN_ATTRS512
4889static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
51964890_mm512_maskz_srli_epi32(__mmask16 __U, __m512i __A, unsigned int __B) {
51974891 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
51984892 (__v16si)_mm512_srli_epi32(__A, __B),
51994893 (__v16si)_mm512_setzero_si512());
52004894}
52014895
5202static __inline__ __m512i __DEFAULT_FN_ATTRS512
5203_mm512_srli_epi64(__m512i __A, unsigned int __B)
5204{
4896static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4897_mm512_srli_epi64(__m512i __A, unsigned int __B) {
52054898 return (__m512i)__builtin_ia32_psrlqi512((__v8di)__A, (int)__B);
52064899}
52074900
5208static __inline__ __m512i __DEFAULT_FN_ATTRS512
4901static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
52094902_mm512_mask_srli_epi64(__m512i __W, __mmask8 __U, __m512i __A,
5210 unsigned int __B)
5211{
4903 unsigned int __B) {
52124904 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
52134905 (__v8di)_mm512_srli_epi64(__A, __B),
52144906 (__v8di)__W);
52154907}
52164908
5217static __inline__ __m512i __DEFAULT_FN_ATTRS512
5218_mm512_maskz_srli_epi64(__mmask8 __U, __m512i __A,
5219 unsigned int __B)
5220{
4909static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
4910_mm512_maskz_srli_epi64(__mmask8 __U, __m512i __A, unsigned int __B) {
52214911 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
52224912 (__v8di)_mm512_srli_epi64(__A, __B),
52234913 (__v8di)_mm512_setzero_si512());
......@@ -5303,7 +4993,7 @@ _mm512_mask_store_epi64 (void *__P, __mmask8 __U, __m512i __A)
53034993 (__mmask8) __U);
53044994}
53054995
5306static __inline__ __m512d __DEFAULT_FN_ATTRS512
4996static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
53074997_mm512_movedup_pd (__m512d __A)
53084998{
53094999 return (__m512d)__builtin_shufflevector((__v8df)__A, (__v8df)__A,
......@@ -5664,10 +5354,9 @@ _mm_maskz_getexp_ss (__mmask8 __U, __m128 __A, __m128 __B)
56645354 (int)(((D)<<2) | (C)), \
56655355 (__v4sf)_mm_setzero_ps(), \
56665356 (__mmask8)(U), (int)(R)))
5667
5668static __inline__ __mmask16 __DEFAULT_FN_ATTRS
5669_mm512_kmov (__mmask16 __A)
5670{
5357
5358static __inline__ __mmask16
5359 __DEFAULT_FN_ATTRS_CONSTEXPR _mm512_kmov(__mmask16 __A) {
56715360 return __A;
56725361}
56735362
......@@ -5684,79 +5373,70 @@ _mm512_kmov (__mmask16 __A)
56845373 ((long long)__builtin_ia32_vcvtsd2si64((__v2df)(__m128d)(A), (int)(R)))
56855374#endif
56865375
5687static __inline__ __m512i __DEFAULT_FN_ATTRS512
5688_mm512_sll_epi32(__m512i __A, __m128i __B)
5689{
5376static __inline__ __m512i
5377 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_sll_epi32(__m512i __A, __m128i __B) {
56905378 return (__m512i)__builtin_ia32_pslld512((__v16si) __A, (__v4si)__B);
56915379}
56925380
5693static __inline__ __m512i __DEFAULT_FN_ATTRS512
5694_mm512_mask_sll_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m128i __B)
5695{
5381static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5382_mm512_mask_sll_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m128i __B) {
56965383 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
56975384 (__v16si)_mm512_sll_epi32(__A, __B),
56985385 (__v16si)__W);
56995386}
57005387
5701static __inline__ __m512i __DEFAULT_FN_ATTRS512
5702_mm512_maskz_sll_epi32(__mmask16 __U, __m512i __A, __m128i __B)
5703{
5388static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5389_mm512_maskz_sll_epi32(__mmask16 __U, __m512i __A, __m128i __B) {
57045390 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
57055391 (__v16si)_mm512_sll_epi32(__A, __B),
57065392 (__v16si)_mm512_setzero_si512());
57075393}
57085394
5709static __inline__ __m512i __DEFAULT_FN_ATTRS512
5710_mm512_sll_epi64(__m512i __A, __m128i __B)
5711{
5395static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5396_mm512_sll_epi64(__m512i __A, __m128i __B) {
57125397 return (__m512i)__builtin_ia32_psllq512((__v8di)__A, (__v2di)__B);
57135398}
57145399
5715static __inline__ __m512i __DEFAULT_FN_ATTRS512
5716_mm512_mask_sll_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B)
5717{
5400static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5401_mm512_mask_sll_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B) {
57185402 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
57195403 (__v8di)_mm512_sll_epi64(__A, __B),
57205404 (__v8di)__W);
57215405}
57225406
5723static __inline__ __m512i __DEFAULT_FN_ATTRS512
5724_mm512_maskz_sll_epi64(__mmask8 __U, __m512i __A, __m128i __B)
5725{
5407static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5408_mm512_maskz_sll_epi64(__mmask8 __U, __m512i __A, __m128i __B) {
57265409 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
57275410 (__v8di)_mm512_sll_epi64(__A, __B),
57285411 (__v8di)_mm512_setzero_si512());
57295412}
57305413
5731static __inline__ __m512i __DEFAULT_FN_ATTRS512
5732_mm512_sllv_epi32(__m512i __X, __m512i __Y)
5733{
5414static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5415_mm512_sllv_epi32(__m512i __X, __m512i __Y) {
57345416 return (__m512i)__builtin_ia32_psllv16si((__v16si)__X, (__v16si)__Y);
57355417}
57365418
5737static __inline__ __m512i __DEFAULT_FN_ATTRS512
5738_mm512_mask_sllv_epi32(__m512i __W, __mmask16 __U, __m512i __X, __m512i __Y)
5739{
5419static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5420_mm512_mask_sllv_epi32(__m512i __W, __mmask16 __U, __m512i __X, __m512i __Y) {
57405421 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
57415422 (__v16si)_mm512_sllv_epi32(__X, __Y),
57425423 (__v16si)__W);
57435424}
57445425
5745static __inline__ __m512i __DEFAULT_FN_ATTRS512
5746_mm512_maskz_sllv_epi32(__mmask16 __U, __m512i __X, __m512i __Y)
5747{
5426static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5427_mm512_maskz_sllv_epi32(__mmask16 __U, __m512i __X, __m512i __Y) {
57485428 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
57495429 (__v16si)_mm512_sllv_epi32(__X, __Y),
57505430 (__v16si)_mm512_setzero_si512());
57515431}
57525432
5753static __inline__ __m512i __DEFAULT_FN_ATTRS512
5433static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
57545434_mm512_sllv_epi64(__m512i __X, __m512i __Y)
57555435{
57565436 return (__m512i)__builtin_ia32_psllv8di((__v8di)__X, (__v8di)__Y);
57575437}
57585438
5759static __inline__ __m512i __DEFAULT_FN_ATTRS512
5439static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
57605440_mm512_mask_sllv_epi64(__m512i __W, __mmask8 __U, __m512i __X, __m512i __Y)
57615441{
57625442 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
......@@ -5764,7 +5444,7 @@ _mm512_mask_sllv_epi64(__m512i __W, __mmask8 __U, __m512i __X, __m512i __Y)
57645444 (__v8di)__W);
57655445}
57665446
5767static __inline__ __m512i __DEFAULT_FN_ATTRS512
5447static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
57685448_mm512_maskz_sllv_epi64(__mmask8 __U, __m512i __X, __m512i __Y)
57695449{
57705450 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
......@@ -5772,79 +5452,70 @@ _mm512_maskz_sllv_epi64(__mmask8 __U, __m512i __X, __m512i __Y)
57725452 (__v8di)_mm512_setzero_si512());
57735453}
57745454
5775static __inline__ __m512i __DEFAULT_FN_ATTRS512
5776_mm512_sra_epi32(__m512i __A, __m128i __B)
5777{
5455static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5456_mm512_sra_epi32(__m512i __A, __m128i __B) {
57785457 return (__m512i)__builtin_ia32_psrad512((__v16si) __A, (__v4si)__B);
57795458}
57805459
5781static __inline__ __m512i __DEFAULT_FN_ATTRS512
5782_mm512_mask_sra_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m128i __B)
5783{
5460static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5461_mm512_mask_sra_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m128i __B) {
57845462 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
57855463 (__v16si)_mm512_sra_epi32(__A, __B),
57865464 (__v16si)__W);
57875465}
57885466
5789static __inline__ __m512i __DEFAULT_FN_ATTRS512
5790_mm512_maskz_sra_epi32(__mmask16 __U, __m512i __A, __m128i __B)
5791{
5467static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5468_mm512_maskz_sra_epi32(__mmask16 __U, __m512i __A, __m128i __B) {
57925469 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
57935470 (__v16si)_mm512_sra_epi32(__A, __B),
57945471 (__v16si)_mm512_setzero_si512());
57955472}
57965473
5797static __inline__ __m512i __DEFAULT_FN_ATTRS512
5798_mm512_sra_epi64(__m512i __A, __m128i __B)
5799{
5474static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5475_mm512_sra_epi64(__m512i __A, __m128i __B) {
58005476 return (__m512i)__builtin_ia32_psraq512((__v8di)__A, (__v2di)__B);
58015477}
58025478
5803static __inline__ __m512i __DEFAULT_FN_ATTRS512
5804_mm512_mask_sra_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B)
5805{
5479static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5480_mm512_mask_sra_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B) {
58065481 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
58075482 (__v8di)_mm512_sra_epi64(__A, __B),
58085483 (__v8di)__W);
58095484}
58105485
5811static __inline__ __m512i __DEFAULT_FN_ATTRS512
5812_mm512_maskz_sra_epi64(__mmask8 __U, __m512i __A, __m128i __B)
5813{
5486static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5487_mm512_maskz_sra_epi64(__mmask8 __U, __m512i __A, __m128i __B) {
58145488 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
58155489 (__v8di)_mm512_sra_epi64(__A, __B),
58165490 (__v8di)_mm512_setzero_si512());
58175491}
58185492
5819static __inline__ __m512i __DEFAULT_FN_ATTRS512
5820_mm512_srav_epi32(__m512i __X, __m512i __Y)
5821{
5493static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5494_mm512_srav_epi32(__m512i __X, __m512i __Y) {
58225495 return (__m512i)__builtin_ia32_psrav16si((__v16si)__X, (__v16si)__Y);
58235496}
58245497
5825static __inline__ __m512i __DEFAULT_FN_ATTRS512
5826_mm512_mask_srav_epi32(__m512i __W, __mmask16 __U, __m512i __X, __m512i __Y)
5827{
5498static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5499_mm512_mask_srav_epi32(__m512i __W, __mmask16 __U, __m512i __X, __m512i __Y) {
58285500 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
58295501 (__v16si)_mm512_srav_epi32(__X, __Y),
58305502 (__v16si)__W);
58315503}
58325504
5833static __inline__ __m512i __DEFAULT_FN_ATTRS512
5834_mm512_maskz_srav_epi32(__mmask16 __U, __m512i __X, __m512i __Y)
5835{
5505static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5506_mm512_maskz_srav_epi32(__mmask16 __U, __m512i __X, __m512i __Y) {
58365507 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
58375508 (__v16si)_mm512_srav_epi32(__X, __Y),
58385509 (__v16si)_mm512_setzero_si512());
58395510}
58405511
5841static __inline__ __m512i __DEFAULT_FN_ATTRS512
5512static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
58425513_mm512_srav_epi64(__m512i __X, __m512i __Y)
58435514{
58445515 return (__m512i)__builtin_ia32_psrav8di((__v8di)__X, (__v8di)__Y);
58455516}
58465517
5847static __inline__ __m512i __DEFAULT_FN_ATTRS512
5518static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
58485519_mm512_mask_srav_epi64(__m512i __W, __mmask8 __U, __m512i __X, __m512i __Y)
58495520{
58505521 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
......@@ -5852,7 +5523,7 @@ _mm512_mask_srav_epi64(__m512i __W, __mmask8 __U, __m512i __X, __m512i __Y)
58525523 (__v8di)__W);
58535524}
58545525
5855static __inline__ __m512i __DEFAULT_FN_ATTRS512
5526static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
58565527_mm512_maskz_srav_epi64(__mmask8 __U, __m512i __X, __m512i __Y)
58575528{
58585529 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
......@@ -5860,79 +5531,70 @@ _mm512_maskz_srav_epi64(__mmask8 __U, __m512i __X, __m512i __Y)
58605531 (__v8di)_mm512_setzero_si512());
58615532}
58625533
5863static __inline__ __m512i __DEFAULT_FN_ATTRS512
5864_mm512_srl_epi32(__m512i __A, __m128i __B)
5865{
5534static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5535_mm512_srl_epi32(__m512i __A, __m128i __B) {
58665536 return (__m512i)__builtin_ia32_psrld512((__v16si) __A, (__v4si)__B);
58675537}
58685538
5869static __inline__ __m512i __DEFAULT_FN_ATTRS512
5870_mm512_mask_srl_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m128i __B)
5871{
5539static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5540_mm512_mask_srl_epi32(__m512i __W, __mmask16 __U, __m512i __A, __m128i __B) {
58725541 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
58735542 (__v16si)_mm512_srl_epi32(__A, __B),
58745543 (__v16si)__W);
58755544}
58765545
5877static __inline__ __m512i __DEFAULT_FN_ATTRS512
5878_mm512_maskz_srl_epi32(__mmask16 __U, __m512i __A, __m128i __B)
5879{
5546static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5547_mm512_maskz_srl_epi32(__mmask16 __U, __m512i __A, __m128i __B) {
58805548 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
58815549 (__v16si)_mm512_srl_epi32(__A, __B),
58825550 (__v16si)_mm512_setzero_si512());
58835551}
58845552
5885static __inline__ __m512i __DEFAULT_FN_ATTRS512
5886_mm512_srl_epi64(__m512i __A, __m128i __B)
5887{
5553static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5554_mm512_srl_epi64(__m512i __A, __m128i __B) {
58885555 return (__m512i)__builtin_ia32_psrlq512((__v8di)__A, (__v2di)__B);
58895556}
58905557
5891static __inline__ __m512i __DEFAULT_FN_ATTRS512
5892_mm512_mask_srl_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B)
5893{
5558static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5559_mm512_mask_srl_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B) {
58945560 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
58955561 (__v8di)_mm512_srl_epi64(__A, __B),
58965562 (__v8di)__W);
58975563}
58985564
5899static __inline__ __m512i __DEFAULT_FN_ATTRS512
5900_mm512_maskz_srl_epi64(__mmask8 __U, __m512i __A, __m128i __B)
5901{
5565static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5566_mm512_maskz_srl_epi64(__mmask8 __U, __m512i __A, __m128i __B) {
59025567 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
59035568 (__v8di)_mm512_srl_epi64(__A, __B),
59045569 (__v8di)_mm512_setzero_si512());
59055570}
59065571
5907static __inline__ __m512i __DEFAULT_FN_ATTRS512
5908_mm512_srlv_epi32(__m512i __X, __m512i __Y)
5909{
5572static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5573_mm512_srlv_epi32(__m512i __X, __m512i __Y) {
59105574 return (__m512i)__builtin_ia32_psrlv16si((__v16si)__X, (__v16si)__Y);
59115575}
59125576
5913static __inline__ __m512i __DEFAULT_FN_ATTRS512
5914_mm512_mask_srlv_epi32(__m512i __W, __mmask16 __U, __m512i __X, __m512i __Y)
5915{
5577static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5578_mm512_mask_srlv_epi32(__m512i __W, __mmask16 __U, __m512i __X, __m512i __Y) {
59165579 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
59175580 (__v16si)_mm512_srlv_epi32(__X, __Y),
59185581 (__v16si)__W);
59195582}
59205583
5921static __inline__ __m512i __DEFAULT_FN_ATTRS512
5922_mm512_maskz_srlv_epi32(__mmask16 __U, __m512i __X, __m512i __Y)
5923{
5584static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
5585_mm512_maskz_srlv_epi32(__mmask16 __U, __m512i __X, __m512i __Y) {
59245586 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
59255587 (__v16si)_mm512_srlv_epi32(__X, __Y),
59265588 (__v16si)_mm512_setzero_si512());
59275589}
59285590
5929static __inline__ __m512i __DEFAULT_FN_ATTRS512
5591static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
59305592_mm512_srlv_epi64 (__m512i __X, __m512i __Y)
59315593{
59325594 return (__m512i)__builtin_ia32_psrlv8di((__v8di)__X, (__v8di)__Y);
59335595}
59345596
5935static __inline__ __m512i __DEFAULT_FN_ATTRS512
5597static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
59365598_mm512_mask_srlv_epi64(__m512i __W, __mmask8 __U, __m512i __X, __m512i __Y)
59375599{
59385600 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
......@@ -5940,7 +5602,7 @@ _mm512_mask_srlv_epi64(__m512i __W, __mmask8 __U, __m512i __X, __m512i __Y)
59405602 (__v8di)__W);
59415603}
59425604
5943static __inline__ __m512i __DEFAULT_FN_ATTRS512
5605static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
59445606_mm512_maskz_srlv_epi64(__mmask8 __U, __m512i __X, __m512i __Y)
59455607{
59465608 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
......@@ -6190,115 +5852,104 @@ _mm_cvttss_u64 (__m128 __A)
61905852 (__v16sf)_mm512_permute_ps((X), (C)), \
61915853 (__v16sf)_mm512_setzero_ps()))
61925854
6193static __inline__ __m512d __DEFAULT_FN_ATTRS512
6194_mm512_permutevar_pd(__m512d __A, __m512i __C)
6195{
5855static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
5856_mm512_permutevar_pd(__m512d __A, __m512i __C) {
61965857 return (__m512d)__builtin_ia32_vpermilvarpd512((__v8df)__A, (__v8di)__C);
61975858}
61985859
6199static __inline__ __m512d __DEFAULT_FN_ATTRS512
6200_mm512_mask_permutevar_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512i __C)
6201{
5860static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
5861_mm512_mask_permutevar_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512i __C) {
62025862 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
62035863 (__v8df)_mm512_permutevar_pd(__A, __C),
62045864 (__v8df)__W);
62055865}
62065866
6207static __inline__ __m512d __DEFAULT_FN_ATTRS512
6208_mm512_maskz_permutevar_pd(__mmask8 __U, __m512d __A, __m512i __C)
6209{
5867static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
5868_mm512_maskz_permutevar_pd(__mmask8 __U, __m512d __A, __m512i __C) {
62105869 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
62115870 (__v8df)_mm512_permutevar_pd(__A, __C),
62125871 (__v8df)_mm512_setzero_pd());
62135872}
62145873
6215static __inline__ __m512 __DEFAULT_FN_ATTRS512
6216_mm512_permutevar_ps(__m512 __A, __m512i __C)
6217{
5874static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5875_mm512_permutevar_ps(__m512 __A, __m512i __C) {
62185876 return (__m512)__builtin_ia32_vpermilvarps512((__v16sf)__A, (__v16si)__C);
62195877}
62205878
6221static __inline__ __m512 __DEFAULT_FN_ATTRS512
6222_mm512_mask_permutevar_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512i __C)
6223{
5879static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5880_mm512_mask_permutevar_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512i __C) {
62245881 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
62255882 (__v16sf)_mm512_permutevar_ps(__A, __C),
62265883 (__v16sf)__W);
62275884}
62285885
6229static __inline__ __m512 __DEFAULT_FN_ATTRS512
6230_mm512_maskz_permutevar_ps(__mmask16 __U, __m512 __A, __m512i __C)
6231{
5886static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5887_mm512_maskz_permutevar_ps(__mmask16 __U, __m512 __A, __m512i __C) {
62325888 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
62335889 (__v16sf)_mm512_permutevar_ps(__A, __C),
62345890 (__v16sf)_mm512_setzero_ps());
62355891}
62365892
6237static __inline __m512d __DEFAULT_FN_ATTRS512
6238_mm512_permutex2var_pd(__m512d __A, __m512i __I, __m512d __B)
6239{
5893static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
5894_mm512_permutex2var_pd(__m512d __A, __m512i __I, __m512d __B) {
62405895 return (__m512d)__builtin_ia32_vpermi2varpd512((__v8df)__A, (__v8di)__I,
62415896 (__v8df)__B);
62425897}
62435898
6244static __inline__ __m512d __DEFAULT_FN_ATTRS512
6245_mm512_mask_permutex2var_pd(__m512d __A, __mmask8 __U, __m512i __I, __m512d __B)
6246{
5899static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
5900_mm512_mask_permutex2var_pd(__m512d __A, __mmask8 __U, __m512i __I,
5901 __m512d __B) {
62475902 return (__m512d)__builtin_ia32_selectpd_512(__U,
62485903 (__v8df)_mm512_permutex2var_pd(__A, __I, __B),
62495904 (__v8df)__A);
62505905}
62515906
6252static __inline__ __m512d __DEFAULT_FN_ATTRS512
5907static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
62535908_mm512_mask2_permutex2var_pd(__m512d __A, __m512i __I, __mmask8 __U,
6254 __m512d __B)
6255{
5909 __m512d __B) {
62565910 return (__m512d)__builtin_ia32_selectpd_512(__U,
62575911 (__v8df)_mm512_permutex2var_pd(__A, __I, __B),
62585912 (__v8df)(__m512d)__I);
62595913}
62605914
6261static __inline__ __m512d __DEFAULT_FN_ATTRS512
5915static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
62625916_mm512_maskz_permutex2var_pd(__mmask8 __U, __m512d __A, __m512i __I,
6263 __m512d __B)
6264{
5917 __m512d __B) {
62655918 return (__m512d)__builtin_ia32_selectpd_512(__U,
62665919 (__v8df)_mm512_permutex2var_pd(__A, __I, __B),
62675920 (__v8df)_mm512_setzero_pd());
62685921}
62695922
6270static __inline __m512 __DEFAULT_FN_ATTRS512
6271_mm512_permutex2var_ps(__m512 __A, __m512i __I, __m512 __B)
6272{
5923static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5924_mm512_permutex2var_ps(__m512 __A, __m512i __I, __m512 __B) {
62735925 return (__m512)__builtin_ia32_vpermi2varps512((__v16sf)__A, (__v16si)__I,
62745926 (__v16sf) __B);
62755927}
62765928
6277static __inline__ __m512 __DEFAULT_FN_ATTRS512
6278_mm512_mask_permutex2var_ps(__m512 __A, __mmask16 __U, __m512i __I, __m512 __B)
6279{
5929static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5930_mm512_mask_permutex2var_ps(__m512 __A, __mmask16 __U, __m512i __I,
5931 __m512 __B) {
62805932 return (__m512)__builtin_ia32_selectps_512(__U,
62815933 (__v16sf)_mm512_permutex2var_ps(__A, __I, __B),
62825934 (__v16sf)__A);
62835935}
62845936
6285static __inline__ __m512 __DEFAULT_FN_ATTRS512
6286_mm512_mask2_permutex2var_ps(__m512 __A, __m512i __I, __mmask16 __U, __m512 __B)
6287{
5937static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5938_mm512_mask2_permutex2var_ps(__m512 __A, __m512i __I, __mmask16 __U,
5939 __m512 __B) {
62885940 return (__m512)__builtin_ia32_selectps_512(__U,
62895941 (__v16sf)_mm512_permutex2var_ps(__A, __I, __B),
62905942 (__v16sf)(__m512)__I);
62915943}
62925944
6293static __inline__ __m512 __DEFAULT_FN_ATTRS512
6294_mm512_maskz_permutex2var_ps(__mmask16 __U, __m512 __A, __m512i __I, __m512 __B)
6295{
5945static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
5946_mm512_maskz_permutex2var_ps(__mmask16 __U, __m512 __A, __m512i __I,
5947 __m512 __B) {
62965948 return (__m512)__builtin_ia32_selectps_512(__U,
62975949 (__v16sf)_mm512_permutex2var_ps(__A, __I, __B),
62985950 (__v16sf)_mm512_setzero_ps());
62995951}
63005952
6301
63025953#define _mm512_cvtt_roundpd_epu32(A, R) \
63035954 ((__m256i)__builtin_ia32_cvttpd2udq512_mask((__v8df)(__m512d)(A), \
63045955 (__v8si)_mm256_undefined_si256(), \
......@@ -6622,46 +6273,41 @@ _mm_maskz_scalef_ss (__mmask8 __U, __m128 __A, __m128 __B)
66226273 (__mmask8)(U), \
66236274 (int)(R)))
66246275
6625static __inline__ __m512i __DEFAULT_FN_ATTRS512
6626_mm512_srai_epi32(__m512i __A, unsigned int __B)
6627{
6276static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6277_mm512_srai_epi32(__m512i __A, unsigned int __B) {
66286278 return (__m512i)__builtin_ia32_psradi512((__v16si)__A, (int)__B);
66296279}
66306280
6631static __inline__ __m512i __DEFAULT_FN_ATTRS512
6281static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
66326282_mm512_mask_srai_epi32(__m512i __W, __mmask16 __U, __m512i __A,
6633 unsigned int __B)
6634{
6283 unsigned int __B) {
66356284 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
66366285 (__v16si)_mm512_srai_epi32(__A, __B),
66376286 (__v16si)__W);
66386287}
66396288
6640static __inline__ __m512i __DEFAULT_FN_ATTRS512
6641_mm512_maskz_srai_epi32(__mmask16 __U, __m512i __A,
6642 unsigned int __B) {
6289static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6290_mm512_maskz_srai_epi32(__mmask16 __U, __m512i __A, unsigned int __B) {
66436291 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
66446292 (__v16si)_mm512_srai_epi32(__A, __B),
66456293 (__v16si)_mm512_setzero_si512());
66466294}
66476295
6648static __inline__ __m512i __DEFAULT_FN_ATTRS512
6649_mm512_srai_epi64(__m512i __A, unsigned int __B)
6650{
6296static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6297_mm512_srai_epi64(__m512i __A, unsigned int __B) {
66516298 return (__m512i)__builtin_ia32_psraqi512((__v8di)__A, (int)__B);
66526299}
66536300
6654static __inline__ __m512i __DEFAULT_FN_ATTRS512
6655_mm512_mask_srai_epi64(__m512i __W, __mmask8 __U, __m512i __A, unsigned int __B)
6656{
6301static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6302_mm512_mask_srai_epi64(__m512i __W, __mmask8 __U, __m512i __A,
6303 unsigned int __B) {
66576304 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
66586305 (__v8di)_mm512_srai_epi64(__A, __B),
66596306 (__v8di)__W);
66606307}
66616308
6662static __inline__ __m512i __DEFAULT_FN_ATTRS512
6663_mm512_maskz_srai_epi64(__mmask8 __U, __m512i __A, unsigned int __B)
6664{
6309static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6310_mm512_maskz_srai_epi64(__mmask8 __U, __m512i __A, unsigned int __B) {
66656311 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
66666312 (__v8di)_mm512_srai_epi64(__A, __B),
66676313 (__v8di)_mm512_setzero_si512());
......@@ -6827,33 +6473,29 @@ _mm_maskz_sqrt_ss (__mmask8 __U, __m128 __A, __m128 __B)
68276473 (__v4sf)_mm_setzero_ps(), \
68286474 (__mmask8)(U), (int)(R)))
68296475
6830static __inline__ __m512 __DEFAULT_FN_ATTRS512
6831_mm512_broadcast_f32x4(__m128 __A)
6832{
6476static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
6477_mm512_broadcast_f32x4(__m128 __A) {
68336478 return (__m512)__builtin_shufflevector((__v4sf)__A, (__v4sf)__A,
68346479 0, 1, 2, 3, 0, 1, 2, 3,
68356480 0, 1, 2, 3, 0, 1, 2, 3);
68366481}
68376482
6838static __inline__ __m512 __DEFAULT_FN_ATTRS512
6839_mm512_mask_broadcast_f32x4(__m512 __O, __mmask16 __M, __m128 __A)
6840{
6483static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
6484_mm512_mask_broadcast_f32x4(__m512 __O, __mmask16 __M, __m128 __A) {
68416485 return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
68426486 (__v16sf)_mm512_broadcast_f32x4(__A),
68436487 (__v16sf)__O);
68446488}
68456489
6846static __inline__ __m512 __DEFAULT_FN_ATTRS512
6847_mm512_maskz_broadcast_f32x4(__mmask16 __M, __m128 __A)
6848{
6490static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
6491_mm512_maskz_broadcast_f32x4(__mmask16 __M, __m128 __A) {
68496492 return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
68506493 (__v16sf)_mm512_broadcast_f32x4(__A),
68516494 (__v16sf)_mm512_setzero_ps());
68526495}
68536496
6854static __inline__ __m512d __DEFAULT_FN_ATTRS512
6855_mm512_broadcast_f64x4(__m256d __A)
6856{
6497static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
6498_mm512_broadcast_f64x4(__m256d __A) {
68576499 return (__m512d)__builtin_shufflevector((__v4df)__A, (__v4df)__A,
68586500 0, 1, 2, 3, 0, 1, 2, 3);
68596501}
......@@ -6874,33 +6516,29 @@ _mm512_maskz_broadcast_f64x4(__mmask8 __M, __m256d __A)
68746516 (__v8df)_mm512_setzero_pd());
68756517}
68766518
6877static __inline__ __m512i __DEFAULT_FN_ATTRS512
6878_mm512_broadcast_i32x4(__m128i __A)
6879{
6519static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6520_mm512_broadcast_i32x4(__m128i __A) {
68806521 return (__m512i)__builtin_shufflevector((__v4si)__A, (__v4si)__A,
68816522 0, 1, 2, 3, 0, 1, 2, 3,
68826523 0, 1, 2, 3, 0, 1, 2, 3);
68836524}
68846525
6885static __inline__ __m512i __DEFAULT_FN_ATTRS512
6886_mm512_mask_broadcast_i32x4(__m512i __O, __mmask16 __M, __m128i __A)
6887{
6526static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6527_mm512_mask_broadcast_i32x4(__m512i __O, __mmask16 __M, __m128i __A) {
68886528 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
68896529 (__v16si)_mm512_broadcast_i32x4(__A),
68906530 (__v16si)__O);
68916531}
68926532
6893static __inline__ __m512i __DEFAULT_FN_ATTRS512
6894_mm512_maskz_broadcast_i32x4(__mmask16 __M, __m128i __A)
6895{
6533static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6534_mm512_maskz_broadcast_i32x4(__mmask16 __M, __m128i __A) {
68966535 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
68976536 (__v16si)_mm512_broadcast_i32x4(__A),
68986537 (__v16si)_mm512_setzero_si512());
68996538}
69006539
6901static __inline__ __m512i __DEFAULT_FN_ATTRS512
6902_mm512_broadcast_i64x4(__m256i __A)
6903{
6540static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
6541_mm512_broadcast_i64x4(__m256i __A) {
69046542 return (__m512i)__builtin_shufflevector((__v4di)__A, (__v4di)__A,
69056543 0, 1, 2, 3, 0, 1, 2, 3);
69066544}
......@@ -6921,33 +6559,29 @@ _mm512_maskz_broadcast_i64x4(__mmask8 __M, __m256i __A)
69216559 (__v8di)_mm512_setzero_si512());
69226560}
69236561
6924static __inline__ __m512d __DEFAULT_FN_ATTRS512
6925_mm512_mask_broadcastsd_pd (__m512d __O, __mmask8 __M, __m128d __A)
6926{
6562static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
6563_mm512_mask_broadcastsd_pd(__m512d __O, __mmask8 __M, __m128d __A) {
69276564 return (__m512d)__builtin_ia32_selectpd_512(__M,
69286565 (__v8df) _mm512_broadcastsd_pd(__A),
69296566 (__v8df) __O);
69306567}
69316568
6932static __inline__ __m512d __DEFAULT_FN_ATTRS512
6933_mm512_maskz_broadcastsd_pd (__mmask8 __M, __m128d __A)
6934{
6569static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
6570_mm512_maskz_broadcastsd_pd(__mmask8 __M, __m128d __A) {
69356571 return (__m512d)__builtin_ia32_selectpd_512(__M,
69366572 (__v8df) _mm512_broadcastsd_pd(__A),
69376573 (__v8df) _mm512_setzero_pd());
69386574}
69396575
6940static __inline__ __m512 __DEFAULT_FN_ATTRS512
6941_mm512_mask_broadcastss_ps (__m512 __O, __mmask16 __M, __m128 __A)
6942{
6576static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
6577_mm512_mask_broadcastss_ps(__m512 __O, __mmask16 __M, __m128 __A) {
69436578 return (__m512)__builtin_ia32_selectps_512(__M,
69446579 (__v16sf) _mm512_broadcastss_ps(__A),
69456580 (__v16sf) __O);
69466581}
69476582
6948static __inline__ __m512 __DEFAULT_FN_ATTRS512
6949_mm512_maskz_broadcastss_ps (__mmask16 __M, __m128 __A)
6950{
6583static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
6584_mm512_maskz_broadcastss_ps(__mmask16 __M, __m128 __A) {
69516585 return (__m512)__builtin_ia32_selectps_512(__M,
69526586 (__v16sf) _mm512_broadcastss_ps(__A),
69536587 (__v16sf) _mm512_setzero_ps());
......@@ -7391,10 +7025,10 @@ _mm512_mask_cvtepi64_storeu_epi16 (void *__P, __mmask8 __M, __m512i __A)
73917025 __builtin_ia32_pmovqw512mem_mask ((__v8hi *) __P, (__v8di) __A, __M);
73927026}
73937027
7394#define _mm512_extracti32x4_epi32(A, imm) \
7395 ((__m128i)__builtin_ia32_extracti32x4_mask((__v16si)(__m512i)(A), (int)(imm), \
7396 (__v4si)_mm_undefined_si128(), \
7397 (__mmask8)-1))
7028#define _mm512_extracti32x4_epi32(A, imm) \
7029 ((__m128i)__builtin_ia32_extracti32x4_mask( \
7030 (__v16si)(__m512i)(A), (int)(imm), (__v4si)_mm_setzero_si128(), \
7031 (__mmask8) - 1))
73987032
73997033#define _mm512_mask_extracti32x4_epi32(W, U, A, imm) \
74007034 ((__m128i)__builtin_ia32_extracti32x4_mask((__v16si)(__m512i)(A), (int)(imm), \
......@@ -7406,10 +7040,10 @@ _mm512_mask_cvtepi64_storeu_epi16 (void *__P, __mmask8 __M, __m512i __A)
74067040 (__v4si)_mm_setzero_si128(), \
74077041 (__mmask8)(U)))
74087042
7409#define _mm512_extracti64x4_epi64(A, imm) \
7043#define _mm512_extracti64x4_epi64(A, imm) \
74107044 ((__m256i)__builtin_ia32_extracti64x4_mask((__v8di)(__m512i)(A), (int)(imm), \
7411 (__v4di)_mm256_undefined_si256(), \
7412 (__mmask8)-1))
7045 (__v4di)_mm256_setzero_si256(), \
7046 (__mmask8) - 1))
74137047
74147048#define _mm512_mask_extracti64x4_epi64(W, U, A, imm) \
74157049 ((__m256i)__builtin_ia32_extracti64x4_mask((__v8di)(__m512i)(A), (int)(imm), \
......@@ -8274,93 +7908,82 @@ _mm_mask3_fnmsub_sd (__m128d __W, __m128d __X, __m128d __Y, __mmask8 __U)
82747908 (__v8di)_mm512_permutex_epi64((X), (C)), \
82757909 (__v8di)_mm512_setzero_si512()))
82767910
8277static __inline__ __m512d __DEFAULT_FN_ATTRS512
8278_mm512_permutexvar_pd (__m512i __X, __m512d __Y)
8279{
7911static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
7912_mm512_permutexvar_pd(__m512i __X, __m512d __Y) {
82807913 return (__m512d)__builtin_ia32_permvardf512((__v8df) __Y, (__v8di) __X);
82817914}
82827915
8283static __inline__ __m512d __DEFAULT_FN_ATTRS512
8284_mm512_mask_permutexvar_pd (__m512d __W, __mmask8 __U, __m512i __X, __m512d __Y)
8285{
7916static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
7917_mm512_mask_permutexvar_pd(__m512d __W, __mmask8 __U, __m512i __X,
7918 __m512d __Y) {
82867919 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
82877920 (__v8df)_mm512_permutexvar_pd(__X, __Y),
82887921 (__v8df)__W);
82897922}
82907923
8291static __inline__ __m512d __DEFAULT_FN_ATTRS512
8292_mm512_maskz_permutexvar_pd (__mmask8 __U, __m512i __X, __m512d __Y)
8293{
7924static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
7925_mm512_maskz_permutexvar_pd(__mmask8 __U, __m512i __X, __m512d __Y) {
82947926 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
82957927 (__v8df)_mm512_permutexvar_pd(__X, __Y),
82967928 (__v8df)_mm512_setzero_pd());
82977929}
82987930
8299static __inline__ __m512i __DEFAULT_FN_ATTRS512
8300_mm512_permutexvar_epi64 (__m512i __X, __m512i __Y)
8301{
7931static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
7932_mm512_permutexvar_epi64(__m512i __X, __m512i __Y) {
83027933 return (__m512i)__builtin_ia32_permvardi512((__v8di)__Y, (__v8di)__X);
83037934}
83047935
8305static __inline__ __m512i __DEFAULT_FN_ATTRS512
8306_mm512_maskz_permutexvar_epi64 (__mmask8 __M, __m512i __X, __m512i __Y)
8307{
7936static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
7937_mm512_maskz_permutexvar_epi64(__mmask8 __M, __m512i __X, __m512i __Y) {
83087938 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
83097939 (__v8di)_mm512_permutexvar_epi64(__X, __Y),
83107940 (__v8di)_mm512_setzero_si512());
83117941}
83127942
8313static __inline__ __m512i __DEFAULT_FN_ATTRS512
8314_mm512_mask_permutexvar_epi64 (__m512i __W, __mmask8 __M, __m512i __X,
8315 __m512i __Y)
8316{
7943static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
7944_mm512_mask_permutexvar_epi64(__m512i __W, __mmask8 __M, __m512i __X,
7945 __m512i __Y) {
83177946 return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
83187947 (__v8di)_mm512_permutexvar_epi64(__X, __Y),
83197948 (__v8di)__W);
83207949}
83217950
8322static __inline__ __m512 __DEFAULT_FN_ATTRS512
8323_mm512_permutexvar_ps (__m512i __X, __m512 __Y)
8324{
7951static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
7952_mm512_permutexvar_ps(__m512i __X, __m512 __Y) {
83257953 return (__m512)__builtin_ia32_permvarsf512((__v16sf)__Y, (__v16si)__X);
83267954}
83277955
8328static __inline__ __m512 __DEFAULT_FN_ATTRS512
8329_mm512_mask_permutexvar_ps (__m512 __W, __mmask16 __U, __m512i __X, __m512 __Y)
8330{
7956static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
7957_mm512_mask_permutexvar_ps(__m512 __W, __mmask16 __U, __m512i __X, __m512 __Y) {
83317958 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
83327959 (__v16sf)_mm512_permutexvar_ps(__X, __Y),
83337960 (__v16sf)__W);
83347961}
83357962
8336static __inline__ __m512 __DEFAULT_FN_ATTRS512
8337_mm512_maskz_permutexvar_ps (__mmask16 __U, __m512i __X, __m512 __Y)
8338{
7963static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
7964_mm512_maskz_permutexvar_ps(__mmask16 __U, __m512i __X, __m512 __Y) {
83397965 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
83407966 (__v16sf)_mm512_permutexvar_ps(__X, __Y),
83417967 (__v16sf)_mm512_setzero_ps());
83427968}
83437969
8344static __inline__ __m512i __DEFAULT_FN_ATTRS512
8345_mm512_permutexvar_epi32 (__m512i __X, __m512i __Y)
8346{
7970static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
7971_mm512_permutexvar_epi32(__m512i __X, __m512i __Y) {
83477972 return (__m512i)__builtin_ia32_permvarsi512((__v16si)__Y, (__v16si)__X);
83487973}
83497974
83507975#define _mm512_permutevar_epi32 _mm512_permutexvar_epi32
83517976
8352static __inline__ __m512i __DEFAULT_FN_ATTRS512
8353_mm512_maskz_permutexvar_epi32 (__mmask16 __M, __m512i __X, __m512i __Y)
8354{
7977static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
7978_mm512_maskz_permutexvar_epi32(__mmask16 __M, __m512i __X, __m512i __Y) {
83557979 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
83567980 (__v16si)_mm512_permutexvar_epi32(__X, __Y),
83577981 (__v16si)_mm512_setzero_si512());
83587982}
83597983
8360static __inline__ __m512i __DEFAULT_FN_ATTRS512
8361_mm512_mask_permutexvar_epi32 (__m512i __W, __mmask16 __M, __m512i __X,
8362 __m512i __Y)
8363{
7984static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
7985_mm512_mask_permutexvar_epi32(__m512i __W, __mmask16 __M, __m512i __X,
7986 __m512i __Y) {
83647987 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
83657988 (__v16si)_mm512_permutexvar_epi32(__X, __Y),
83667989 (__v16si)__W);
......@@ -8368,69 +7991,59 @@ _mm512_mask_permutexvar_epi32 (__m512i __W, __mmask16 __M, __m512i __X,
83687991
83697992#define _mm512_mask_permutevar_epi32 _mm512_mask_permutexvar_epi32
83707993
8371static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8372_mm512_kand (__mmask16 __A, __mmask16 __B)
8373{
7994static __inline__ __mmask16
7995 __DEFAULT_FN_ATTRS_CONSTEXPR _mm512_kand(__mmask16 __A, __mmask16 __B) {
83747996 return (__mmask16) __builtin_ia32_kandhi ((__mmask16) __A, (__mmask16) __B);
83757997}
83767998
8377static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8378_mm512_kandn (__mmask16 __A, __mmask16 __B)
8379{
7999static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
8000_mm512_kandn(__mmask16 __A, __mmask16 __B) {
83808001 return (__mmask16) __builtin_ia32_kandnhi ((__mmask16) __A, (__mmask16) __B);
83818002}
83828003
8383static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8384_mm512_kor (__mmask16 __A, __mmask16 __B)
8385{
8004static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
8005_mm512_kor(__mmask16 __A, __mmask16 __B) {
83868006 return (__mmask16) __builtin_ia32_korhi ((__mmask16) __A, (__mmask16) __B);
83878007}
83888008
8389static __inline__ int __DEFAULT_FN_ATTRS
8390_mm512_kortestc (__mmask16 __A, __mmask16 __B)
8391{
8009static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
8010_mm512_kortestc(__mmask16 __A, __mmask16 __B) {
83928011 return __builtin_ia32_kortestchi ((__mmask16) __A, (__mmask16) __B);
83938012}
83948013
8395static __inline__ int __DEFAULT_FN_ATTRS
8396_mm512_kortestz (__mmask16 __A, __mmask16 __B)
8397{
8014static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
8015_mm512_kortestz(__mmask16 __A, __mmask16 __B) {
83988016 return __builtin_ia32_kortestzhi ((__mmask16) __A, (__mmask16) __B);
83998017}
84008018
8401static __inline__ unsigned char __DEFAULT_FN_ATTRS
8402_kortestc_mask16_u8(__mmask16 __A, __mmask16 __B)
8403{
8019static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
8020_kortestc_mask16_u8(__mmask16 __A, __mmask16 __B) {
84048021 return (unsigned char)__builtin_ia32_kortestchi(__A, __B);
84058022}
84068023
8407static __inline__ unsigned char __DEFAULT_FN_ATTRS
8408_kortestz_mask16_u8(__mmask16 __A, __mmask16 __B)
8409{
8024static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
8025_kortestz_mask16_u8(__mmask16 __A, __mmask16 __B) {
84108026 return (unsigned char)__builtin_ia32_kortestzhi(__A, __B);
84118027}
84128028
8413static __inline__ unsigned char __DEFAULT_FN_ATTRS
8029static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
84148030_kortest_mask16_u8(__mmask16 __A, __mmask16 __B, unsigned char *__C) {
84158031 *__C = (unsigned char)__builtin_ia32_kortestchi(__A, __B);
84168032 return (unsigned char)__builtin_ia32_kortestzhi(__A, __B);
84178033}
84188034
8419static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8420_mm512_kunpackb (__mmask16 __A, __mmask16 __B)
8421{
8035static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
8036_mm512_kunpackb(__mmask16 __A, __mmask16 __B) {
84228037 return (__mmask16) __builtin_ia32_kunpckhi ((__mmask16) __A, (__mmask16) __B);
84238038}
84248039
8425static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8426_mm512_kxnor (__mmask16 __A, __mmask16 __B)
8427{
8040static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
8041_mm512_kxnor(__mmask16 __A, __mmask16 __B) {
84288042 return (__mmask16) __builtin_ia32_kxnorhi ((__mmask16) __A, (__mmask16) __B);
84298043}
84308044
8431static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8432_mm512_kxor (__mmask16 __A, __mmask16 __B)
8433{
8045static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
8046_mm512_kxor(__mmask16 __A, __mmask16 __B) {
84348047 return (__mmask16) __builtin_ia32_kxorhi ((__mmask16) __A, (__mmask16) __B);
84358048}
84368049
......@@ -8447,12 +8060,12 @@ _mm512_kxor (__mmask16 __A, __mmask16 __B)
84478060#define _kshiftri_mask16(A, I) \
84488061 ((__mmask16)__builtin_ia32_kshiftrihi((__mmask16)(A), (unsigned int)(I)))
84498062
8450static __inline__ unsigned int __DEFAULT_FN_ATTRS
8451_cvtmask16_u32(__mmask16 __A) {
8063static __inline__ unsigned int
8064 __DEFAULT_FN_ATTRS_CONSTEXPR _cvtmask16_u32(__mmask16 __A) {
84528065 return (unsigned int)__builtin_ia32_kmovw((__mmask16)__A);
84538066}
84548067
8455static __inline__ __mmask16 __DEFAULT_FN_ATTRS
8068static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
84568069_cvtu32_mask16(unsigned int __A) {
84578070 return (__mmask16)__builtin_ia32_kmovw((__mmask16)__A);
84588071}
......@@ -8665,74 +8278,66 @@ _mm512_mask_testn_epi64_mask (__mmask8 __U, __m512i __A, __m512i __B)
86658278 _mm512_setzero_si512());
86668279}
86678280
8668static __inline__ __m512 __DEFAULT_FN_ATTRS512
8281static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
86698282_mm512_movehdup_ps (__m512 __A)
86708283{
86718284 return (__m512)__builtin_shufflevector((__v16sf)__A, (__v16sf)__A,
86728285 1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15);
86738286}
86748287
8675static __inline__ __m512 __DEFAULT_FN_ATTRS512
8676_mm512_mask_movehdup_ps (__m512 __W, __mmask16 __U, __m512 __A)
8677{
8288static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8289_mm512_mask_movehdup_ps(__m512 __W, __mmask16 __U, __m512 __A) {
86788290 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
86798291 (__v16sf)_mm512_movehdup_ps(__A),
86808292 (__v16sf)__W);
86818293}
86828294
8683static __inline__ __m512 __DEFAULT_FN_ATTRS512
8684_mm512_maskz_movehdup_ps (__mmask16 __U, __m512 __A)
8685{
8295static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8296_mm512_maskz_movehdup_ps(__mmask16 __U, __m512 __A) {
86868297 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
86878298 (__v16sf)_mm512_movehdup_ps(__A),
86888299 (__v16sf)_mm512_setzero_ps());
86898300}
86908301
8691static __inline__ __m512 __DEFAULT_FN_ATTRS512
8302static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
86928303_mm512_moveldup_ps (__m512 __A)
86938304{
86948305 return (__m512)__builtin_shufflevector((__v16sf)__A, (__v16sf)__A,
86958306 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14);
86968307}
86978308
8698static __inline__ __m512 __DEFAULT_FN_ATTRS512
8699_mm512_mask_moveldup_ps (__m512 __W, __mmask16 __U, __m512 __A)
8700{
8309static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8310_mm512_mask_moveldup_ps(__m512 __W, __mmask16 __U, __m512 __A) {
87018311 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
87028312 (__v16sf)_mm512_moveldup_ps(__A),
87038313 (__v16sf)__W);
87048314}
87058315
8706static __inline__ __m512 __DEFAULT_FN_ATTRS512
8707_mm512_maskz_moveldup_ps (__mmask16 __U, __m512 __A)
8708{
8316static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8317_mm512_maskz_moveldup_ps(__mmask16 __U, __m512 __A) {
87098318 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
87108319 (__v16sf)_mm512_moveldup_ps(__A),
87118320 (__v16sf)_mm512_setzero_ps());
87128321}
87138322
8714static __inline__ __m128 __DEFAULT_FN_ATTRS128
8715_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
8716{
8323static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
8324_mm_mask_move_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
87178325 return __builtin_ia32_selectss_128(__U, _mm_move_ss(__A, __B), __W);
87188326}
87198327
8720static __inline__ __m128 __DEFAULT_FN_ATTRS128
8721_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
8722{
8328static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
8329_mm_maskz_move_ss(__mmask8 __U, __m128 __A, __m128 __B) {
87238330 return __builtin_ia32_selectss_128(__U, _mm_move_ss(__A, __B),
87248331 _mm_setzero_ps());
87258332}
87268333
8727static __inline__ __m128d __DEFAULT_FN_ATTRS128
8728_mm_mask_move_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
8729{
8334static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
8335_mm_mask_move_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
87308336 return __builtin_ia32_selectsd_128(__U, _mm_move_sd(__A, __B), __W);
87318337}
87328338
8733static __inline__ __m128d __DEFAULT_FN_ATTRS128
8734_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
8735{
8339static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
8340_mm_maskz_move_sd(__mmask8 __U, __m128d __A, __m128d __B) {
87368341 return __builtin_ia32_selectsd_128(__U, _mm_move_sd(__A, __B),
87378342 _mm_setzero_pd());
87388343}
......@@ -8941,70 +8546,57 @@ _mm512_maskz_expand_epi32 (__mmask16 __U, __m512i __A)
89418546 (__v8df)_mm512_setzero_pd(), \
89428547 (__mmask8)(U), (int)(R)))
89438548
8944static __inline__ __m512d __DEFAULT_FN_ATTRS512
8945_mm512_cvtps_pd (__m256 __A)
8946{
8549static __inline__ __m512d
8550 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_cvtps_pd(__m256 __A) {
89478551 return (__m512d) __builtin_convertvector((__v8sf)__A, __v8df);
89488552}
89498553
8950static __inline__ __m512d __DEFAULT_FN_ATTRS512
8951_mm512_mask_cvtps_pd (__m512d __W, __mmask8 __U, __m256 __A)
8952{
8554static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8555_mm512_mask_cvtps_pd(__m512d __W, __mmask8 __U, __m256 __A) {
89538556 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
89548557 (__v8df)_mm512_cvtps_pd(__A),
89558558 (__v8df)__W);
89568559}
89578560
8958static __inline__ __m512d __DEFAULT_FN_ATTRS512
8959_mm512_maskz_cvtps_pd (__mmask8 __U, __m256 __A)
8960{
8561static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8562_mm512_maskz_cvtps_pd(__mmask8 __U, __m256 __A) {
89618563 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
89628564 (__v8df)_mm512_cvtps_pd(__A),
89638565 (__v8df)_mm512_setzero_pd());
89648566}
89658567
8966static __inline__ __m512d __DEFAULT_FN_ATTRS512
8967_mm512_cvtpslo_pd (__m512 __A)
8968{
8568static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8569_mm512_cvtpslo_pd(__m512 __A) {
89698570 return (__m512d) _mm512_cvtps_pd(_mm512_castps512_ps256(__A));
89708571}
89718572
8972static __inline__ __m512d __DEFAULT_FN_ATTRS512
8973_mm512_mask_cvtpslo_pd (__m512d __W, __mmask8 __U, __m512 __A)
8974{
8573static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8574_mm512_mask_cvtpslo_pd(__m512d __W, __mmask8 __U, __m512 __A) {
89758575 return (__m512d) _mm512_mask_cvtps_pd(__W, __U, _mm512_castps512_ps256(__A));
89768576}
89778577
8978static __inline__ __m512d __DEFAULT_FN_ATTRS512
8979_mm512_mask_mov_pd (__m512d __W, __mmask8 __U, __m512d __A)
8980{
8981 return (__m512d) __builtin_ia32_selectpd_512 ((__mmask8) __U,
8982 (__v8df) __A,
8983 (__v8df) __W);
8578static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8579_mm512_mask_mov_pd(__m512d __W, __mmask8 __U, __m512d __A) {
8580 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U, (__v8df)__A,
8581 (__v8df)__W);
89848582}
89858583
8986static __inline__ __m512d __DEFAULT_FN_ATTRS512
8987_mm512_maskz_mov_pd (__mmask8 __U, __m512d __A)
8988{
8989 return (__m512d) __builtin_ia32_selectpd_512 ((__mmask8) __U,
8990 (__v8df) __A,
8991 (__v8df) _mm512_setzero_pd ());
8584static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8585_mm512_maskz_mov_pd(__mmask8 __U, __m512d __A) {
8586 return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U, (__v8df)__A,
8587 (__v8df)_mm512_setzero_pd());
89928588}
89938589
8994static __inline__ __m512 __DEFAULT_FN_ATTRS512
8995_mm512_mask_mov_ps (__m512 __W, __mmask16 __U, __m512 __A)
8996{
8997 return (__m512) __builtin_ia32_selectps_512 ((__mmask16) __U,
8998 (__v16sf) __A,
8999 (__v16sf) __W);
8590static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8591_mm512_mask_mov_ps(__m512 __W, __mmask16 __U, __m512 __A) {
8592 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U, (__v16sf)__A,
8593 (__v16sf)__W);
90008594}
90018595
9002static __inline__ __m512 __DEFAULT_FN_ATTRS512
9003_mm512_maskz_mov_ps (__mmask16 __U, __m512 __A)
9004{
9005 return (__m512) __builtin_ia32_selectps_512 ((__mmask16) __U,
9006 (__v16sf) __A,
9007 (__v16sf) _mm512_setzero_ps ());
8596static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8597_mm512_maskz_mov_ps(__mmask16 __U, __m512 __A) {
8598 return (__m512)__builtin_ia32_selectps_512((__mmask16)__U, (__v16sf)__A,
8599 (__v16sf)_mm512_setzero_ps());
90088600}
90098601
90108602static __inline__ void __DEFAULT_FN_ATTRS512
......@@ -9053,18 +8645,16 @@ _mm512_mask_compressstoreu_epi32 (void *__P, __mmask16 __U, __m512i __A)
90538645 (__v4sf)_mm_setzero_ps(), \
90548646 (__mmask8)(U), (int)(R)))
90558647
9056static __inline__ __m128 __DEFAULT_FN_ATTRS128
9057_mm_mask_cvtsd_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128d __B)
9058{
8648static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
8649_mm_mask_cvtsd_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128d __B) {
90598650 return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)__A,
90608651 (__v2df)__B,
90618652 (__v4sf)__W,
90628653 (__mmask8)__U, _MM_FROUND_CUR_DIRECTION);
90638654}
90648655
9065static __inline__ __m128 __DEFAULT_FN_ATTRS128
9066_mm_maskz_cvtsd_ss (__mmask8 __U, __m128 __A, __m128d __B)
9067{
8656static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
8657_mm_maskz_cvtsd_ss(__mmask8 __U, __m128 __A, __m128d __B) {
90688658 return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)__A,
90698659 (__v2df)__B,
90708660 (__v4sf)_mm_setzero_ps(),
......@@ -9188,34 +8778,32 @@ _mm_cvtu64_ss (__m128 __A, unsigned long long __B)
91888778}
91898779#endif
91908780
9191static __inline__ __m512i __DEFAULT_FN_ATTRS512
9192_mm512_mask_set1_epi32 (__m512i __O, __mmask16 __M, int __A)
9193{
8781static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8782_mm512_mask_set1_epi32(__m512i __O, __mmask16 __M, int __A) {
91948783 return (__m512i) __builtin_ia32_selectd_512(__M,
91958784 (__v16si) _mm512_set1_epi32(__A),
91968785 (__v16si) __O);
91978786}
91988787
9199static __inline__ __m512i __DEFAULT_FN_ATTRS512
9200_mm512_mask_set1_epi64 (__m512i __O, __mmask8 __M, long long __A)
9201{
8788static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8789_mm512_mask_set1_epi64(__m512i __O, __mmask8 __M, long long __A) {
92028790 return (__m512i) __builtin_ia32_selectq_512(__M,
92038791 (__v8di) _mm512_set1_epi64(__A),
92048792 (__v8di) __O);
92058793}
92068794
9207static __inline __m512i __DEFAULT_FN_ATTRS512
9208_mm512_set_epi8 (char __e63, char __e62, char __e61, char __e60, char __e59,
9209 char __e58, char __e57, char __e56, char __e55, char __e54, char __e53,
9210 char __e52, char __e51, char __e50, char __e49, char __e48, char __e47,
9211 char __e46, char __e45, char __e44, char __e43, char __e42, char __e41,
9212 char __e40, char __e39, char __e38, char __e37, char __e36, char __e35,
9213 char __e34, char __e33, char __e32, char __e31, char __e30, char __e29,
9214 char __e28, char __e27, char __e26, char __e25, char __e24, char __e23,
9215 char __e22, char __e21, char __e20, char __e19, char __e18, char __e17,
9216 char __e16, char __e15, char __e14, char __e13, char __e12, char __e11,
9217 char __e10, char __e9, char __e8, char __e7, char __e6, char __e5,
9218 char __e4, char __e3, char __e2, char __e1, char __e0) {
8795static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_set_epi8(
8796 char __e63, char __e62, char __e61, char __e60, char __e59, char __e58,
8797 char __e57, char __e56, char __e55, char __e54, char __e53, char __e52,
8798 char __e51, char __e50, char __e49, char __e48, char __e47, char __e46,
8799 char __e45, char __e44, char __e43, char __e42, char __e41, char __e40,
8800 char __e39, char __e38, char __e37, char __e36, char __e35, char __e34,
8801 char __e33, char __e32, char __e31, char __e30, char __e29, char __e28,
8802 char __e27, char __e26, char __e25, char __e24, char __e23, char __e22,
8803 char __e21, char __e20, char __e19, char __e18, char __e17, char __e16,
8804 char __e15, char __e14, char __e13, char __e12, char __e11, char __e10,
8805 char __e9, char __e8, char __e7, char __e6, char __e5, char __e4, char __e3,
8806 char __e2, char __e1, char __e0) {
92198807
92208808 return __extension__ (__m512i)(__v64qi)
92218809 {__e0, __e1, __e2, __e3, __e4, __e5, __e6, __e7,
......@@ -9228,14 +8816,13 @@ _mm512_set_epi8 (char __e63, char __e62, char __e61, char __e60, char __e59,
92288816 __e56, __e57, __e58, __e59, __e60, __e61, __e62, __e63};
92298817}
92308818
9231static __inline __m512i __DEFAULT_FN_ATTRS512
9232_mm512_set_epi16(short __e31, short __e30, short __e29, short __e28,
9233 short __e27, short __e26, short __e25, short __e24, short __e23,
9234 short __e22, short __e21, short __e20, short __e19, short __e18,
9235 short __e17, short __e16, short __e15, short __e14, short __e13,
9236 short __e12, short __e11, short __e10, short __e9, short __e8,
9237 short __e7, short __e6, short __e5, short __e4, short __e3,
9238 short __e2, short __e1, short __e0) {
8819static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_set_epi16(
8820 short __e31, short __e30, short __e29, short __e28, short __e27,
8821 short __e26, short __e25, short __e24, short __e23, short __e22,
8822 short __e21, short __e20, short __e19, short __e18, short __e17,
8823 short __e16, short __e15, short __e14, short __e13, short __e12,
8824 short __e11, short __e10, short __e9, short __e8, short __e7, short __e6,
8825 short __e5, short __e4, short __e3, short __e2, short __e1, short __e0) {
92398826 return __extension__ (__m512i)(__v32hi)
92408827 {__e0, __e1, __e2, __e3, __e4, __e5, __e6, __e7,
92418828 __e8, __e9, __e10, __e11, __e12, __e13, __e14, __e15,
......@@ -9243,81 +8830,81 @@ _mm512_set_epi16(short __e31, short __e30, short __e29, short __e28,
92438830 __e24, __e25, __e26, __e27, __e28, __e29, __e30, __e31 };
92448831}
92458832
9246static __inline __m512i __DEFAULT_FN_ATTRS512
9247_mm512_set_epi32 (int __A, int __B, int __C, int __D,
9248 int __E, int __F, int __G, int __H,
9249 int __I, int __J, int __K, int __L,
9250 int __M, int __N, int __O, int __P)
9251{
8833static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_set_epi32(
8834 int __A, int __B, int __C, int __D, int __E, int __F, int __G, int __H,
8835 int __I, int __J, int __K, int __L, int __M, int __N, int __O, int __P) {
92528836 return __extension__ (__m512i)(__v16si)
92538837 { __P, __O, __N, __M, __L, __K, __J, __I,
92548838 __H, __G, __F, __E, __D, __C, __B, __A };
92558839}
92568840
9257#define _mm512_setr_epi32(e0,e1,e2,e3,e4,e5,e6,e7, \
9258 e8,e9,e10,e11,e12,e13,e14,e15) \
9259 _mm512_set_epi32((e15),(e14),(e13),(e12),(e11),(e10),(e9),(e8),(e7),(e6), \
9260 (e5),(e4),(e3),(e2),(e1),(e0))
8841static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_setr_epi32(
8842 int e0, int e1, int e2, int e3, int e4, int e5, int e6, int e7, int e8,
8843 int e9, int e10, int e11, int e12, int e13, int e14, int e15) {
8844 return _mm512_set_epi32(e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4,
8845 e3, e2, e1, e0);
8846}
92618847
9262static __inline__ __m512i __DEFAULT_FN_ATTRS512
9263_mm512_set_epi64 (long long __A, long long __B, long long __C,
9264 long long __D, long long __E, long long __F,
9265 long long __G, long long __H)
9266{
8848static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8849_mm512_set_epi64(long long __A, long long __B, long long __C, long long __D,
8850 long long __E, long long __F, long long __G, long long __H) {
92678851 return __extension__ (__m512i) (__v8di)
92688852 { __H, __G, __F, __E, __D, __C, __B, __A };
92698853}
92708854
9271#define _mm512_setr_epi64(e0,e1,e2,e3,e4,e5,e6,e7) \
9272 _mm512_set_epi64((e7),(e6),(e5),(e4),(e3),(e2),(e1),(e0))
8855static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8856_mm512_setr_epi64(long long e0, long long e1, long long e2, long long e3,
8857 long long e4, long long e5, long long e6, long long e7) {
8858 return _mm512_set_epi64(e7, e6, e5, e4, e3, e2, e1, e0);
8859}
92738860
9274static __inline__ __m512d __DEFAULT_FN_ATTRS512
9275_mm512_set_pd (double __A, double __B, double __C, double __D,
9276 double __E, double __F, double __G, double __H)
9277{
8861static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8862_mm512_set_pd(double __A, double __B, double __C, double __D, double __E,
8863 double __F, double __G, double __H) {
92788864 return __extension__ (__m512d)
92798865 { __H, __G, __F, __E, __D, __C, __B, __A };
92808866}
92818867
9282#define _mm512_setr_pd(e0,e1,e2,e3,e4,e5,e6,e7) \
9283 _mm512_set_pd((e7),(e6),(e5),(e4),(e3),(e2),(e1),(e0))
8868static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8869_mm512_setr_pd(double e0, double e1, double e2, double e3, double e4, double e5,
8870 double e6, double e7) {
8871 return _mm512_set_pd(e7, e6, e5, e4, e3, e2, e1, e0);
8872}
92848873
9285static __inline__ __m512 __DEFAULT_FN_ATTRS512
9286_mm512_set_ps (float __A, float __B, float __C, float __D,
9287 float __E, float __F, float __G, float __H,
9288 float __I, float __J, float __K, float __L,
9289 float __M, float __N, float __O, float __P)
9290{
8874static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8875_mm512_set_ps(float __A, float __B, float __C, float __D, float __E, float __F,
8876 float __G, float __H, float __I, float __J, float __K, float __L,
8877 float __M, float __N, float __O, float __P) {
92918878 return __extension__ (__m512)
92928879 { __P, __O, __N, __M, __L, __K, __J, __I,
92938880 __H, __G, __F, __E, __D, __C, __B, __A };
92948881}
92958882
9296#define _mm512_setr_ps(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15) \
9297 _mm512_set_ps((e15),(e14),(e13),(e12),(e11),(e10),(e9),(e8),(e7),(e6),(e5), \
9298 (e4),(e3),(e2),(e1),(e0))
8883static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8884_mm512_setr_ps(float e0, float e1, float e2, float e3, float e4, float e5,
8885 float e6, float e7, float e8, float e9, float e10, float e11,
8886 float e12, float e13, float e14, float e15) {
8887 return _mm512_set_ps(e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3,
8888 e2, e1, e0);
8889}
92998890
9300static __inline__ __m512 __DEFAULT_FN_ATTRS512
9301_mm512_abs_ps(__m512 __A)
9302{
8891static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8892_mm512_abs_ps(__m512 __A) {
93038893 return (__m512)_mm512_and_epi32(_mm512_set1_epi32(0x7FFFFFFF),(__m512i)__A) ;
93048894}
93058895
9306static __inline__ __m512 __DEFAULT_FN_ATTRS512
9307_mm512_mask_abs_ps(__m512 __W, __mmask16 __K, __m512 __A)
9308{
8896static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8897_mm512_mask_abs_ps(__m512 __W, __mmask16 __K, __m512 __A) {
93098898 return (__m512)_mm512_mask_and_epi32((__m512i)__W, __K, _mm512_set1_epi32(0x7FFFFFFF),(__m512i)__A) ;
93108899}
93118900
9312static __inline__ __m512d __DEFAULT_FN_ATTRS512
9313_mm512_abs_pd(__m512d __A)
9314{
8901static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8902_mm512_abs_pd(__m512d __A) {
93158903 return (__m512d)_mm512_and_epi64(_mm512_set1_epi64(0x7FFFFFFFFFFFFFFF),(__v8di)__A) ;
93168904}
93178905
9318static __inline__ __m512d __DEFAULT_FN_ATTRS512
9319_mm512_mask_abs_pd(__m512d __W, __mmask8 __K, __m512d __A)
9320{
8906static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8907_mm512_mask_abs_pd(__m512d __W, __mmask8 __K, __m512d __A) {
93218908 return (__m512d)_mm512_mask_and_epi64((__v8di)__W, __K, _mm512_set1_epi64(0x7FFFFFFFFFFFFFFF),(__v8di)__A);
93228909}
93238910
......@@ -9337,19 +8924,23 @@ _mm512_mask_abs_pd(__m512d __W, __mmask8 __K, __m512d __A)
93378924 * This takes log2(n) steps where n is the number of elements in the vector.
93388925 */
93398926
9340static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_add_epi64(__m512i __W) {
8927static __inline__ long long __DEFAULT_FN_ATTRS512_CONSTEXPR
8928_mm512_reduce_add_epi64(__m512i __W) {
93418929 return __builtin_reduce_add((__v8di)__W);
93428930}
93438931
9344static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_mul_epi64(__m512i __W) {
8932static __inline__ long long __DEFAULT_FN_ATTRS512_CONSTEXPR
8933_mm512_reduce_mul_epi64(__m512i __W) {
93458934 return __builtin_reduce_mul((__v8di)__W);
93468935}
93478936
9348static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_and_epi64(__m512i __W) {
8937static __inline__ long long __DEFAULT_FN_ATTRS512_CONSTEXPR
8938_mm512_reduce_and_epi64(__m512i __W) {
93498939 return __builtin_reduce_and((__v8di)__W);
93508940}
93518941
9352static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_or_epi64(__m512i __W) {
8942static __inline__ long long __DEFAULT_FN_ATTRS512_CONSTEXPR
8943_mm512_reduce_or_epi64(__m512i __W) {
93538944 return __builtin_reduce_or((__v8di)__W);
93548945}
93558946
......@@ -9400,22 +8991,22 @@ _mm512_mask_reduce_mul_pd(__mmask8 __M, __m512d __W) {
94008991 return __builtin_ia32_reduce_fmul_pd512(1.0, __W);
94018992}
94028993
9403static __inline__ int __DEFAULT_FN_ATTRS512
8994static __inline__ int __DEFAULT_FN_ATTRS512_CONSTEXPR
94048995_mm512_reduce_add_epi32(__m512i __W) {
94058996 return __builtin_reduce_add((__v16si)__W);
94068997}
94078998
9408static __inline__ int __DEFAULT_FN_ATTRS512
8999static __inline__ int __DEFAULT_FN_ATTRS512_CONSTEXPR
94099000_mm512_reduce_mul_epi32(__m512i __W) {
94109001 return __builtin_reduce_mul((__v16si)__W);
94119002}
94129003
9413static __inline__ int __DEFAULT_FN_ATTRS512
9004static __inline__ int __DEFAULT_FN_ATTRS512_CONSTEXPR
94149005_mm512_reduce_and_epi32(__m512i __W) {
94159006 return __builtin_reduce_and((__v16si)__W);
94169007}
94179008
9418static __inline__ int __DEFAULT_FN_ATTRS512
9009static __inline__ int __DEFAULT_FN_ATTRS512_CONSTEXPR
94199010_mm512_reduce_or_epi32(__m512i __W) {
94209011 return __builtin_reduce_or((__v16si)__W);
94219012}
......@@ -9466,22 +9057,22 @@ _mm512_mask_reduce_mul_ps(__mmask16 __M, __m512 __W) {
94669057 return __builtin_ia32_reduce_fmul_ps512(1.0f, __W);
94679058}
94689059
9469static __inline__ long long __DEFAULT_FN_ATTRS512
9060static __inline__ long long __DEFAULT_FN_ATTRS512_CONSTEXPR
94709061_mm512_reduce_max_epi64(__m512i __V) {
94719062 return __builtin_reduce_max((__v8di)__V);
94729063}
94739064
9474static __inline__ unsigned long long __DEFAULT_FN_ATTRS512
9065static __inline__ unsigned long long __DEFAULT_FN_ATTRS512_CONSTEXPR
94759066_mm512_reduce_max_epu64(__m512i __V) {
94769067 return __builtin_reduce_max((__v8du)__V);
94779068}
94789069
9479static __inline__ long long __DEFAULT_FN_ATTRS512
9070static __inline__ long long __DEFAULT_FN_ATTRS512_CONSTEXPR
94809071_mm512_reduce_min_epi64(__m512i __V) {
94819072 return __builtin_reduce_min((__v8di)__V);
94829073}
94839074
9484static __inline__ unsigned long long __DEFAULT_FN_ATTRS512
9075static __inline__ unsigned long long __DEFAULT_FN_ATTRS512_CONSTEXPR
94859076_mm512_reduce_min_epu64(__m512i __V) {
94869077 return __builtin_reduce_min((__v8du)__V);
94879078}
......@@ -9509,22 +9100,22 @@ _mm512_mask_reduce_min_epu64(__mmask8 __M, __m512i __V) {
95099100 __V = _mm512_mask_mov_epi64(_mm512_set1_epi64(-1LL), __M, __V);
95109101 return __builtin_reduce_min((__v8du)__V);
95119102}
9512static __inline__ int __DEFAULT_FN_ATTRS512
9103static __inline__ int __DEFAULT_FN_ATTRS512_CONSTEXPR
95139104_mm512_reduce_max_epi32(__m512i __V) {
95149105 return __builtin_reduce_max((__v16si)__V);
95159106}
95169107
9517static __inline__ unsigned int __DEFAULT_FN_ATTRS512
9108static __inline__ unsigned int __DEFAULT_FN_ATTRS512_CONSTEXPR
95189109_mm512_reduce_max_epu32(__m512i __V) {
95199110 return __builtin_reduce_max((__v16su)__V);
95209111}
95219112
9522static __inline__ int __DEFAULT_FN_ATTRS512
9113static __inline__ int __DEFAULT_FN_ATTRS512_CONSTEXPR
95239114_mm512_reduce_min_epi32(__m512i __V) {
95249115 return __builtin_reduce_min((__v16si)__V);
95259116}
95269117
9527static __inline__ unsigned int __DEFAULT_FN_ATTRS512
9118static __inline__ unsigned int __DEFAULT_FN_ATTRS512_CONSTEXPR
95289119_mm512_reduce_min_epu32(__m512i __V) {
95299120 return __builtin_reduce_min((__v16su)__V);
95309121}
lib/include/avx512fp16intrin.h+112-110
......@@ -22,26 +22,36 @@ typedef _Float16 __m512h_u __attribute__((__vector_size__(64), __aligned__(1)));
2222
2323/* Define the default attributes for the functions in this file. */
2424#define __DEFAULT_FN_ATTRS512 \
25 __attribute__((__always_inline__, __nodebug__, \
26 __target__("avx512fp16,evex512"), __min_vector_width__(512)))
25 __attribute__((__always_inline__, __nodebug__, __target__("avx512fp16"), \
26 __min_vector_width__(512)))
2727#define __DEFAULT_FN_ATTRS256 \
28 __attribute__((__always_inline__, __nodebug__, \
29 __target__("avx512fp16,no-evex512"), \
28 __attribute__((__always_inline__, __nodebug__, __target__("avx512fp16"), \
3029 __min_vector_width__(256)))
3130#define __DEFAULT_FN_ATTRS128 \
32 __attribute__((__always_inline__, __nodebug__, \
33 __target__("avx512fp16,no-evex512"), \
31 __attribute__((__always_inline__, __nodebug__, __target__("avx512fp16"), \
3432 __min_vector_width__(128)))
3533
36static __inline__ _Float16 __DEFAULT_FN_ATTRS512 _mm512_cvtsh_h(__m512h __a) {
34#if defined(__cplusplus) && (__cplusplus >= 201103L)
35#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
36#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
37#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
38#else
39#define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
40#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
41#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
42#endif
43
44static __inline__ _Float16 __DEFAULT_FN_ATTRS512_CONSTEXPR
45_mm512_cvtsh_h(__m512h __a) {
3746 return __a[0];
3847}
3948
40static __inline __m128h __DEFAULT_FN_ATTRS128 _mm_setzero_ph(void) {
49static __inline __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_setzero_ph(void) {
4150 return (__m128h){0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4251}
4352
44static __inline __m256h __DEFAULT_FN_ATTRS256 _mm256_setzero_ph(void) {
53static __inline __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
54_mm256_setzero_ph(void) {
4555 return (__m256h){0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
4656 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4757}
......@@ -50,7 +60,8 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_undefined_ph(void) {
5060 return (__m256h)__builtin_ia32_undef256();
5161}
5262
53static __inline __m512h __DEFAULT_FN_ATTRS512 _mm512_setzero_ph(void) {
63static __inline __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
64_mm512_setzero_ph(void) {
5465 return (__m512h){0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
5566 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
5667 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
......@@ -64,14 +75,15 @@ static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_undefined_ph(void) {
6475 return (__m512h)__builtin_ia32_undef512();
6576}
6677
67static __inline __m512h __DEFAULT_FN_ATTRS512 _mm512_set1_ph(_Float16 __h) {
78static __inline __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
79_mm512_set1_ph(_Float16 __h) {
6880 return (__m512h)(__v32hf){__h, __h, __h, __h, __h, __h, __h, __h,
6981 __h, __h, __h, __h, __h, __h, __h, __h,
7082 __h, __h, __h, __h, __h, __h, __h, __h,
7183 __h, __h, __h, __h, __h, __h, __h, __h};
7284}
7385
74static __inline __m512h __DEFAULT_FN_ATTRS512
86static __inline __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
7587_mm512_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
7688 _Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8,
7789 _Float16 __h9, _Float16 __h10, _Float16 __h11, _Float16 __h12,
......@@ -87,106 +99,111 @@ _mm512_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
8799 __h4, __h3, __h2, __h1};
88100}
89101
90#define _mm512_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, \
91 h14, h15, h16, h17, h18, h19, h20, h21, h22, h23, h24, \
92 h25, h26, h27, h28, h29, h30, h31, h32) \
93 _mm512_set_ph((h32), (h31), (h30), (h29), (h28), (h27), (h26), (h25), (h24), \
94 (h23), (h22), (h21), (h20), (h19), (h18), (h17), (h16), (h15), \
95 (h14), (h13), (h12), (h11), (h10), (h9), (h8), (h7), (h6), \
96 (h5), (h4), (h3), (h2), (h1))
102static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_setr_ph(
103 _Float16 e0, _Float16 e1, _Float16 e2, _Float16 e3, _Float16 e4,
104 _Float16 e5, _Float16 e6, _Float16 e7, _Float16 e8, _Float16 e9,
105 _Float16 e10, _Float16 e11, _Float16 e12, _Float16 e13, _Float16 e14,
106 _Float16 e15, _Float16 e16, _Float16 e17, _Float16 e18, _Float16 e19,
107 _Float16 e20, _Float16 e21, _Float16 e22, _Float16 e23, _Float16 e24,
108 _Float16 e25, _Float16 e26, _Float16 e27, _Float16 e28, _Float16 e29,
109 _Float16 e30, _Float16 e31) {
110 return _mm512_set_ph(e31, e30, e29, e28, e27, e26, e25, e24, e23, e22, e21,
111 e20, e19, e18, e17, e16, e15, e14, e13, e12, e11, e10,
112 e9, e8, e7, e6, e5, e4, e3, e2, e1, e0);
113}
97114
98static __inline __m512h __DEFAULT_FN_ATTRS512
115static __inline __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
99116_mm512_set1_pch(_Float16 _Complex __h) {
100117 return (__m512h)_mm512_set1_ps(__builtin_bit_cast(float, __h));
101118}
102119
103static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_castph_ps(__m128h __a) {
120static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castph_ps(__m128h __a) {
104121 return (__m128)__a;
105122}
106123
107static __inline__ __m256 __DEFAULT_FN_ATTRS256 _mm256_castph_ps(__m256h __a) {
124static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castph_ps(__m256h __a) {
108125 return (__m256)__a;
109126}
110127
111static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_castph_ps(__m512h __a) {
128static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castph_ps(__m512h __a) {
112129 return (__m512)__a;
113130}
114131
115static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_castph_pd(__m128h __a) {
132static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castph_pd(__m128h __a) {
116133 return (__m128d)__a;
117134}
118135
119static __inline__ __m256d __DEFAULT_FN_ATTRS256 _mm256_castph_pd(__m256h __a) {
136static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castph_pd(__m256h __a) {
120137 return (__m256d)__a;
121138}
122139
123static __inline__ __m512d __DEFAULT_FN_ATTRS512 _mm512_castph_pd(__m512h __a) {
140static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castph_pd(__m512h __a) {
124141 return (__m512d)__a;
125142}
126143
127static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_castph_si128(__m128h __a) {
144static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castph_si128(__m128h __a) {
128145 return (__m128i)__a;
129146}
130147
131static __inline__ __m256i __DEFAULT_FN_ATTRS256
148static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
132149_mm256_castph_si256(__m256h __a) {
133150 return (__m256i)__a;
134151}
135152
136static __inline__ __m512i __DEFAULT_FN_ATTRS512
153static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
137154_mm512_castph_si512(__m512h __a) {
138155 return (__m512i)__a;
139156}
140157
141static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_castps_ph(__m128 __a) {
158static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castps_ph(__m128 __a) {
142159 return (__m128h)__a;
143160}
144161
145static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_castps_ph(__m256 __a) {
162static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castps_ph(__m256 __a) {
146163 return (__m256h)__a;
147164}
148165
149static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_castps_ph(__m512 __a) {
166static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castps_ph(__m512 __a) {
150167 return (__m512h)__a;
151168}
152169
153static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_castpd_ph(__m128d __a) {
170static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castpd_ph(__m128d __a) {
154171 return (__m128h)__a;
155172}
156173
157static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_castpd_ph(__m256d __a) {
174static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castpd_ph(__m256d __a) {
158175 return (__m256h)__a;
159176}
160177
161static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_castpd_ph(__m512d __a) {
178static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castpd_ph(__m512d __a) {
162179 return (__m512h)__a;
163180}
164181
165static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_castsi128_ph(__m128i __a) {
182static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castsi128_ph(__m128i __a) {
166183 return (__m128h)__a;
167184}
168185
169static __inline__ __m256h __DEFAULT_FN_ATTRS256
186static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
170187_mm256_castsi256_ph(__m256i __a) {
171188 return (__m256h)__a;
172189}
173190
174static __inline__ __m512h __DEFAULT_FN_ATTRS512
191static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
175192_mm512_castsi512_ph(__m512i __a) {
176193 return (__m512h)__a;
177194}
178195
179static __inline__ __m128h __DEFAULT_FN_ATTRS256
196static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
180197_mm256_castph256_ph128(__m256h __a) {
181198 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, 4, 5, 6, 7);
182199}
183200
184static __inline__ __m128h __DEFAULT_FN_ATTRS512
201static __inline__ __m128h __DEFAULT_FN_ATTRS512_CONSTEXPR
185202_mm512_castph512_ph128(__m512h __a) {
186203 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, 4, 5, 6, 7);
187204}
188205
189static __inline__ __m256h __DEFAULT_FN_ATTRS512
206static __inline__ __m256h __DEFAULT_FN_ATTRS512_CONSTEXPR
190207_mm512_castph512_ph256(__m512h __a) {
191208 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
192209 12, 13, 14, 15);
......@@ -229,7 +246,7 @@ _mm512_castph256_ph512(__m256h __a) {
229246/// A 128-bit vector of [8 x half].
230247/// \returns A 512-bit floating-point vector of [16 x half]. The lower 128 bits
231248/// contain the value of the parameter. The upper 384 bits are set to zero.
232static __inline__ __m256h __DEFAULT_FN_ATTRS256
249static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
233250_mm256_zextph128_ph256(__m128h __a) {
234251 return __builtin_shufflevector(__a, (__v8hf)_mm_setzero_ph(), 0, 1, 2, 3, 4,
235252 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
......@@ -248,7 +265,7 @@ _mm256_zextph128_ph256(__m128h __a) {
248265/// A 128-bit vector of [8 x half].
249266/// \returns A 512-bit floating-point vector of [32 x half]. The lower 128 bits
250267/// contain the value of the parameter. The upper 384 bits are set to zero.
251static __inline__ __m512h __DEFAULT_FN_ATTRS512
268static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
252269_mm512_zextph128_ph512(__m128h __a) {
253270 return __builtin_shufflevector(
254271 __a, (__v8hf)_mm_setzero_ph(), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
......@@ -268,7 +285,7 @@ _mm512_zextph128_ph512(__m128h __a) {
268285/// A 256-bit vector of [16 x half].
269286/// \returns A 512-bit floating-point vector of [32 x half]. The lower 256 bits
270287/// contain the value of the parameter. The upper 256 bits are set to zero.
271static __inline__ __m512h __DEFAULT_FN_ATTRS512
288static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
272289_mm512_zextph256_ph512(__m256h __a) {
273290 return __builtin_shufflevector(__a, (__v16hf)_mm256_setzero_ph(), 0, 1, 2, 3,
274291 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
......@@ -482,19 +499,19 @@ _mm512_maskz_div_ph(__mmask32 __U, __m512h __A, __m512h __B) {
482499 (__mmask32)(U), (__v32hf)_mm512_div_round_ph((A), (B), (R)), \
483500 (__v32hf)_mm512_setzero_ph()))
484501
485static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_min_ph(__m512h __A,
486 __m512h __B) {
502static __inline__ __m512h
503 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_min_ph(__m512h __A, __m512h __B) {
487504 return (__m512h)__builtin_ia32_minph512((__v32hf)__A, (__v32hf)__B,
488505 _MM_FROUND_CUR_DIRECTION);
489506}
490507
491static __inline__ __m512h __DEFAULT_FN_ATTRS512
508static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
492509_mm512_mask_min_ph(__m512h __W, __mmask32 __U, __m512h __A, __m512h __B) {
493510 return (__m512h)__builtin_ia32_selectph_512(
494511 (__mmask32)__U, (__v32hf)_mm512_min_ph(__A, __B), (__v32hf)__W);
495512}
496513
497static __inline__ __m512h __DEFAULT_FN_ATTRS512
514static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
498515_mm512_maskz_min_ph(__mmask32 __U, __m512h __A, __m512h __B) {
499516 return (__m512h)__builtin_ia32_selectph_512((__mmask32)__U,
500517 (__v32hf)_mm512_min_ph(__A, __B),
......@@ -515,19 +532,19 @@ _mm512_maskz_min_ph(__mmask32 __U, __m512h __A, __m512h __B) {
515532 (__mmask32)(U), (__v32hf)_mm512_min_round_ph((A), (B), (R)), \
516533 (__v32hf)_mm512_setzero_ph()))
517534
518static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_max_ph(__m512h __A,
519 __m512h __B) {
535static __inline__ __m512h
536 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_max_ph(__m512h __A, __m512h __B) {
520537 return (__m512h)__builtin_ia32_maxph512((__v32hf)__A, (__v32hf)__B,
521538 _MM_FROUND_CUR_DIRECTION);
522539}
523540
524static __inline__ __m512h __DEFAULT_FN_ATTRS512
541static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
525542_mm512_mask_max_ph(__m512h __W, __mmask32 __U, __m512h __A, __m512h __B) {
526543 return (__m512h)__builtin_ia32_selectph_512(
527544 (__mmask32)__U, (__v32hf)_mm512_max_ph(__A, __B), (__v32hf)__W);
528545}
529546
530static __inline__ __m512h __DEFAULT_FN_ATTRS512
547static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
531548_mm512_maskz_max_ph(__mmask32 __U, __m512h __A, __m512h __B) {
532549 return (__m512h)__builtin_ia32_selectph_512((__mmask32)__U,
533550 (__v32hf)_mm512_max_ph(__A, __B),
......@@ -548,7 +565,8 @@ _mm512_maskz_max_ph(__mmask32 __U, __m512h __A, __m512h __B) {
548565 (__mmask32)(U), (__v32hf)_mm512_max_round_ph((A), (B), (R)), \
549566 (__v32hf)_mm512_setzero_ph()))
550567
551static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_abs_ph(__m512h __A) {
568static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
569_mm512_abs_ph(__m512h __A) {
552570 return (__m512h)_mm512_and_epi32(_mm512_set1_epi32(0x7FFF7FFF), (__m512i)__A);
553571}
554572
......@@ -570,23 +588,20 @@ _mm512_maskz_conj_pch(__mmask16 __U, __m512h __A) {
570588 (__v16sf)_mm512_setzero_ps());
571589}
572590
573static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_add_sh(__m128h __A,
574 __m128h __B) {
591static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
592_mm_add_sh(__m128h __A, __m128h __B) {
575593 __A[0] += __B[0];
576594 return __A;
577595}
578596
579static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_add_sh(__m128h __W,
580 __mmask8 __U,
581 __m128h __A,
582 __m128h __B) {
597static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
598_mm_mask_add_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
583599 __A = _mm_add_sh(__A, __B);
584600 return __builtin_ia32_selectsh_128(__U, __A, __W);
585601}
586602
587static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_add_sh(__mmask8 __U,
588 __m128h __A,
589 __m128h __B) {
603static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
604_mm_maskz_add_sh(__mmask8 __U, __m128h __A, __m128h __B) {
590605 __A = _mm_add_sh(__A, __B);
591606 return __builtin_ia32_selectsh_128(__U, __A, _mm_setzero_ph());
592607}
......@@ -606,23 +621,20 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_add_sh(__mmask8 __U,
606621 (__v8hf)(__m128h)(A), (__v8hf)(__m128h)(B), (__v8hf)_mm_setzero_ph(), \
607622 (__mmask8)(U), (int)(R)))
608623
609static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_sub_sh(__m128h __A,
610 __m128h __B) {
624static __inline__ __m128h
625 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_sub_sh(__m128h __A, __m128h __B) {
611626 __A[0] -= __B[0];
612627 return __A;
613628}
614629
615static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_sub_sh(__m128h __W,
616 __mmask8 __U,
617 __m128h __A,
618 __m128h __B) {
630static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
631_mm_mask_sub_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
619632 __A = _mm_sub_sh(__A, __B);
620633 return __builtin_ia32_selectsh_128(__U, __A, __W);
621634}
622635
623static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_sub_sh(__mmask8 __U,
624 __m128h __A,
625 __m128h __B) {
636static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
637_mm_maskz_sub_sh(__mmask8 __U, __m128h __A, __m128h __B) {
626638 __A = _mm_sub_sh(__A, __B);
627639 return __builtin_ia32_selectsh_128(__U, __A, _mm_setzero_ph());
628640}
......@@ -642,23 +654,20 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_sub_sh(__mmask8 __U,
642654 (__v8hf)(__m128h)(A), (__v8hf)(__m128h)(B), (__v8hf)_mm_setzero_ph(), \
643655 (__mmask8)(U), (int)(R)))
644656
645static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mul_sh(__m128h __A,
646 __m128h __B) {
657static __inline__ __m128h
658 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_mul_sh(__m128h __A, __m128h __B) {
647659 __A[0] *= __B[0];
648660 return __A;
649661}
650662
651static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_mul_sh(__m128h __W,
652 __mmask8 __U,
653 __m128h __A,
654 __m128h __B) {
663static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
664_mm_mask_mul_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
655665 __A = _mm_mul_sh(__A, __B);
656666 return __builtin_ia32_selectsh_128(__U, __A, __W);
657667}
658668
659static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_mul_sh(__mmask8 __U,
660 __m128h __A,
661 __m128h __B) {
669static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
670_mm_maskz_mul_sh(__mmask8 __U, __m128h __A, __m128h __B) {
662671 __A = _mm_mul_sh(__A, __B);
663672 return __builtin_ia32_selectsh_128(__U, __A, _mm_setzero_ph());
664673}
......@@ -678,23 +687,20 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_mul_sh(__mmask8 __U,
678687 (__v8hf)(__m128h)(A), (__v8hf)(__m128h)(B), (__v8hf)_mm_setzero_ph(), \
679688 (__mmask8)(U), (int)(R)))
680689
681static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_div_sh(__m128h __A,
682 __m128h __B) {
690static __inline__ __m128h
691 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_div_sh(__m128h __A, __m128h __B) {
683692 __A[0] /= __B[0];
684693 return __A;
685694}
686695
687static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_div_sh(__m128h __W,
688 __mmask8 __U,
689 __m128h __A,
690 __m128h __B) {
696static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
697_mm_mask_div_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
691698 __A = _mm_div_sh(__A, __B);
692699 return __builtin_ia32_selectsh_128(__U, __A, __W);
693700}
694701
695static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_div_sh(__mmask8 __U,
696 __m128h __A,
697 __m128h __B) {
702static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
703_mm_maskz_div_sh(__mmask8 __U, __m128h __A, __m128h __B) {
698704 __A = _mm_div_sh(__A, __B);
699705 return __builtin_ia32_selectsh_128(__U, __A, _mm_setzero_ph());
700706}
......@@ -942,22 +948,19 @@ static __inline__ void __DEFAULT_FN_ATTRS128 _mm_storeu_ph(void *__P,
942948}
943949
944950// moves with vmovsh:
945static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_move_sh(__m128h __a,
946 __m128h __b) {
951static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
952_mm_move_sh(__m128h __a, __m128h __b) {
947953 __a[0] = __b[0];
948954 return __a;
949955}
950956
951static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_move_sh(__m128h __W,
952 __mmask8 __U,
953 __m128h __A,
954 __m128h __B) {
957static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
958_mm_mask_move_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
955959 return __builtin_ia32_selectsh_128(__U, _mm_move_sh(__A, __B), __W);
956960}
957961
958static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_move_sh(__mmask8 __U,
959 __m128h __A,
960 __m128h __B) {
962static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
963_mm_maskz_move_sh(__mmask8 __U, __m128h __A, __m128h __B) {
961964 return __builtin_ia32_selectsh_128(__U, _mm_move_sh(__A, __B),
962965 _mm_setzero_ph());
963966}
......@@ -1383,24 +1386,20 @@ _mm_maskz_scalef_sh(__mmask8 __U, __m128h __A, __m128h __B) {
13831386 (__v32hf)_mm512_setzero_ph()))
13841387
13851388static __inline__ __m512h __DEFAULT_FN_ATTRS512 _mm512_sqrt_ph(__m512h __A) {
1386 return (__m512h)__builtin_ia32_sqrtph512((__v32hf)__A,
1387 _MM_FROUND_CUR_DIRECTION);
1389 return (__m512h)__builtin_elementwise_sqrt((__v32hf)__A);
13881390}
13891391
13901392static __inline__ __m512h __DEFAULT_FN_ATTRS512
13911393_mm512_mask_sqrt_ph(__m512h __W, __mmask32 __U, __m512h __A) {
13921394 return (__m512h)__builtin_ia32_selectph_512(
1393 (__mmask32)(__U),
1394 (__v32hf)__builtin_ia32_sqrtph512((__A), (_MM_FROUND_CUR_DIRECTION)),
1395 (__v32hf)(__m512h)(__W));
1395 (__mmask32)(__U), (__v32hf)_mm512_sqrt_ph(__A), (__v32hf)(__m512h)(__W));
13961396}
13971397
13981398static __inline__ __m512h __DEFAULT_FN_ATTRS512
13991399_mm512_maskz_sqrt_ph(__mmask32 __U, __m512h __A) {
1400 return (__m512h)__builtin_ia32_selectph_512(
1401 (__mmask32)(__U),
1402 (__v32hf)__builtin_ia32_sqrtph512((__A), (_MM_FROUND_CUR_DIRECTION)),
1403 (__v32hf)_mm512_setzero_ph());
1400 return (__m512h)__builtin_ia32_selectph_512((__mmask32)(__U),
1401 (__v32hf)_mm512_sqrt_ph(__A),
1402 (__v32hf)_mm512_setzero_ph());
14041403}
14051404
14061405#define _mm_sqrt_round_sh(A, B, R) \
......@@ -3292,19 +3291,19 @@ _mm512_reduce_min_ph(__m512h __V) {
32923291 return __builtin_ia32_reduce_fmin_ph512(__V);
32933292}
32943293
3295static __inline__ __m512h __DEFAULT_FN_ATTRS512
3294static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
32963295_mm512_mask_blend_ph(__mmask32 __U, __m512h __A, __m512h __W) {
32973296 return (__m512h)__builtin_ia32_selectph_512((__mmask32)__U, (__v32hf)__W,
32983297 (__v32hf)__A);
32993298}
33003299
3301static __inline__ __m512h __DEFAULT_FN_ATTRS512
3300static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
33023301_mm512_permutex2var_ph(__m512h __A, __m512i __I, __m512h __B) {
33033302 return (__m512h)__builtin_ia32_vpermi2varhi512((__v32hi)__A, (__v32hi)__I,
33043303 (__v32hi)__B);
33053304}
33063305
3307static __inline__ __m512h __DEFAULT_FN_ATTRS512
3306static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
33083307_mm512_permutexvar_ph(__m512i __A, __m512h __B) {
33093308 return (__m512h)__builtin_ia32_permvarhi512((__v32hi)__B, (__v32hi)__A);
33103309}
......@@ -3348,6 +3347,9 @@ _mm512_permutexvar_ph(__m512i __A, __m512h __B) {
33483347#undef __DEFAULT_FN_ATTRS128
33493348#undef __DEFAULT_FN_ATTRS256
33503349#undef __DEFAULT_FN_ATTRS512
3350#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
3351#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
3352#undef __DEFAULT_FN_ATTRS512_CONSTEXPR
33513353
33523354#endif
33533355#endif
lib/include/avx512ifmaintrin.h+32-34
......@@ -15,54 +15,52 @@
1515#define __IFMAINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1819#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512ifma,evex512"), __min_vector_width__(512)))
20 __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma"), \
21 __min_vector_width__(512))) constexpr
22#else
23#define __DEFAULT_FN_ATTRS \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma"), \
25 __min_vector_width__(512)))
26#endif
2127
2228static __inline__ __m512i __DEFAULT_FN_ATTRS
23_mm512_madd52hi_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
24{
25 return (__m512i)__builtin_ia32_vpmadd52huq512((__v8di) __X, (__v8di) __Y,
26 (__v8di) __Z);
29_mm512_madd52hi_epu64(__m512i __X, __m512i __Y, __m512i __Z) {
30 return (__m512i)__builtin_ia32_vpmadd52huq512((__v8di)__X, (__v8di)__Y,
31 (__v8di)__Z);
2732}
2833
29static __inline__ __m512i __DEFAULT_FN_ATTRS
30_mm512_mask_madd52hi_epu64 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
31{
32 return (__m512i)__builtin_ia32_selectq_512(__M,
33 (__v8di)_mm512_madd52hi_epu64(__W, __X, __Y),
34 (__v8di)__W);
34static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_madd52hi_epu64(
35 __m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) {
36 return (__m512i)__builtin_ia32_selectq_512(
37 __M, (__v8di)_mm512_madd52hi_epu64(__W, __X, __Y), (__v8di)__W);
3538}
3639
37static __inline__ __m512i __DEFAULT_FN_ATTRS
38_mm512_maskz_madd52hi_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
39{
40 return (__m512i)__builtin_ia32_selectq_512(__M,
41 (__v8di)_mm512_madd52hi_epu64(__X, __Y, __Z),
42 (__v8di)_mm512_setzero_si512());
40static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_madd52hi_epu64(
41 __mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z) {
42 return (__m512i)__builtin_ia32_selectq_512(
43 __M, (__v8di)_mm512_madd52hi_epu64(__X, __Y, __Z),
44 (__v8di)_mm512_setzero_si512());
4345}
4446
4547static __inline__ __m512i __DEFAULT_FN_ATTRS
46_mm512_madd52lo_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
47{
48 return (__m512i)__builtin_ia32_vpmadd52luq512((__v8di) __X, (__v8di) __Y,
49 (__v8di) __Z);
48_mm512_madd52lo_epu64(__m512i __X, __m512i __Y, __m512i __Z) {
49 return (__m512i)__builtin_ia32_vpmadd52luq512((__v8di)__X, (__v8di)__Y,
50 (__v8di)__Z);
5051}
5152
52static __inline__ __m512i __DEFAULT_FN_ATTRS
53_mm512_mask_madd52lo_epu64 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
54{
55 return (__m512i)__builtin_ia32_selectq_512(__M,
56 (__v8di)_mm512_madd52lo_epu64(__W, __X, __Y),
57 (__v8di)__W);
53static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_madd52lo_epu64(
54 __m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) {
55 return (__m512i)__builtin_ia32_selectq_512(
56 __M, (__v8di)_mm512_madd52lo_epu64(__W, __X, __Y), (__v8di)__W);
5857}
5958
60static __inline__ __m512i __DEFAULT_FN_ATTRS
61_mm512_maskz_madd52lo_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
62{
63 return (__m512i)__builtin_ia32_selectq_512(__M,
64 (__v8di)_mm512_madd52lo_epu64(__X, __Y, __Z),
65 (__v8di)_mm512_setzero_si512());
59static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_madd52lo_epu64(
60 __mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z) {
61 return (__m512i)__builtin_ia32_selectq_512(
62 __M, (__v8di)_mm512_madd52lo_epu64(__X, __Y, __Z),
63 (__v8di)_mm512_setzero_si512());
6664}
6765
6866#undef __DEFAULT_FN_ATTRS
lib/include/avx512ifmavlintrin.h+73-46
......@@ -8,22 +8,35 @@
88 *===-----------------------------------------------------------------------===
99 */
1010#ifndef __IMMINTRIN_H
11#error "Never use <avx512ifmavlintrin.h> directly; include <immintrin.h> instead."
11#error \
12 "Never use <avx512ifmavlintrin.h> directly; include <immintrin.h> instead."
1213#endif
1314
1415#ifndef __IFMAVLINTRIN_H
1516#define __IFMAVLINTRIN_H
1617
1718/* Define the default attributes for the functions in this file. */
19#if defined(__cplusplus) && (__cplusplus >= 201103L)
1820#define __DEFAULT_FN_ATTRS128 \
1921 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512ifma,avx512vl,no-evex512"), \
22 __target__("avx512ifma,avx512vl"), \
23 __min_vector_width__(128))) constexpr
24#define __DEFAULT_FN_ATTRS256 \
25 __attribute__((__always_inline__, __nodebug__, \
26 __target__("avx512ifma,avx512vl"), \
27 __min_vector_width__(256))) constexpr
28#else
29#define __DEFAULT_FN_ATTRS128 \
30 __attribute__((__always_inline__, __nodebug__, \
31 __target__("avx512ifma,avx512vl"), \
2132 __min_vector_width__(128)))
2233#define __DEFAULT_FN_ATTRS256 \
2334 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512ifma,avx512vl,no-evex512"), \
35 __target__("avx512ifma,avx512vl"), \
2536 __min_vector_width__(256)))
37#endif
2638
39#if !(defined(__AVXIFMA__) || defined(__AVX512IFMA__))
2740#define _mm_madd52hi_epu64(X, Y, Z) \
2841 ((__m128i)__builtin_ia32_vpmadd52huq128((__v2di)(X), (__v2di)(Y), \
2942 (__v2di)(Z)))
......@@ -39,71 +52,85 @@
3952#define _mm256_madd52lo_epu64(X, Y, Z) \
4053 ((__m256i)__builtin_ia32_vpmadd52luq256((__v4di)(X), (__v4di)(Y), \
4154 (__v4di)(Z)))
55#endif
4256
57#if defined(__AVX512IFMA__)
4358static __inline__ __m128i __DEFAULT_FN_ATTRS128
44_mm_mask_madd52hi_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
45{
46 return (__m128i)__builtin_ia32_selectq_128(__M,
47 (__v2di)_mm_madd52hi_epu64(__W, __X, __Y),
48 (__v2di)__W);
59_mm_madd52hi_epu64(__m128i __X, __m128i __Y, __m128i __Z) {
60 return (__m128i)__builtin_ia32_vpmadd52huq128((__v2di)__X, (__v2di)__Y,
61 (__v2di)__Z);
62}
63
64static __inline__ __m256i __DEFAULT_FN_ATTRS256
65_mm256_madd52hi_epu64(__m256i __X, __m256i __Y, __m256i __Z) {
66 return (__m256i)__builtin_ia32_vpmadd52huq256((__v4di)__X, (__v4di)__Y,
67 (__v4di)__Z);
4968}
5069
5170static __inline__ __m128i __DEFAULT_FN_ATTRS128
52_mm_maskz_madd52hi_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
53{
54 return (__m128i)__builtin_ia32_selectq_128(__M,
55 (__v2di)_mm_madd52hi_epu64(__X, __Y, __Z),
56 (__v2di)_mm_setzero_si128());
71_mm_madd52lo_epu64(__m128i __X, __m128i __Y, __m128i __Z) {
72 return (__m128i)__builtin_ia32_vpmadd52luq128((__v2di)__X, (__v2di)__Y,
73 (__v2di)__Z);
5774}
5875
5976static __inline__ __m256i __DEFAULT_FN_ATTRS256
60_mm256_mask_madd52hi_epu64 (__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y)
61{
62 return (__m256i)__builtin_ia32_selectq_256(__M,
63 (__v4di)_mm256_madd52hi_epu64(__W, __X, __Y),
64 (__v4di)__W);
77_mm256_madd52lo_epu64(__m256i __X, __m256i __Y, __m256i __Z) {
78 return (__m256i)__builtin_ia32_vpmadd52luq256((__v4di)__X, (__v4di)__Y,
79 (__v4di)__Z);
6580}
81#endif
6682
67static __inline__ __m256i __DEFAULT_FN_ATTRS256
68_mm256_maskz_madd52hi_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
69{
70 return (__m256i)__builtin_ia32_selectq_256(__M,
71 (__v4di)_mm256_madd52hi_epu64(__X, __Y, __Z),
72 (__v4di)_mm256_setzero_si256());
83static __inline__ __m128i __DEFAULT_FN_ATTRS128
84_mm_mask_madd52hi_epu64(__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y) {
85 return (__m128i)__builtin_ia32_selectq_128(
86 __M, (__v2di)__builtin_ia32_vpmadd52huq128(__W, __X, __Y), (__v2di)__W);
7387}
7488
7589static __inline__ __m128i __DEFAULT_FN_ATTRS128
76_mm_mask_madd52lo_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
77{
78 return (__m128i)__builtin_ia32_selectq_128(__M,
79 (__v2di)_mm_madd52lo_epu64(__W, __X, __Y),
80 (__v2di)__W);
90_mm_maskz_madd52hi_epu64(__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z) {
91 return (__m128i)__builtin_ia32_selectq_128(
92 __M, (__v2di)__builtin_ia32_vpmadd52huq128(__X, __Y, __Z),
93 (__v2di)_mm_setzero_si128());
94}
95
96static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask_madd52hi_epu64(
97 __m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) {
98 return (__m256i)__builtin_ia32_selectq_256(
99 __M, (__v4di)__builtin_ia32_vpmadd52huq256(__W, __X, __Y), (__v4di)__W);
100}
101
102static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_madd52hi_epu64(
103 __mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z) {
104 return (__m256i)__builtin_ia32_selectq_256(
105 __M, (__v4di)__builtin_ia32_vpmadd52huq256(__X, __Y, __Z),
106 (__v4di)_mm256_setzero_si256());
81107}
82108
83109static __inline__ __m128i __DEFAULT_FN_ATTRS128
84_mm_maskz_madd52lo_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
85{
86 return (__m128i)__builtin_ia32_selectq_128(__M,
87 (__v2di)_mm_madd52lo_epu64(__X, __Y, __Z),
88 (__v2di)_mm_setzero_si128());
110_mm_mask_madd52lo_epu64(__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y) {
111 return (__m128i)__builtin_ia32_selectq_128(
112 __M, (__v2di)__builtin_ia32_vpmadd52luq128(__W, __X, __Y), (__v2di)__W);
89113}
90114
91static __inline__ __m256i __DEFAULT_FN_ATTRS256
92_mm256_mask_madd52lo_epu64 (__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y)
93{
94 return (__m256i)__builtin_ia32_selectq_256(__M,
95 (__v4di)_mm256_madd52lo_epu64(__W, __X, __Y),
96 (__v4di)__W);
115static __inline__ __m128i __DEFAULT_FN_ATTRS128
116_mm_maskz_madd52lo_epu64(__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z) {
117 return (__m128i)__builtin_ia32_selectq_128(
118 __M, (__v2di)__builtin_ia32_vpmadd52luq128(__X, __Y, __Z),
119 (__v2di)_mm_setzero_si128());
97120}
98121
99static __inline__ __m256i __DEFAULT_FN_ATTRS256
100_mm256_maskz_madd52lo_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
101{
102 return (__m256i)__builtin_ia32_selectq_256(__M,
103 (__v4di)_mm256_madd52lo_epu64(__X, __Y, __Z),
104 (__v4di)_mm256_setzero_si256());
122static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask_madd52lo_epu64(
123 __m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) {
124 return (__m256i)__builtin_ia32_selectq_256(
125 __M, (__v4di)__builtin_ia32_vpmadd52luq256(__W, __X, __Y), (__v4di)__W);
105126}
106127
128static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_madd52lo_epu64(
129 __mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z) {
130 return (__m256i)__builtin_ia32_selectq_256(
131 __M, (__v4di)__builtin_ia32_vpmadd52luq256(__X, __Y, __Z),
132 (__v4di)_mm256_setzero_si256());
133}
107134
108135#undef __DEFAULT_FN_ATTRS128
109136#undef __DEFAULT_FN_ATTRS256
lib/include/avx512vbmi2intrin.h+43-32
......@@ -15,8 +15,15 @@
1515#define __AVX512VBMI2INTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi2,evex512"), __min_vector_width__(512)))
19
18#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi2"), \
20 __min_vector_width__(512)))
21
22#if defined(__cplusplus) && (__cplusplus >= 201103L)
23#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
24#else
25#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
26#endif
2027
2128static __inline__ __m512i __DEFAULT_FN_ATTRS
2229_mm512_mask_compress_epi16(__m512i __S, __mmask32 __U, __m512i __D)
......@@ -212,14 +219,14 @@ _mm512_maskz_expandloadu_epi8(__mmask64 __U, void const *__P)
212219 (__v32hi)_mm512_shrdi_epi16((A), (B), (I)), \
213220 (__v32hi)_mm512_setzero_si512()))
214221
215static __inline__ __m512i __DEFAULT_FN_ATTRS
222static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
216223_mm512_shldv_epi64(__m512i __A, __m512i __B, __m512i __C)
217224{
218 return (__m512i)__builtin_ia32_vpshldvq512((__v8di)__A, (__v8di)__B,
219 (__v8di)__C);
225 return (__m512i)__builtin_elementwise_fshl((__v8du)__A, (__v8du)__B,
226 (__v8du)__C);
220227}
221228
222static __inline__ __m512i __DEFAULT_FN_ATTRS
229static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
223230_mm512_mask_shldv_epi64(__m512i __A, __mmask8 __U, __m512i __B, __m512i __C)
224231{
225232 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -227,7 +234,7 @@ _mm512_mask_shldv_epi64(__m512i __A, __mmask8 __U, __m512i __B, __m512i __C)
227234 (__v8di)__A);
228235}
229236
230static __inline__ __m512i __DEFAULT_FN_ATTRS
237static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
231238_mm512_maskz_shldv_epi64(__mmask8 __U, __m512i __A, __m512i __B, __m512i __C)
232239{
233240 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -235,14 +242,14 @@ _mm512_maskz_shldv_epi64(__mmask8 __U, __m512i __A, __m512i __B, __m512i __C)
235242 (__v8di)_mm512_setzero_si512());
236243}
237244
238static __inline__ __m512i __DEFAULT_FN_ATTRS
245static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
239246_mm512_shldv_epi32(__m512i __A, __m512i __B, __m512i __C)
240247{
241 return (__m512i)__builtin_ia32_vpshldvd512((__v16si)__A, (__v16si)__B,
242 (__v16si)__C);
248 return (__m512i)__builtin_elementwise_fshl((__v16su)__A, (__v16su)__B,
249 (__v16su)__C);
243250}
244251
245static __inline__ __m512i __DEFAULT_FN_ATTRS
252static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
246253_mm512_mask_shldv_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C)
247254{
248255 return (__m512i)__builtin_ia32_selectd_512(__U,
......@@ -250,7 +257,7 @@ _mm512_mask_shldv_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C)
250257 (__v16si)__A);
251258}
252259
253static __inline__ __m512i __DEFAULT_FN_ATTRS
260static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
254261_mm512_maskz_shldv_epi32(__mmask16 __U, __m512i __A, __m512i __B, __m512i __C)
255262{
256263 return (__m512i)__builtin_ia32_selectd_512(__U,
......@@ -258,14 +265,14 @@ _mm512_maskz_shldv_epi32(__mmask16 __U, __m512i __A, __m512i __B, __m512i __C)
258265 (__v16si)_mm512_setzero_si512());
259266}
260267
261static __inline__ __m512i __DEFAULT_FN_ATTRS
268static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
262269_mm512_shldv_epi16(__m512i __A, __m512i __B, __m512i __C)
263270{
264 return (__m512i)__builtin_ia32_vpshldvw512((__v32hi)__A, (__v32hi)__B,
265 (__v32hi)__C);
271 return (__m512i)__builtin_elementwise_fshl((__v32hu)__A, (__v32hu)__B,
272 (__v32hu)__C);
266273}
267274
268static __inline__ __m512i __DEFAULT_FN_ATTRS
275static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
269276_mm512_mask_shldv_epi16(__m512i __A, __mmask32 __U, __m512i __B, __m512i __C)
270277{
271278 return (__m512i)__builtin_ia32_selectw_512(__U,
......@@ -273,7 +280,7 @@ _mm512_mask_shldv_epi16(__m512i __A, __mmask32 __U, __m512i __B, __m512i __C)
273280 (__v32hi)__A);
274281}
275282
276static __inline__ __m512i __DEFAULT_FN_ATTRS
283static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
277284_mm512_maskz_shldv_epi16(__mmask32 __U, __m512i __A, __m512i __B, __m512i __C)
278285{
279286 return (__m512i)__builtin_ia32_selectw_512(__U,
......@@ -281,14 +288,15 @@ _mm512_maskz_shldv_epi16(__mmask32 __U, __m512i __A, __m512i __B, __m512i __C)
281288 (__v32hi)_mm512_setzero_si512());
282289}
283290
284static __inline__ __m512i __DEFAULT_FN_ATTRS
291static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
285292_mm512_shrdv_epi64(__m512i __A, __m512i __B, __m512i __C)
286293{
287 return (__m512i)__builtin_ia32_vpshrdvq512((__v8di)__A, (__v8di)__B,
288 (__v8di)__C);
294 // Ops __A and __B are swapped.
295 return (__m512i)__builtin_elementwise_fshr((__v8du)__B, (__v8du)__A,
296 (__v8du)__C);
289297}
290298
291static __inline__ __m512i __DEFAULT_FN_ATTRS
299static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
292300_mm512_mask_shrdv_epi64(__m512i __A, __mmask8 __U, __m512i __B, __m512i __C)
293301{
294302 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -296,7 +304,7 @@ _mm512_mask_shrdv_epi64(__m512i __A, __mmask8 __U, __m512i __B, __m512i __C)
296304 (__v8di)__A);
297305}
298306
299static __inline__ __m512i __DEFAULT_FN_ATTRS
307static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
300308_mm512_maskz_shrdv_epi64(__mmask8 __U, __m512i __A, __m512i __B, __m512i __C)
301309{
302310 return (__m512i)__builtin_ia32_selectq_512(__U,
......@@ -304,14 +312,15 @@ _mm512_maskz_shrdv_epi64(__mmask8 __U, __m512i __A, __m512i __B, __m512i __C)
304312 (__v8di)_mm512_setzero_si512());
305313}
306314
307static __inline__ __m512i __DEFAULT_FN_ATTRS
315static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
308316_mm512_shrdv_epi32(__m512i __A, __m512i __B, __m512i __C)
309317{
310 return (__m512i)__builtin_ia32_vpshrdvd512((__v16si)__A, (__v16si)__B,
311 (__v16si)__C);
318 // Ops __A and __B are swapped.
319 return (__m512i)__builtin_elementwise_fshr((__v16su)__B, (__v16su)__A,
320 (__v16su)__C);
312321}
313322
314static __inline__ __m512i __DEFAULT_FN_ATTRS
323static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
315324_mm512_mask_shrdv_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C)
316325{
317326 return (__m512i) __builtin_ia32_selectd_512(__U,
......@@ -319,7 +328,7 @@ _mm512_mask_shrdv_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C)
319328 (__v16si)__A);
320329}
321330
322static __inline__ __m512i __DEFAULT_FN_ATTRS
331static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
323332_mm512_maskz_shrdv_epi32(__mmask16 __U, __m512i __A, __m512i __B, __m512i __C)
324333{
325334 return (__m512i) __builtin_ia32_selectd_512(__U,
......@@ -327,14 +336,15 @@ _mm512_maskz_shrdv_epi32(__mmask16 __U, __m512i __A, __m512i __B, __m512i __C)
327336 (__v16si)_mm512_setzero_si512());
328337}
329338
330static __inline__ __m512i __DEFAULT_FN_ATTRS
339static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
331340_mm512_shrdv_epi16(__m512i __A, __m512i __B, __m512i __C)
332341{
333 return (__m512i)__builtin_ia32_vpshrdvw512((__v32hi)__A, (__v32hi)__B,
334 (__v32hi)__C);
342 // Ops __A and __B are swapped.
343 return (__m512i)__builtin_elementwise_fshr((__v32hu)__B, (__v32hu)__A,
344 (__v32hu)__C);
335345}
336346
337static __inline__ __m512i __DEFAULT_FN_ATTRS
347static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
338348_mm512_mask_shrdv_epi16(__m512i __A, __mmask32 __U, __m512i __B, __m512i __C)
339349{
340350 return (__m512i)__builtin_ia32_selectw_512(__U,
......@@ -342,7 +352,7 @@ _mm512_mask_shrdv_epi16(__m512i __A, __mmask32 __U, __m512i __B, __m512i __C)
342352 (__v32hi)__A);
343353}
344354
345static __inline__ __m512i __DEFAULT_FN_ATTRS
355static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
346356_mm512_maskz_shrdv_epi16(__mmask32 __U, __m512i __A, __m512i __B, __m512i __C)
347357{
348358 return (__m512i)__builtin_ia32_selectw_512(__U,
......@@ -352,6 +362,7 @@ _mm512_maskz_shrdv_epi16(__mmask32 __U, __m512i __A, __m512i __B, __m512i __C)
352362
353363
354364#undef __DEFAULT_FN_ATTRS
365#undef __DEFAULT_FN_ATTRS_CONSTEXPR
355366
356367#endif
357368
lib/include/avx512vbmiintrin.h+19-27
......@@ -15,63 +15,57 @@
1515#define __VBMIINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1819#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vbmi,evex512"), __min_vector_width__(512)))
20 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi"), \
21 __min_vector_width__(512))) constexpr
22#else
23#define __DEFAULT_FN_ATTRS \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi"), \
25 __min_vector_width__(512)))
26#endif
2127
2228static __inline__ __m512i __DEFAULT_FN_ATTRS
23_mm512_permutex2var_epi8(__m512i __A, __m512i __I, __m512i __B)
24{
29_mm512_permutex2var_epi8(__m512i __A, __m512i __I, __m512i __B) {
2530 return (__m512i)__builtin_ia32_vpermi2varqi512((__v64qi)__A, (__v64qi)__I,
2631 (__v64qi) __B);
2732}
2833
29static __inline__ __m512i __DEFAULT_FN_ATTRS
30_mm512_mask_permutex2var_epi8(__m512i __A, __mmask64 __U, __m512i __I,
31 __m512i __B)
32{
34static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_permutex2var_epi8(
35 __m512i __A, __mmask64 __U, __m512i __I, __m512i __B) {
3336 return (__m512i)__builtin_ia32_selectb_512(__U,
3437 (__v64qi)_mm512_permutex2var_epi8(__A, __I, __B),
3538 (__v64qi)__A);
3639}
3740
38static __inline__ __m512i __DEFAULT_FN_ATTRS
39_mm512_mask2_permutex2var_epi8(__m512i __A, __m512i __I, __mmask64 __U,
40 __m512i __B)
41{
41static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask2_permutex2var_epi8(
42 __m512i __A, __m512i __I, __mmask64 __U, __m512i __B) {
4243 return (__m512i)__builtin_ia32_selectb_512(__U,
4344 (__v64qi)_mm512_permutex2var_epi8(__A, __I, __B),
4445 (__v64qi)__I);
4546}
4647
47static __inline__ __m512i __DEFAULT_FN_ATTRS
48_mm512_maskz_permutex2var_epi8(__mmask64 __U, __m512i __A, __m512i __I,
49 __m512i __B)
50{
48static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_permutex2var_epi8(
49 __mmask64 __U, __m512i __A, __m512i __I, __m512i __B) {
5150 return (__m512i)__builtin_ia32_selectb_512(__U,
5251 (__v64qi)_mm512_permutex2var_epi8(__A, __I, __B),
5352 (__v64qi)_mm512_setzero_si512());
5453}
5554
5655static __inline__ __m512i __DEFAULT_FN_ATTRS
57_mm512_permutexvar_epi8 (__m512i __A, __m512i __B)
58{
56_mm512_permutexvar_epi8(__m512i __A, __m512i __B) {
5957 return (__m512i)__builtin_ia32_permvarqi512((__v64qi) __B, (__v64qi) __A);
6058}
6159
6260static __inline__ __m512i __DEFAULT_FN_ATTRS
63_mm512_maskz_permutexvar_epi8 (__mmask64 __M, __m512i __A,
64 __m512i __B)
65{
61_mm512_maskz_permutexvar_epi8(__mmask64 __M, __m512i __A, __m512i __B) {
6662 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
6763 (__v64qi)_mm512_permutexvar_epi8(__A, __B),
6864 (__v64qi)_mm512_setzero_si512());
6965}
7066
71static __inline__ __m512i __DEFAULT_FN_ATTRS
72_mm512_mask_permutexvar_epi8 (__m512i __W, __mmask64 __M, __m512i __A,
73 __m512i __B)
74{
67static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_permutexvar_epi8(
68 __m512i __W, __mmask64 __M, __m512i __A, __m512i __B) {
7569 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
7670 (__v64qi)_mm512_permutexvar_epi8(__A, __B),
7771 (__v64qi)__W);
......@@ -100,7 +94,5 @@ _mm512_maskz_multishift_epi64_epi8(__mmask64 __M, __m512i __X, __m512i __Y)
10094 (__v64qi)_mm512_setzero_si512());
10195}
10296
103
10497#undef __DEFAULT_FN_ATTRS
105
10698#endif
lib/include/avx512vbmivlintrin.h+35-49
......@@ -15,126 +15,114 @@
1515#define __VBMIVLINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1819#define __DEFAULT_FN_ATTRS128 \
1920 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vbmi,avx512vl,no-evex512"), \
21 __target__("avx512vbmi,avx512vl"), \
22 __min_vector_width__(128))) constexpr
23#define __DEFAULT_FN_ATTRS256 \
24 __attribute__((__always_inline__, __nodebug__, \
25 __target__("avx512vbmi,avx512vl"), \
26 __min_vector_width__(256))) constexpr
27#else
28#define __DEFAULT_FN_ATTRS128 \
29 __attribute__((__always_inline__, __nodebug__, \
30 __target__("avx512vbmi,avx512vl"), \
2131 __min_vector_width__(128)))
2232#define __DEFAULT_FN_ATTRS256 \
2333 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vbmi,avx512vl,no-evex512"), \
34 __target__("avx512vbmi,avx512vl"), \
2535 __min_vector_width__(256)))
36#endif
2637
2738static __inline__ __m128i __DEFAULT_FN_ATTRS128
28_mm_permutex2var_epi8(__m128i __A, __m128i __I, __m128i __B)
29{
39_mm_permutex2var_epi8(__m128i __A, __m128i __I, __m128i __B) {
3040 return (__m128i)__builtin_ia32_vpermi2varqi128((__v16qi)__A,
3141 (__v16qi)__I,
3242 (__v16qi)__B);
3343}
3444
35static __inline__ __m128i __DEFAULT_FN_ATTRS128
36_mm_mask_permutex2var_epi8(__m128i __A, __mmask16 __U, __m128i __I,
37 __m128i __B)
38{
45static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_mask_permutex2var_epi8(
46 __m128i __A, __mmask16 __U, __m128i __I, __m128i __B) {
3947 return (__m128i)__builtin_ia32_selectb_128(__U,
4048 (__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
4149 (__v16qi)__A);
4250}
4351
44static __inline__ __m128i __DEFAULT_FN_ATTRS128
45_mm_mask2_permutex2var_epi8(__m128i __A, __m128i __I, __mmask16 __U,
46 __m128i __B)
47{
52static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_mask2_permutex2var_epi8(
53 __m128i __A, __m128i __I, __mmask16 __U, __m128i __B) {
4854 return (__m128i)__builtin_ia32_selectb_128(__U,
4955 (__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
5056 (__v16qi)__I);
5157}
5258
53static __inline__ __m128i __DEFAULT_FN_ATTRS128
54_mm_maskz_permutex2var_epi8(__mmask16 __U, __m128i __A, __m128i __I,
55 __m128i __B)
56{
59static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_maskz_permutex2var_epi8(
60 __mmask16 __U, __m128i __A, __m128i __I, __m128i __B) {
5761 return (__m128i)__builtin_ia32_selectb_128(__U,
5862 (__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
5963 (__v16qi)_mm_setzero_si128());
6064}
6165
6266static __inline__ __m256i __DEFAULT_FN_ATTRS256
63_mm256_permutex2var_epi8(__m256i __A, __m256i __I, __m256i __B)
64{
67_mm256_permutex2var_epi8(__m256i __A, __m256i __I, __m256i __B) {
6568 return (__m256i)__builtin_ia32_vpermi2varqi256((__v32qi)__A, (__v32qi)__I,
6669 (__v32qi)__B);
6770}
6871
69static __inline__ __m256i __DEFAULT_FN_ATTRS256
70_mm256_mask_permutex2var_epi8(__m256i __A, __mmask32 __U, __m256i __I,
71 __m256i __B)
72{
72static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask_permutex2var_epi8(
73 __m256i __A, __mmask32 __U, __m256i __I, __m256i __B) {
7374 return (__m256i)__builtin_ia32_selectb_256(__U,
7475 (__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
7576 (__v32qi)__A);
7677}
7778
78static __inline__ __m256i __DEFAULT_FN_ATTRS256
79_mm256_mask2_permutex2var_epi8(__m256i __A, __m256i __I, __mmask32 __U,
80 __m256i __B)
81{
79static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask2_permutex2var_epi8(
80 __m256i __A, __m256i __I, __mmask32 __U, __m256i __B) {
8281 return (__m256i)__builtin_ia32_selectb_256(__U,
8382 (__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
8483 (__v32qi)__I);
8584}
8685
87static __inline__ __m256i __DEFAULT_FN_ATTRS256
88_mm256_maskz_permutex2var_epi8(__mmask32 __U, __m256i __A, __m256i __I,
89 __m256i __B)
90{
86static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_permutex2var_epi8(
87 __mmask32 __U, __m256i __A, __m256i __I, __m256i __B) {
9188 return (__m256i)__builtin_ia32_selectb_256(__U,
9289 (__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
9390 (__v32qi)_mm256_setzero_si256());
9491}
9592
9693static __inline__ __m128i __DEFAULT_FN_ATTRS128
97_mm_permutexvar_epi8 (__m128i __A, __m128i __B)
98{
94_mm_permutexvar_epi8(__m128i __A, __m128i __B) {
9995 return (__m128i)__builtin_ia32_permvarqi128((__v16qi)__B, (__v16qi)__A);
10096}
10197
10298static __inline__ __m128i __DEFAULT_FN_ATTRS128
103_mm_maskz_permutexvar_epi8 (__mmask16 __M, __m128i __A, __m128i __B)
104{
99_mm_maskz_permutexvar_epi8(__mmask16 __M, __m128i __A, __m128i __B) {
105100 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
106101 (__v16qi)_mm_permutexvar_epi8(__A, __B),
107102 (__v16qi)_mm_setzero_si128());
108103}
109104
110static __inline__ __m128i __DEFAULT_FN_ATTRS128
111_mm_mask_permutexvar_epi8 (__m128i __W, __mmask16 __M, __m128i __A,
112 __m128i __B)
113{
105static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_mask_permutexvar_epi8(
106 __m128i __W, __mmask16 __M, __m128i __A, __m128i __B) {
114107 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
115108 (__v16qi)_mm_permutexvar_epi8(__A, __B),
116109 (__v16qi)__W);
117110}
118111
119112static __inline__ __m256i __DEFAULT_FN_ATTRS256
120_mm256_permutexvar_epi8 (__m256i __A, __m256i __B)
121{
113_mm256_permutexvar_epi8(__m256i __A, __m256i __B) {
122114 return (__m256i)__builtin_ia32_permvarqi256((__v32qi) __B, (__v32qi) __A);
123115}
124116
125117static __inline__ __m256i __DEFAULT_FN_ATTRS256
126_mm256_maskz_permutexvar_epi8 (__mmask32 __M, __m256i __A,
127 __m256i __B)
128{
118_mm256_maskz_permutexvar_epi8(__mmask32 __M, __m256i __A, __m256i __B) {
129119 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
130120 (__v32qi)_mm256_permutexvar_epi8(__A, __B),
131121 (__v32qi)_mm256_setzero_si256());
132122}
133123
134static __inline__ __m256i __DEFAULT_FN_ATTRS256
135_mm256_mask_permutexvar_epi8 (__m256i __W, __mmask32 __M, __m256i __A,
136 __m256i __B)
137{
124static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask_permutexvar_epi8(
125 __m256i __W, __mmask32 __M, __m256i __A, __m256i __B) {
138126 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
139127 (__v32qi)_mm256_permutexvar_epi8(__A, __B),
140128 (__v32qi)__W);
......@@ -186,8 +174,6 @@ _mm256_maskz_multishift_epi64_epi8(__mmask32 __M, __m256i __X, __m256i __Y)
186174 (__v32qi)_mm256_setzero_si256());
187175}
188176
189
190177#undef __DEFAULT_FN_ATTRS128
191178#undef __DEFAULT_FN_ATTRS256
192
193179#endif
lib/include/avx512vlbf16intrin.h+32-22
......@@ -17,13 +17,21 @@
1717
1818#define __DEFAULT_FN_ATTRS128 \
1919 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vl,avx512bf16,no-evex512"), \
20 __target__("avx512vl,avx512bf16"), \
2121 __min_vector_width__(128)))
2222#define __DEFAULT_FN_ATTRS256 \
2323 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vl,avx512bf16,no-evex512"), \
24 __target__("avx512vl,avx512bf16"), \
2525 __min_vector_width__(256)))
2626
27#if defined(__cplusplus) && (__cplusplus >= 201103L)
28#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
29#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
30#else
31#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
32#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
33#endif
34
2735/// Convert Two Packed Single Data to One Packed BF16 Data.
2836///
2937/// \headerfile <x86intrin.h>
......@@ -421,9 +429,10 @@ static __inline__ __bf16 __DEFAULT_FN_ATTRS128 _mm_cvtness_sbh(float __A) {
421429/// \param __A
422430/// A 128-bit vector of [4 x bfloat].
423431/// \returns A 128-bit vector of [4 x float] come from conversion of __A
424static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_cvtpbh_ps(__m128bh __A) {
425 return _mm_castsi128_ps(
426 (__m128i)_mm_slli_epi32((__m128i)_mm_cvtepi16_epi32((__m128i)__A), 16));
432static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
433_mm_cvtpbh_ps(__m128bh __A) {
434 return (__m128)_mm256_castps256_ps128(
435 (__m256) __builtin_convertvector(__A, __v8sf));
427436}
428437
429438/// Convert Packed BF16 Data to Packed float Data.
......@@ -433,9 +442,9 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_cvtpbh_ps(__m128bh __A) {
433442/// \param __A
434443/// A 128-bit vector of [8 x bfloat].
435444/// \returns A 256-bit vector of [8 x float] come from conversion of __A
436static __inline__ __m256 __DEFAULT_FN_ATTRS256 _mm256_cvtpbh_ps(__m128bh __A) {
437 return _mm256_castsi256_ps((__m256i)_mm256_slli_epi32(
438 (__m256i)_mm256_cvtepi16_epi32((__m128i)__A), 16));
445static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
446_mm256_cvtpbh_ps(__m128bh __A) {
447 return (__m256) __builtin_convertvector(__A, __v8sf);
439448}
440449
441450/// Convert Packed BF16 Data to Packed float Data using zeroing mask.
......@@ -448,10 +457,10 @@ static __inline__ __m256 __DEFAULT_FN_ATTRS256 _mm256_cvtpbh_ps(__m128bh __A) {
448457/// \param __A
449458/// A 128-bit vector of [4 x bfloat].
450459/// \returns A 128-bit vector of [4 x float] come from conversion of __A
451static __inline__ __m128 __DEFAULT_FN_ATTRS128
460static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
452461_mm_maskz_cvtpbh_ps(__mmask8 __U, __m128bh __A) {
453 return _mm_castsi128_ps((__m128i)_mm_slli_epi32(
454 (__m128i)_mm_maskz_cvtepi16_epi32((__mmask8)__U, (__m128i)__A), 16));
462 return (__m128)__builtin_ia32_selectps_128(
463 (__mmask8)__U, (__v4sf)_mm_cvtpbh_ps(__A), (__v4sf)_mm_setzero_ps());
455464}
456465
457466/// Convert Packed BF16 Data to Packed float Data using zeroing mask.
......@@ -464,10 +473,11 @@ _mm_maskz_cvtpbh_ps(__mmask8 __U, __m128bh __A) {
464473/// \param __A
465474/// A 128-bit vector of [8 x bfloat].
466475/// \returns A 256-bit vector of [8 x float] come from conversion of __A
467static __inline__ __m256 __DEFAULT_FN_ATTRS256
476static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
468477_mm256_maskz_cvtpbh_ps(__mmask8 __U, __m128bh __A) {
469 return _mm256_castsi256_ps((__m256i)_mm256_slli_epi32(
470 (__m256i)_mm256_maskz_cvtepi16_epi32((__mmask8)__U, (__m128i)__A), 16));
478 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
479 (__v8sf)_mm256_cvtpbh_ps(__A),
480 (__v8sf)_mm256_setzero_ps());
471481}
472482
473483/// Convert Packed BF16 Data to Packed float Data using merging mask.
......@@ -483,11 +493,10 @@ _mm256_maskz_cvtpbh_ps(__mmask8 __U, __m128bh __A) {
483493/// \param __A
484494/// A 128-bit vector of [4 x bfloat].
485495/// \returns A 128-bit vector of [4 x float] come from conversion of __A
486static __inline__ __m128 __DEFAULT_FN_ATTRS128
496static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
487497_mm_mask_cvtpbh_ps(__m128 __S, __mmask8 __U, __m128bh __A) {
488 return _mm_castsi128_ps((__m128i)_mm_mask_slli_epi32(
489 (__m128i)__S, (__mmask8)__U, (__m128i)_mm_cvtepi16_epi32((__m128i)__A),
490 16));
498 return (__m128)__builtin_ia32_selectps_128(
499 (__mmask8)__U, (__v4sf)_mm_cvtpbh_ps(__A), (__v4sf)__S);
491500}
492501
493502/// Convert Packed BF16 Data to Packed float Data using merging mask.
......@@ -503,15 +512,16 @@ _mm_mask_cvtpbh_ps(__m128 __S, __mmask8 __U, __m128bh __A) {
503512/// \param __A
504513/// A 128-bit vector of [8 x bfloat].
505514/// \returns A 256-bit vector of [8 x float] come from conversion of __A
506static __inline__ __m256 __DEFAULT_FN_ATTRS256
515static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
507516_mm256_mask_cvtpbh_ps(__m256 __S, __mmask8 __U, __m128bh __A) {
508 return _mm256_castsi256_ps((__m256i)_mm256_mask_slli_epi32(
509 (__m256i)__S, (__mmask8)__U, (__m256i)_mm256_cvtepi16_epi32((__m128i)__A),
510 16));
517 return (__m256)__builtin_ia32_selectps_256(
518 (__mmask8)__U, (__v8sf)_mm256_cvtpbh_ps(__A), (__v8sf)__S);
511519}
512520
513521#undef __DEFAULT_FN_ATTRS128
514522#undef __DEFAULT_FN_ATTRS256
523#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
524#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
515525
516526#endif
517527#endif
lib/include/avx512vlbitalgintrin.h+37-53
......@@ -15,101 +15,86 @@
1515#define __AVX512VLBITALGINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1819#define __DEFAULT_FN_ATTRS128 \
1920 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vl,avx512bitalg,no-evex512"), \
21 __target__("avx512vl,avx512bitalg"), \
22 __min_vector_width__(128))) constexpr
23#define __DEFAULT_FN_ATTRS256 \
24 __attribute__((__always_inline__, __nodebug__, \
25 __target__("avx512vl,avx512bitalg"), \
26 __min_vector_width__(256))) constexpr
27#else
28#define __DEFAULT_FN_ATTRS128 \
29 __attribute__((__always_inline__, __nodebug__, \
30 __target__("avx512vl,avx512bitalg"), \
2131 __min_vector_width__(128)))
2232#define __DEFAULT_FN_ATTRS256 \
2333 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vl,avx512bitalg,no-evex512"), \
34 __target__("avx512vl,avx512bitalg"), \
2535 __min_vector_width__(256)))
36#endif
2637
2738static __inline__ __m256i __DEFAULT_FN_ATTRS256
28_mm256_popcnt_epi16(__m256i __A)
29{
39_mm256_popcnt_epi16(__m256i __A) {
3040 return (__m256i)__builtin_elementwise_popcount((__v16hu)__A);
3141}
3242
3343static __inline__ __m256i __DEFAULT_FN_ATTRS256
34_mm256_mask_popcnt_epi16(__m256i __A, __mmask16 __U, __m256i __B)
35{
36 return (__m256i) __builtin_ia32_selectw_256((__mmask16) __U,
37 (__v16hi) _mm256_popcnt_epi16(__B),
38 (__v16hi) __A);
44_mm256_mask_popcnt_epi16(__m256i __A, __mmask16 __U, __m256i __B) {
45 return (__m256i)__builtin_ia32_selectw_256(
46 (__mmask16)__U, (__v16hi)_mm256_popcnt_epi16(__B), (__v16hi)__A);
3947}
4048
4149static __inline__ __m256i __DEFAULT_FN_ATTRS256
42_mm256_maskz_popcnt_epi16(__mmask16 __U, __m256i __B)
43{
44 return _mm256_mask_popcnt_epi16((__m256i) _mm256_setzero_si256(),
45 __U,
46 __B);
50_mm256_maskz_popcnt_epi16(__mmask16 __U, __m256i __B) {
51 return _mm256_mask_popcnt_epi16((__m256i)_mm256_setzero_si256(), __U, __B);
4752}
4853
49static __inline__ __m128i __DEFAULT_FN_ATTRS128
50_mm_popcnt_epi16(__m128i __A)
51{
54static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_popcnt_epi16(__m128i __A) {
5255 return (__m128i)__builtin_elementwise_popcount((__v8hu)__A);
5356}
5457
5558static __inline__ __m128i __DEFAULT_FN_ATTRS128
56_mm_mask_popcnt_epi16(__m128i __A, __mmask8 __U, __m128i __B)
57{
58 return (__m128i) __builtin_ia32_selectw_128((__mmask8) __U,
59 (__v8hi) _mm_popcnt_epi16(__B),
60 (__v8hi) __A);
59_mm_mask_popcnt_epi16(__m128i __A, __mmask8 __U, __m128i __B) {
60 return (__m128i)__builtin_ia32_selectw_128(
61 (__mmask8)__U, (__v8hi)_mm_popcnt_epi16(__B), (__v8hi)__A);
6162}
6263
6364static __inline__ __m128i __DEFAULT_FN_ATTRS128
64_mm_maskz_popcnt_epi16(__mmask8 __U, __m128i __B)
65{
66 return _mm_mask_popcnt_epi16((__m128i) _mm_setzero_si128(),
67 __U,
68 __B);
65_mm_maskz_popcnt_epi16(__mmask8 __U, __m128i __B) {
66 return _mm_mask_popcnt_epi16((__m128i)_mm_setzero_si128(), __U, __B);
6967}
7068
7169static __inline__ __m256i __DEFAULT_FN_ATTRS256
72_mm256_popcnt_epi8(__m256i __A)
73{
70_mm256_popcnt_epi8(__m256i __A) {
7471 return (__m256i)__builtin_elementwise_popcount((__v32qu)__A);
7572}
7673
7774static __inline__ __m256i __DEFAULT_FN_ATTRS256
78_mm256_mask_popcnt_epi8(__m256i __A, __mmask32 __U, __m256i __B)
79{
80 return (__m256i) __builtin_ia32_selectb_256((__mmask32) __U,
81 (__v32qi) _mm256_popcnt_epi8(__B),
82 (__v32qi) __A);
75_mm256_mask_popcnt_epi8(__m256i __A, __mmask32 __U, __m256i __B) {
76 return (__m256i)__builtin_ia32_selectb_256(
77 (__mmask32)__U, (__v32qi)_mm256_popcnt_epi8(__B), (__v32qi)__A);
8378}
8479
8580static __inline__ __m256i __DEFAULT_FN_ATTRS256
86_mm256_maskz_popcnt_epi8(__mmask32 __U, __m256i __B)
87{
88 return _mm256_mask_popcnt_epi8((__m256i) _mm256_setzero_si256(),
89 __U,
90 __B);
81_mm256_maskz_popcnt_epi8(__mmask32 __U, __m256i __B) {
82 return _mm256_mask_popcnt_epi8((__m256i)_mm256_setzero_si256(), __U, __B);
9183}
9284
93static __inline__ __m128i __DEFAULT_FN_ATTRS128
94_mm_popcnt_epi8(__m128i __A)
95{
85static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_popcnt_epi8(__m128i __A) {
9686 return (__m128i)__builtin_elementwise_popcount((__v16qu)__A);
9787}
9888
9989static __inline__ __m128i __DEFAULT_FN_ATTRS128
100_mm_mask_popcnt_epi8(__m128i __A, __mmask16 __U, __m128i __B)
101{
102 return (__m128i) __builtin_ia32_selectb_128((__mmask16) __U,
103 (__v16qi) _mm_popcnt_epi8(__B),
104 (__v16qi) __A);
90_mm_mask_popcnt_epi8(__m128i __A, __mmask16 __U, __m128i __B) {
91 return (__m128i)__builtin_ia32_selectb_128(
92 (__mmask16)__U, (__v16qi)_mm_popcnt_epi8(__B), (__v16qi)__A);
10593}
10694
10795static __inline__ __m128i __DEFAULT_FN_ATTRS128
108_mm_maskz_popcnt_epi8(__mmask16 __U, __m128i __B)
109{
110 return _mm_mask_popcnt_epi8((__m128i) _mm_setzero_si128(),
111 __U,
112 __B);
96_mm_maskz_popcnt_epi8(__mmask16 __U, __m128i __B) {
97 return _mm_mask_popcnt_epi8((__m128i)_mm_setzero_si128(), __U, __B);
11398}
11499
115100static __inline__ __mmask32 __DEFAULT_FN_ATTRS256
......@@ -147,5 +132,4 @@ _mm_bitshuffle_epi64_mask(__m128i __A, __m128i __B)
147132
148133#undef __DEFAULT_FN_ATTRS128
149134#undef __DEFAULT_FN_ATTRS256
150
151135#endif
lib/include/avx512vlbwintrin.h+470-573
......@@ -17,12 +17,18 @@
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS128 \
1919 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vl,avx512bw,no-evex512"), \
21 __min_vector_width__(128)))
20 __target__("avx512vl,avx512bw"), __min_vector_width__(128)))
2221#define __DEFAULT_FN_ATTRS256 \
2322 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vl,avx512bw,no-evex512"), \
25 __min_vector_width__(256)))
23 __target__("avx512vl,avx512bw"), __min_vector_width__(256)))
24
25#if defined(__cplusplus) && (__cplusplus >= 201103L)
26#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
27#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
28#else
29#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
30#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
31#endif
2632
2733/* Integer compare */
2834
......@@ -306,250 +312,238 @@
306312#define _mm256_mask_cmpneq_epu16_mask(k, A, B) \
307313 _mm256_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_NE)
308314
309static __inline__ __m256i __DEFAULT_FN_ATTRS256
310_mm256_mask_add_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B){
315static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
316_mm256_mask_add_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
311317 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
312318 (__v32qi)_mm256_add_epi8(__A, __B),
313319 (__v32qi)__W);
314320}
315321
316static __inline__ __m256i __DEFAULT_FN_ATTRS256
322static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
317323_mm256_maskz_add_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
318324 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
319325 (__v32qi)_mm256_add_epi8(__A, __B),
320326 (__v32qi)_mm256_setzero_si256());
321327}
322328
323static __inline__ __m256i __DEFAULT_FN_ATTRS256
329static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
324330_mm256_mask_add_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
325331 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
326332 (__v16hi)_mm256_add_epi16(__A, __B),
327333 (__v16hi)__W);
328334}
329335
330static __inline__ __m256i __DEFAULT_FN_ATTRS256
336static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
331337_mm256_maskz_add_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
332338 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
333339 (__v16hi)_mm256_add_epi16(__A, __B),
334340 (__v16hi)_mm256_setzero_si256());
335341}
336342
337static __inline__ __m256i __DEFAULT_FN_ATTRS256
343static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
338344_mm256_mask_sub_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
339345 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
340346 (__v32qi)_mm256_sub_epi8(__A, __B),
341347 (__v32qi)__W);
342348}
343349
344static __inline__ __m256i __DEFAULT_FN_ATTRS256
350static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
345351_mm256_maskz_sub_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
346352 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
347353 (__v32qi)_mm256_sub_epi8(__A, __B),
348354 (__v32qi)_mm256_setzero_si256());
349355}
350356
351static __inline__ __m256i __DEFAULT_FN_ATTRS256
357static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
352358_mm256_mask_sub_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
353359 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
354360 (__v16hi)_mm256_sub_epi16(__A, __B),
355361 (__v16hi)__W);
356362}
357363
358static __inline__ __m256i __DEFAULT_FN_ATTRS256
364static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
359365_mm256_maskz_sub_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
360366 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
361367 (__v16hi)_mm256_sub_epi16(__A, __B),
362368 (__v16hi)_mm256_setzero_si256());
363369}
364370
365static __inline__ __m128i __DEFAULT_FN_ATTRS128
371static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
366372_mm_mask_add_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
367373 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
368374 (__v16qi)_mm_add_epi8(__A, __B),
369375 (__v16qi)__W);
370376}
371377
372static __inline__ __m128i __DEFAULT_FN_ATTRS128
378static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
373379_mm_maskz_add_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
374380 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
375381 (__v16qi)_mm_add_epi8(__A, __B),
376382 (__v16qi)_mm_setzero_si128());
377383}
378384
379static __inline__ __m128i __DEFAULT_FN_ATTRS128
385static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
380386_mm_mask_add_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
381387 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
382388 (__v8hi)_mm_add_epi16(__A, __B),
383389 (__v8hi)__W);
384390}
385391
386static __inline__ __m128i __DEFAULT_FN_ATTRS128
392static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
387393_mm_maskz_add_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
388394 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
389395 (__v8hi)_mm_add_epi16(__A, __B),
390396 (__v8hi)_mm_setzero_si128());
391397}
392398
393static __inline__ __m128i __DEFAULT_FN_ATTRS128
399static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
394400_mm_mask_sub_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
395401 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
396402 (__v16qi)_mm_sub_epi8(__A, __B),
397403 (__v16qi)__W);
398404}
399405
400static __inline__ __m128i __DEFAULT_FN_ATTRS128
406static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
401407_mm_maskz_sub_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
402408 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
403409 (__v16qi)_mm_sub_epi8(__A, __B),
404410 (__v16qi)_mm_setzero_si128());
405411}
406412
407static __inline__ __m128i __DEFAULT_FN_ATTRS128
413static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
408414_mm_mask_sub_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
409415 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
410416 (__v8hi)_mm_sub_epi16(__A, __B),
411417 (__v8hi)__W);
412418}
413419
414static __inline__ __m128i __DEFAULT_FN_ATTRS128
420static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
415421_mm_maskz_sub_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
416422 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
417423 (__v8hi)_mm_sub_epi16(__A, __B),
418424 (__v8hi)_mm_setzero_si128());
419425}
420426
421static __inline__ __m256i __DEFAULT_FN_ATTRS256
427static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
422428_mm256_mask_mullo_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
423429 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
424430 (__v16hi)_mm256_mullo_epi16(__A, __B),
425431 (__v16hi)__W);
426432}
427433
428static __inline__ __m256i __DEFAULT_FN_ATTRS256
434static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
429435_mm256_maskz_mullo_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
430436 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
431437 (__v16hi)_mm256_mullo_epi16(__A, __B),
432438 (__v16hi)_mm256_setzero_si256());
433439}
434440
435static __inline__ __m128i __DEFAULT_FN_ATTRS128
441static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
436442_mm_mask_mullo_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
437443 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
438444 (__v8hi)_mm_mullo_epi16(__A, __B),
439445 (__v8hi)__W);
440446}
441447
442static __inline__ __m128i __DEFAULT_FN_ATTRS128
448static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
443449_mm_maskz_mullo_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
444450 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
445451 (__v8hi)_mm_mullo_epi16(__A, __B),
446452 (__v8hi)_mm_setzero_si128());
447453}
448454
449static __inline__ __m128i __DEFAULT_FN_ATTRS128
450_mm_mask_blend_epi8 (__mmask16 __U, __m128i __A, __m128i __W)
451{
455static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
456_mm_mask_blend_epi8(__mmask16 __U, __m128i __A, __m128i __W) {
452457 return (__m128i) __builtin_ia32_selectb_128 ((__mmask16) __U,
453458 (__v16qi) __W,
454459 (__v16qi) __A);
455460}
456461
457static __inline__ __m256i __DEFAULT_FN_ATTRS256
458_mm256_mask_blend_epi8 (__mmask32 __U, __m256i __A, __m256i __W)
459{
462static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
463_mm256_mask_blend_epi8(__mmask32 __U, __m256i __A, __m256i __W) {
460464 return (__m256i) __builtin_ia32_selectb_256 ((__mmask32) __U,
461465 (__v32qi) __W,
462466 (__v32qi) __A);
463467}
464468
465static __inline__ __m128i __DEFAULT_FN_ATTRS128
466_mm_mask_blend_epi16 (__mmask8 __U, __m128i __A, __m128i __W)
467{
469static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
470_mm_mask_blend_epi16(__mmask8 __U, __m128i __A, __m128i __W) {
468471 return (__m128i) __builtin_ia32_selectw_128 ((__mmask8) __U,
469472 (__v8hi) __W,
470473 (__v8hi) __A);
471474}
472475
473static __inline__ __m256i __DEFAULT_FN_ATTRS256
474_mm256_mask_blend_epi16 (__mmask16 __U, __m256i __A, __m256i __W)
475{
476static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
477_mm256_mask_blend_epi16(__mmask16 __U, __m256i __A, __m256i __W) {
476478 return (__m256i) __builtin_ia32_selectw_256 ((__mmask16) __U,
477479 (__v16hi) __W,
478480 (__v16hi) __A);
479481}
480482
481static __inline__ __m128i __DEFAULT_FN_ATTRS128
482_mm_mask_abs_epi8(__m128i __W, __mmask16 __U, __m128i __A)
483{
483static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
484_mm_mask_abs_epi8(__m128i __W, __mmask16 __U, __m128i __A) {
484485 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
485486 (__v16qi)_mm_abs_epi8(__A),
486487 (__v16qi)__W);
487488}
488489
489static __inline__ __m128i __DEFAULT_FN_ATTRS128
490_mm_maskz_abs_epi8(__mmask16 __U, __m128i __A)
491{
490static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
491_mm_maskz_abs_epi8(__mmask16 __U, __m128i __A) {
492492 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
493493 (__v16qi)_mm_abs_epi8(__A),
494494 (__v16qi)_mm_setzero_si128());
495495}
496496
497static __inline__ __m256i __DEFAULT_FN_ATTRS256
498_mm256_mask_abs_epi8(__m256i __W, __mmask32 __U, __m256i __A)
499{
497static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
498_mm256_mask_abs_epi8(__m256i __W, __mmask32 __U, __m256i __A) {
500499 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
501500 (__v32qi)_mm256_abs_epi8(__A),
502501 (__v32qi)__W);
503502}
504503
505static __inline__ __m256i __DEFAULT_FN_ATTRS256
506_mm256_maskz_abs_epi8 (__mmask32 __U, __m256i __A)
507{
504static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
505_mm256_maskz_abs_epi8(__mmask32 __U, __m256i __A) {
508506 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
509507 (__v32qi)_mm256_abs_epi8(__A),
510508 (__v32qi)_mm256_setzero_si256());
511509}
512510
513static __inline__ __m128i __DEFAULT_FN_ATTRS128
514_mm_mask_abs_epi16(__m128i __W, __mmask8 __U, __m128i __A)
515{
511static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
512_mm_mask_abs_epi16(__m128i __W, __mmask8 __U, __m128i __A) {
516513 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
517514 (__v8hi)_mm_abs_epi16(__A),
518515 (__v8hi)__W);
519516}
520517
521static __inline__ __m128i __DEFAULT_FN_ATTRS128
522_mm_maskz_abs_epi16(__mmask8 __U, __m128i __A)
523{
518static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
519_mm_maskz_abs_epi16(__mmask8 __U, __m128i __A) {
524520 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
525521 (__v8hi)_mm_abs_epi16(__A),
526522 (__v8hi)_mm_setzero_si128());
527523}
528524
529static __inline__ __m256i __DEFAULT_FN_ATTRS256
530_mm256_mask_abs_epi16(__m256i __W, __mmask16 __U, __m256i __A)
531{
525static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
526_mm256_mask_abs_epi16(__m256i __W, __mmask16 __U, __m256i __A) {
532527 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
533528 (__v16hi)_mm256_abs_epi16(__A),
534529 (__v16hi)__W);
535530}
536531
537static __inline__ __m256i __DEFAULT_FN_ATTRS256
538_mm256_maskz_abs_epi16(__mmask16 __U, __m256i __A)
539{
532static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
533_mm256_maskz_abs_epi16(__mmask16 __U, __m256i __A) {
540534 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
541535 (__v16hi)_mm256_abs_epi16(__A),
542536 (__v16hi)_mm256_setzero_si256());
543537}
544538
545static __inline__ __m128i __DEFAULT_FN_ATTRS128
539static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
546540_mm_maskz_packs_epi32(__mmask8 __M, __m128i __A, __m128i __B) {
547541 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
548542 (__v8hi)_mm_packs_epi32(__A, __B),
549543 (__v8hi)_mm_setzero_si128());
550544}
551545
552static __inline__ __m128i __DEFAULT_FN_ATTRS128
546static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
553547_mm_mask_packs_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
554548{
555549 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
......@@ -557,7 +551,7 @@ _mm_mask_packs_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
557551 (__v8hi)__W);
558552}
559553
560static __inline__ __m256i __DEFAULT_FN_ATTRS256
554static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
561555_mm256_maskz_packs_epi32(__mmask16 __M, __m256i __A, __m256i __B)
562556{
563557 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
......@@ -565,7 +559,7 @@ _mm256_maskz_packs_epi32(__mmask16 __M, __m256i __A, __m256i __B)
565559 (__v16hi)_mm256_setzero_si256());
566560}
567561
568static __inline__ __m256i __DEFAULT_FN_ATTRS256
562static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
569563_mm256_mask_packs_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
570564{
571565 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
......@@ -573,7 +567,7 @@ _mm256_mask_packs_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
573567 (__v16hi)__W);
574568}
575569
576static __inline__ __m128i __DEFAULT_FN_ATTRS128
570static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
577571_mm_maskz_packs_epi16(__mmask16 __M, __m128i __A, __m128i __B)
578572{
579573 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
......@@ -581,7 +575,7 @@ _mm_maskz_packs_epi16(__mmask16 __M, __m128i __A, __m128i __B)
581575 (__v16qi)_mm_setzero_si128());
582576}
583577
584static __inline__ __m128i __DEFAULT_FN_ATTRS128
578static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
585579_mm_mask_packs_epi16(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
586580{
587581 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
......@@ -589,7 +583,7 @@ _mm_mask_packs_epi16(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
589583 (__v16qi)__W);
590584}
591585
592static __inline__ __m256i __DEFAULT_FN_ATTRS256
586static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
593587_mm256_maskz_packs_epi16(__mmask32 __M, __m256i __A, __m256i __B)
594588{
595589 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
......@@ -597,7 +591,7 @@ _mm256_maskz_packs_epi16(__mmask32 __M, __m256i __A, __m256i __B)
597591 (__v32qi)_mm256_setzero_si256());
598592}
599593
600static __inline__ __m256i __DEFAULT_FN_ATTRS256
594static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
601595_mm256_mask_packs_epi16(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
602596{
603597 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
......@@ -605,7 +599,7 @@ _mm256_mask_packs_epi16(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
605599 (__v32qi)__W);
606600}
607601
608static __inline__ __m128i __DEFAULT_FN_ATTRS128
602static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
609603_mm_maskz_packus_epi32(__mmask8 __M, __m128i __A, __m128i __B)
610604{
611605 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
......@@ -613,7 +607,7 @@ _mm_maskz_packus_epi32(__mmask8 __M, __m128i __A, __m128i __B)
613607 (__v8hi)_mm_setzero_si128());
614608}
615609
616static __inline__ __m128i __DEFAULT_FN_ATTRS128
610static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
617611_mm_mask_packus_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
618612{
619613 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
......@@ -621,7 +615,7 @@ _mm_mask_packus_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
621615 (__v8hi)__W);
622616}
623617
624static __inline__ __m256i __DEFAULT_FN_ATTRS256
618static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
625619_mm256_maskz_packus_epi32(__mmask16 __M, __m256i __A, __m256i __B)
626620{
627621 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
......@@ -629,7 +623,7 @@ _mm256_maskz_packus_epi32(__mmask16 __M, __m256i __A, __m256i __B)
629623 (__v16hi)_mm256_setzero_si256());
630624}
631625
632static __inline__ __m256i __DEFAULT_FN_ATTRS256
626static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
633627_mm256_mask_packus_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
634628{
635629 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
......@@ -637,7 +631,7 @@ _mm256_mask_packus_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
637631 (__v16hi)__W);
638632}
639633
640static __inline__ __m128i __DEFAULT_FN_ATTRS128
634static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
641635_mm_maskz_packus_epi16(__mmask16 __M, __m128i __A, __m128i __B)
642636{
643637 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
......@@ -645,7 +639,7 @@ _mm_maskz_packus_epi16(__mmask16 __M, __m128i __A, __m128i __B)
645639 (__v16qi)_mm_setzero_si128());
646640}
647641
648static __inline__ __m128i __DEFAULT_FN_ATTRS128
642static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
649643_mm_mask_packus_epi16(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
650644{
651645 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
......@@ -653,7 +647,7 @@ _mm_mask_packus_epi16(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
653647 (__v16qi)__W);
654648}
655649
656static __inline__ __m256i __DEFAULT_FN_ATTRS256
650static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
657651_mm256_maskz_packus_epi16(__mmask32 __M, __m256i __A, __m256i __B)
658652{
659653 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
......@@ -661,7 +655,7 @@ _mm256_maskz_packus_epi16(__mmask32 __M, __m256i __A, __m256i __B)
661655 (__v32qi)_mm256_setzero_si256());
662656}
663657
664static __inline__ __m256i __DEFAULT_FN_ATTRS256
658static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
665659_mm256_mask_packus_epi16(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
666660{
667661 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
......@@ -669,7 +663,7 @@ _mm256_mask_packus_epi16(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
669663 (__v32qi)__W);
670664}
671665
672static __inline__ __m128i __DEFAULT_FN_ATTRS128
666static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
673667_mm_mask_adds_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
674668{
675669 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -677,7 +671,7 @@ _mm_mask_adds_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
677671 (__v16qi)__W);
678672}
679673
680static __inline__ __m128i __DEFAULT_FN_ATTRS128
674static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
681675_mm_maskz_adds_epi8(__mmask16 __U, __m128i __A, __m128i __B)
682676{
683677 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -685,7 +679,7 @@ _mm_maskz_adds_epi8(__mmask16 __U, __m128i __A, __m128i __B)
685679 (__v16qi)_mm_setzero_si128());
686680}
687681
688static __inline__ __m256i __DEFAULT_FN_ATTRS256
682static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
689683_mm256_mask_adds_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
690684{
691685 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -693,7 +687,7 @@ _mm256_mask_adds_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
693687 (__v32qi)__W);
694688}
695689
696static __inline__ __m256i __DEFAULT_FN_ATTRS256
690static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
697691_mm256_maskz_adds_epi8(__mmask32 __U, __m256i __A, __m256i __B)
698692{
699693 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -701,7 +695,7 @@ _mm256_maskz_adds_epi8(__mmask32 __U, __m256i __A, __m256i __B)
701695 (__v32qi)_mm256_setzero_si256());
702696}
703697
704static __inline__ __m128i __DEFAULT_FN_ATTRS128
698static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
705699_mm_mask_adds_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
706700{
707701 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -709,7 +703,7 @@ _mm_mask_adds_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
709703 (__v8hi)__W);
710704}
711705
712static __inline__ __m128i __DEFAULT_FN_ATTRS128
706static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
713707_mm_maskz_adds_epi16(__mmask8 __U, __m128i __A, __m128i __B)
714708{
715709 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -717,7 +711,7 @@ _mm_maskz_adds_epi16(__mmask8 __U, __m128i __A, __m128i __B)
717711 (__v8hi)_mm_setzero_si128());
718712}
719713
720static __inline__ __m256i __DEFAULT_FN_ATTRS256
714static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
721715_mm256_mask_adds_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
722716{
723717 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -725,7 +719,7 @@ _mm256_mask_adds_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
725719 (__v16hi)__W);
726720}
727721
728static __inline__ __m256i __DEFAULT_FN_ATTRS256
722static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
729723_mm256_maskz_adds_epi16(__mmask16 __U, __m256i __A, __m256i __B)
730724{
731725 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -733,7 +727,7 @@ _mm256_maskz_adds_epi16(__mmask16 __U, __m256i __A, __m256i __B)
733727 (__v16hi)_mm256_setzero_si256());
734728}
735729
736static __inline__ __m128i __DEFAULT_FN_ATTRS128
730static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
737731_mm_mask_adds_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
738732{
739733 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -741,7 +735,7 @@ _mm_mask_adds_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
741735 (__v16qi)__W);
742736}
743737
744static __inline__ __m128i __DEFAULT_FN_ATTRS128
738static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
745739_mm_maskz_adds_epu8(__mmask16 __U, __m128i __A, __m128i __B)
746740{
747741 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -749,7 +743,7 @@ _mm_maskz_adds_epu8(__mmask16 __U, __m128i __A, __m128i __B)
749743 (__v16qi)_mm_setzero_si128());
750744}
751745
752static __inline__ __m256i __DEFAULT_FN_ATTRS256
746static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
753747_mm256_mask_adds_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
754748{
755749 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -757,7 +751,7 @@ _mm256_mask_adds_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
757751 (__v32qi)__W);
758752}
759753
760static __inline__ __m256i __DEFAULT_FN_ATTRS256
754static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
761755_mm256_maskz_adds_epu8(__mmask32 __U, __m256i __A, __m256i __B)
762756{
763757 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -765,7 +759,7 @@ _mm256_maskz_adds_epu8(__mmask32 __U, __m256i __A, __m256i __B)
765759 (__v32qi)_mm256_setzero_si256());
766760}
767761
768static __inline__ __m128i __DEFAULT_FN_ATTRS128
762static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
769763_mm_mask_adds_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
770764{
771765 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -773,7 +767,7 @@ _mm_mask_adds_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
773767 (__v8hi)__W);
774768}
775769
776static __inline__ __m128i __DEFAULT_FN_ATTRS128
770static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
777771_mm_maskz_adds_epu16(__mmask8 __U, __m128i __A, __m128i __B)
778772{
779773 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -781,7 +775,7 @@ _mm_maskz_adds_epu16(__mmask8 __U, __m128i __A, __m128i __B)
781775 (__v8hi)_mm_setzero_si128());
782776}
783777
784static __inline__ __m256i __DEFAULT_FN_ATTRS256
778static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
785779_mm256_mask_adds_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
786780{
787781 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -789,7 +783,7 @@ _mm256_mask_adds_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
789783 (__v16hi)__W);
790784}
791785
792static __inline__ __m256i __DEFAULT_FN_ATTRS256
786static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
793787_mm256_maskz_adds_epu16(__mmask16 __U, __m256i __A, __m256i __B)
794788{
795789 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -797,359 +791,311 @@ _mm256_maskz_adds_epu16(__mmask16 __U, __m256i __A, __m256i __B)
797791 (__v16hi)_mm256_setzero_si256());
798792}
799793
800static __inline__ __m128i __DEFAULT_FN_ATTRS128
801_mm_mask_avg_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
802{
803 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
804 (__v16qi)_mm_avg_epu8(__A, __B),
805 (__v16qi)__W);
794static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
795_mm_mask_avg_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
796 return (__m128i)__builtin_ia32_selectb_128(
797 (__mmask16)__U, (__v16qi)_mm_avg_epu8(__A, __B), (__v16qi)__W);
806798}
807799
808static __inline__ __m128i __DEFAULT_FN_ATTRS128
809_mm_maskz_avg_epu8(__mmask16 __U, __m128i __A, __m128i __B)
810{
800static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
801_mm_maskz_avg_epu8(__mmask16 __U, __m128i __A, __m128i __B) {
811802 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
812803 (__v16qi)_mm_avg_epu8(__A, __B),
813804 (__v16qi)_mm_setzero_si128());
814805}
815806
816static __inline__ __m256i __DEFAULT_FN_ATTRS256
817_mm256_mask_avg_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
818{
819 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
820 (__v32qi)_mm256_avg_epu8(__A, __B),
821 (__v32qi)__W);
807static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
808_mm256_mask_avg_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
809 return (__m256i)__builtin_ia32_selectb_256(
810 (__mmask32)__U, (__v32qi)_mm256_avg_epu8(__A, __B), (__v32qi)__W);
822811}
823812
824static __inline__ __m256i __DEFAULT_FN_ATTRS256
825_mm256_maskz_avg_epu8(__mmask32 __U, __m256i __A, __m256i __B)
826{
813static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
814_mm256_maskz_avg_epu8(__mmask32 __U, __m256i __A, __m256i __B) {
827815 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
828816 (__v32qi)_mm256_avg_epu8(__A, __B),
829817 (__v32qi)_mm256_setzero_si256());
830818}
831819
832static __inline__ __m128i __DEFAULT_FN_ATTRS128
833_mm_mask_avg_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
834{
835 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
836 (__v8hi)_mm_avg_epu16(__A, __B),
837 (__v8hi)__W);
820static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
821_mm_mask_avg_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
822 return (__m128i)__builtin_ia32_selectw_128(
823 (__mmask8)__U, (__v8hi)_mm_avg_epu16(__A, __B), (__v8hi)__W);
838824}
839825
840static __inline__ __m128i __DEFAULT_FN_ATTRS128
841_mm_maskz_avg_epu16(__mmask8 __U, __m128i __A, __m128i __B)
842{
826static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
827_mm_maskz_avg_epu16(__mmask8 __U, __m128i __A, __m128i __B) {
843828 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
844829 (__v8hi)_mm_avg_epu16(__A, __B),
845830 (__v8hi)_mm_setzero_si128());
846831}
847832
848static __inline__ __m256i __DEFAULT_FN_ATTRS256
849_mm256_mask_avg_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
850{
851 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
852 (__v16hi)_mm256_avg_epu16(__A, __B),
853 (__v16hi)__W);
833static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
834_mm256_mask_avg_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
835 return (__m256i)__builtin_ia32_selectw_256(
836 (__mmask16)__U, (__v16hi)_mm256_avg_epu16(__A, __B), (__v16hi)__W);
854837}
855838
856static __inline__ __m256i __DEFAULT_FN_ATTRS256
857_mm256_maskz_avg_epu16(__mmask16 __U, __m256i __A, __m256i __B)
858{
859 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
860 (__v16hi)_mm256_avg_epu16(__A, __B),
861 (__v16hi)_mm256_setzero_si256());
839static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
840_mm256_maskz_avg_epu16(__mmask16 __U, __m256i __A, __m256i __B) {
841 return (__m256i)__builtin_ia32_selectw_256(
842 (__mmask16)__U, (__v16hi)_mm256_avg_epu16(__A, __B),
843 (__v16hi)_mm256_setzero_si256());
862844}
863845
864static __inline__ __m128i __DEFAULT_FN_ATTRS128
865_mm_maskz_max_epi8(__mmask16 __M, __m128i __A, __m128i __B)
866{
846static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
847_mm_maskz_max_epi8(__mmask16 __M, __m128i __A, __m128i __B) {
867848 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
868849 (__v16qi)_mm_max_epi8(__A, __B),
869850 (__v16qi)_mm_setzero_si128());
870851}
871852
872static __inline__ __m128i __DEFAULT_FN_ATTRS128
873_mm_mask_max_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
874{
853static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
854_mm_mask_max_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) {
875855 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
876856 (__v16qi)_mm_max_epi8(__A, __B),
877857 (__v16qi)__W);
878858}
879859
880static __inline__ __m256i __DEFAULT_FN_ATTRS256
881_mm256_maskz_max_epi8(__mmask32 __M, __m256i __A, __m256i __B)
882{
860static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
861_mm256_maskz_max_epi8(__mmask32 __M, __m256i __A, __m256i __B) {
883862 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
884863 (__v32qi)_mm256_max_epi8(__A, __B),
885864 (__v32qi)_mm256_setzero_si256());
886865}
887866
888static __inline__ __m256i __DEFAULT_FN_ATTRS256
889_mm256_mask_max_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
890{
867static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
868_mm256_mask_max_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) {
891869 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
892870 (__v32qi)_mm256_max_epi8(__A, __B),
893871 (__v32qi)__W);
894872}
895873
896static __inline__ __m128i __DEFAULT_FN_ATTRS128
897_mm_maskz_max_epi16(__mmask8 __M, __m128i __A, __m128i __B)
898{
874static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
875_mm_maskz_max_epi16(__mmask8 __M, __m128i __A, __m128i __B) {
899876 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
900877 (__v8hi)_mm_max_epi16(__A, __B),
901878 (__v8hi)_mm_setzero_si128());
902879}
903880
904static __inline__ __m128i __DEFAULT_FN_ATTRS128
905_mm_mask_max_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
906{
881static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
882_mm_mask_max_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
907883 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
908884 (__v8hi)_mm_max_epi16(__A, __B),
909885 (__v8hi)__W);
910886}
911887
912static __inline__ __m256i __DEFAULT_FN_ATTRS256
913_mm256_maskz_max_epi16(__mmask16 __M, __m256i __A, __m256i __B)
914{
888static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
889_mm256_maskz_max_epi16(__mmask16 __M, __m256i __A, __m256i __B) {
915890 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
916891 (__v16hi)_mm256_max_epi16(__A, __B),
917892 (__v16hi)_mm256_setzero_si256());
918893}
919894
920static __inline__ __m256i __DEFAULT_FN_ATTRS256
921_mm256_mask_max_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
922{
895static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
896_mm256_mask_max_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) {
923897 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
924898 (__v16hi)_mm256_max_epi16(__A, __B),
925899 (__v16hi)__W);
926900}
927901
928static __inline__ __m128i __DEFAULT_FN_ATTRS128
929_mm_maskz_max_epu8(__mmask16 __M, __m128i __A, __m128i __B)
930{
902static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
903_mm_maskz_max_epu8(__mmask16 __M, __m128i __A, __m128i __B) {
931904 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
932905 (__v16qi)_mm_max_epu8(__A, __B),
933906 (__v16qi)_mm_setzero_si128());
934907}
935908
936static __inline__ __m128i __DEFAULT_FN_ATTRS128
937_mm_mask_max_epu8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
938{
909static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
910_mm_mask_max_epu8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) {
939911 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
940912 (__v16qi)_mm_max_epu8(__A, __B),
941913 (__v16qi)__W);
942914}
943915
944static __inline__ __m256i __DEFAULT_FN_ATTRS256
945_mm256_maskz_max_epu8 (__mmask32 __M, __m256i __A, __m256i __B)
946{
916static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
917_mm256_maskz_max_epu8(__mmask32 __M, __m256i __A, __m256i __B) {
947918 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
948919 (__v32qi)_mm256_max_epu8(__A, __B),
949920 (__v32qi)_mm256_setzero_si256());
950921}
951922
952static __inline__ __m256i __DEFAULT_FN_ATTRS256
953_mm256_mask_max_epu8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
954{
923static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
924_mm256_mask_max_epu8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) {
955925 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
956926 (__v32qi)_mm256_max_epu8(__A, __B),
957927 (__v32qi)__W);
958928}
959929
960static __inline__ __m128i __DEFAULT_FN_ATTRS128
961_mm_maskz_max_epu16(__mmask8 __M, __m128i __A, __m128i __B)
962{
930static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
931_mm_maskz_max_epu16(__mmask8 __M, __m128i __A, __m128i __B) {
963932 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
964933 (__v8hi)_mm_max_epu16(__A, __B),
965934 (__v8hi)_mm_setzero_si128());
966935}
967936
968static __inline__ __m128i __DEFAULT_FN_ATTRS128
969_mm_mask_max_epu16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
970{
937static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
938_mm_mask_max_epu16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
971939 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
972940 (__v8hi)_mm_max_epu16(__A, __B),
973941 (__v8hi)__W);
974942}
975943
976static __inline__ __m256i __DEFAULT_FN_ATTRS256
977_mm256_maskz_max_epu16(__mmask16 __M, __m256i __A, __m256i __B)
978{
944static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
945_mm256_maskz_max_epu16(__mmask16 __M, __m256i __A, __m256i __B) {
979946 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
980947 (__v16hi)_mm256_max_epu16(__A, __B),
981948 (__v16hi)_mm256_setzero_si256());
982949}
983950
984static __inline__ __m256i __DEFAULT_FN_ATTRS256
985_mm256_mask_max_epu16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
986{
951static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
952_mm256_mask_max_epu16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) {
987953 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
988954 (__v16hi)_mm256_max_epu16(__A, __B),
989955 (__v16hi)__W);
990956}
991957
992static __inline__ __m128i __DEFAULT_FN_ATTRS128
993_mm_maskz_min_epi8(__mmask16 __M, __m128i __A, __m128i __B)
994{
958static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
959_mm_maskz_min_epi8(__mmask16 __M, __m128i __A, __m128i __B) {
995960 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
996961 (__v16qi)_mm_min_epi8(__A, __B),
997962 (__v16qi)_mm_setzero_si128());
998963}
999964
1000static __inline__ __m128i __DEFAULT_FN_ATTRS128
1001_mm_mask_min_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
1002{
965static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
966_mm_mask_min_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) {
1003967 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
1004968 (__v16qi)_mm_min_epi8(__A, __B),
1005969 (__v16qi)__W);
1006970}
1007971
1008static __inline__ __m256i __DEFAULT_FN_ATTRS256
1009_mm256_maskz_min_epi8(__mmask32 __M, __m256i __A, __m256i __B)
1010{
972static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
973_mm256_maskz_min_epi8(__mmask32 __M, __m256i __A, __m256i __B) {
1011974 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
1012975 (__v32qi)_mm256_min_epi8(__A, __B),
1013976 (__v32qi)_mm256_setzero_si256());
1014977}
1015978
1016static __inline__ __m256i __DEFAULT_FN_ATTRS256
1017_mm256_mask_min_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
1018{
979static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
980_mm256_mask_min_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) {
1019981 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
1020982 (__v32qi)_mm256_min_epi8(__A, __B),
1021983 (__v32qi)__W);
1022984}
1023985
1024static __inline__ __m128i __DEFAULT_FN_ATTRS128
1025_mm_maskz_min_epi16(__mmask8 __M, __m128i __A, __m128i __B)
1026{
986static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
987_mm_maskz_min_epi16(__mmask8 __M, __m128i __A, __m128i __B) {
1027988 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
1028989 (__v8hi)_mm_min_epi16(__A, __B),
1029990 (__v8hi)_mm_setzero_si128());
1030991}
1031992
1032static __inline__ __m128i __DEFAULT_FN_ATTRS128
1033_mm_mask_min_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
1034{
993static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
994_mm_mask_min_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
1035995 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
1036996 (__v8hi)_mm_min_epi16(__A, __B),
1037997 (__v8hi)__W);
1038998}
1039999
1040static __inline__ __m256i __DEFAULT_FN_ATTRS256
1041_mm256_maskz_min_epi16(__mmask16 __M, __m256i __A, __m256i __B)
1042{
1000static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1001_mm256_maskz_min_epi16(__mmask16 __M, __m256i __A, __m256i __B) {
10431002 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
10441003 (__v16hi)_mm256_min_epi16(__A, __B),
10451004 (__v16hi)_mm256_setzero_si256());
10461005}
10471006
1048static __inline__ __m256i __DEFAULT_FN_ATTRS256
1049_mm256_mask_min_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
1050{
1007static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1008_mm256_mask_min_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) {
10511009 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
10521010 (__v16hi)_mm256_min_epi16(__A, __B),
10531011 (__v16hi)__W);
10541012}
10551013
1056static __inline__ __m128i __DEFAULT_FN_ATTRS128
1057_mm_maskz_min_epu8(__mmask16 __M, __m128i __A, __m128i __B)
1058{
1014static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1015_mm_maskz_min_epu8(__mmask16 __M, __m128i __A, __m128i __B) {
10591016 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
10601017 (__v16qi)_mm_min_epu8(__A, __B),
10611018 (__v16qi)_mm_setzero_si128());
10621019}
10631020
1064static __inline__ __m128i __DEFAULT_FN_ATTRS128
1065_mm_mask_min_epu8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B)
1066{
1021static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1022_mm_mask_min_epu8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) {
10671023 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
10681024 (__v16qi)_mm_min_epu8(__A, __B),
10691025 (__v16qi)__W);
10701026}
10711027
1072static __inline__ __m256i __DEFAULT_FN_ATTRS256
1073_mm256_maskz_min_epu8 (__mmask32 __M, __m256i __A, __m256i __B)
1074{
1028static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1029_mm256_maskz_min_epu8(__mmask32 __M, __m256i __A, __m256i __B) {
10751030 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
10761031 (__v32qi)_mm256_min_epu8(__A, __B),
10771032 (__v32qi)_mm256_setzero_si256());
10781033}
10791034
1080static __inline__ __m256i __DEFAULT_FN_ATTRS256
1081_mm256_mask_min_epu8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B)
1082{
1035static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1036_mm256_mask_min_epu8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) {
10831037 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
10841038 (__v32qi)_mm256_min_epu8(__A, __B),
10851039 (__v32qi)__W);
10861040}
10871041
1088static __inline__ __m128i __DEFAULT_FN_ATTRS128
1089_mm_maskz_min_epu16(__mmask8 __M, __m128i __A, __m128i __B)
1090{
1042static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1043_mm_maskz_min_epu16(__mmask8 __M, __m128i __A, __m128i __B) {
10911044 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
10921045 (__v8hi)_mm_min_epu16(__A, __B),
10931046 (__v8hi)_mm_setzero_si128());
10941047}
10951048
1096static __inline__ __m128i __DEFAULT_FN_ATTRS128
1097_mm_mask_min_epu16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
1098{
1049static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1050_mm_mask_min_epu16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
10991051 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
11001052 (__v8hi)_mm_min_epu16(__A, __B),
11011053 (__v8hi)__W);
11021054}
11031055
1104static __inline__ __m256i __DEFAULT_FN_ATTRS256
1105_mm256_maskz_min_epu16(__mmask16 __M, __m256i __A, __m256i __B)
1106{
1056static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1057_mm256_maskz_min_epu16(__mmask16 __M, __m256i __A, __m256i __B) {
11071058 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
11081059 (__v16hi)_mm256_min_epu16(__A, __B),
11091060 (__v16hi)_mm256_setzero_si256());
11101061}
11111062
1112static __inline__ __m256i __DEFAULT_FN_ATTRS256
1113_mm256_mask_min_epu16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B)
1114{
1063static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1064_mm256_mask_min_epu16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) {
11151065 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
11161066 (__v16hi)_mm256_min_epu16(__A, __B),
11171067 (__v16hi)__W);
11181068}
11191069
1120static __inline__ __m128i __DEFAULT_FN_ATTRS128
1121_mm_mask_shuffle_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
1122{
1070static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1071_mm_mask_shuffle_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
11231072 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
11241073 (__v16qi)_mm_shuffle_epi8(__A, __B),
11251074 (__v16qi)__W);
11261075}
11271076
1128static __inline__ __m128i __DEFAULT_FN_ATTRS128
1129_mm_maskz_shuffle_epi8(__mmask16 __U, __m128i __A, __m128i __B)
1130{
1077static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1078_mm_maskz_shuffle_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
11311079 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
11321080 (__v16qi)_mm_shuffle_epi8(__A, __B),
11331081 (__v16qi)_mm_setzero_si128());
11341082}
11351083
1136static __inline__ __m256i __DEFAULT_FN_ATTRS256
1137_mm256_mask_shuffle_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
1138{
1084static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1085_mm256_mask_shuffle_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
11391086 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
11401087 (__v32qi)_mm256_shuffle_epi8(__A, __B),
11411088 (__v32qi)__W);
11421089}
11431090
1144static __inline__ __m256i __DEFAULT_FN_ATTRS256
1145_mm256_maskz_shuffle_epi8(__mmask32 __U, __m256i __A, __m256i __B)
1146{
1091static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1092_mm256_maskz_shuffle_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
11471093 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
11481094 (__v32qi)_mm256_shuffle_epi8(__A, __B),
11491095 (__v32qi)_mm256_setzero_si256());
11501096}
11511097
1152static __inline__ __m128i __DEFAULT_FN_ATTRS128
1098static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
11531099_mm_mask_subs_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
11541100{
11551101 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -1157,7 +1103,7 @@ _mm_mask_subs_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
11571103 (__v16qi)__W);
11581104}
11591105
1160static __inline__ __m128i __DEFAULT_FN_ATTRS128
1106static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
11611107_mm_maskz_subs_epi8(__mmask16 __U, __m128i __A, __m128i __B)
11621108{
11631109 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -1165,7 +1111,7 @@ _mm_maskz_subs_epi8(__mmask16 __U, __m128i __A, __m128i __B)
11651111 (__v16qi)_mm_setzero_si128());
11661112}
11671113
1168static __inline__ __m256i __DEFAULT_FN_ATTRS256
1114static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
11691115_mm256_mask_subs_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
11701116{
11711117 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -1173,7 +1119,7 @@ _mm256_mask_subs_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
11731119 (__v32qi)__W);
11741120}
11751121
1176static __inline__ __m256i __DEFAULT_FN_ATTRS256
1122static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
11771123_mm256_maskz_subs_epi8(__mmask32 __U, __m256i __A, __m256i __B)
11781124{
11791125 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -1181,7 +1127,7 @@ _mm256_maskz_subs_epi8(__mmask32 __U, __m256i __A, __m256i __B)
11811127 (__v32qi)_mm256_setzero_si256());
11821128}
11831129
1184static __inline__ __m128i __DEFAULT_FN_ATTRS128
1130static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
11851131_mm_mask_subs_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
11861132{
11871133 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1189,7 +1135,7 @@ _mm_mask_subs_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
11891135 (__v8hi)__W);
11901136}
11911137
1192static __inline__ __m128i __DEFAULT_FN_ATTRS128
1138static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
11931139_mm_maskz_subs_epi16(__mmask8 __U, __m128i __A, __m128i __B)
11941140{
11951141 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1197,7 +1143,7 @@ _mm_maskz_subs_epi16(__mmask8 __U, __m128i __A, __m128i __B)
11971143 (__v8hi)_mm_setzero_si128());
11981144}
11991145
1200static __inline__ __m256i __DEFAULT_FN_ATTRS256
1146static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
12011147_mm256_mask_subs_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
12021148{
12031149 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1205,7 +1151,7 @@ _mm256_mask_subs_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
12051151 (__v16hi)__W);
12061152}
12071153
1208static __inline__ __m256i __DEFAULT_FN_ATTRS256
1154static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
12091155_mm256_maskz_subs_epi16(__mmask16 __U, __m256i __A, __m256i __B)
12101156{
12111157 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1213,7 +1159,7 @@ _mm256_maskz_subs_epi16(__mmask16 __U, __m256i __A, __m256i __B)
12131159 (__v16hi)_mm256_setzero_si256());
12141160}
12151161
1216static __inline__ __m128i __DEFAULT_FN_ATTRS128
1162static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
12171163_mm_mask_subs_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
12181164{
12191165 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -1221,7 +1167,7 @@ _mm_mask_subs_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B)
12211167 (__v16qi)__W);
12221168}
12231169
1224static __inline__ __m128i __DEFAULT_FN_ATTRS128
1170static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
12251171_mm_maskz_subs_epu8(__mmask16 __U, __m128i __A, __m128i __B)
12261172{
12271173 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
......@@ -1229,7 +1175,7 @@ _mm_maskz_subs_epu8(__mmask16 __U, __m128i __A, __m128i __B)
12291175 (__v16qi)_mm_setzero_si128());
12301176}
12311177
1232static __inline__ __m256i __DEFAULT_FN_ATTRS256
1178static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
12331179_mm256_mask_subs_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
12341180{
12351181 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -1237,7 +1183,7 @@ _mm256_mask_subs_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B)
12371183 (__v32qi)__W);
12381184}
12391185
1240static __inline__ __m256i __DEFAULT_FN_ATTRS256
1186static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
12411187_mm256_maskz_subs_epu8(__mmask32 __U, __m256i __A, __m256i __B)
12421188{
12431189 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
......@@ -1245,7 +1191,7 @@ _mm256_maskz_subs_epu8(__mmask32 __U, __m256i __A, __m256i __B)
12451191 (__v32qi)_mm256_setzero_si256());
12461192}
12471193
1248static __inline__ __m128i __DEFAULT_FN_ATTRS128
1194static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
12491195_mm_mask_subs_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
12501196{
12511197 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1253,7 +1199,7 @@ _mm_mask_subs_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
12531199 (__v8hi)__W);
12541200}
12551201
1256static __inline__ __m128i __DEFAULT_FN_ATTRS128
1202static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
12571203_mm_maskz_subs_epu16(__mmask8 __U, __m128i __A, __m128i __B)
12581204{
12591205 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1261,7 +1207,7 @@ _mm_maskz_subs_epu16(__mmask8 __U, __m128i __A, __m128i __B)
12611207 (__v8hi)_mm_setzero_si128());
12621208}
12631209
1264static __inline__ __m256i __DEFAULT_FN_ATTRS256
1210static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
12651211_mm256_mask_subs_epu16(__m256i __W, __mmask16 __U, __m256i __A,
12661212 __m256i __B) {
12671213 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1269,7 +1215,7 @@ _mm256_mask_subs_epu16(__m256i __W, __mmask16 __U, __m256i __A,
12691215 (__v16hi)__W);
12701216}
12711217
1272static __inline__ __m256i __DEFAULT_FN_ATTRS256
1218static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
12731219_mm256_maskz_subs_epu16(__mmask16 __U, __m256i __A, __m256i __B)
12741220{
12751221 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1277,89 +1223,81 @@ _mm256_maskz_subs_epu16(__mmask16 __U, __m256i __A, __m256i __B)
12771223 (__v16hi)_mm256_setzero_si256());
12781224}
12791225
1280static __inline__ __m128i __DEFAULT_FN_ATTRS128
1281_mm_permutex2var_epi16(__m128i __A, __m128i __I, __m128i __B)
1282{
1226static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1227_mm_permutex2var_epi16(__m128i __A, __m128i __I, __m128i __B) {
12831228 return (__m128i)__builtin_ia32_vpermi2varhi128((__v8hi)__A, (__v8hi)__I,
12841229 (__v8hi) __B);
12851230}
12861231
1287static __inline__ __m128i __DEFAULT_FN_ATTRS128
1232static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
12881233_mm_mask_permutex2var_epi16(__m128i __A, __mmask8 __U, __m128i __I,
1289 __m128i __B)
1290{
1234 __m128i __B) {
12911235 return (__m128i)__builtin_ia32_selectw_128(__U,
12921236 (__v8hi)_mm_permutex2var_epi16(__A, __I, __B),
12931237 (__v8hi)__A);
12941238}
12951239
1296static __inline__ __m128i __DEFAULT_FN_ATTRS128
1240static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
12971241_mm_mask2_permutex2var_epi16(__m128i __A, __m128i __I, __mmask8 __U,
1298 __m128i __B)
1299{
1242 __m128i __B) {
13001243 return (__m128i)__builtin_ia32_selectw_128(__U,
13011244 (__v8hi)_mm_permutex2var_epi16(__A, __I, __B),
13021245 (__v8hi)__I);
13031246}
13041247
1305static __inline__ __m128i __DEFAULT_FN_ATTRS128
1306_mm_maskz_permutex2var_epi16 (__mmask8 __U, __m128i __A, __m128i __I,
1307 __m128i __B)
1308{
1248static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1249_mm_maskz_permutex2var_epi16(__mmask8 __U, __m128i __A, __m128i __I,
1250 __m128i __B) {
13091251 return (__m128i)__builtin_ia32_selectw_128(__U,
13101252 (__v8hi)_mm_permutex2var_epi16(__A, __I, __B),
13111253 (__v8hi)_mm_setzero_si128());
13121254}
13131255
1314static __inline__ __m256i __DEFAULT_FN_ATTRS256
1315_mm256_permutex2var_epi16(__m256i __A, __m256i __I, __m256i __B)
1316{
1256static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1257_mm256_permutex2var_epi16(__m256i __A, __m256i __I, __m256i __B) {
13171258 return (__m256i)__builtin_ia32_vpermi2varhi256((__v16hi)__A, (__v16hi)__I,
13181259 (__v16hi)__B);
13191260}
13201261
1321static __inline__ __m256i __DEFAULT_FN_ATTRS256
1262static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
13221263_mm256_mask_permutex2var_epi16(__m256i __A, __mmask16 __U, __m256i __I,
1323 __m256i __B)
1324{
1264 __m256i __B) {
13251265 return (__m256i)__builtin_ia32_selectw_256(__U,
13261266 (__v16hi)_mm256_permutex2var_epi16(__A, __I, __B),
13271267 (__v16hi)__A);
13281268}
13291269
1330static __inline__ __m256i __DEFAULT_FN_ATTRS256
1270static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
13311271_mm256_mask2_permutex2var_epi16(__m256i __A, __m256i __I, __mmask16 __U,
1332 __m256i __B)
1333{
1272 __m256i __B) {
13341273 return (__m256i)__builtin_ia32_selectw_256(__U,
13351274 (__v16hi)_mm256_permutex2var_epi16(__A, __I, __B),
13361275 (__v16hi)__I);
13371276}
13381277
1339static __inline__ __m256i __DEFAULT_FN_ATTRS256
1340_mm256_maskz_permutex2var_epi16 (__mmask16 __U, __m256i __A, __m256i __I,
1341 __m256i __B)
1342{
1278static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1279_mm256_maskz_permutex2var_epi16(__mmask16 __U, __m256i __A, __m256i __I,
1280 __m256i __B) {
13431281 return (__m256i)__builtin_ia32_selectw_256(__U,
13441282 (__v16hi)_mm256_permutex2var_epi16(__A, __I, __B),
13451283 (__v16hi)_mm256_setzero_si256());
13461284}
13471285
1348static __inline__ __m128i __DEFAULT_FN_ATTRS128
1286static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
13491287_mm_mask_maddubs_epi16(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y) {
13501288 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
13511289 (__v8hi)_mm_maddubs_epi16(__X, __Y),
13521290 (__v8hi)__W);
13531291}
13541292
1355static __inline__ __m128i __DEFAULT_FN_ATTRS128
1293static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
13561294_mm_maskz_maddubs_epi16(__mmask8 __U, __m128i __X, __m128i __Y) {
13571295 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
13581296 (__v8hi)_mm_maddubs_epi16(__X, __Y),
13591297 (__v8hi)_mm_setzero_si128());
13601298}
13611299
1362static __inline__ __m256i __DEFAULT_FN_ATTRS256
1300static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
13631301_mm256_mask_maddubs_epi16(__m256i __W, __mmask16 __U, __m256i __X,
13641302 __m256i __Y) {
13651303 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1367,35 +1305,35 @@ _mm256_mask_maddubs_epi16(__m256i __W, __mmask16 __U, __m256i __X,
13671305 (__v16hi)__W);
13681306}
13691307
1370static __inline__ __m256i __DEFAULT_FN_ATTRS256
1308static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
13711309_mm256_maskz_maddubs_epi16(__mmask16 __U, __m256i __X, __m256i __Y) {
13721310 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
13731311 (__v16hi)_mm256_maddubs_epi16(__X, __Y),
13741312 (__v16hi)_mm256_setzero_si256());
13751313}
13761314
1377static __inline__ __m128i __DEFAULT_FN_ATTRS128
1315static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
13781316_mm_mask_madd_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
13791317 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
13801318 (__v4si)_mm_madd_epi16(__A, __B),
13811319 (__v4si)__W);
13821320}
13831321
1384static __inline__ __m128i __DEFAULT_FN_ATTRS128
1322static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
13851323_mm_maskz_madd_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
13861324 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
13871325 (__v4si)_mm_madd_epi16(__A, __B),
13881326 (__v4si)_mm_setzero_si128());
13891327}
13901328
1391static __inline__ __m256i __DEFAULT_FN_ATTRS256
1329static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
13921330_mm256_mask_madd_epi16(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
13931331 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
13941332 (__v8si)_mm256_madd_epi16(__A, __B),
13951333 (__v8si)__W);
13961334}
13971335
1398static __inline__ __m256i __DEFAULT_FN_ATTRS256
1336static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
13991337_mm256_maskz_madd_epi16(__mmask8 __U, __m256i __A, __m256i __B) {
14001338 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
14011339 (__v8si)_mm256_madd_epi16(__A, __B),
......@@ -1486,8 +1424,8 @@ _mm256_maskz_cvtusepi16_epi8 (__mmask16 __M, __m256i __A) {
14861424 __M);
14871425}
14881426
1489static __inline__ __m128i __DEFAULT_FN_ATTRS128
1490_mm_cvtepi16_epi8 (__m128i __A) {
1427static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1428_mm_cvtepi16_epi8(__m128i __A) {
14911429 return (__m128i)__builtin_shufflevector(
14921430 __builtin_convertvector((__v8hi)__A, __v8qi),
14931431 (__v8qi){0, 0, 0, 0, 0, 0, 0, 0}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
......@@ -1527,20 +1465,20 @@ _mm_mask_cvtusepi16_storeu_epi8 (void * __P, __mmask8 __M, __m128i __A)
15271465 __builtin_ia32_pmovuswb128mem_mask ((__v16qi *) __P, (__v8hi) __A, __M);
15281466}
15291467
1530static __inline__ __m128i __DEFAULT_FN_ATTRS256
1531_mm256_cvtepi16_epi8 (__m256i __A) {
1468static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
1469_mm256_cvtepi16_epi8(__m256i __A) {
15321470 return (__m128i)__builtin_convertvector((__v16hi) __A, __v16qi);
15331471}
15341472
1535static __inline__ __m128i __DEFAULT_FN_ATTRS256
1536_mm256_mask_cvtepi16_epi8 (__m128i __O, __mmask16 __M, __m256i __A) {
1473static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
1474_mm256_mask_cvtepi16_epi8(__m128i __O, __mmask16 __M, __m256i __A) {
15371475 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
15381476 (__v16qi)_mm256_cvtepi16_epi8(__A),
15391477 (__v16qi)__O);
15401478}
15411479
1542static __inline__ __m128i __DEFAULT_FN_ATTRS256
1543_mm256_maskz_cvtepi16_epi8 (__mmask16 __M, __m256i __A) {
1480static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
1481_mm256_maskz_cvtepi16_epi8(__mmask16 __M, __m256i __A) {
15441482 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
15451483 (__v16qi)_mm256_cvtepi16_epi8(__A),
15461484 (__v16qi)_mm_setzero_si128());
......@@ -1564,203 +1502,198 @@ _mm256_mask_cvtusepi16_storeu_epi8 (void * __P, __mmask16 __M, __m256i __A)
15641502 __builtin_ia32_pmovuswb256mem_mask ((__v16qi*) __P, (__v16hi) __A, __M);
15651503}
15661504
1567static __inline__ __m128i __DEFAULT_FN_ATTRS128
1505static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
15681506_mm_mask_mulhrs_epi16(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y) {
15691507 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
15701508 (__v8hi)_mm_mulhrs_epi16(__X, __Y),
15711509 (__v8hi)__W);
15721510}
15731511
1574static __inline__ __m128i __DEFAULT_FN_ATTRS128
1512static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
15751513_mm_maskz_mulhrs_epi16(__mmask8 __U, __m128i __X, __m128i __Y) {
15761514 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
15771515 (__v8hi)_mm_mulhrs_epi16(__X, __Y),
15781516 (__v8hi)_mm_setzero_si128());
15791517}
15801518
1581static __inline__ __m256i __DEFAULT_FN_ATTRS256
1519static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
15821520_mm256_mask_mulhrs_epi16(__m256i __W, __mmask16 __U, __m256i __X, __m256i __Y) {
15831521 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
15841522 (__v16hi)_mm256_mulhrs_epi16(__X, __Y),
15851523 (__v16hi)__W);
15861524}
15871525
1588static __inline__ __m256i __DEFAULT_FN_ATTRS256
1526static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
15891527_mm256_maskz_mulhrs_epi16(__mmask16 __U, __m256i __X, __m256i __Y) {
15901528 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
15911529 (__v16hi)_mm256_mulhrs_epi16(__X, __Y),
15921530 (__v16hi)_mm256_setzero_si256());
15931531}
15941532
1595static __inline__ __m128i __DEFAULT_FN_ATTRS128
1533static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
15961534_mm_mask_mulhi_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
1597 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
1598 (__v8hi)_mm_mulhi_epu16(__A, __B),
1599 (__v8hi)__W);
1535 return (__m128i)__builtin_ia32_selectw_128(
1536 (__mmask8)__U, (__v8hi)_mm_mulhi_epu16(__A, __B), (__v8hi)__W);
16001537}
16011538
1602static __inline__ __m128i __DEFAULT_FN_ATTRS128
1539static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16031540_mm_maskz_mulhi_epu16(__mmask8 __U, __m128i __A, __m128i __B) {
16041541 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
16051542 (__v8hi)_mm_mulhi_epu16(__A, __B),
16061543 (__v8hi)_mm_setzero_si128());
16071544}
16081545
1609static __inline__ __m256i __DEFAULT_FN_ATTRS256
1546static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16101547_mm256_mask_mulhi_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
1611 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
1612 (__v16hi)_mm256_mulhi_epu16(__A, __B),
1613 (__v16hi)__W);
1548 return (__m256i)__builtin_ia32_selectw_256(
1549 (__mmask16)__U, (__v16hi)_mm256_mulhi_epu16(__A, __B), (__v16hi)__W);
16141550}
16151551
1616static __inline__ __m256i __DEFAULT_FN_ATTRS256
1552static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16171553_mm256_maskz_mulhi_epu16(__mmask16 __U, __m256i __A, __m256i __B) {
1618 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
1619 (__v16hi)_mm256_mulhi_epu16(__A, __B),
1620 (__v16hi)_mm256_setzero_si256());
1554 return (__m256i)__builtin_ia32_selectw_256(
1555 (__mmask16)__U, (__v16hi)_mm256_mulhi_epu16(__A, __B),
1556 (__v16hi)_mm256_setzero_si256());
16211557}
16221558
1623static __inline__ __m128i __DEFAULT_FN_ATTRS128
1559static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16241560_mm_mask_mulhi_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
1625 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
1626 (__v8hi)_mm_mulhi_epi16(__A, __B),
1627 (__v8hi)__W);
1561 return (__m128i)__builtin_ia32_selectw_128(
1562 (__mmask8)__U, (__v8hi)_mm_mulhi_epi16(__A, __B), (__v8hi)__W);
16281563}
16291564
1630static __inline__ __m128i __DEFAULT_FN_ATTRS128
1565static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16311566_mm_maskz_mulhi_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
16321567 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
16331568 (__v8hi)_mm_mulhi_epi16(__A, __B),
16341569 (__v8hi)_mm_setzero_si128());
16351570}
16361571
1637static __inline__ __m256i __DEFAULT_FN_ATTRS256
1572static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16381573_mm256_mask_mulhi_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
1639 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
1640 (__v16hi)_mm256_mulhi_epi16(__A, __B),
1641 (__v16hi)__W);
1574 return (__m256i)__builtin_ia32_selectw_256(
1575 (__mmask16)__U, (__v16hi)_mm256_mulhi_epi16(__A, __B), (__v16hi)__W);
16421576}
16431577
1644static __inline__ __m256i __DEFAULT_FN_ATTRS256
1578static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16451579_mm256_maskz_mulhi_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
1646 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
1647 (__v16hi)_mm256_mulhi_epi16(__A, __B),
1648 (__v16hi)_mm256_setzero_si256());
1580 return (__m256i)__builtin_ia32_selectw_256(
1581 (__mmask16)__U, (__v16hi)_mm256_mulhi_epi16(__A, __B),
1582 (__v16hi)_mm256_setzero_si256());
16491583}
16501584
1651static __inline__ __m128i __DEFAULT_FN_ATTRS128
1585static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16521586_mm_mask_unpackhi_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
1653 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
1654 (__v16qi)_mm_unpackhi_epi8(__A, __B),
1655 (__v16qi)__W);
1587 return (__m128i)__builtin_ia32_selectb_128(
1588 (__mmask16)__U, (__v16qi)_mm_unpackhi_epi8(__A, __B), (__v16qi)__W);
16561589}
16571590
1658static __inline__ __m128i __DEFAULT_FN_ATTRS128
1591static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16591592_mm_maskz_unpackhi_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
16601593 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
16611594 (__v16qi)_mm_unpackhi_epi8(__A, __B),
16621595 (__v16qi)_mm_setzero_si128());
16631596}
16641597
1665static __inline__ __m256i __DEFAULT_FN_ATTRS256
1598static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16661599_mm256_mask_unpackhi_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
16671600 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
16681601 (__v32qi)_mm256_unpackhi_epi8(__A, __B),
16691602 (__v32qi)__W);
16701603}
16711604
1672static __inline__ __m256i __DEFAULT_FN_ATTRS256
1605static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16731606_mm256_maskz_unpackhi_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
16741607 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
16751608 (__v32qi)_mm256_unpackhi_epi8(__A, __B),
16761609 (__v32qi)_mm256_setzero_si256());
16771610}
16781611
1679static __inline__ __m128i __DEFAULT_FN_ATTRS128
1612static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16801613_mm_mask_unpackhi_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
16811614 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
16821615 (__v8hi)_mm_unpackhi_epi16(__A, __B),
16831616 (__v8hi)__W);
16841617}
16851618
1686static __inline__ __m128i __DEFAULT_FN_ATTRS128
1619static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
16871620_mm_maskz_unpackhi_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
16881621 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
16891622 (__v8hi)_mm_unpackhi_epi16(__A, __B),
16901623 (__v8hi) _mm_setzero_si128());
16911624}
16921625
1693static __inline__ __m256i __DEFAULT_FN_ATTRS256
1626static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
16941627_mm256_mask_unpackhi_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
16951628 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
16961629 (__v16hi)_mm256_unpackhi_epi16(__A, __B),
16971630 (__v16hi)__W);
16981631}
16991632
1700static __inline__ __m256i __DEFAULT_FN_ATTRS256
1633static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17011634_mm256_maskz_unpackhi_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
17021635 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
17031636 (__v16hi)_mm256_unpackhi_epi16(__A, __B),
17041637 (__v16hi)_mm256_setzero_si256());
17051638}
17061639
1707static __inline__ __m128i __DEFAULT_FN_ATTRS128
1640static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17081641_mm_mask_unpacklo_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
17091642 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
17101643 (__v16qi)_mm_unpacklo_epi8(__A, __B),
17111644 (__v16qi)__W);
17121645}
17131646
1714static __inline__ __m128i __DEFAULT_FN_ATTRS128
1647static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17151648_mm_maskz_unpacklo_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
17161649 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
17171650 (__v16qi)_mm_unpacklo_epi8(__A, __B),
17181651 (__v16qi)_mm_setzero_si128());
17191652}
17201653
1721static __inline__ __m256i __DEFAULT_FN_ATTRS256
1654static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17221655_mm256_mask_unpacklo_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
17231656 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
17241657 (__v32qi)_mm256_unpacklo_epi8(__A, __B),
17251658 (__v32qi)__W);
17261659}
17271660
1728static __inline__ __m256i __DEFAULT_FN_ATTRS256
1661static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17291662_mm256_maskz_unpacklo_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
17301663 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
17311664 (__v32qi)_mm256_unpacklo_epi8(__A, __B),
17321665 (__v32qi)_mm256_setzero_si256());
17331666}
17341667
1735static __inline__ __m128i __DEFAULT_FN_ATTRS128
1668static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17361669_mm_mask_unpacklo_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
17371670 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
17381671 (__v8hi)_mm_unpacklo_epi16(__A, __B),
17391672 (__v8hi)__W);
17401673}
17411674
1742static __inline__ __m128i __DEFAULT_FN_ATTRS128
1675static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17431676_mm_maskz_unpacklo_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
17441677 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
17451678 (__v8hi)_mm_unpacklo_epi16(__A, __B),
17461679 (__v8hi) _mm_setzero_si128());
17471680}
17481681
1749static __inline__ __m256i __DEFAULT_FN_ATTRS256
1682static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17501683_mm256_mask_unpacklo_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
17511684 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
17521685 (__v16hi)_mm256_unpacklo_epi16(__A, __B),
17531686 (__v16hi)__W);
17541687}
17551688
1756static __inline__ __m256i __DEFAULT_FN_ATTRS256
1689static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17571690_mm256_maskz_unpacklo_epi16(__mmask16 __U, __m256i __A, __m256i __B) {
17581691 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
17591692 (__v16hi)_mm256_unpacklo_epi16(__A, __B),
17601693 (__v16hi)_mm256_setzero_si256());
17611694}
17621695
1763static __inline__ __m128i __DEFAULT_FN_ATTRS128
1696static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17641697_mm_mask_cvtepi8_epi16(__m128i __W, __mmask8 __U, __m128i __A)
17651698{
17661699 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1768,7 +1701,7 @@ _mm_mask_cvtepi8_epi16(__m128i __W, __mmask8 __U, __m128i __A)
17681701 (__v8hi)__W);
17691702}
17701703
1771static __inline__ __m128i __DEFAULT_FN_ATTRS128
1704static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17721705_mm_maskz_cvtepi8_epi16(__mmask8 __U, __m128i __A)
17731706{
17741707 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1776,7 +1709,7 @@ _mm_maskz_cvtepi8_epi16(__mmask8 __U, __m128i __A)
17761709 (__v8hi)_mm_setzero_si128());
17771710}
17781711
1779static __inline__ __m256i __DEFAULT_FN_ATTRS256
1712static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17801713_mm256_mask_cvtepi8_epi16(__m256i __W, __mmask16 __U, __m128i __A)
17811714{
17821715 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1784,7 +1717,7 @@ _mm256_mask_cvtepi8_epi16(__m256i __W, __mmask16 __U, __m128i __A)
17841717 (__v16hi)__W);
17851718}
17861719
1787static __inline__ __m256i __DEFAULT_FN_ATTRS256
1720static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17881721_mm256_maskz_cvtepi8_epi16(__mmask16 __U, __m128i __A)
17891722{
17901723 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1793,7 +1726,7 @@ _mm256_maskz_cvtepi8_epi16(__mmask16 __U, __m128i __A)
17931726}
17941727
17951728
1796static __inline__ __m128i __DEFAULT_FN_ATTRS128
1729static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
17971730_mm_mask_cvtepu8_epi16(__m128i __W, __mmask8 __U, __m128i __A)
17981731{
17991732 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1801,7 +1734,7 @@ _mm_mask_cvtepu8_epi16(__m128i __W, __mmask8 __U, __m128i __A)
18011734 (__v8hi)__W);
18021735}
18031736
1804static __inline__ __m128i __DEFAULT_FN_ATTRS128
1737static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
18051738_mm_maskz_cvtepu8_epi16(__mmask8 __U, __m128i __A)
18061739{
18071740 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1809,7 +1742,7 @@ _mm_maskz_cvtepu8_epi16(__mmask8 __U, __m128i __A)
18091742 (__v8hi)_mm_setzero_si128());
18101743}
18111744
1812static __inline__ __m256i __DEFAULT_FN_ATTRS256
1745static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
18131746_mm256_mask_cvtepu8_epi16(__m256i __W, __mmask16 __U, __m128i __A)
18141747{
18151748 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1817,7 +1750,7 @@ _mm256_mask_cvtepu8_epi16(__m256i __W, __mmask16 __U, __m128i __A)
18171750 (__v16hi)__W);
18181751}
18191752
1820static __inline__ __m256i __DEFAULT_FN_ATTRS256
1753static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
18211754_mm256_maskz_cvtepu8_epi16 (__mmask16 __U, __m128i __A)
18221755{
18231756 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1868,13 +1801,13 @@ _mm256_maskz_cvtepu8_epi16 (__mmask16 __U, __m128i __A)
18681801 (imm)), \
18691802 (__v16hi)_mm256_setzero_si256()))
18701803
1871static __inline__ __m256i __DEFAULT_FN_ATTRS256
1804static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
18721805_mm256_sllv_epi16(__m256i __A, __m256i __B)
18731806{
18741807 return (__m256i)__builtin_ia32_psllv16hi((__v16hi)__A, (__v16hi)__B);
18751808}
18761809
1877static __inline__ __m256i __DEFAULT_FN_ATTRS256
1810static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
18781811_mm256_mask_sllv_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
18791812{
18801813 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1882,7 +1815,7 @@ _mm256_mask_sllv_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
18821815 (__v16hi)__W);
18831816}
18841817
1885static __inline__ __m256i __DEFAULT_FN_ATTRS256
1818static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
18861819_mm256_maskz_sllv_epi16(__mmask16 __U, __m256i __A, __m256i __B)
18871820{
18881821 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1890,13 +1823,13 @@ _mm256_maskz_sllv_epi16(__mmask16 __U, __m256i __A, __m256i __B)
18901823 (__v16hi)_mm256_setzero_si256());
18911824}
18921825
1893static __inline__ __m128i __DEFAULT_FN_ATTRS128
1826static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
18941827_mm_sllv_epi16(__m128i __A, __m128i __B)
18951828{
18961829 return (__m128i)__builtin_ia32_psllv8hi((__v8hi)__A, (__v8hi)__B);
18971830}
18981831
1899static __inline__ __m128i __DEFAULT_FN_ATTRS128
1832static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
19001833_mm_mask_sllv_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
19011834{
19021835 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1904,7 +1837,7 @@ _mm_mask_sllv_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
19041837 (__v8hi)__W);
19051838}
19061839
1907static __inline__ __m128i __DEFAULT_FN_ATTRS128
1840static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
19081841_mm_maskz_sllv_epi16(__mmask8 __U, __m128i __A, __m128i __B)
19091842{
19101843 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1944,7 +1877,7 @@ _mm256_maskz_sll_epi16(__mmask16 __U, __m256i __A, __m128i __B)
19441877 (__v16hi)_mm256_setzero_si256());
19451878}
19461879
1947static __inline__ __m128i __DEFAULT_FN_ATTRS128
1880static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
19481881_mm_mask_slli_epi16(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B)
19491882{
19501883 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1952,7 +1885,7 @@ _mm_mask_slli_epi16(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B)
19521885 (__v8hi)__W);
19531886}
19541887
1955static __inline__ __m128i __DEFAULT_FN_ATTRS128
1888static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
19561889_mm_maskz_slli_epi16 (__mmask8 __U, __m128i __A, unsigned int __B)
19571890{
19581891 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -1960,30 +1893,28 @@ _mm_maskz_slli_epi16 (__mmask8 __U, __m128i __A, unsigned int __B)
19601893 (__v8hi)_mm_setzero_si128());
19611894}
19621895
1963static __inline__ __m256i __DEFAULT_FN_ATTRS256
1896static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
19641897_mm256_mask_slli_epi16(__m256i __W, __mmask16 __U, __m256i __A,
1965 unsigned int __B)
1966{
1898 unsigned int __B) {
19671899 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
19681900 (__v16hi)_mm256_slli_epi16(__A, (int)__B),
19691901 (__v16hi)__W);
19701902}
19711903
1972static __inline__ __m256i __DEFAULT_FN_ATTRS256
1973_mm256_maskz_slli_epi16(__mmask16 __U, __m256i __A, unsigned int __B)
1974{
1904static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1905_mm256_maskz_slli_epi16(__mmask16 __U, __m256i __A, unsigned int __B) {
19751906 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
19761907 (__v16hi)_mm256_slli_epi16(__A, (int)__B),
19771908 (__v16hi)_mm256_setzero_si256());
19781909}
19791910
1980static __inline__ __m256i __DEFAULT_FN_ATTRS256
1911static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
19811912_mm256_srlv_epi16(__m256i __A, __m256i __B)
19821913{
19831914 return (__m256i)__builtin_ia32_psrlv16hi((__v16hi)__A, (__v16hi)__B);
19841915}
19851916
1986static __inline__ __m256i __DEFAULT_FN_ATTRS256
1917static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
19871918_mm256_mask_srlv_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
19881919{
19891920 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1991,7 +1922,7 @@ _mm256_mask_srlv_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
19911922 (__v16hi)__W);
19921923}
19931924
1994static __inline__ __m256i __DEFAULT_FN_ATTRS256
1925static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
19951926_mm256_maskz_srlv_epi16(__mmask16 __U, __m256i __A, __m256i __B)
19961927{
19971928 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -1999,13 +1930,13 @@ _mm256_maskz_srlv_epi16(__mmask16 __U, __m256i __A, __m256i __B)
19991930 (__v16hi)_mm256_setzero_si256());
20001931}
20011932
2002static __inline__ __m128i __DEFAULT_FN_ATTRS128
1933static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
20031934_mm_srlv_epi16(__m128i __A, __m128i __B)
20041935{
20051936 return (__m128i)__builtin_ia32_psrlv8hi((__v8hi)__A, (__v8hi)__B);
20061937}
20071938
2008static __inline__ __m128i __DEFAULT_FN_ATTRS128
1939static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
20091940_mm_mask_srlv_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
20101941{
20111942 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -2013,7 +1944,7 @@ _mm_mask_srlv_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
20131944 (__v8hi)__W);
20141945}
20151946
2016static __inline__ __m128i __DEFAULT_FN_ATTRS128
1947static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
20171948_mm_maskz_srlv_epi16(__mmask8 __U, __m128i __A, __m128i __B)
20181949{
20191950 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -2021,13 +1952,13 @@ _mm_maskz_srlv_epi16(__mmask8 __U, __m128i __A, __m128i __B)
20211952 (__v8hi)_mm_setzero_si128());
20221953}
20231954
2024static __inline__ __m256i __DEFAULT_FN_ATTRS256
1955static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
20251956_mm256_srav_epi16(__m256i __A, __m256i __B)
20261957{
20271958 return (__m256i)__builtin_ia32_psrav16hi((__v16hi)__A, (__v16hi)__B);
20281959}
20291960
2030static __inline__ __m256i __DEFAULT_FN_ATTRS256
1961static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
20311962_mm256_mask_srav_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
20321963{
20331964 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -2035,7 +1966,7 @@ _mm256_mask_srav_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B)
20351966 (__v16hi)__W);
20361967}
20371968
2038static __inline__ __m256i __DEFAULT_FN_ATTRS256
1969static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
20391970_mm256_maskz_srav_epi16(__mmask16 __U, __m256i __A, __m256i __B)
20401971{
20411972 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
......@@ -2043,13 +1974,13 @@ _mm256_maskz_srav_epi16(__mmask16 __U, __m256i __A, __m256i __B)
20431974 (__v16hi)_mm256_setzero_si256());
20441975}
20451976
2046static __inline__ __m128i __DEFAULT_FN_ATTRS128
1977static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
20471978_mm_srav_epi16(__m128i __A, __m128i __B)
20481979{
20491980 return (__m128i)__builtin_ia32_psrav8hi((__v8hi)__A, (__v8hi)__B);
20501981}
20511982
2052static __inline__ __m128i __DEFAULT_FN_ATTRS128
1983static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
20531984_mm_mask_srav_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
20541985{
20551986 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -2057,7 +1988,7 @@ _mm_mask_srav_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
20571988 (__v8hi)__W);
20581989}
20591990
2060static __inline__ __m128i __DEFAULT_FN_ATTRS128
1991static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
20611992_mm_maskz_srav_epi16(__mmask8 __U, __m128i __A, __m128i __B)
20621993{
20631994 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
......@@ -2097,34 +2028,30 @@ _mm256_maskz_sra_epi16(__mmask16 __U, __m256i __A, __m128i __B)
20972028 (__v16hi)_mm256_setzero_si256());
20982029}
20992030
2100static __inline__ __m128i __DEFAULT_FN_ATTRS128
2101_mm_mask_srai_epi16(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B)
2102{
2031static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2032_mm_mask_srai_epi16(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) {
21032033 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
21042034 (__v8hi)_mm_srai_epi16(__A, (int)__B),
21052035 (__v8hi)__W);
21062036}
21072037
2108static __inline__ __m128i __DEFAULT_FN_ATTRS128
2109_mm_maskz_srai_epi16(__mmask8 __U, __m128i __A, unsigned int __B)
2110{
2038static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2039_mm_maskz_srai_epi16(__mmask8 __U, __m128i __A, unsigned int __B) {
21112040 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
21122041 (__v8hi)_mm_srai_epi16(__A, (int)__B),
21132042 (__v8hi)_mm_setzero_si128());
21142043}
21152044
2116static __inline__ __m256i __DEFAULT_FN_ATTRS256
2045static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
21172046_mm256_mask_srai_epi16(__m256i __W, __mmask16 __U, __m256i __A,
2118 unsigned int __B)
2119{
2047 unsigned int __B) {
21202048 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
21212049 (__v16hi)_mm256_srai_epi16(__A, (int)__B),
21222050 (__v16hi)__W);
21232051}
21242052
2125static __inline__ __m256i __DEFAULT_FN_ATTRS256
2126_mm256_maskz_srai_epi16(__mmask16 __U, __m256i __A, unsigned int __B)
2127{
2053static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2054_mm256_maskz_srai_epi16(__mmask16 __U, __m256i __A, unsigned int __B) {
21282055 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
21292056 (__v16hi)_mm256_srai_epi16(__A, (int)__B),
21302057 (__v16hi)_mm256_setzero_si256());
......@@ -2162,104 +2089,91 @@ _mm256_maskz_srl_epi16(__mmask16 __U, __m256i __A, __m128i __B)
21622089 (__v16hi)_mm256_setzero_si256());
21632090}
21642091
2165static __inline__ __m128i __DEFAULT_FN_ATTRS128
2166_mm_mask_srli_epi16(__m128i __W, __mmask8 __U, __m128i __A, int __B)
2167{
2092static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2093_mm_mask_srli_epi16(__m128i __W, __mmask8 __U, __m128i __A, int __B) {
21682094 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
21692095 (__v8hi)_mm_srli_epi16(__A, __B),
21702096 (__v8hi)__W);
21712097}
21722098
2173static __inline__ __m128i __DEFAULT_FN_ATTRS128
2174_mm_maskz_srli_epi16 (__mmask8 __U, __m128i __A, int __B)
2175{
2099static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2100_mm_maskz_srli_epi16(__mmask8 __U, __m128i __A, int __B) {
21762101 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__U,
21772102 (__v8hi)_mm_srli_epi16(__A, __B),
21782103 (__v8hi)_mm_setzero_si128());
21792104}
21802105
2181static __inline__ __m256i __DEFAULT_FN_ATTRS256
2182_mm256_mask_srli_epi16(__m256i __W, __mmask16 __U, __m256i __A, int __B)
2183{
2106static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2107_mm256_mask_srli_epi16(__m256i __W, __mmask16 __U, __m256i __A, int __B) {
21842108 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
21852109 (__v16hi)_mm256_srli_epi16(__A, __B),
21862110 (__v16hi)__W);
21872111}
21882112
2189static __inline__ __m256i __DEFAULT_FN_ATTRS256
2190_mm256_maskz_srli_epi16(__mmask16 __U, __m256i __A, int __B)
2191{
2113static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2114_mm256_maskz_srli_epi16(__mmask16 __U, __m256i __A, int __B) {
21922115 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__U,
21932116 (__v16hi)_mm256_srli_epi16(__A, __B),
21942117 (__v16hi)_mm256_setzero_si256());
21952118}
21962119
2197static __inline__ __m128i __DEFAULT_FN_ATTRS128
2198_mm_mask_mov_epi16 (__m128i __W, __mmask8 __U, __m128i __A)
2199{
2120static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2121_mm_mask_mov_epi16(__m128i __W, __mmask8 __U, __m128i __A) {
22002122 return (__m128i) __builtin_ia32_selectw_128 ((__mmask8) __U,
22012123 (__v8hi) __A,
22022124 (__v8hi) __W);
22032125}
22042126
2205static __inline__ __m128i __DEFAULT_FN_ATTRS128
2206_mm_maskz_mov_epi16 (__mmask8 __U, __m128i __A)
2207{
2127static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2128_mm_maskz_mov_epi16(__mmask8 __U, __m128i __A) {
22082129 return (__m128i) __builtin_ia32_selectw_128 ((__mmask8) __U,
22092130 (__v8hi) __A,
22102131 (__v8hi) _mm_setzero_si128 ());
22112132}
22122133
2213static __inline__ __m256i __DEFAULT_FN_ATTRS256
2214_mm256_mask_mov_epi16 (__m256i __W, __mmask16 __U, __m256i __A)
2215{
2134static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2135_mm256_mask_mov_epi16(__m256i __W, __mmask16 __U, __m256i __A) {
22162136 return (__m256i) __builtin_ia32_selectw_256 ((__mmask16) __U,
22172137 (__v16hi) __A,
22182138 (__v16hi) __W);
22192139}
22202140
2221static __inline__ __m256i __DEFAULT_FN_ATTRS256
2222_mm256_maskz_mov_epi16 (__mmask16 __U, __m256i __A)
2223{
2141static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2142_mm256_maskz_mov_epi16(__mmask16 __U, __m256i __A) {
22242143 return (__m256i) __builtin_ia32_selectw_256 ((__mmask16) __U,
22252144 (__v16hi) __A,
22262145 (__v16hi) _mm256_setzero_si256 ());
22272146}
22282147
2229static __inline__ __m128i __DEFAULT_FN_ATTRS128
2230_mm_mask_mov_epi8 (__m128i __W, __mmask16 __U, __m128i __A)
2231{
2148static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2149_mm_mask_mov_epi8(__m128i __W, __mmask16 __U, __m128i __A) {
22322150 return (__m128i) __builtin_ia32_selectb_128 ((__mmask16) __U,
22332151 (__v16qi) __A,
22342152 (__v16qi) __W);
22352153}
22362154
2237static __inline__ __m128i __DEFAULT_FN_ATTRS128
2238_mm_maskz_mov_epi8 (__mmask16 __U, __m128i __A)
2239{
2155static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2156_mm_maskz_mov_epi8(__mmask16 __U, __m128i __A) {
22402157 return (__m128i) __builtin_ia32_selectb_128 ((__mmask16) __U,
22412158 (__v16qi) __A,
22422159 (__v16qi) _mm_setzero_si128 ());
22432160}
22442161
2245static __inline__ __m256i __DEFAULT_FN_ATTRS256
2246_mm256_mask_mov_epi8 (__m256i __W, __mmask32 __U, __m256i __A)
2247{
2162static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2163_mm256_mask_mov_epi8(__m256i __W, __mmask32 __U, __m256i __A) {
22482164 return (__m256i) __builtin_ia32_selectb_256 ((__mmask32) __U,
22492165 (__v32qi) __A,
22502166 (__v32qi) __W);
22512167}
22522168
2253static __inline__ __m256i __DEFAULT_FN_ATTRS256
2254_mm256_maskz_mov_epi8 (__mmask32 __U, __m256i __A)
2255{
2169static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2170_mm256_maskz_mov_epi8(__mmask32 __U, __m256i __A) {
22562171 return (__m256i) __builtin_ia32_selectb_256 ((__mmask32) __U,
22572172 (__v32qi) __A,
22582173 (__v32qi) _mm256_setzero_si256 ());
22592174}
22602175
2261
2262static __inline__ __m128i __DEFAULT_FN_ATTRS128
2176static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
22632177_mm_mask_set1_epi8 (__m128i __O, __mmask16 __M, char __A)
22642178{
22652179 return (__m128i) __builtin_ia32_selectb_128(__M,
......@@ -2267,7 +2181,7 @@ _mm_mask_set1_epi8 (__m128i __O, __mmask16 __M, char __A)
22672181 (__v16qi) __O);
22682182}
22692183
2270static __inline__ __m128i __DEFAULT_FN_ATTRS128
2184static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
22712185_mm_maskz_set1_epi8 (__mmask16 __M, char __A)
22722186{
22732187 return (__m128i) __builtin_ia32_selectb_128(__M,
......@@ -2275,7 +2189,7 @@ _mm_maskz_set1_epi8 (__mmask16 __M, char __A)
22752189 (__v16qi) _mm_setzero_si128());
22762190}
22772191
2278static __inline__ __m256i __DEFAULT_FN_ATTRS256
2192static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
22792193_mm256_mask_set1_epi8 (__m256i __O, __mmask32 __M, char __A)
22802194{
22812195 return (__m256i) __builtin_ia32_selectb_256(__M,
......@@ -2283,7 +2197,7 @@ _mm256_mask_set1_epi8 (__m256i __O, __mmask32 __M, char __A)
22832197 (__v32qi) __O);
22842198}
22852199
2286static __inline__ __m256i __DEFAULT_FN_ATTRS256
2200static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
22872201_mm256_maskz_set1_epi8 (__mmask32 __M, char __A)
22882202{
22892203 return (__m256i) __builtin_ia32_selectb_256(__M,
......@@ -2463,22 +2377,19 @@ _mm256_mask_storeu_epi8 (void *__P, __mmask32 __U, __m256i __A)
24632377 (__mmask32) __U);
24642378}
24652379
2466static __inline__ __mmask16 __DEFAULT_FN_ATTRS128
2467_mm_test_epi8_mask (__m128i __A, __m128i __B)
2468{
2380static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2381_mm_test_epi8_mask(__m128i __A, __m128i __B) {
24692382 return _mm_cmpneq_epi8_mask (_mm_and_si128(__A, __B), _mm_setzero_si128());
24702383}
24712384
2472static __inline__ __mmask16 __DEFAULT_FN_ATTRS128
2473_mm_mask_test_epi8_mask (__mmask16 __U, __m128i __A, __m128i __B)
2474{
2385static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2386_mm_mask_test_epi8_mask(__mmask16 __U, __m128i __A, __m128i __B) {
24752387 return _mm_mask_cmpneq_epi8_mask (__U, _mm_and_si128 (__A, __B),
24762388 _mm_setzero_si128());
24772389}
24782390
2479static __inline__ __mmask32 __DEFAULT_FN_ATTRS256
2480_mm256_test_epi8_mask (__m256i __A, __m256i __B)
2481{
2391static __inline__ __mmask32 __DEFAULT_FN_ATTRS256_CONSTEXPR
2392_mm256_test_epi8_mask(__m256i __A, __m256i __B) {
24822393 return _mm256_cmpneq_epi8_mask (_mm256_and_si256(__A, __B),
24832394 _mm256_setzero_si256());
24842395}
......@@ -2517,9 +2428,8 @@ _mm256_mask_test_epi16_mask (__mmask16 __U, __m256i __A, __m256i __B)
25172428 _mm256_setzero_si256());
25182429}
25192430
2520static __inline__ __mmask16 __DEFAULT_FN_ATTRS128
2521_mm_testn_epi8_mask (__m128i __A, __m128i __B)
2522{
2431static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2432_mm_testn_epi8_mask(__m128i __A, __m128i __B) {
25232433 return _mm_cmpeq_epi8_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
25242434}
25252435
......@@ -2570,55 +2480,47 @@ _mm256_mask_testn_epi16_mask (__mmask16 __U, __m256i __A, __m256i __B)
25702480 _mm256_setzero_si256());
25712481}
25722482
2573static __inline__ __mmask16 __DEFAULT_FN_ATTRS128
2574_mm_movepi8_mask (__m128i __A)
2575{
2483static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2484_mm_movepi8_mask(__m128i __A) {
25762485 return (__mmask16) __builtin_ia32_cvtb2mask128 ((__v16qi) __A);
25772486}
25782487
2579static __inline__ __mmask32 __DEFAULT_FN_ATTRS256
2580_mm256_movepi8_mask (__m256i __A)
2581{
2488static __inline__ __mmask32 __DEFAULT_FN_ATTRS256_CONSTEXPR
2489_mm256_movepi8_mask(__m256i __A) {
25822490 return (__mmask32) __builtin_ia32_cvtb2mask256 ((__v32qi) __A);
25832491}
25842492
2585static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
2586_mm_movepi16_mask (__m128i __A)
2587{
2493static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
2494_mm_movepi16_mask(__m128i __A) {
25882495 return (__mmask8) __builtin_ia32_cvtw2mask128 ((__v8hi) __A);
25892496}
25902497
2591static __inline__ __mmask16 __DEFAULT_FN_ATTRS256
2592_mm256_movepi16_mask (__m256i __A)
2593{
2498static __inline__ __mmask16 __DEFAULT_FN_ATTRS256_CONSTEXPR
2499_mm256_movepi16_mask(__m256i __A) {
25942500 return (__mmask16) __builtin_ia32_cvtw2mask256 ((__v16hi) __A);
25952501}
25962502
2597static __inline__ __m128i __DEFAULT_FN_ATTRS128
2598_mm_movm_epi8 (__mmask16 __A)
2599{
2503static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2504_mm_movm_epi8(__mmask16 __A) {
26002505 return (__m128i) __builtin_ia32_cvtmask2b128 (__A);
26012506}
26022507
2603static __inline__ __m256i __DEFAULT_FN_ATTRS256
2604_mm256_movm_epi8 (__mmask32 __A)
2605{
2508static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2509_mm256_movm_epi8(__mmask32 __A) {
26062510 return (__m256i) __builtin_ia32_cvtmask2b256 (__A);
26072511}
26082512
2609static __inline__ __m128i __DEFAULT_FN_ATTRS128
2610_mm_movm_epi16 (__mmask8 __A)
2611{
2513static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2514_mm_movm_epi16(__mmask8 __A) {
26122515 return (__m128i) __builtin_ia32_cvtmask2w128 (__A);
26132516}
26142517
2615static __inline__ __m256i __DEFAULT_FN_ATTRS256
2616_mm256_movm_epi16 (__mmask16 __A)
2617{
2518static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2519_mm256_movm_epi16(__mmask16 __A) {
26182520 return (__m256i) __builtin_ia32_cvtmask2w256 (__A);
26192521}
26202522
2621static __inline__ __m128i __DEFAULT_FN_ATTRS128
2523static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
26222524_mm_mask_broadcastb_epi8 (__m128i __O, __mmask16 __M, __m128i __A)
26232525{
26242526 return (__m128i)__builtin_ia32_selectb_128(__M,
......@@ -2626,7 +2528,7 @@ _mm_mask_broadcastb_epi8 (__m128i __O, __mmask16 __M, __m128i __A)
26262528 (__v16qi) __O);
26272529}
26282530
2629static __inline__ __m128i __DEFAULT_FN_ATTRS128
2531static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
26302532_mm_maskz_broadcastb_epi8 (__mmask16 __M, __m128i __A)
26312533{
26322534 return (__m128i)__builtin_ia32_selectb_128(__M,
......@@ -2634,7 +2536,7 @@ _mm_maskz_broadcastb_epi8 (__mmask16 __M, __m128i __A)
26342536 (__v16qi) _mm_setzero_si128());
26352537}
26362538
2637static __inline__ __m256i __DEFAULT_FN_ATTRS256
2539static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
26382540_mm256_mask_broadcastb_epi8 (__m256i __O, __mmask32 __M, __m128i __A)
26392541{
26402542 return (__m256i)__builtin_ia32_selectb_256(__M,
......@@ -2642,7 +2544,7 @@ _mm256_mask_broadcastb_epi8 (__m256i __O, __mmask32 __M, __m128i __A)
26422544 (__v32qi) __O);
26432545}
26442546
2645static __inline__ __m256i __DEFAULT_FN_ATTRS256
2547static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
26462548_mm256_maskz_broadcastb_epi8 (__mmask32 __M, __m128i __A)
26472549{
26482550 return (__m256i)__builtin_ia32_selectb_256(__M,
......@@ -2650,7 +2552,7 @@ _mm256_maskz_broadcastb_epi8 (__mmask32 __M, __m128i __A)
26502552 (__v32qi) _mm256_setzero_si256());
26512553}
26522554
2653static __inline__ __m128i __DEFAULT_FN_ATTRS128
2555static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
26542556_mm_mask_broadcastw_epi16 (__m128i __O, __mmask8 __M, __m128i __A)
26552557{
26562558 return (__m128i)__builtin_ia32_selectw_128(__M,
......@@ -2658,7 +2560,7 @@ _mm_mask_broadcastw_epi16 (__m128i __O, __mmask8 __M, __m128i __A)
26582560 (__v8hi) __O);
26592561}
26602562
2661static __inline__ __m128i __DEFAULT_FN_ATTRS128
2563static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
26622564_mm_maskz_broadcastw_epi16 (__mmask8 __M, __m128i __A)
26632565{
26642566 return (__m128i)__builtin_ia32_selectw_128(__M,
......@@ -2666,7 +2568,7 @@ _mm_maskz_broadcastw_epi16 (__mmask8 __M, __m128i __A)
26662568 (__v8hi) _mm_setzero_si128());
26672569}
26682570
2669static __inline__ __m256i __DEFAULT_FN_ATTRS256
2571static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
26702572_mm256_mask_broadcastw_epi16 (__m256i __O, __mmask16 __M, __m128i __A)
26712573{
26722574 return (__m256i)__builtin_ia32_selectw_256(__M,
......@@ -2674,7 +2576,7 @@ _mm256_mask_broadcastw_epi16 (__m256i __O, __mmask16 __M, __m128i __A)
26742576 (__v16hi) __O);
26752577}
26762578
2677static __inline__ __m256i __DEFAULT_FN_ATTRS256
2579static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
26782580_mm256_maskz_broadcastw_epi16 (__mmask16 __M, __m128i __A)
26792581{
26802582 return (__m256i)__builtin_ia32_selectw_256(__M,
......@@ -2682,7 +2584,7 @@ _mm256_maskz_broadcastw_epi16 (__mmask16 __M, __m128i __A)
26822584 (__v16hi) _mm256_setzero_si256());
26832585}
26842586
2685static __inline__ __m256i __DEFAULT_FN_ATTRS256
2587static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
26862588_mm256_mask_set1_epi16 (__m256i __O, __mmask16 __M, short __A)
26872589{
26882590 return (__m256i) __builtin_ia32_selectw_256 (__M,
......@@ -2690,7 +2592,7 @@ _mm256_mask_set1_epi16 (__m256i __O, __mmask16 __M, short __A)
26902592 (__v16hi) __O);
26912593}
26922594
2693static __inline__ __m256i __DEFAULT_FN_ATTRS256
2595static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
26942596_mm256_maskz_set1_epi16 (__mmask16 __M, short __A)
26952597{
26962598 return (__m256i) __builtin_ia32_selectw_256(__M,
......@@ -2698,7 +2600,7 @@ _mm256_maskz_set1_epi16 (__mmask16 __M, short __A)
26982600 (__v16hi) _mm256_setzero_si256());
26992601}
27002602
2701static __inline__ __m128i __DEFAULT_FN_ATTRS128
2603static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
27022604_mm_mask_set1_epi16 (__m128i __O, __mmask8 __M, short __A)
27032605{
27042606 return (__m128i) __builtin_ia32_selectw_128(__M,
......@@ -2706,7 +2608,7 @@ _mm_mask_set1_epi16 (__m128i __O, __mmask8 __M, short __A)
27062608 (__v8hi) __O);
27072609}
27082610
2709static __inline__ __m128i __DEFAULT_FN_ATTRS128
2611static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
27102612_mm_maskz_set1_epi16 (__mmask8 __M, short __A)
27112613{
27122614 return (__m128i) __builtin_ia32_selectw_128(__M,
......@@ -2714,48 +2616,41 @@ _mm_maskz_set1_epi16 (__mmask8 __M, short __A)
27142616 (__v8hi) _mm_setzero_si128());
27152617}
27162618
2717static __inline__ __m128i __DEFAULT_FN_ATTRS128
2718_mm_permutexvar_epi16 (__m128i __A, __m128i __B)
2719{
2619static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2620_mm_permutexvar_epi16(__m128i __A, __m128i __B) {
27202621 return (__m128i)__builtin_ia32_permvarhi128((__v8hi) __B, (__v8hi) __A);
27212622}
27222623
2723static __inline__ __m128i __DEFAULT_FN_ATTRS128
2724_mm_maskz_permutexvar_epi16 (__mmask8 __M, __m128i __A, __m128i __B)
2725{
2624static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2625_mm_maskz_permutexvar_epi16(__mmask8 __M, __m128i __A, __m128i __B) {
27262626 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
27272627 (__v8hi)_mm_permutexvar_epi16(__A, __B),
27282628 (__v8hi) _mm_setzero_si128());
27292629}
27302630
2731static __inline__ __m128i __DEFAULT_FN_ATTRS128
2732_mm_mask_permutexvar_epi16 (__m128i __W, __mmask8 __M, __m128i __A,
2733 __m128i __B)
2734{
2631static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2632_mm_mask_permutexvar_epi16(__m128i __W, __mmask8 __M, __m128i __A,
2633 __m128i __B) {
27352634 return (__m128i)__builtin_ia32_selectw_128((__mmask8)__M,
27362635 (__v8hi)_mm_permutexvar_epi16(__A, __B),
27372636 (__v8hi)__W);
27382637}
27392638
2740static __inline__ __m256i __DEFAULT_FN_ATTRS256
2741_mm256_permutexvar_epi16 (__m256i __A, __m256i __B)
2742{
2639static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2640_mm256_permutexvar_epi16(__m256i __A, __m256i __B) {
27432641 return (__m256i)__builtin_ia32_permvarhi256((__v16hi) __B, (__v16hi) __A);
27442642}
27452643
2746static __inline__ __m256i __DEFAULT_FN_ATTRS256
2747_mm256_maskz_permutexvar_epi16 (__mmask16 __M, __m256i __A,
2748 __m256i __B)
2749{
2644static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2645_mm256_maskz_permutexvar_epi16(__mmask16 __M, __m256i __A, __m256i __B) {
27502646 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
27512647 (__v16hi)_mm256_permutexvar_epi16(__A, __B),
27522648 (__v16hi)_mm256_setzero_si256());
27532649}
27542650
2755static __inline__ __m256i __DEFAULT_FN_ATTRS256
2756_mm256_mask_permutexvar_epi16 (__m256i __W, __mmask16 __M, __m256i __A,
2757 __m256i __B)
2758{
2651static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2652_mm256_mask_permutexvar_epi16(__m256i __W, __mmask16 __M, __m256i __A,
2653 __m256i __B) {
27592654 return (__m256i)__builtin_ia32_selectw_256((__mmask16)__M,
27602655 (__v16hi)_mm256_permutexvar_epi16(__A, __B),
27612656 (__v16hi)__W);
......@@ -2809,353 +2704,353 @@ _mm256_mask_permutexvar_epi16 (__m256i __W, __mmask16 __M, __m256i __A,
28092704 (__v16hi)_mm256_dbsad_epu8((A), (B), (imm)), \
28102705 (__v16hi)_mm256_setzero_si256()))
28112706
2812static __inline__ short __DEFAULT_FN_ATTRS128
2707static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28132708_mm_reduce_add_epi16(__m128i __W) {
28142709 return __builtin_reduce_add((__v8hi)__W);
28152710}
28162711
2817static __inline__ short __DEFAULT_FN_ATTRS128
2712static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28182713_mm_reduce_mul_epi16(__m128i __W) {
28192714 return __builtin_reduce_mul((__v8hi)__W);
28202715}
28212716
2822static __inline__ short __DEFAULT_FN_ATTRS128
2717static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28232718_mm_reduce_and_epi16(__m128i __W) {
28242719 return __builtin_reduce_and((__v8hi)__W);
28252720}
28262721
2827static __inline__ short __DEFAULT_FN_ATTRS128
2722static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28282723_mm_reduce_or_epi16(__m128i __W) {
28292724 return __builtin_reduce_or((__v8hi)__W);
28302725}
28312726
2832static __inline__ short __DEFAULT_FN_ATTRS128
2833_mm_mask_reduce_add_epi16( __mmask8 __M, __m128i __W) {
2727static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
2728_mm_mask_reduce_add_epi16(__mmask8 __M, __m128i __W) {
28342729 __W = _mm_maskz_mov_epi16(__M, __W);
28352730 return __builtin_reduce_add((__v8hi)__W);
28362731}
28372732
2838static __inline__ short __DEFAULT_FN_ATTRS128
2839_mm_mask_reduce_mul_epi16( __mmask8 __M, __m128i __W) {
2733static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
2734_mm_mask_reduce_mul_epi16(__mmask8 __M, __m128i __W) {
28402735 __W = _mm_mask_mov_epi16(_mm_set1_epi16(1), __M, __W);
28412736 return __builtin_reduce_mul((__v8hi)__W);
28422737}
28432738
2844static __inline__ short __DEFAULT_FN_ATTRS128
2845_mm_mask_reduce_and_epi16( __mmask8 __M, __m128i __W) {
2739static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
2740_mm_mask_reduce_and_epi16(__mmask8 __M, __m128i __W) {
28462741 __W = _mm_mask_mov_epi16(_mm_set1_epi16(-1), __M, __W);
28472742 return __builtin_reduce_and((__v8hi)__W);
28482743}
28492744
2850static __inline__ short __DEFAULT_FN_ATTRS128
2745static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28512746_mm_mask_reduce_or_epi16(__mmask8 __M, __m128i __W) {
28522747 __W = _mm_maskz_mov_epi16(__M, __W);
28532748 return __builtin_reduce_or((__v8hi)__W);
28542749}
28552750
2856static __inline__ short __DEFAULT_FN_ATTRS128
2751static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28572752_mm_reduce_max_epi16(__m128i __V) {
28582753 return __builtin_reduce_max((__v8hi)__V);
28592754}
28602755
2861static __inline__ unsigned short __DEFAULT_FN_ATTRS128
2756static __inline__ unsigned short __DEFAULT_FN_ATTRS128_CONSTEXPR
28622757_mm_reduce_max_epu16(__m128i __V) {
28632758 return __builtin_reduce_max((__v8hu)__V);
28642759}
28652760
2866static __inline__ short __DEFAULT_FN_ATTRS128
2761static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28672762_mm_reduce_min_epi16(__m128i __V) {
28682763 return __builtin_reduce_min((__v8hi)__V);
28692764}
28702765
2871static __inline__ unsigned short __DEFAULT_FN_ATTRS128
2766static __inline__ unsigned short __DEFAULT_FN_ATTRS128_CONSTEXPR
28722767_mm_reduce_min_epu16(__m128i __V) {
28732768 return __builtin_reduce_min((__v8hu)__V);
28742769}
28752770
2876static __inline__ short __DEFAULT_FN_ATTRS128
2771static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28772772_mm_mask_reduce_max_epi16(__mmask16 __M, __m128i __V) {
28782773 __V = _mm_mask_mov_epi16(_mm_set1_epi16(-32767-1), __M, __V);
28792774 return __builtin_reduce_max((__v8hi)__V);
28802775}
28812776
2882static __inline__ unsigned short __DEFAULT_FN_ATTRS128
2777static __inline__ unsigned short __DEFAULT_FN_ATTRS128_CONSTEXPR
28832778_mm_mask_reduce_max_epu16(__mmask16 __M, __m128i __V) {
28842779 __V = _mm_maskz_mov_epi16(__M, __V);
28852780 return __builtin_reduce_max((__v8hu)__V);
28862781}
28872782
2888static __inline__ short __DEFAULT_FN_ATTRS128
2783static __inline__ short __DEFAULT_FN_ATTRS128_CONSTEXPR
28892784_mm_mask_reduce_min_epi16(__mmask16 __M, __m128i __V) {
28902785 __V = _mm_mask_mov_epi16(_mm_set1_epi16(32767), __M, __V);
28912786 return __builtin_reduce_min((__v8hi)__V);
28922787}
28932788
2894static __inline__ unsigned short __DEFAULT_FN_ATTRS128
2789static __inline__ unsigned short __DEFAULT_FN_ATTRS128_CONSTEXPR
28952790_mm_mask_reduce_min_epu16(__mmask16 __M, __m128i __V) {
28962791 __V = _mm_mask_mov_epi16(_mm_set1_epi16(-1), __M, __V);
28972792 return __builtin_reduce_min((__v8hu)__V);
28982793}
28992794
2900static __inline__ short __DEFAULT_FN_ATTRS256
2795static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29012796_mm256_reduce_add_epi16(__m256i __W) {
29022797 return __builtin_reduce_add((__v16hi)__W);
29032798}
29042799
2905static __inline__ short __DEFAULT_FN_ATTRS256
2800static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29062801_mm256_reduce_mul_epi16(__m256i __W) {
29072802 return __builtin_reduce_mul((__v16hi)__W);
29082803}
29092804
2910static __inline__ short __DEFAULT_FN_ATTRS256
2805static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29112806_mm256_reduce_and_epi16(__m256i __W) {
29122807 return __builtin_reduce_and((__v16hi)__W);
29132808}
29142809
2915static __inline__ short __DEFAULT_FN_ATTRS256
2810static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29162811_mm256_reduce_or_epi16(__m256i __W) {
29172812 return __builtin_reduce_or((__v16hi)__W);
29182813}
29192814
2920static __inline__ short __DEFAULT_FN_ATTRS256
2921_mm256_mask_reduce_add_epi16( __mmask16 __M, __m256i __W) {
2815static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
2816_mm256_mask_reduce_add_epi16(__mmask16 __M, __m256i __W) {
29222817 __W = _mm256_maskz_mov_epi16(__M, __W);
29232818 return __builtin_reduce_add((__v16hi)__W);
29242819}
29252820
2926static __inline__ short __DEFAULT_FN_ATTRS256
2927_mm256_mask_reduce_mul_epi16( __mmask16 __M, __m256i __W) {
2821static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
2822_mm256_mask_reduce_mul_epi16(__mmask16 __M, __m256i __W) {
29282823 __W = _mm256_mask_mov_epi16(_mm256_set1_epi16(1), __M, __W);
29292824 return __builtin_reduce_mul((__v16hi)__W);
29302825}
29312826
2932static __inline__ short __DEFAULT_FN_ATTRS256
2933_mm256_mask_reduce_and_epi16( __mmask16 __M, __m256i __W) {
2827static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
2828_mm256_mask_reduce_and_epi16(__mmask16 __M, __m256i __W) {
29342829 __W = _mm256_mask_mov_epi16(_mm256_set1_epi16(-1), __M, __W);
29352830 return __builtin_reduce_and((__v16hi)__W);
29362831}
29372832
2938static __inline__ short __DEFAULT_FN_ATTRS256
2833static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29392834_mm256_mask_reduce_or_epi16(__mmask16 __M, __m256i __W) {
29402835 __W = _mm256_maskz_mov_epi16(__M, __W);
29412836 return __builtin_reduce_or((__v16hi)__W);
29422837}
29432838
2944static __inline__ short __DEFAULT_FN_ATTRS256
2839static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29452840_mm256_reduce_max_epi16(__m256i __V) {
29462841 return __builtin_reduce_max((__v16hi)__V);
29472842}
29482843
2949static __inline__ unsigned short __DEFAULT_FN_ATTRS256
2844static __inline__ unsigned short __DEFAULT_FN_ATTRS256_CONSTEXPR
29502845_mm256_reduce_max_epu16(__m256i __V) {
29512846 return __builtin_reduce_max((__v16hu)__V);
29522847}
29532848
2954static __inline__ short __DEFAULT_FN_ATTRS256
2849static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29552850_mm256_reduce_min_epi16(__m256i __V) {
29562851 return __builtin_reduce_min((__v16hi)__V);
29572852}
29582853
2959static __inline__ unsigned short __DEFAULT_FN_ATTRS256
2854static __inline__ unsigned short __DEFAULT_FN_ATTRS256_CONSTEXPR
29602855_mm256_reduce_min_epu16(__m256i __V) {
29612856 return __builtin_reduce_min((__v16hu)__V);
29622857}
29632858
2964static __inline__ short __DEFAULT_FN_ATTRS256
2859static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29652860_mm256_mask_reduce_max_epi16(__mmask16 __M, __m256i __V) {
29662861 __V = _mm256_mask_mov_epi16(_mm256_set1_epi16(-32767-1), __M, __V);
29672862 return __builtin_reduce_max((__v16hi)__V);
29682863}
29692864
2970static __inline__ unsigned short __DEFAULT_FN_ATTRS256
2865static __inline__ unsigned short __DEFAULT_FN_ATTRS256_CONSTEXPR
29712866_mm256_mask_reduce_max_epu16(__mmask16 __M, __m256i __V) {
29722867 __V = _mm256_maskz_mov_epi16(__M, __V);
29732868 return __builtin_reduce_max((__v16hu)__V);
29742869}
29752870
2976static __inline__ short __DEFAULT_FN_ATTRS256
2871static __inline__ short __DEFAULT_FN_ATTRS256_CONSTEXPR
29772872_mm256_mask_reduce_min_epi16(__mmask16 __M, __m256i __V) {
29782873 __V = _mm256_mask_mov_epi16(_mm256_set1_epi16(32767), __M, __V);
29792874 return __builtin_reduce_min((__v16hi)__V);
29802875}
29812876
2982static __inline__ unsigned short __DEFAULT_FN_ATTRS256
2877static __inline__ unsigned short __DEFAULT_FN_ATTRS256_CONSTEXPR
29832878_mm256_mask_reduce_min_epu16(__mmask16 __M, __m256i __V) {
29842879 __V = _mm256_mask_mov_epi16(_mm256_set1_epi16(-1), __M, __V);
29852880 return __builtin_reduce_min((__v16hu)__V);
29862881}
29872882
2988static __inline__ signed char __DEFAULT_FN_ATTRS128
2883static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
29892884_mm_reduce_add_epi8(__m128i __W) {
29902885 return __builtin_reduce_add((__v16qs)__W);
29912886}
29922887
2993static __inline__ signed char __DEFAULT_FN_ATTRS128
2888static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
29942889_mm_reduce_mul_epi8(__m128i __W) {
29952890 return __builtin_reduce_mul((__v16qs)__W);
29962891}
29972892
2998static __inline__ signed char __DEFAULT_FN_ATTRS128
2893static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
29992894_mm_reduce_and_epi8(__m128i __W) {
30002895 return __builtin_reduce_and((__v16qs)__W);
30012896}
30022897
3003static __inline__ signed char __DEFAULT_FN_ATTRS128
2898static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30042899_mm_reduce_or_epi8(__m128i __W) {
30052900 return __builtin_reduce_or((__v16qs)__W);
30062901}
30072902
3008static __inline__ signed char __DEFAULT_FN_ATTRS128
2903static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30092904_mm_mask_reduce_add_epi8(__mmask16 __M, __m128i __W) {
30102905 __W = _mm_maskz_mov_epi8(__M, __W);
30112906 return __builtin_reduce_add((__v16qs)__W);
30122907}
30132908
3014static __inline__ signed char __DEFAULT_FN_ATTRS128
2909static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30152910_mm_mask_reduce_mul_epi8(__mmask16 __M, __m128i __W) {
30162911 __W = _mm_mask_mov_epi8(_mm_set1_epi8(1), __M, __W);
30172912 return __builtin_reduce_mul((__v16qs)__W);
30182913}
30192914
3020static __inline__ signed char __DEFAULT_FN_ATTRS128
2915static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30212916_mm_mask_reduce_and_epi8(__mmask16 __M, __m128i __W) {
30222917 __W = _mm_mask_mov_epi8(_mm_set1_epi8(-1), __M, __W);
30232918 return __builtin_reduce_and((__v16qs)__W);
30242919}
30252920
3026static __inline__ signed char __DEFAULT_FN_ATTRS128
2921static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30272922_mm_mask_reduce_or_epi8(__mmask16 __M, __m128i __W) {
30282923 __W = _mm_maskz_mov_epi8(__M, __W);
30292924 return __builtin_reduce_or((__v16qs)__W);
30302925}
30312926
3032static __inline__ signed char __DEFAULT_FN_ATTRS128
2927static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30332928_mm_reduce_max_epi8(__m128i __V) {
30342929 return __builtin_reduce_max((__v16qs)__V);
30352930}
30362931
3037static __inline__ unsigned char __DEFAULT_FN_ATTRS128
2932static __inline__ unsigned char __DEFAULT_FN_ATTRS128_CONSTEXPR
30382933_mm_reduce_max_epu8(__m128i __V) {
30392934 return __builtin_reduce_max((__v16qu)__V);
30402935}
30412936
3042static __inline__ signed char __DEFAULT_FN_ATTRS128
2937static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30432938_mm_reduce_min_epi8(__m128i __V) {
30442939 return __builtin_reduce_min((__v16qs)__V);
30452940}
30462941
3047static __inline__ unsigned char __DEFAULT_FN_ATTRS128
2942static __inline__ unsigned char __DEFAULT_FN_ATTRS128_CONSTEXPR
30482943_mm_reduce_min_epu8(__m128i __V) {
30492944 return __builtin_reduce_min((__v16qu)__V);
30502945}
30512946
3052static __inline__ signed char __DEFAULT_FN_ATTRS128
2947static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30532948_mm_mask_reduce_max_epi8(__mmask16 __M, __m128i __V) {
30542949 __V = _mm_mask_mov_epi8(_mm_set1_epi8(-127-1), __M, __V);
30552950 return __builtin_reduce_max((__v16qs)__V);
30562951}
30572952
3058static __inline__ unsigned char __DEFAULT_FN_ATTRS128
2953static __inline__ unsigned char __DEFAULT_FN_ATTRS128_CONSTEXPR
30592954_mm_mask_reduce_max_epu8(__mmask16 __M, __m128i __V) {
30602955 __V = _mm_maskz_mov_epi8(__M, __V);
30612956 return __builtin_reduce_max((__v16qu)__V);
30622957}
30632958
3064static __inline__ signed char __DEFAULT_FN_ATTRS128
2959static __inline__ signed char __DEFAULT_FN_ATTRS128_CONSTEXPR
30652960_mm_mask_reduce_min_epi8(__mmask16 __M, __m128i __V) {
30662961 __V = _mm_mask_mov_epi8(_mm_set1_epi8(127), __M, __V);
30672962 return __builtin_reduce_min((__v16qs)__V);
30682963}
30692964
3070static __inline__ unsigned char __DEFAULT_FN_ATTRS128
2965static __inline__ unsigned char __DEFAULT_FN_ATTRS128_CONSTEXPR
30712966_mm_mask_reduce_min_epu8(__mmask16 __M, __m128i __V) {
30722967 __V = _mm_mask_mov_epi8(_mm_set1_epi8(-1), __M, __V);
30732968 return __builtin_reduce_min((__v16qu)__V);
30742969}
30752970
3076static __inline__ signed char __DEFAULT_FN_ATTRS256
2971static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
30772972_mm256_reduce_add_epi8(__m256i __W) {
30782973 return __builtin_reduce_add((__v32qs)__W);
30792974}
30802975
3081static __inline__ signed char __DEFAULT_FN_ATTRS256
2976static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
30822977_mm256_reduce_mul_epi8(__m256i __W) {
30832978 return __builtin_reduce_mul((__v32qs)__W);
30842979}
30852980
3086static __inline__ signed char __DEFAULT_FN_ATTRS256
2981static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
30872982_mm256_reduce_and_epi8(__m256i __W) {
30882983 return __builtin_reduce_and((__v32qs)__W);
30892984}
30902985
3091static __inline__ signed char __DEFAULT_FN_ATTRS256
2986static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
30922987_mm256_reduce_or_epi8(__m256i __W) {
30932988 return __builtin_reduce_or((__v32qs)__W);
30942989}
30952990
3096static __inline__ signed char __DEFAULT_FN_ATTRS256
2991static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
30972992_mm256_mask_reduce_add_epi8(__mmask32 __M, __m256i __W) {
30982993 __W = _mm256_maskz_mov_epi8(__M, __W);
30992994 return __builtin_reduce_add((__v32qs)__W);
31002995}
31012996
3102static __inline__ signed char __DEFAULT_FN_ATTRS256
2997static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31032998_mm256_mask_reduce_mul_epi8(__mmask32 __M, __m256i __W) {
31042999 __W = _mm256_mask_mov_epi8(_mm256_set1_epi8(1), __M, __W);
31053000 return __builtin_reduce_mul((__v32qs)__W);
31063001}
31073002
3108static __inline__ signed char __DEFAULT_FN_ATTRS256
3003static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31093004_mm256_mask_reduce_and_epi8(__mmask32 __M, __m256i __W) {
31103005 __W = _mm256_mask_mov_epi8(_mm256_set1_epi8(-1), __M, __W);
31113006 return __builtin_reduce_and((__v32qs)__W);
31123007}
31133008
3114static __inline__ signed char __DEFAULT_FN_ATTRS256
3009static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31153010_mm256_mask_reduce_or_epi8(__mmask32 __M, __m256i __W) {
31163011 __W = _mm256_maskz_mov_epi8(__M, __W);
31173012 return __builtin_reduce_or((__v32qs)__W);
31183013}
31193014
3120static __inline__ signed char __DEFAULT_FN_ATTRS256
3015static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31213016_mm256_reduce_max_epi8(__m256i __V) {
31223017 return __builtin_reduce_max((__v32qs)__V);
31233018}
31243019
3125static __inline__ unsigned char __DEFAULT_FN_ATTRS256
3020static __inline__ unsigned char __DEFAULT_FN_ATTRS256_CONSTEXPR
31263021_mm256_reduce_max_epu8(__m256i __V) {
31273022 return __builtin_reduce_max((__v32qu)__V);
31283023}
31293024
3130static __inline__ signed char __DEFAULT_FN_ATTRS256
3025static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31313026_mm256_reduce_min_epi8(__m256i __V) {
31323027 return __builtin_reduce_min((__v32qs)__V);
31333028}
31343029
3135static __inline__ unsigned char __DEFAULT_FN_ATTRS256
3030static __inline__ unsigned char __DEFAULT_FN_ATTRS256_CONSTEXPR
31363031_mm256_reduce_min_epu8(__m256i __V) {
31373032 return __builtin_reduce_min((__v32qu)__V);
31383033}
31393034
3140static __inline__ signed char __DEFAULT_FN_ATTRS256
3035static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31413036_mm256_mask_reduce_max_epi8(__mmask32 __M, __m256i __V) {
31423037 __V = _mm256_mask_mov_epi8(_mm256_set1_epi8(-127-1), __M, __V);
31433038 return __builtin_reduce_max((__v32qs)__V);
31443039}
31453040
3146static __inline__ unsigned char __DEFAULT_FN_ATTRS256
3041static __inline__ unsigned char __DEFAULT_FN_ATTRS256_CONSTEXPR
31473042_mm256_mask_reduce_max_epu8(__mmask32 __M, __m256i __V) {
31483043 __V = _mm256_maskz_mov_epi8(__M, __V);
31493044 return __builtin_reduce_max((__v32qu)__V);
31503045}
31513046
3152static __inline__ signed char __DEFAULT_FN_ATTRS256
3047static __inline__ signed char __DEFAULT_FN_ATTRS256_CONSTEXPR
31533048_mm256_mask_reduce_min_epi8(__mmask32 __M, __m256i __V) {
31543049 __V = _mm256_mask_mov_epi8(_mm256_set1_epi8(127), __M, __V);
31553050 return __builtin_reduce_min((__v32qs)__V);
31563051}
31573052
3158static __inline__ unsigned char __DEFAULT_FN_ATTRS256
3053static __inline__ unsigned char __DEFAULT_FN_ATTRS256_CONSTEXPR
31593054_mm256_mask_reduce_min_epu8(__mmask32 __M, __m256i __V) {
31603055 __V = _mm256_mask_mov_epi8(_mm256_set1_epi8(-1), __M, __V);
31613056 return __builtin_reduce_min((__v32qu)__V);
......@@ -3163,5 +3058,7 @@ _mm256_mask_reduce_min_epu8(__mmask32 __M, __m256i __V) {
31633058
31643059#undef __DEFAULT_FN_ATTRS128
31653060#undef __DEFAULT_FN_ATTRS256
3061#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
3062#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
31663063
31673064#endif /* __AVX512VLBWINTRIN_H */
lib/include/avx512vlcdintrin.h+74-102
......@@ -14,211 +14,183 @@
1414#define __AVX512VLCDINTRIN_H
1515
1616/* Define the default attributes for the functions in this file. */
17#if defined(__cplusplus) && (__cplusplus >= 201103L)
1718#define __DEFAULT_FN_ATTRS128 \
1819 __attribute__((__always_inline__, __nodebug__, \
19 __target__("avx512vl,avx512cd,no-evex512"), \
20 __min_vector_width__(128)))
20 __target__("avx512vl,avx512cd"), \
21 __min_vector_width__(128))) constexpr
2122#define __DEFAULT_FN_ATTRS256 \
2223 __attribute__((__always_inline__, __nodebug__, \
23 __target__("avx512vl,avx512cd,no-evex512"), \
24 __min_vector_width__(256)))
24 __target__("avx512vl,avx512cd"), \
25 __min_vector_width__(256))) constexpr
26#else
27#define __DEFAULT_FN_ATTRS128 \
28 __attribute__((__always_inline__, __nodebug__, \
29 __target__("avx512vl,avx512cd"), __min_vector_width__(128)))
30#define __DEFAULT_FN_ATTRS256 \
31 __attribute__((__always_inline__, __nodebug__, \
32 __target__("avx512vl,avx512cd"), __min_vector_width__(256)))
33#endif
2534
2635static __inline__ __m128i __DEFAULT_FN_ATTRS128
27_mm_broadcastmb_epi64 (__mmask8 __A)
28{
36_mm_broadcastmb_epi64(__mmask8 __A) {
2937 return (__m128i) _mm_set1_epi64x((long long) __A);
3038}
3139
3240static __inline__ __m256i __DEFAULT_FN_ATTRS256
33_mm256_broadcastmb_epi64 (__mmask8 __A)
34{
35 return (__m256i) _mm256_set1_epi64x((long long)__A);
41_mm256_broadcastmb_epi64(__mmask8 __A) {
42 return (__m256i)_mm256_set1_epi64x((long long)__A);
3643}
3744
3845static __inline__ __m128i __DEFAULT_FN_ATTRS128
39_mm_broadcastmw_epi32 (__mmask16 __A)
40{
46_mm_broadcastmw_epi32(__mmask16 __A) {
4147 return (__m128i) _mm_set1_epi32((int)__A);
4248}
4349
4450static __inline__ __m256i __DEFAULT_FN_ATTRS256
45_mm256_broadcastmw_epi32 (__mmask16 __A)
46{
51_mm256_broadcastmw_epi32(__mmask16 __A) {
4752 return (__m256i) _mm256_set1_epi32((int)__A);
4853}
4954
50
5155static __inline__ __m128i __DEFAULT_FN_ATTRS128
52_mm_conflict_epi64 (__m128i __A)
53{
54 return (__m128i) __builtin_ia32_vpconflictdi_128 ((__v2di) __A);
56_mm_conflict_epi64(__m128i __A) {
57 return (__m128i)__builtin_ia32_vpconflictdi_128((__v2di)__A);
5558}
5659
5760static __inline__ __m128i __DEFAULT_FN_ATTRS128
58_mm_mask_conflict_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
59{
60 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
61 (__v2di)_mm_conflict_epi64(__A),
62 (__v2di)__W);
61_mm_mask_conflict_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
62 return (__m128i)__builtin_ia32_selectq_128(
63 (__mmask8)__U, (__v2di)_mm_conflict_epi64(__A), (__v2di)__W);
6364}
6465
6566static __inline__ __m128i __DEFAULT_FN_ATTRS128
66_mm_maskz_conflict_epi64 (__mmask8 __U, __m128i __A)
67{
67_mm_maskz_conflict_epi64(__mmask8 __U, __m128i __A) {
6868 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
6969 (__v2di)_mm_conflict_epi64(__A),
7070 (__v2di)_mm_setzero_si128());
7171}
7272
7373static __inline__ __m256i __DEFAULT_FN_ATTRS256
74_mm256_conflict_epi64 (__m256i __A)
75{
76 return (__m256i) __builtin_ia32_vpconflictdi_256 ((__v4di) __A);
74_mm256_conflict_epi64(__m256i __A) {
75 return (__m256i)__builtin_ia32_vpconflictdi_256((__v4di)__A);
7776}
7877
7978static __inline__ __m256i __DEFAULT_FN_ATTRS256
80_mm256_mask_conflict_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
81{
82 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
83 (__v4di)_mm256_conflict_epi64(__A),
84 (__v4di)__W);
79_mm256_mask_conflict_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
80 return (__m256i)__builtin_ia32_selectq_256(
81 (__mmask8)__U, (__v4di)_mm256_conflict_epi64(__A), (__v4di)__W);
8582}
8683
8784static __inline__ __m256i __DEFAULT_FN_ATTRS256
88_mm256_maskz_conflict_epi64 (__mmask8 __U, __m256i __A)
89{
85_mm256_maskz_conflict_epi64(__mmask8 __U, __m256i __A) {
9086 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
9187 (__v4di)_mm256_conflict_epi64(__A),
9288 (__v4di)_mm256_setzero_si256());
9389}
9490
9591static __inline__ __m128i __DEFAULT_FN_ATTRS128
96_mm_conflict_epi32 (__m128i __A)
97{
98 return (__m128i) __builtin_ia32_vpconflictsi_128 ((__v4si) __A);
92_mm_conflict_epi32(__m128i __A) {
93 return (__m128i)__builtin_ia32_vpconflictsi_128((__v4si)__A);
9994}
10095
10196static __inline__ __m128i __DEFAULT_FN_ATTRS128
102_mm_mask_conflict_epi32 (__m128i __W, __mmask8 __U, __m128i __A)
103{
104 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
105 (__v4si)_mm_conflict_epi32(__A),
106 (__v4si)__W);
97_mm_mask_conflict_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
98 return (__m128i)__builtin_ia32_selectd_128(
99 (__mmask8)__U, (__v4si)_mm_conflict_epi32(__A), (__v4si)__W);
107100}
108101
109102static __inline__ __m128i __DEFAULT_FN_ATTRS128
110_mm_maskz_conflict_epi32 (__mmask8 __U, __m128i __A)
111{
103_mm_maskz_conflict_epi32(__mmask8 __U, __m128i __A) {
112104 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
113105 (__v4si)_mm_conflict_epi32(__A),
114106 (__v4si)_mm_setzero_si128());
115107}
116108
117109static __inline__ __m256i __DEFAULT_FN_ATTRS256
118_mm256_conflict_epi32 (__m256i __A)
119{
120 return (__m256i) __builtin_ia32_vpconflictsi_256 ((__v8si) __A);
110_mm256_conflict_epi32(__m256i __A) {
111 return (__m256i)__builtin_ia32_vpconflictsi_256((__v8si)__A);
121112}
122113
123114static __inline__ __m256i __DEFAULT_FN_ATTRS256
124_mm256_mask_conflict_epi32 (__m256i __W, __mmask8 __U, __m256i __A)
125{
126 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
127 (__v8si)_mm256_conflict_epi32(__A),
128 (__v8si)__W);
115_mm256_mask_conflict_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
116 return (__m256i)__builtin_ia32_selectd_256(
117 (__mmask8)__U, (__v8si)_mm256_conflict_epi32(__A), (__v8si)__W);
129118}
130119
131120static __inline__ __m256i __DEFAULT_FN_ATTRS256
132_mm256_maskz_conflict_epi32 (__mmask8 __U, __m256i __A)
133{
121_mm256_maskz_conflict_epi32(__mmask8 __U, __m256i __A) {
134122 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
135123 (__v8si)_mm256_conflict_epi32(__A),
136124 (__v8si)_mm256_setzero_si256());
137125}
138126
139static __inline__ __m128i __DEFAULT_FN_ATTRS128
140_mm_lzcnt_epi32 (__m128i __A)
141{
142 return (__m128i) __builtin_ia32_vplzcntd_128 ((__v4si) __A);
127static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_lzcnt_epi32(__m128i __A) {
128 return (__m128i)__builtin_elementwise_clzg((__v4si)__A,
129 (__v4si)_mm_set1_epi32(32));
143130}
144131
145132static __inline__ __m128i __DEFAULT_FN_ATTRS128
146_mm_mask_lzcnt_epi32 (__m128i __W, __mmask8 __U, __m128i __A)
147{
148 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
149 (__v4si)_mm_lzcnt_epi32(__A),
150 (__v4si)__W);
133_mm_mask_lzcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
134 return (__m128i)__builtin_ia32_selectd_128(
135 (__mmask8)__U, (__v4si)_mm_lzcnt_epi32(__A), (__v4si)__W);
151136}
152137
153138static __inline__ __m128i __DEFAULT_FN_ATTRS128
154_mm_maskz_lzcnt_epi32 (__mmask8 __U, __m128i __A)
155{
156 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
157 (__v4si)_mm_lzcnt_epi32(__A),
158 (__v4si)_mm_setzero_si128());
139_mm_maskz_lzcnt_epi32(__mmask8 __U, __m128i __A) {
140 return (__m128i)__builtin_ia32_selectd_128(
141 (__mmask8)__U, (__v4si)_mm_lzcnt_epi32(__A), (__v4si)_mm_setzero_si128());
159142}
160143
161144static __inline__ __m256i __DEFAULT_FN_ATTRS256
162_mm256_lzcnt_epi32 (__m256i __A)
163{
164 return (__m256i) __builtin_ia32_vplzcntd_256 ((__v8si) __A);
145_mm256_lzcnt_epi32(__m256i __A) {
146 return (__m256i)__builtin_elementwise_clzg((__v8si)__A,
147 (__v8si)_mm256_set1_epi32(32));
165148}
166149
167150static __inline__ __m256i __DEFAULT_FN_ATTRS256
168_mm256_mask_lzcnt_epi32 (__m256i __W, __mmask8 __U, __m256i __A)
169{
170 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
171 (__v8si)_mm256_lzcnt_epi32(__A),
172 (__v8si)__W);
151_mm256_mask_lzcnt_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
152 return (__m256i)__builtin_ia32_selectd_256(
153 (__mmask8)__U, (__v8si)_mm256_lzcnt_epi32(__A), (__v8si)__W);
173154}
174155
175156static __inline__ __m256i __DEFAULT_FN_ATTRS256
176_mm256_maskz_lzcnt_epi32 (__mmask8 __U, __m256i __A)
177{
157_mm256_maskz_lzcnt_epi32(__mmask8 __U, __m256i __A) {
178158 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
179159 (__v8si)_mm256_lzcnt_epi32(__A),
180160 (__v8si)_mm256_setzero_si256());
181161}
182162
183static __inline__ __m128i __DEFAULT_FN_ATTRS128
184_mm_lzcnt_epi64 (__m128i __A)
185{
186 return (__m128i) __builtin_ia32_vplzcntq_128 ((__v2di) __A);
163static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_lzcnt_epi64(__m128i __A) {
164 return (__m128i)__builtin_elementwise_clzg(
165 (__v2di)__A, (__v2di)_mm_set1_epi64x((long long)64));
187166}
188167
189168static __inline__ __m128i __DEFAULT_FN_ATTRS128
190_mm_mask_lzcnt_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
191{
192 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
193 (__v2di)_mm_lzcnt_epi64(__A),
194 (__v2di)__W);
169_mm_mask_lzcnt_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
170 return (__m128i)__builtin_ia32_selectq_128(
171 (__mmask8)__U, (__v2di)_mm_lzcnt_epi64(__A), (__v2di)__W);
195172}
196173
197174static __inline__ __m128i __DEFAULT_FN_ATTRS128
198_mm_maskz_lzcnt_epi64 (__mmask8 __U, __m128i __A)
199{
200 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
201 (__v2di)_mm_lzcnt_epi64(__A),
202 (__v2di)_mm_setzero_si128());
175_mm_maskz_lzcnt_epi64(__mmask8 __U, __m128i __A) {
176 return (__m128i)__builtin_ia32_selectq_128(
177 (__mmask8)__U, (__v2di)_mm_lzcnt_epi64(__A), (__v2di)_mm_setzero_si128());
203178}
204179
205180static __inline__ __m256i __DEFAULT_FN_ATTRS256
206_mm256_lzcnt_epi64 (__m256i __A)
207{
208 return (__m256i) __builtin_ia32_vplzcntq_256 ((__v4di) __A);
181_mm256_lzcnt_epi64(__m256i __A) {
182 return (__m256i)__builtin_elementwise_clzg(
183 (__v4di)__A, (__v4di)_mm256_set1_epi64x((long long)64));
209184}
210185
211186static __inline__ __m256i __DEFAULT_FN_ATTRS256
212_mm256_mask_lzcnt_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
213{
214 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
215 (__v4di)_mm256_lzcnt_epi64(__A),
216 (__v4di)__W);
187_mm256_mask_lzcnt_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
188 return (__m256i)__builtin_ia32_selectq_256(
189 (__mmask8)__U, (__v4di)_mm256_lzcnt_epi64(__A), (__v4di)__W);
217190}
218191
219192static __inline__ __m256i __DEFAULT_FN_ATTRS256
220_mm256_maskz_lzcnt_epi64 (__mmask8 __U, __m256i __A)
221{
193_mm256_maskz_lzcnt_epi64(__mmask8 __U, __m256i __A) {
222194 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
223195 (__v4di)_mm256_lzcnt_epi64(__A),
224196 (__v4di)_mm256_setzero_si256());
lib/include/avx512vldqintrin.h+110-127
......@@ -17,45 +17,51 @@
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS128 \
1919 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vl,avx512dq,no-evex512"), \
21 __min_vector_width__(128)))
20 __target__("avx512vl,avx512dq"), __min_vector_width__(128)))
2221#define __DEFAULT_FN_ATTRS256 \
2322 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vl,avx512dq,no-evex512"), \
25 __min_vector_width__(256)))
23 __target__("avx512vl,avx512dq"), __min_vector_width__(256)))
24
25#if defined(__cplusplus) && (__cplusplus >= 201103L)
26#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
27#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
28#else
29#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
30#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
31#endif
2632
27static __inline__ __m256i __DEFAULT_FN_ATTRS256
28_mm256_mullo_epi64 (__m256i __A, __m256i __B) {
33static __inline__ __m256i __DEFAULT_FN_ATTRS128_CONSTEXPR
34_mm256_mullo_epi64(__m256i __A, __m256i __B) {
2935 return (__m256i) ((__v4du) __A * (__v4du) __B);
3036}
3137
32static __inline__ __m256i __DEFAULT_FN_ATTRS256
38static __inline__ __m256i __DEFAULT_FN_ATTRS128_CONSTEXPR
3339_mm256_mask_mullo_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
3440 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
3541 (__v4di)_mm256_mullo_epi64(__A, __B),
3642 (__v4di)__W);
3743}
3844
39static __inline__ __m256i __DEFAULT_FN_ATTRS256
45static __inline__ __m256i __DEFAULT_FN_ATTRS128_CONSTEXPR
4046_mm256_maskz_mullo_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
4147 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
4248 (__v4di)_mm256_mullo_epi64(__A, __B),
4349 (__v4di)_mm256_setzero_si256());
4450}
4551
46static __inline__ __m128i __DEFAULT_FN_ATTRS128
47_mm_mullo_epi64 (__m128i __A, __m128i __B) {
52static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
53_mm_mullo_epi64(__m128i __A, __m128i __B) {
4854 return (__m128i) ((__v2du) __A * (__v2du) __B);
4955}
5056
51static __inline__ __m128i __DEFAULT_FN_ATTRS128
57static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5258_mm_mask_mullo_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
5359 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
5460 (__v2di)_mm_mullo_epi64(__A, __B),
5561 (__v2di)__W);
5662}
5763
58static __inline__ __m128i __DEFAULT_FN_ATTRS128
64static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5965_mm_maskz_mullo_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
6066 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
6167 (__v2di)_mm_mullo_epi64(__A, __B),
......@@ -454,39 +460,39 @@ _mm256_maskz_cvtps_epu64 (__mmask8 __U, __m128 __A) {
454460 (__mmask8) __U);
455461}
456462
457static __inline__ __m128d __DEFAULT_FN_ATTRS128
458_mm_cvtepi64_pd (__m128i __A) {
463static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
464_mm_cvtepi64_pd(__m128i __A) {
459465 return (__m128d)__builtin_convertvector((__v2di)__A, __v2df);
460466}
461467
462static __inline__ __m128d __DEFAULT_FN_ATTRS128
463_mm_mask_cvtepi64_pd (__m128d __W, __mmask8 __U, __m128i __A) {
468static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
469_mm_mask_cvtepi64_pd(__m128d __W, __mmask8 __U, __m128i __A) {
464470 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
465471 (__v2df)_mm_cvtepi64_pd(__A),
466472 (__v2df)__W);
467473}
468474
469static __inline__ __m128d __DEFAULT_FN_ATTRS128
470_mm_maskz_cvtepi64_pd (__mmask8 __U, __m128i __A) {
475static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
476_mm_maskz_cvtepi64_pd(__mmask8 __U, __m128i __A) {
471477 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
472478 (__v2df)_mm_cvtepi64_pd(__A),
473479 (__v2df)_mm_setzero_pd());
474480}
475481
476static __inline__ __m256d __DEFAULT_FN_ATTRS256
477_mm256_cvtepi64_pd (__m256i __A) {
482static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
483_mm256_cvtepi64_pd(__m256i __A) {
478484 return (__m256d)__builtin_convertvector((__v4di)__A, __v4df);
479485}
480486
481static __inline__ __m256d __DEFAULT_FN_ATTRS256
482_mm256_mask_cvtepi64_pd (__m256d __W, __mmask8 __U, __m256i __A) {
487static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
488_mm256_mask_cvtepi64_pd(__m256d __W, __mmask8 __U, __m256i __A) {
483489 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
484490 (__v4df)_mm256_cvtepi64_pd(__A),
485491 (__v4df)__W);
486492}
487493
488static __inline__ __m256d __DEFAULT_FN_ATTRS256
489_mm256_maskz_cvtepi64_pd (__mmask8 __U, __m256i __A) {
494static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
495_mm256_maskz_cvtepi64_pd(__mmask8 __U, __m256i __A) {
490496 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
491497 (__v4df)_mm256_cvtepi64_pd(__A),
492498 (__v4df)_mm256_setzero_pd());
......@@ -513,20 +519,20 @@ _mm_maskz_cvtepi64_ps (__mmask8 __U, __m128i __A) {
513519 (__mmask8) __U);
514520}
515521
516static __inline__ __m128 __DEFAULT_FN_ATTRS256
517_mm256_cvtepi64_ps (__m256i __A) {
522static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
523_mm256_cvtepi64_ps(__m256i __A) {
518524 return (__m128)__builtin_convertvector((__v4di)__A, __v4sf);
519525}
520526
521static __inline__ __m128 __DEFAULT_FN_ATTRS256
522_mm256_mask_cvtepi64_ps (__m128 __W, __mmask8 __U, __m256i __A) {
527static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
528_mm256_mask_cvtepi64_ps(__m128 __W, __mmask8 __U, __m256i __A) {
523529 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
524530 (__v4sf)_mm256_cvtepi64_ps(__A),
525531 (__v4sf)__W);
526532}
527533
528static __inline__ __m128 __DEFAULT_FN_ATTRS256
529_mm256_maskz_cvtepi64_ps (__mmask8 __U, __m256i __A) {
534static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
535_mm256_maskz_cvtepi64_ps(__mmask8 __U, __m256i __A) {
530536 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
531537 (__v4sf)_mm256_cvtepi64_ps(__A),
532538 (__v4sf)_mm_setzero_ps());
......@@ -700,39 +706,39 @@ _mm256_maskz_cvttps_epu64 (__mmask8 __U, __m128 __A) {
700706 (__mmask8) __U);
701707}
702708
703static __inline__ __m128d __DEFAULT_FN_ATTRS128
704_mm_cvtepu64_pd (__m128i __A) {
709static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
710_mm_cvtepu64_pd(__m128i __A) {
705711 return (__m128d)__builtin_convertvector((__v2du)__A, __v2df);
706712}
707713
708static __inline__ __m128d __DEFAULT_FN_ATTRS128
709_mm_mask_cvtepu64_pd (__m128d __W, __mmask8 __U, __m128i __A) {
714static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
715_mm_mask_cvtepu64_pd(__m128d __W, __mmask8 __U, __m128i __A) {
710716 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
711717 (__v2df)_mm_cvtepu64_pd(__A),
712718 (__v2df)__W);
713719}
714720
715static __inline__ __m128d __DEFAULT_FN_ATTRS128
716_mm_maskz_cvtepu64_pd (__mmask8 __U, __m128i __A) {
721static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
722_mm_maskz_cvtepu64_pd(__mmask8 __U, __m128i __A) {
717723 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
718724 (__v2df)_mm_cvtepu64_pd(__A),
719725 (__v2df)_mm_setzero_pd());
720726}
721727
722static __inline__ __m256d __DEFAULT_FN_ATTRS256
723_mm256_cvtepu64_pd (__m256i __A) {
728static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
729_mm256_cvtepu64_pd(__m256i __A) {
724730 return (__m256d)__builtin_convertvector((__v4du)__A, __v4df);
725731}
726732
727static __inline__ __m256d __DEFAULT_FN_ATTRS256
728_mm256_mask_cvtepu64_pd (__m256d __W, __mmask8 __U, __m256i __A) {
733static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
734_mm256_mask_cvtepu64_pd(__m256d __W, __mmask8 __U, __m256i __A) {
729735 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
730736 (__v4df)_mm256_cvtepu64_pd(__A),
731737 (__v4df)__W);
732738}
733739
734static __inline__ __m256d __DEFAULT_FN_ATTRS256
735_mm256_maskz_cvtepu64_pd (__mmask8 __U, __m256i __A) {
740static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
741_mm256_maskz_cvtepu64_pd(__mmask8 __U, __m256i __A) {
736742 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
737743 (__v4df)_mm256_cvtepu64_pd(__A),
738744 (__v4df)_mm256_setzero_pd());
......@@ -759,20 +765,20 @@ _mm_maskz_cvtepu64_ps (__mmask8 __U, __m128i __A) {
759765 (__mmask8) __U);
760766}
761767
762static __inline__ __m128 __DEFAULT_FN_ATTRS256
763_mm256_cvtepu64_ps (__m256i __A) {
768static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
769_mm256_cvtepu64_ps(__m256i __A) {
764770 return (__m128)__builtin_convertvector((__v4du)__A, __v4sf);
765771}
766772
767static __inline__ __m128 __DEFAULT_FN_ATTRS256
768_mm256_mask_cvtepu64_ps (__m128 __W, __mmask8 __U, __m256i __A) {
773static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
774_mm256_mask_cvtepu64_ps(__m128 __W, __mmask8 __U, __m256i __A) {
769775 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
770776 (__v4sf)_mm256_cvtepu64_ps(__A),
771777 (__v4sf)__W);
772778}
773779
774static __inline__ __m128 __DEFAULT_FN_ATTRS256
775_mm256_maskz_cvtepu64_ps (__mmask8 __U, __m256i __A) {
780static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
781_mm256_maskz_cvtepu64_ps(__mmask8 __U, __m256i __A) {
776782 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
777783 (__v4sf)_mm256_cvtepu64_ps(__A),
778784 (__v4sf)_mm_setzero_ps());
......@@ -908,174 +914,150 @@ _mm256_maskz_cvtepu64_ps (__mmask8 __U, __m256i __A) {
908914 (__v8sf)_mm256_setzero_ps(), \
909915 (__mmask8)(U)))
910916
911static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
912_mm_movepi32_mask (__m128i __A)
913{
917static __inline__ __mmask8
918 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_movepi32_mask(__m128i __A) {
914919 return (__mmask8) __builtin_ia32_cvtd2mask128 ((__v4si) __A);
915920}
916921
917static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
918_mm256_movepi32_mask (__m256i __A)
919{
922static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
923_mm256_movepi32_mask(__m256i __A) {
920924 return (__mmask8) __builtin_ia32_cvtd2mask256 ((__v8si) __A);
921925}
922926
923static __inline__ __m128i __DEFAULT_FN_ATTRS128
924_mm_movm_epi32 (__mmask8 __A)
925{
927static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
928_mm_movm_epi32(__mmask8 __A) {
926929 return (__m128i) __builtin_ia32_cvtmask2d128 (__A);
927930}
928931
929static __inline__ __m256i __DEFAULT_FN_ATTRS256
930_mm256_movm_epi32 (__mmask8 __A)
931{
932static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
933_mm256_movm_epi32(__mmask8 __A) {
932934 return (__m256i) __builtin_ia32_cvtmask2d256 (__A);
933935}
934936
935static __inline__ __m128i __DEFAULT_FN_ATTRS128
936_mm_movm_epi64 (__mmask8 __A)
937{
937static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
938_mm_movm_epi64(__mmask8 __A) {
938939 return (__m128i) __builtin_ia32_cvtmask2q128 (__A);
939940}
940941
941static __inline__ __m256i __DEFAULT_FN_ATTRS256
942_mm256_movm_epi64 (__mmask8 __A)
943{
942static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
943_mm256_movm_epi64(__mmask8 __A) {
944944 return (__m256i) __builtin_ia32_cvtmask2q256 (__A);
945945}
946946
947static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
948_mm_movepi64_mask (__m128i __A)
949{
947static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
948_mm_movepi64_mask(__m128i __A) {
950949 return (__mmask8) __builtin_ia32_cvtq2mask128 ((__v2di) __A);
951950}
952951
953static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
954_mm256_movepi64_mask (__m256i __A)
955{
952static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
953_mm256_movepi64_mask(__m256i __A) {
956954 return (__mmask8) __builtin_ia32_cvtq2mask256 ((__v4di) __A);
957955}
958956
959static __inline__ __m256 __DEFAULT_FN_ATTRS256
960_mm256_broadcast_f32x2 (__m128 __A)
961{
957static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
958_mm256_broadcast_f32x2(__m128 __A) {
962959 return (__m256)__builtin_shufflevector((__v4sf)__A, (__v4sf)__A,
963960 0, 1, 0, 1, 0, 1, 0, 1);
964961}
965962
966static __inline__ __m256 __DEFAULT_FN_ATTRS256
967_mm256_mask_broadcast_f32x2 (__m256 __O, __mmask8 __M, __m128 __A)
968{
963static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
964_mm256_mask_broadcast_f32x2(__m256 __O, __mmask8 __M, __m128 __A) {
969965 return (__m256)__builtin_ia32_selectps_256((__mmask8)__M,
970966 (__v8sf)_mm256_broadcast_f32x2(__A),
971967 (__v8sf)__O);
972968}
973969
974static __inline__ __m256 __DEFAULT_FN_ATTRS256
975_mm256_maskz_broadcast_f32x2 (__mmask8 __M, __m128 __A)
976{
970static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
971_mm256_maskz_broadcast_f32x2(__mmask8 __M, __m128 __A) {
977972 return (__m256)__builtin_ia32_selectps_256((__mmask8)__M,
978973 (__v8sf)_mm256_broadcast_f32x2(__A),
979974 (__v8sf)_mm256_setzero_ps());
980975}
981976
982static __inline__ __m256d __DEFAULT_FN_ATTRS256
983_mm256_broadcast_f64x2(__m128d __A)
984{
977static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
978_mm256_broadcast_f64x2(__m128d __A) {
985979 return (__m256d)__builtin_shufflevector((__v2df)__A, (__v2df)__A,
986980 0, 1, 0, 1);
987981}
988982
989static __inline__ __m256d __DEFAULT_FN_ATTRS256
990_mm256_mask_broadcast_f64x2(__m256d __O, __mmask8 __M, __m128d __A)
991{
983static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
984_mm256_mask_broadcast_f64x2(__m256d __O, __mmask8 __M, __m128d __A) {
992985 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__M,
993986 (__v4df)_mm256_broadcast_f64x2(__A),
994987 (__v4df)__O);
995988}
996989
997static __inline__ __m256d __DEFAULT_FN_ATTRS256
998_mm256_maskz_broadcast_f64x2 (__mmask8 __M, __m128d __A)
999{
990static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
991_mm256_maskz_broadcast_f64x2(__mmask8 __M, __m128d __A) {
1000992 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__M,
1001993 (__v4df)_mm256_broadcast_f64x2(__A),
1002994 (__v4df)_mm256_setzero_pd());
1003995}
1004996
1005static __inline__ __m128i __DEFAULT_FN_ATTRS128
1006_mm_broadcast_i32x2 (__m128i __A)
1007{
997static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
998_mm_broadcast_i32x2(__m128i __A) {
1008999 return (__m128i)__builtin_shufflevector((__v4si)__A, (__v4si)__A,
10091000 0, 1, 0, 1);
10101001}
10111002
1012static __inline__ __m128i __DEFAULT_FN_ATTRS128
1013_mm_mask_broadcast_i32x2 (__m128i __O, __mmask8 __M, __m128i __A)
1014{
1003static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1004_mm_mask_broadcast_i32x2(__m128i __O, __mmask8 __M, __m128i __A) {
10151005 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
10161006 (__v4si)_mm_broadcast_i32x2(__A),
10171007 (__v4si)__O);
10181008}
10191009
1020static __inline__ __m128i __DEFAULT_FN_ATTRS128
1021_mm_maskz_broadcast_i32x2 (__mmask8 __M, __m128i __A)
1022{
1010static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1011_mm_maskz_broadcast_i32x2(__mmask8 __M, __m128i __A) {
10231012 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
10241013 (__v4si)_mm_broadcast_i32x2(__A),
10251014 (__v4si)_mm_setzero_si128());
10261015}
10271016
1028static __inline__ __m256i __DEFAULT_FN_ATTRS256
1029_mm256_broadcast_i32x2 (__m128i __A)
1030{
1017static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1018_mm256_broadcast_i32x2(__m128i __A) {
10311019 return (__m256i)__builtin_shufflevector((__v4si)__A, (__v4si)__A,
10321020 0, 1, 0, 1, 0, 1, 0, 1);
10331021}
10341022
1035static __inline__ __m256i __DEFAULT_FN_ATTRS256
1036_mm256_mask_broadcast_i32x2 (__m256i __O, __mmask8 __M, __m128i __A)
1037{
1023static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1024_mm256_mask_broadcast_i32x2(__m256i __O, __mmask8 __M, __m128i __A) {
10381025 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
10391026 (__v8si)_mm256_broadcast_i32x2(__A),
10401027 (__v8si)__O);
10411028}
10421029
1043static __inline__ __m256i __DEFAULT_FN_ATTRS256
1044_mm256_maskz_broadcast_i32x2 (__mmask8 __M, __m128i __A)
1045{
1030static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1031_mm256_maskz_broadcast_i32x2(__mmask8 __M, __m128i __A) {
10461032 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
10471033 (__v8si)_mm256_broadcast_i32x2(__A),
10481034 (__v8si)_mm256_setzero_si256());
10491035}
10501036
1051static __inline__ __m256i __DEFAULT_FN_ATTRS256
1052_mm256_broadcast_i64x2(__m128i __A)
1053{
1037static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1038_mm256_broadcast_i64x2(__m128i __A) {
10541039 return (__m256i)__builtin_shufflevector((__v2di)__A, (__v2di)__A,
10551040 0, 1, 0, 1);
10561041}
10571042
1058static __inline__ __m256i __DEFAULT_FN_ATTRS256
1059_mm256_mask_broadcast_i64x2(__m256i __O, __mmask8 __M, __m128i __A)
1060{
1043static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1044_mm256_mask_broadcast_i64x2(__m256i __O, __mmask8 __M, __m128i __A) {
10611045 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
10621046 (__v4di)_mm256_broadcast_i64x2(__A),
10631047 (__v4di)__O);
10641048}
10651049
1066static __inline__ __m256i __DEFAULT_FN_ATTRS256
1067_mm256_maskz_broadcast_i64x2 (__mmask8 __M, __m128i __A)
1068{
1050static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1051_mm256_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A) {
10691052 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
10701053 (__v4di)_mm256_broadcast_i64x2(__A),
10711054 (__v4di)_mm256_setzero_si256());
10721055}
10731056
1074#define _mm256_extractf64x2_pd(A, imm) \
1075 ((__m128d)__builtin_ia32_extractf64x2_256_mask((__v4df)(__m256d)(A), \
1076 (int)(imm), \
1077 (__v2df)_mm_undefined_pd(), \
1078 (__mmask8)-1))
1057#define _mm256_extractf64x2_pd(A, imm) \
1058 ((__m128d)__builtin_ia32_extractf64x2_256_mask( \
1059 (__v4df)(__m256d)(A), (int)(imm), (__v2df)_mm_setzero_pd(), \
1060 (__mmask8) - 1))
10791061
10801062#define _mm256_mask_extractf64x2_pd(W, U, A, imm) \
10811063 ((__m128d)__builtin_ia32_extractf64x2_256_mask((__v4df)(__m256d)(A), \
......@@ -1089,11 +1071,10 @@ _mm256_maskz_broadcast_i64x2 (__mmask8 __M, __m128i __A)
10891071 (__v2df)_mm_setzero_pd(), \
10901072 (__mmask8)(U)))
10911073
1092#define _mm256_extracti64x2_epi64(A, imm) \
1093 ((__m128i)__builtin_ia32_extracti64x2_256_mask((__v4di)(__m256i)(A), \
1094 (int)(imm), \
1095 (__v2di)_mm_undefined_si128(), \
1096 (__mmask8)-1))
1074#define _mm256_extracti64x2_epi64(A, imm) \
1075 ((__m128i)__builtin_ia32_extracti64x2_256_mask( \
1076 (__v4di)(__m256i)(A), (int)(imm), (__v2di)_mm_setzero_si128(), \
1077 (__mmask8) - 1))
10971078
10981079#define _mm256_mask_extracti64x2_epi64(W, U, A, imm) \
10991080 ((__m128i)__builtin_ia32_extracti64x2_256_mask((__v4di)(__m256i)(A), \
......@@ -1169,5 +1150,7 @@ _mm256_maskz_broadcast_i64x2 (__mmask8 __M, __m128i __A)
11691150
11701151#undef __DEFAULT_FN_ATTRS128
11711152#undef __DEFAULT_FN_ATTRS256
1153#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
1154#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
11721155
11731156#endif
lib/include/avx512vlfp16intrin.h+130-111
......@@ -19,51 +19,64 @@
1919/* Define the default attributes for the functions in this file. */
2020#define __DEFAULT_FN_ATTRS256 \
2121 __attribute__((__always_inline__, __nodebug__, \
22 __target__("avx512fp16,avx512vl,no-evex512"), \
22 __target__("avx512fp16,avx512vl"), \
2323 __min_vector_width__(256)))
2424#define __DEFAULT_FN_ATTRS128 \
2525 __attribute__((__always_inline__, __nodebug__, \
26 __target__("avx512fp16,avx512vl,no-evex512"), \
26 __target__("avx512fp16,avx512vl"), \
2727 __min_vector_width__(128)))
2828
29static __inline__ _Float16 __DEFAULT_FN_ATTRS128 _mm_cvtsh_h(__m128h __a) {
29#if defined(__cplusplus) && (__cplusplus >= 201103L)
30#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
31#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
32#else
33#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
34#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
35#endif
36
37static __inline__ _Float16 __DEFAULT_FN_ATTRS128_CONSTEXPR
38_mm_cvtsh_h(__m128h __a) {
3039 return __a[0];
3140}
3241
33static __inline__ _Float16 __DEFAULT_FN_ATTRS256 _mm256_cvtsh_h(__m256h __a) {
42static __inline__ _Float16 __DEFAULT_FN_ATTRS256_CONSTEXPR
43_mm256_cvtsh_h(__m256h __a) {
3444 return __a[0];
3545}
3646
37static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_set_sh(_Float16 __h) {
47static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
48_mm_set_sh(_Float16 __h) {
3849 return __extension__(__m128h){__h, 0, 0, 0, 0, 0, 0, 0};
3950}
4051
41static __inline __m128h __DEFAULT_FN_ATTRS128 _mm_set1_ph(_Float16 __h) {
52static __inline __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
53_mm_set1_ph(_Float16 __h) {
4254 return (__m128h)(__v8hf){__h, __h, __h, __h, __h, __h, __h, __h};
4355}
4456
45static __inline __m256h __DEFAULT_FN_ATTRS256 _mm256_set1_ph(_Float16 __h) {
57static __inline __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
58_mm256_set1_ph(_Float16 __h) {
4659 return (__m256h)(__v16hf){__h, __h, __h, __h, __h, __h, __h, __h,
4760 __h, __h, __h, __h, __h, __h, __h, __h};
4861}
4962
50static __inline __m128h __DEFAULT_FN_ATTRS128
63static __inline __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
5164_mm_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
5265 _Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8) {
5366 return (__m128h)(__v8hf){__h8, __h7, __h6, __h5, __h4, __h3, __h2, __h1};
5467}
5568
56static __inline __m256h __DEFAULT_FN_ATTRS256
69static __inline __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
5770_mm256_set1_pch(_Float16 _Complex h) {
5871 return (__m256h)_mm256_set1_ps(__builtin_bit_cast(float, h));
5972}
6073
61static __inline __m128h __DEFAULT_FN_ATTRS128
74static __inline __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
6275_mm_set1_pch(_Float16 _Complex h) {
6376 return (__m128h)_mm_set1_ps(__builtin_bit_cast(float, h));
6477}
6578
66static __inline __m256h __DEFAULT_FN_ATTRS256
79static __inline __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
6780_mm256_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
6881 _Float16 __h5, _Float16 __h6, _Float16 __h7, _Float16 __h8,
6982 _Float16 __h9, _Float16 __h10, _Float16 __h11, _Float16 __h12,
......@@ -73,13 +86,20 @@ _mm256_set_ph(_Float16 __h1, _Float16 __h2, _Float16 __h3, _Float16 __h4,
7386 __h4, __h3, __h2, __h1};
7487}
7588
76#define _mm_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8) \
77 _mm_set_ph((h8), (h7), (h6), (h5), (h4), (h3), (h2), (h1))
89static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
90_mm_setr_ph(_Float16 e0, _Float16 e1, _Float16 e2, _Float16 e3, _Float16 e4,
91 _Float16 e5, _Float16 e6, _Float16 e7) {
92 return _mm_set_ph(e7, e6, e5, e4, e3, e2, e1, e0);
93}
7894
79#define _mm256_setr_ph(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, \
80 h14, h15, h16) \
81 _mm256_set_ph((h16), (h15), (h14), (h13), (h12), (h11), (h10), (h9), (h8), \
82 (h7), (h6), (h5), (h4), (h3), (h2), (h1))
95static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
96_mm256_setr_ph(_Float16 e0, _Float16 e1, _Float16 e2, _Float16 e3, _Float16 e4,
97 _Float16 e5, _Float16 e6, _Float16 e7, _Float16 e8, _Float16 e9,
98 _Float16 e10, _Float16 e11, _Float16 e12, _Float16 e13,
99 _Float16 e14, _Float16 e15) {
100 return _mm256_set_ph(e15, e14, e13, e12, e11, e10, e9, e8, e7, e6, e5, e4, e3,
101 e2, e1, e0);
102}
83103
84104static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_add_ph(__m256h __A,
85105 __m256h __B) {
......@@ -229,12 +249,12 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_div_ph(__mmask8 __U,
229249 (__v8hf)_mm_setzero_ph());
230250}
231251
232static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_min_ph(__m256h __A,
233 __m256h __B) {
252static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
253_mm256_min_ph(__m256h __A, __m256h __B) {
234254 return (__m256h)__builtin_ia32_minph256((__v16hf)__A, (__v16hf)__B);
235255}
236256
237static __inline__ __m256h __DEFAULT_FN_ATTRS256
257static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
238258_mm256_mask_min_ph(__m256h __W, __mmask16 __U, __m256h __A, __m256h __B) {
239259 return (__m256h)__builtin_ia32_selectph_256(
240260 (__mmask16)__U,
......@@ -242,7 +262,7 @@ _mm256_mask_min_ph(__m256h __W, __mmask16 __U, __m256h __A, __m256h __B) {
242262 (__v16hf)__W);
243263}
244264
245static __inline__ __m256h __DEFAULT_FN_ATTRS256
265static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
246266_mm256_maskz_min_ph(__mmask16 __U, __m256h __A, __m256h __B) {
247267 return (__m256h)__builtin_ia32_selectph_256(
248268 (__mmask16)__U,
......@@ -250,34 +270,31 @@ _mm256_maskz_min_ph(__mmask16 __U, __m256h __A, __m256h __B) {
250270 (__v16hf)_mm256_setzero_ph());
251271}
252272
253static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_min_ph(__m128h __A,
254 __m128h __B) {
273static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
274_mm_min_ph(__m128h __A, __m128h __B) {
255275 return (__m128h)__builtin_ia32_minph128((__v8hf)__A, (__v8hf)__B);
256276}
257277
258static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_min_ph(__m128h __W,
259 __mmask8 __U,
260 __m128h __A,
261 __m128h __B) {
278static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
279_mm_mask_min_ph(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
262280 return (__m128h)__builtin_ia32_selectph_128(
263281 (__mmask8)__U, (__v8hf)__builtin_ia32_minph128((__v8hf)__A, (__v8hf)__B),
264282 (__v8hf)__W);
265283}
266284
267static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_min_ph(__mmask8 __U,
268 __m128h __A,
269 __m128h __B) {
285static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
286_mm_maskz_min_ph(__mmask8 __U, __m128h __A, __m128h __B) {
270287 return (__m128h)__builtin_ia32_selectph_128(
271288 (__mmask8)__U, (__v8hf)__builtin_ia32_minph128((__v8hf)__A, (__v8hf)__B),
272289 (__v8hf)_mm_setzero_ph());
273290}
274291
275static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_max_ph(__m256h __A,
276 __m256h __B) {
292static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
293_mm256_max_ph(__m256h __A, __m256h __B) {
277294 return (__m256h)__builtin_ia32_maxph256((__v16hf)__A, (__v16hf)__B);
278295}
279296
280static __inline__ __m256h __DEFAULT_FN_ATTRS256
297static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
281298_mm256_mask_max_ph(__m256h __W, __mmask16 __U, __m256h __A, __m256h __B) {
282299 return (__m256h)__builtin_ia32_selectph_256(
283300 (__mmask16)__U,
......@@ -285,7 +302,7 @@ _mm256_mask_max_ph(__m256h __W, __mmask16 __U, __m256h __A, __m256h __B) {
285302 (__v16hf)__W);
286303}
287304
288static __inline__ __m256h __DEFAULT_FN_ATTRS256
305static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
289306_mm256_maskz_max_ph(__mmask16 __U, __m256h __A, __m256h __B) {
290307 return (__m256h)__builtin_ia32_selectph_256(
291308 (__mmask16)__U,
......@@ -293,33 +310,32 @@ _mm256_maskz_max_ph(__mmask16 __U, __m256h __A, __m256h __B) {
293310 (__v16hf)_mm256_setzero_ph());
294311}
295312
296static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_max_ph(__m128h __A,
297 __m128h __B) {
313static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
314_mm_max_ph(__m128h __A, __m128h __B) {
298315 return (__m128h)__builtin_ia32_maxph128((__v8hf)__A, (__v8hf)__B);
299316}
300317
301static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_max_ph(__m128h __W,
302 __mmask8 __U,
303 __m128h __A,
304 __m128h __B) {
318static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
319_mm_mask_max_ph(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
305320 return (__m128h)__builtin_ia32_selectph_128(
306321 (__mmask8)__U, (__v8hf)__builtin_ia32_maxph128((__v8hf)__A, (__v8hf)__B),
307322 (__v8hf)__W);
308323}
309324
310static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_max_ph(__mmask8 __U,
311 __m128h __A,
312 __m128h __B) {
325static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
326_mm_maskz_max_ph(__mmask8 __U, __m128h __A, __m128h __B) {
313327 return (__m128h)__builtin_ia32_selectph_128(
314328 (__mmask8)__U, (__v8hf)__builtin_ia32_maxph128((__v8hf)__A, (__v8hf)__B),
315329 (__v8hf)_mm_setzero_ph());
316330}
317331
318static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_abs_ph(__m256h __A) {
332static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
333_mm256_abs_ph(__m256h __A) {
319334 return (__m256h)_mm256_and_epi32(_mm256_set1_epi32(0x7FFF7FFF), (__m256i)__A);
320335}
321336
322static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_abs_ph(__m128h __A) {
337static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
338_mm_abs_ph(__m128h __A) {
323339 return (__m128h)_mm_and_epi32(_mm_set1_epi32(0x7FFF7FFF), (__m128i)__A);
324340}
325341
......@@ -601,7 +617,7 @@ _mm256_maskz_scalef_ph(__mmask16 __U, __m256h __A, __m256h __B) {
601617 (__mmask16)(U)))
602618
603619static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_sqrt_ph(__m128h __a) {
604 return __builtin_ia32_sqrtph((__v8hf)__a);
620 return __builtin_elementwise_sqrt(__a);
605621}
606622
607623static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_sqrt_ph(__m128h __W,
......@@ -618,7 +634,7 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_sqrt_ph(__mmask8 __U,
618634}
619635
620636static __inline __m256h __DEFAULT_FN_ATTRS256 _mm256_sqrt_ph(__m256h __a) {
621 return (__m256h)__builtin_ia32_sqrtph256((__v16hf)__a);
637 return __builtin_elementwise_sqrt(__a);
622638}
623639
624640static __inline__ __m256h __DEFAULT_FN_ATTRS256
......@@ -790,34 +806,35 @@ _mm256_maskz_cvttph_epi16(__mmask16 __U, __m256h __A) {
790806 (__v16hf)__A, (__v16hi)_mm256_setzero_si256(), (__mmask16)__U);
791807}
792808
793static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_cvtepi16_ph(__m128i __A) {
809static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
810_mm_cvtepi16_ph(__m128i __A) {
794811 return (__m128h) __builtin_convertvector((__v8hi)__A, __v8hf);
795812}
796813
797static __inline__ __m128h __DEFAULT_FN_ATTRS128
814static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
798815_mm_mask_cvtepi16_ph(__m128h __W, __mmask8 __U, __m128i __A) {
799816 return (__m128h)__builtin_ia32_selectph_128(
800817 (__mmask8)__U, (__v8hf)_mm_cvtepi16_ph(__A), (__v8hf)__W);
801818}
802819
803static __inline__ __m128h __DEFAULT_FN_ATTRS128
820static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
804821_mm_maskz_cvtepi16_ph(__mmask8 __U, __m128i __A) {
805822 return (__m128h)__builtin_ia32_selectph_128(
806823 (__mmask8)__U, (__v8hf)_mm_cvtepi16_ph(__A), (__v8hf)_mm_setzero_ph());
807824}
808825
809static __inline__ __m256h __DEFAULT_FN_ATTRS256
826static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
810827_mm256_cvtepi16_ph(__m256i __A) {
811828 return (__m256h) __builtin_convertvector((__v16hi)__A, __v16hf);
812829}
813830
814static __inline__ __m256h __DEFAULT_FN_ATTRS256
831static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
815832_mm256_mask_cvtepi16_ph(__m256h __W, __mmask16 __U, __m256i __A) {
816833 return (__m256h)__builtin_ia32_selectph_256(
817834 (__mmask16)__U, (__v16hf)_mm256_cvtepi16_ph(__A), (__v16hf)__W);
818835}
819836
820static __inline__ __m256h __DEFAULT_FN_ATTRS256
837static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
821838_mm256_maskz_cvtepi16_ph(__mmask16 __U, __m256i __A) {
822839 return (__m256h)__builtin_ia32_selectph_256((__mmask16)__U,
823840 (__v16hf)_mm256_cvtepi16_ph(__A),
......@@ -894,34 +911,35 @@ _mm256_maskz_cvttph_epu16(__mmask16 __U, __m256h __A) {
894911 (__v16hf)__A, (__v16hu)_mm256_setzero_si256(), (__mmask16)__U);
895912}
896913
897static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_cvtepu16_ph(__m128i __A) {
914static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
915_mm_cvtepu16_ph(__m128i __A) {
898916 return (__m128h) __builtin_convertvector((__v8hu)__A, __v8hf);
899917}
900918
901static __inline__ __m128h __DEFAULT_FN_ATTRS128
919static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
902920_mm_mask_cvtepu16_ph(__m128h __W, __mmask8 __U, __m128i __A) {
903921 return (__m128h)__builtin_ia32_selectph_128(
904922 (__mmask8)__U, (__v8hf)_mm_cvtepu16_ph(__A), (__v8hf)__W);
905923}
906924
907static __inline__ __m128h __DEFAULT_FN_ATTRS128
925static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
908926_mm_maskz_cvtepu16_ph(__mmask8 __U, __m128i __A) {
909927 return (__m128h)__builtin_ia32_selectph_128(
910928 (__mmask8)__U, (__v8hf)_mm_cvtepu16_ph(__A), (__v8hf)_mm_setzero_ph());
911929}
912930
913static __inline__ __m256h __DEFAULT_FN_ATTRS256
931static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
914932_mm256_cvtepu16_ph(__m256i __A) {
915933 return (__m256h) __builtin_convertvector((__v16hu)__A, __v16hf);
916934}
917935
918static __inline__ __m256h __DEFAULT_FN_ATTRS256
936static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
919937_mm256_mask_cvtepu16_ph(__m256h __W, __mmask16 __U, __m256i __A) {
920938 return (__m256h)__builtin_ia32_selectph_256(
921939 (__mmask16)__U, (__v16hf)_mm256_cvtepu16_ph(__A), (__v16hf)__W);
922940}
923941
924static __inline__ __m256h __DEFAULT_FN_ATTRS256
942static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
925943_mm256_maskz_cvtepu16_ph(__mmask16 __U, __m256i __A) {
926944 return (__m256h)__builtin_ia32_selectph_256((__mmask16)__U,
927945 (__v16hf)_mm256_cvtepu16_ph(__A),
......@@ -1015,18 +1033,18 @@ _mm_maskz_cvtepi32_ph(__mmask8 __U, __m128i __A) {
10151033 (__v4si)__A, (__v8hf)_mm_setzero_ph(), (__mmask8)__U);
10161034}
10171035
1018static __inline__ __m128h __DEFAULT_FN_ATTRS256
1036static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
10191037_mm256_cvtepi32_ph(__m256i __A) {
10201038 return (__m128h) __builtin_convertvector((__v8si)__A, __v8hf);
10211039}
10221040
1023static __inline__ __m128h __DEFAULT_FN_ATTRS256
1041static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
10241042_mm256_mask_cvtepi32_ph(__m128h __W, __mmask8 __U, __m256i __A) {
10251043 return (__m128h)__builtin_ia32_selectph_128(
10261044 (__mmask8)__U, (__v8hf)_mm256_cvtepi32_ph(__A), (__v8hf)__W);
10271045}
10281046
1029static __inline__ __m128h __DEFAULT_FN_ATTRS256
1047static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
10301048_mm256_maskz_cvtepi32_ph(__mmask8 __U, __m256i __A) {
10311049 return (__m128h)__builtin_ia32_selectph_128(
10321050 (__mmask8)__U, (__v8hf)_mm256_cvtepi32_ph(__A), (__v8hf)_mm_setzero_ph());
......@@ -1049,18 +1067,18 @@ _mm_maskz_cvtepu32_ph(__mmask8 __U, __m128i __A) {
10491067 (__v4su)__A, (__v8hf)_mm_setzero_ph(), (__mmask8)__U);
10501068}
10511069
1052static __inline__ __m128h __DEFAULT_FN_ATTRS256
1070static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
10531071_mm256_cvtepu32_ph(__m256i __A) {
10541072 return (__m128h) __builtin_convertvector((__v8su)__A, __v8hf);
10551073}
10561074
1057static __inline__ __m128h __DEFAULT_FN_ATTRS256
1075static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
10581076_mm256_mask_cvtepu32_ph(__m128h __W, __mmask8 __U, __m256i __A) {
10591077 return (__m128h)__builtin_ia32_selectph_128(
10601078 (__mmask8)__U, (__v8hf)_mm256_cvtepu32_ph(__A), (__v8hf)__W);
10611079}
10621080
1063static __inline__ __m128h __DEFAULT_FN_ATTRS256
1081static __inline__ __m128h __DEFAULT_FN_ATTRS256_CONSTEXPR
10641082_mm256_maskz_cvtepu32_ph(__mmask8 __U, __m256i __A) {
10651083 return (__m128h)__builtin_ia32_selectph_128(
10661084 (__mmask8)__U, (__v8hf)_mm256_cvtepu32_ph(__A), (__v8hf)_mm_setzero_ph());
......@@ -1419,8 +1437,8 @@ _mm256_maskz_cvtxps_ph(__mmask8 __U, __m256 __A) {
14191437static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_fmadd_ph(__m128h __A,
14201438 __m128h __B,
14211439 __m128h __C) {
1422 return (__m128h)__builtin_ia32_vfmaddph((__v8hf)__A, (__v8hf)__B,
1423 (__v8hf)__C);
1440 return (__m128h)__builtin_elementwise_fma((__v8hf)__A, (__v8hf)__B,
1441 (__v8hf)__C);
14241442}
14251443
14261444static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_fmadd_ph(__m128h __A,
......@@ -1429,7 +1447,7 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_fmadd_ph(__m128h __A,
14291447 __m128h __C) {
14301448 return (__m128h)__builtin_ia32_selectph_128(
14311449 (__mmask8)__U,
1432 __builtin_ia32_vfmaddph((__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
1450 __builtin_elementwise_fma((__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
14331451 (__v8hf)__A);
14341452}
14351453
......@@ -1437,7 +1455,7 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
14371455_mm_mask3_fmadd_ph(__m128h __A, __m128h __B, __m128h __C, __mmask8 __U) {
14381456 return (__m128h)__builtin_ia32_selectph_128(
14391457 (__mmask8)__U,
1440 __builtin_ia32_vfmaddph((__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
1458 __builtin_elementwise_fma((__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
14411459 (__v8hf)__C);
14421460}
14431461
......@@ -1445,15 +1463,15 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
14451463_mm_maskz_fmadd_ph(__mmask8 __U, __m128h __A, __m128h __B, __m128h __C) {
14461464 return (__m128h)__builtin_ia32_selectph_128(
14471465 (__mmask8)__U,
1448 __builtin_ia32_vfmaddph((__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
1466 __builtin_elementwise_fma((__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
14491467 (__v8hf)_mm_setzero_ph());
14501468}
14511469
14521470static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_fmsub_ph(__m128h __A,
14531471 __m128h __B,
14541472 __m128h __C) {
1455 return (__m128h)__builtin_ia32_vfmaddph((__v8hf)__A, (__v8hf)__B,
1456 -(__v8hf)__C);
1473 return (__m128h)__builtin_elementwise_fma((__v8hf)__A, (__v8hf)__B,
1474 -(__v8hf)__C);
14571475}
14581476
14591477static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_fmsub_ph(__m128h __A,
......@@ -1476,7 +1494,7 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
14761494_mm_mask3_fnmadd_ph(__m128h __A, __m128h __B, __m128h __C, __mmask8 __U) {
14771495 return (__m128h)__builtin_ia32_selectph_128(
14781496 (__mmask8)__U,
1479 __builtin_ia32_vfmaddph(-(__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
1497 __builtin_elementwise_fma(-(__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
14801498 (__v8hf)__C);
14811499}
14821500
......@@ -1484,7 +1502,7 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
14841502_mm_maskz_fnmadd_ph(__mmask8 __U, __m128h __A, __m128h __B, __m128h __C) {
14851503 return (__m128h)__builtin_ia32_selectph_128(
14861504 (__mmask8)__U,
1487 __builtin_ia32_vfmaddph(-(__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
1505 __builtin_elementwise_fma(-(__v8hf)__A, (__v8hf)__B, (__v8hf)__C),
14881506 (__v8hf)_mm_setzero_ph());
14891507}
14901508
......@@ -1492,22 +1510,22 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
14921510_mm_maskz_fnmsub_ph(__mmask8 __U, __m128h __A, __m128h __B, __m128h __C) {
14931511 return (__m128h)__builtin_ia32_selectph_128(
14941512 (__mmask8)__U,
1495 __builtin_ia32_vfmaddph(-(__v8hf)__A, (__v8hf)__B, -(__v8hf)__C),
1513 __builtin_elementwise_fma(-(__v8hf)__A, (__v8hf)__B, -(__v8hf)__C),
14961514 (__v8hf)_mm_setzero_ph());
14971515}
14981516
14991517static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_fmadd_ph(__m256h __A,
15001518 __m256h __B,
15011519 __m256h __C) {
1502 return (__m256h)__builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B,
1503 (__v16hf)__C);
1520 return (__m256h)__builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B,
1521 (__v16hf)__C);
15041522}
15051523
15061524static __inline__ __m256h __DEFAULT_FN_ATTRS256
15071525_mm256_mask_fmadd_ph(__m256h __A, __mmask16 __U, __m256h __B, __m256h __C) {
15081526 return (__m256h)__builtin_ia32_selectph_256(
15091527 (__mmask16)__U,
1510 __builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
1528 __builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
15111529 (__v16hf)__A);
15121530}
15131531
......@@ -1515,7 +1533,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
15151533_mm256_mask3_fmadd_ph(__m256h __A, __m256h __B, __m256h __C, __mmask16 __U) {
15161534 return (__m256h)__builtin_ia32_selectph_256(
15171535 (__mmask16)__U,
1518 __builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
1536 __builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
15191537 (__v16hf)__C);
15201538}
15211539
......@@ -1523,22 +1541,22 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
15231541_mm256_maskz_fmadd_ph(__mmask16 __U, __m256h __A, __m256h __B, __m256h __C) {
15241542 return (__m256h)__builtin_ia32_selectph_256(
15251543 (__mmask16)__U,
1526 __builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
1544 __builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
15271545 (__v16hf)_mm256_setzero_ph());
15281546}
15291547
15301548static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_fmsub_ph(__m256h __A,
15311549 __m256h __B,
15321550 __m256h __C) {
1533 return (__m256h)__builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B,
1534 -(__v16hf)__C);
1551 return (__m256h)__builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B,
1552 -(__v16hf)__C);
15351553}
15361554
15371555static __inline__ __m256h __DEFAULT_FN_ATTRS256
15381556_mm256_mask_fmsub_ph(__m256h __A, __mmask16 __U, __m256h __B, __m256h __C) {
15391557 return (__m256h)__builtin_ia32_selectph_256(
15401558 (__mmask16)__U,
1541 __builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
1559 __builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
15421560 (__v16hf)__A);
15431561}
15441562
......@@ -1546,7 +1564,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
15461564_mm256_maskz_fmsub_ph(__mmask16 __U, __m256h __A, __m256h __B, __m256h __C) {
15471565 return (__m256h)__builtin_ia32_selectph_256(
15481566 (__mmask16)__U,
1549 __builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
1567 __builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
15501568 (__v16hf)_mm256_setzero_ph());
15511569}
15521570
......@@ -1554,7 +1572,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
15541572_mm256_mask3_fnmadd_ph(__m256h __A, __m256h __B, __m256h __C, __mmask16 __U) {
15551573 return (__m256h)__builtin_ia32_selectph_256(
15561574 (__mmask16)__U,
1557 __builtin_ia32_vfmaddph256(-(__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
1575 __builtin_elementwise_fma(-(__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
15581576 (__v16hf)__C);
15591577}
15601578
......@@ -1562,7 +1580,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
15621580_mm256_maskz_fnmadd_ph(__mmask16 __U, __m256h __A, __m256h __B, __m256h __C) {
15631581 return (__m256h)__builtin_ia32_selectph_256(
15641582 (__mmask16)__U,
1565 __builtin_ia32_vfmaddph256(-(__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
1583 __builtin_elementwise_fma(-(__v16hf)__A, (__v16hf)__B, (__v16hf)__C),
15661584 (__v16hf)_mm256_setzero_ph());
15671585}
15681586
......@@ -1570,7 +1588,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
15701588_mm256_maskz_fnmsub_ph(__mmask16 __U, __m256h __A, __m256h __B, __m256h __C) {
15711589 return (__m256h)__builtin_ia32_selectph_256(
15721590 (__mmask16)__U,
1573 __builtin_ia32_vfmaddph256(-(__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
1591 __builtin_elementwise_fma(-(__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
15741592 (__v16hf)_mm256_setzero_ph());
15751593}
15761594
......@@ -1684,7 +1702,7 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
16841702_mm_mask3_fmsub_ph(__m128h __A, __m128h __B, __m128h __C, __mmask8 __U) {
16851703 return (__m128h)__builtin_ia32_selectph_128(
16861704 (__mmask8)__U,
1687 __builtin_ia32_vfmaddph((__v8hf)__A, (__v8hf)__B, -(__v8hf)__C),
1705 __builtin_elementwise_fma((__v8hf)__A, (__v8hf)__B, -(__v8hf)__C),
16881706 (__v8hf)__C);
16891707}
16901708
......@@ -1692,7 +1710,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
16921710_mm256_mask3_fmsub_ph(__m256h __A, __m256h __B, __m256h __C, __mmask16 __U) {
16931711 return (__m256h)__builtin_ia32_selectph_256(
16941712 (__mmask16)__U,
1695 __builtin_ia32_vfmaddph256((__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
1713 __builtin_elementwise_fma((__v16hf)__A, (__v16hf)__B, -(__v16hf)__C),
16961714 (__v16hf)__C);
16971715}
16981716
......@@ -1715,45 +1733,45 @@ _mm256_mask3_fmsubadd_ph(__m256h __A, __m256h __B, __m256h __C, __mmask16 __U) {
17151733static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_fnmadd_ph(__m128h __A,
17161734 __m128h __B,
17171735 __m128h __C) {
1718 return (__m128h)__builtin_ia32_vfmaddph((__v8hf)__A, -(__v8hf)__B,
1719 (__v8hf)__C);
1736 return (__m128h)__builtin_elementwise_fma((__v8hf)__A, -(__v8hf)__B,
1737 (__v8hf)__C);
17201738}
17211739
17221740static __inline__ __m128h __DEFAULT_FN_ATTRS128
17231741_mm_mask_fnmadd_ph(__m128h __A, __mmask8 __U, __m128h __B, __m128h __C) {
17241742 return (__m128h)__builtin_ia32_selectph_128(
17251743 (__mmask8)__U,
1726 __builtin_ia32_vfmaddph((__v8hf)__A, -(__v8hf)__B, (__v8hf)__C),
1744 __builtin_elementwise_fma((__v8hf)__A, -(__v8hf)__B, (__v8hf)__C),
17271745 (__v8hf)__A);
17281746}
17291747
17301748static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_fnmadd_ph(__m256h __A,
17311749 __m256h __B,
17321750 __m256h __C) {
1733 return (__m256h)__builtin_ia32_vfmaddph256((__v16hf)__A, -(__v16hf)__B,
1734 (__v16hf)__C);
1751 return (__m256h)__builtin_elementwise_fma((__v16hf)__A, -(__v16hf)__B,
1752 (__v16hf)__C);
17351753}
17361754
17371755static __inline__ __m256h __DEFAULT_FN_ATTRS256
17381756_mm256_mask_fnmadd_ph(__m256h __A, __mmask16 __U, __m256h __B, __m256h __C) {
17391757 return (__m256h)__builtin_ia32_selectph_256(
17401758 (__mmask16)__U,
1741 __builtin_ia32_vfmaddph256((__v16hf)__A, -(__v16hf)__B, (__v16hf)__C),
1759 __builtin_elementwise_fma((__v16hf)__A, -(__v16hf)__B, (__v16hf)__C),
17421760 (__v16hf)__A);
17431761}
17441762
17451763static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_fnmsub_ph(__m128h __A,
17461764 __m128h __B,
17471765 __m128h __C) {
1748 return (__m128h)__builtin_ia32_vfmaddph((__v8hf)__A, -(__v8hf)__B,
1749 -(__v8hf)__C);
1766 return (__m128h)__builtin_elementwise_fma((__v8hf)__A, -(__v8hf)__B,
1767 -(__v8hf)__C);
17501768}
17511769
17521770static __inline__ __m128h __DEFAULT_FN_ATTRS128
17531771_mm_mask_fnmsub_ph(__m128h __A, __mmask8 __U, __m128h __B, __m128h __C) {
17541772 return (__m128h)__builtin_ia32_selectph_128(
17551773 (__mmask8)__U,
1756 __builtin_ia32_vfmaddph((__v8hf)__A, -(__v8hf)__B, -(__v8hf)__C),
1774 __builtin_elementwise_fma((__v8hf)__A, -(__v8hf)__B, -(__v8hf)__C),
17571775 (__v8hf)__A);
17581776}
17591777
......@@ -1761,22 +1779,22 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128
17611779_mm_mask3_fnmsub_ph(__m128h __A, __m128h __B, __m128h __C, __mmask8 __U) {
17621780 return (__m128h)__builtin_ia32_selectph_128(
17631781 (__mmask8)__U,
1764 __builtin_ia32_vfmaddph((__v8hf)__A, -(__v8hf)__B, -(__v8hf)__C),
1782 __builtin_elementwise_fma((__v8hf)__A, -(__v8hf)__B, -(__v8hf)__C),
17651783 (__v8hf)__C);
17661784}
17671785
17681786static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_fnmsub_ph(__m256h __A,
17691787 __m256h __B,
17701788 __m256h __C) {
1771 return (__m256h)__builtin_ia32_vfmaddph256((__v16hf)__A, -(__v16hf)__B,
1772 -(__v16hf)__C);
1789 return (__m256h)__builtin_elementwise_fma((__v16hf)__A, -(__v16hf)__B,
1790 -(__v16hf)__C);
17731791}
17741792
17751793static __inline__ __m256h __DEFAULT_FN_ATTRS256
17761794_mm256_mask_fnmsub_ph(__m256h __A, __mmask16 __U, __m256h __B, __m256h __C) {
17771795 return (__m256h)__builtin_ia32_selectph_256(
17781796 (__mmask16)__U,
1779 __builtin_ia32_vfmaddph256((__v16hf)__A, -(__v16hf)__B, -(__v16hf)__C),
1797 __builtin_elementwise_fma((__v16hf)__A, -(__v16hf)__B, -(__v16hf)__C),
17801798 (__v16hf)__A);
17811799}
17821800
......@@ -1784,7 +1802,7 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256
17841802_mm256_mask3_fnmsub_ph(__m256h __A, __m256h __B, __m256h __C, __mmask16 __U) {
17851803 return (__m256h)__builtin_ia32_selectph_256(
17861804 (__mmask16)__U,
1787 __builtin_ia32_vfmaddph256((__v16hf)__A, -(__v16hf)__B, -(__v16hf)__C),
1805 __builtin_elementwise_fma((__v16hf)__A, -(__v16hf)__B, -(__v16hf)__C),
17881806 (__v16hf)__C);
17891807}
17901808
......@@ -1974,37 +1992,36 @@ _mm256_maskz_fmadd_pch(__mmask8 __U, __m256h __A, __m256h __B, __m256h __C) {
19741992 (__v8sf)__C, (__mmask8)__U);
19751993}
19761994
1977static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_blend_ph(__mmask8 __U,
1978 __m128h __A,
1979 __m128h __W) {
1995static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
1996_mm_mask_blend_ph(__mmask8 __U, __m128h __A, __m128h __W) {
19801997 return (__m128h)__builtin_ia32_selectph_128((__mmask8)__U, (__v8hf)__W,
19811998 (__v8hf)__A);
19821999}
19832000
1984static __inline__ __m256h __DEFAULT_FN_ATTRS256
2001static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
19852002_mm256_mask_blend_ph(__mmask16 __U, __m256h __A, __m256h __W) {
19862003 return (__m256h)__builtin_ia32_selectph_256((__mmask16)__U, (__v16hf)__W,
19872004 (__v16hf)__A);
19882005}
19892006
1990static __inline__ __m128h __DEFAULT_FN_ATTRS128
2007static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
19912008_mm_permutex2var_ph(__m128h __A, __m128i __I, __m128h __B) {
19922009 return (__m128h)__builtin_ia32_vpermi2varhi128((__v8hi)__A, (__v8hi)__I,
19932010 (__v8hi)__B);
19942011}
19952012
1996static __inline__ __m256h __DEFAULT_FN_ATTRS256
2013static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
19972014_mm256_permutex2var_ph(__m256h __A, __m256i __I, __m256h __B) {
19982015 return (__m256h)__builtin_ia32_vpermi2varhi256((__v16hi)__A, (__v16hi)__I,
19992016 (__v16hi)__B);
20002017}
20012018
2002static __inline__ __m128h __DEFAULT_FN_ATTRS128
2019static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
20032020_mm_permutexvar_ph(__m128i __A, __m128h __B) {
20042021 return (__m128h)__builtin_ia32_permvarhi128((__v8hi)__B, (__v8hi)__A);
20052022}
20062023
2007static __inline__ __m256h __DEFAULT_FN_ATTRS256
2024static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
20082025_mm256_permutexvar_ph(__m256i __A, __m256h __B) {
20092026 return (__m256h)__builtin_ia32_permvarhi256((__v16hi)__B, (__v16hi)__A);
20102027}
......@@ -2066,6 +2083,8 @@ _mm_reduce_min_ph(__m128h __V) {
20662083
20672084#undef __DEFAULT_FN_ATTRS128
20682085#undef __DEFAULT_FN_ATTRS256
2086#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
2087#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
20692088
20702089#endif
20712090#endif
lib/include/avx512vlintrin.h+945-1299
......@@ -15,14 +15,20 @@
1515#define __AVX512VLINTRIN_H
1616
1717#define __DEFAULT_FN_ATTRS128 \
18 __attribute__((__always_inline__, __nodebug__, \
19 __target__("avx512vl,no-evex512"), \
18 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl"), \
2019 __min_vector_width__(128)))
2120#define __DEFAULT_FN_ATTRS256 \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("avx512vl,no-evex512"), \
21 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl"), \
2422 __min_vector_width__(256)))
2523
24#if defined(__cplusplus) && (__cplusplus >= 201103L)
25#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
26#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
27#else
28#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
29#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
30#endif
31
2632typedef short __v2hi __attribute__((__vector_size__(4)));
2733typedef char __v4qi __attribute__((__vector_size__(4)));
2834typedef char __v2qi __attribute__((__vector_size__(2)));
......@@ -229,209 +235,183 @@ typedef char __v2qi __attribute__((__vector_size__(2)));
229235#define _mm256_mask_cmpneq_epu64_mask(k, A, B) \
230236 _mm256_mask_cmp_epu64_mask((k), (A), (B), _MM_CMPINT_NE)
231237
232static __inline__ __m256i __DEFAULT_FN_ATTRS256
233_mm256_mask_add_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
234{
238static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
239_mm256_mask_add_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
235240 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
236241 (__v8si)_mm256_add_epi32(__A, __B),
237242 (__v8si)__W);
238243}
239244
240static __inline__ __m256i __DEFAULT_FN_ATTRS256
241_mm256_maskz_add_epi32(__mmask8 __U, __m256i __A, __m256i __B)
242{
245static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
246_mm256_maskz_add_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
243247 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
244248 (__v8si)_mm256_add_epi32(__A, __B),
245249 (__v8si)_mm256_setzero_si256());
246250}
247251
248static __inline__ __m256i __DEFAULT_FN_ATTRS256
249_mm256_mask_add_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
250{
252static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
253_mm256_mask_add_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
251254 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
252255 (__v4di)_mm256_add_epi64(__A, __B),
253256 (__v4di)__W);
254257}
255258
256static __inline__ __m256i __DEFAULT_FN_ATTRS256
257_mm256_maskz_add_epi64(__mmask8 __U, __m256i __A, __m256i __B)
258{
259static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
260_mm256_maskz_add_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
259261 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
260262 (__v4di)_mm256_add_epi64(__A, __B),
261263 (__v4di)_mm256_setzero_si256());
262264}
263265
264static __inline__ __m256i __DEFAULT_FN_ATTRS256
265_mm256_mask_sub_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
266{
266static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
267_mm256_mask_sub_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
267268 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
268269 (__v8si)_mm256_sub_epi32(__A, __B),
269270 (__v8si)__W);
270271}
271272
272static __inline__ __m256i __DEFAULT_FN_ATTRS256
273_mm256_maskz_sub_epi32(__mmask8 __U, __m256i __A, __m256i __B)
274{
273static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
274_mm256_maskz_sub_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
275275 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
276276 (__v8si)_mm256_sub_epi32(__A, __B),
277277 (__v8si)_mm256_setzero_si256());
278278}
279279
280static __inline__ __m256i __DEFAULT_FN_ATTRS256
281_mm256_mask_sub_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
282{
280static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
281_mm256_mask_sub_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
283282 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
284283 (__v4di)_mm256_sub_epi64(__A, __B),
285284 (__v4di)__W);
286285}
287286
288static __inline__ __m256i __DEFAULT_FN_ATTRS256
289_mm256_maskz_sub_epi64(__mmask8 __U, __m256i __A, __m256i __B)
290{
287static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
288_mm256_maskz_sub_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
291289 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
292290 (__v4di)_mm256_sub_epi64(__A, __B),
293291 (__v4di)_mm256_setzero_si256());
294292}
295293
296static __inline__ __m128i __DEFAULT_FN_ATTRS128
297_mm_mask_add_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
298{
294static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
295_mm_mask_add_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
299296 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
300297 (__v4si)_mm_add_epi32(__A, __B),
301298 (__v4si)__W);
302299}
303300
304static __inline__ __m128i __DEFAULT_FN_ATTRS128
305_mm_maskz_add_epi32(__mmask8 __U, __m128i __A, __m128i __B)
306{
301static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
302_mm_maskz_add_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
307303 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
308304 (__v4si)_mm_add_epi32(__A, __B),
309305 (__v4si)_mm_setzero_si128());
310306}
311307
312static __inline__ __m128i __DEFAULT_FN_ATTRS128
313_mm_mask_add_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
314{
308static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
309_mm_mask_add_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
315310 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
316311 (__v2di)_mm_add_epi64(__A, __B),
317312 (__v2di)__W);
318313}
319314
320static __inline__ __m128i __DEFAULT_FN_ATTRS128
321_mm_maskz_add_epi64(__mmask8 __U, __m128i __A, __m128i __B)
322{
315static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
316_mm_maskz_add_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
323317 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
324318 (__v2di)_mm_add_epi64(__A, __B),
325319 (__v2di)_mm_setzero_si128());
326320}
327321
328static __inline__ __m128i __DEFAULT_FN_ATTRS128
329_mm_mask_sub_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
330{
322static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
323_mm_mask_sub_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
331324 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
332325 (__v4si)_mm_sub_epi32(__A, __B),
333326 (__v4si)__W);
334327}
335328
336static __inline__ __m128i __DEFAULT_FN_ATTRS128
337_mm_maskz_sub_epi32(__mmask8 __U, __m128i __A, __m128i __B)
338{
329static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
330_mm_maskz_sub_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
339331 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
340332 (__v4si)_mm_sub_epi32(__A, __B),
341333 (__v4si)_mm_setzero_si128());
342334}
343335
344static __inline__ __m128i __DEFAULT_FN_ATTRS128
345_mm_mask_sub_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
346{
336static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
337_mm_mask_sub_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
347338 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
348339 (__v2di)_mm_sub_epi64(__A, __B),
349340 (__v2di)__W);
350341}
351342
352static __inline__ __m128i __DEFAULT_FN_ATTRS128
353_mm_maskz_sub_epi64(__mmask8 __U, __m128i __A, __m128i __B)
354{
343static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
344_mm_maskz_sub_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
355345 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
356346 (__v2di)_mm_sub_epi64(__A, __B),
357347 (__v2di)_mm_setzero_si128());
358348}
359349
360static __inline__ __m256i __DEFAULT_FN_ATTRS256
361_mm256_mask_mul_epi32(__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y)
362{
350static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
351_mm256_mask_mul_epi32(__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) {
363352 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
364353 (__v4di)_mm256_mul_epi32(__X, __Y),
365354 (__v4di)__W);
366355}
367356
368static __inline__ __m256i __DEFAULT_FN_ATTRS256
369_mm256_maskz_mul_epi32(__mmask8 __M, __m256i __X, __m256i __Y)
370{
357static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
358_mm256_maskz_mul_epi32(__mmask8 __M, __m256i __X, __m256i __Y) {
371359 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
372360 (__v4di)_mm256_mul_epi32(__X, __Y),
373361 (__v4di)_mm256_setzero_si256());
374362}
375363
376static __inline__ __m128i __DEFAULT_FN_ATTRS128
377_mm_mask_mul_epi32(__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
378{
364static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
365_mm_mask_mul_epi32(__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y) {
379366 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
380367 (__v2di)_mm_mul_epi32(__X, __Y),
381368 (__v2di)__W);
382369}
383370
384static __inline__ __m128i __DEFAULT_FN_ATTRS128
385_mm_maskz_mul_epi32(__mmask8 __M, __m128i __X, __m128i __Y)
386{
371static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
372_mm_maskz_mul_epi32(__mmask8 __M, __m128i __X, __m128i __Y) {
387373 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
388374 (__v2di)_mm_mul_epi32(__X, __Y),
389375 (__v2di)_mm_setzero_si128());
390376}
391377
392static __inline__ __m256i __DEFAULT_FN_ATTRS256
393_mm256_mask_mul_epu32(__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y)
394{
378static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
379_mm256_mask_mul_epu32(__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) {
395380 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
396381 (__v4di)_mm256_mul_epu32(__X, __Y),
397382 (__v4di)__W);
398383}
399384
400static __inline__ __m256i __DEFAULT_FN_ATTRS256
401_mm256_maskz_mul_epu32(__mmask8 __M, __m256i __X, __m256i __Y)
402{
385static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
386_mm256_maskz_mul_epu32(__mmask8 __M, __m256i __X, __m256i __Y) {
403387 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
404388 (__v4di)_mm256_mul_epu32(__X, __Y),
405389 (__v4di)_mm256_setzero_si256());
406390}
407391
408static __inline__ __m128i __DEFAULT_FN_ATTRS128
409_mm_mask_mul_epu32(__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
410{
392static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
393_mm_mask_mul_epu32(__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y) {
411394 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
412395 (__v2di)_mm_mul_epu32(__X, __Y),
413396 (__v2di)__W);
414397}
415398
416static __inline__ __m128i __DEFAULT_FN_ATTRS128
417_mm_maskz_mul_epu32(__mmask8 __M, __m128i __X, __m128i __Y)
418{
399static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
400_mm_maskz_mul_epu32(__mmask8 __M, __m128i __X, __m128i __Y) {
419401 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
420402 (__v2di)_mm_mul_epu32(__X, __Y),
421403 (__v2di)_mm_setzero_si128());
422404}
423405
424static __inline__ __m256i __DEFAULT_FN_ATTRS256
425_mm256_maskz_mullo_epi32(__mmask8 __M, __m256i __A, __m256i __B)
426{
406static __inline__ __m256i __DEFAULT_FN_ATTRS128_CONSTEXPR
407_mm256_maskz_mullo_epi32(__mmask8 __M, __m256i __A, __m256i __B) {
427408 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
428409 (__v8si)_mm256_mullo_epi32(__A, __B),
429410 (__v8si)_mm256_setzero_si256());
430411}
431412
432static __inline__ __m256i __DEFAULT_FN_ATTRS256
433_mm256_mask_mullo_epi32(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B)
434{
413static __inline__ __m256i __DEFAULT_FN_ATTRS128_CONSTEXPR
414_mm256_mask_mullo_epi32(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
435415 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
436416 (__v8si)_mm256_mullo_epi32(__A, __B),
437417 (__v8si)__W);
......@@ -453,9 +433,8 @@ _mm_mask_mullo_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B)
453433 (__v4si)__W);
454434}
455435
456static __inline__ __m256i __DEFAULT_FN_ATTRS256
457_mm256_and_epi32(__m256i __a, __m256i __b)
458{
436static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
437_mm256_and_epi32(__m256i __a, __m256i __b) {
459438 return (__m256i)((__v8su)__a & (__v8su)__b);
460439}
461440
......@@ -473,9 +452,8 @@ _mm256_maskz_and_epi32(__mmask8 __U, __m256i __A, __m256i __B)
473452 return (__m256i)_mm256_mask_and_epi32(_mm256_setzero_si256(), __U, __A, __B);
474453}
475454
476static __inline__ __m128i __DEFAULT_FN_ATTRS128
477_mm_and_epi32(__m128i __a, __m128i __b)
478{
455static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
456_mm_and_epi32(__m128i __a, __m128i __b) {
479457 return (__m128i)((__v4su)__a & (__v4su)__b);
480458}
481459
......@@ -896,329 +874,312 @@ _mm_maskz_xor_epi64(__mmask8 __U, __m128i __A, __m128i __B)
896874 (__v2df)(__m128d)(b), (int)(p), \
897875 (__mmask8)(m)))
898876
899static __inline__ __m128d __DEFAULT_FN_ATTRS128
900_mm_mask_fmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
901{
902 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
903 __builtin_ia32_vfmaddpd ((__v2df) __A,
904 (__v2df) __B,
905 (__v2df) __C),
906 (__v2df) __A);
877static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
878_mm_mask_fmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) {
879 return (__m128d)__builtin_ia32_selectpd_128(
880 (__mmask8)__U, (__v2df)_mm_fmadd_pd(__A, __B, __C), (__v2df)__A);
907881}
908882
909static __inline__ __m128d __DEFAULT_FN_ATTRS128
910_mm_mask3_fmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
911{
912 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
913 __builtin_ia32_vfmaddpd ((__v2df) __A,
914 (__v2df) __B,
915 (__v2df) __C),
916 (__v2df) __C);
883static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
884_mm_mask3_fmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) {
885 return (__m128d)__builtin_ia32_selectpd_128(
886 (__mmask8)__U, (__v2df)_mm_fmadd_pd(__A, __B, __C), (__v2df)__C);
917887}
918888
919static __inline__ __m128d __DEFAULT_FN_ATTRS128
920_mm_maskz_fmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
921{
922 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
923 __builtin_ia32_vfmaddpd ((__v2df) __A,
924 (__v2df) __B,
925 (__v2df) __C),
926 (__v2df)_mm_setzero_pd());
889static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
890_mm_maskz_fmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) {
891 return (__m128d)__builtin_ia32_selectpd_128(
892 (__mmask8)__U, (__v2df)_mm_fmadd_pd(__A, __B, __C),
893 (__v2df)_mm_setzero_pd());
927894}
928895
929static __inline__ __m128d __DEFAULT_FN_ATTRS128
930_mm_mask_fmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
931{
932 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
933 __builtin_ia32_vfmaddpd ((__v2df) __A,
934 (__v2df) __B,
935 -(__v2df) __C),
936 (__v2df) __A);
896static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
897_mm_mask_fmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) {
898 return (__m128d)__builtin_ia32_selectpd_128(
899 (__mmask8)__U, (__v2df)_mm_fmsub_pd(__A, __B, __C), (__v2df)__A);
937900}
938901
939static __inline__ __m128d __DEFAULT_FN_ATTRS128
940_mm_maskz_fmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
941{
942 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
943 __builtin_ia32_vfmaddpd ((__v2df) __A,
944 (__v2df) __B,
945 -(__v2df) __C),
946 (__v2df)_mm_setzero_pd());
902static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
903_mm_mask3_fmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) {
904 return (__m128d)__builtin_ia32_selectpd_128(
905 (__mmask8)__U, (__v2df)_mm_fmsub_pd(__A, __B, __C), (__v2df)__C);
947906}
948907
949static __inline__ __m128d __DEFAULT_FN_ATTRS128
950_mm_mask3_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
951{
952 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
953 __builtin_ia32_vfmaddpd (-(__v2df) __A,
954 (__v2df) __B,
955 (__v2df) __C),
956 (__v2df) __C);
908static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
909_mm_maskz_fmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) {
910 return (__m128d)__builtin_ia32_selectpd_128(
911 (__mmask8)__U, (__v2df)_mm_fmsub_pd(__A, __B, __C),
912 (__v2df)_mm_setzero_pd());
957913}
958914
959static __inline__ __m128d __DEFAULT_FN_ATTRS128
960_mm_maskz_fnmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
961{
962 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
963 __builtin_ia32_vfmaddpd (-(__v2df) __A,
964 (__v2df) __B,
965 (__v2df) __C),
966 (__v2df)_mm_setzero_pd());
915static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
916_mm_mask_fnmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) {
917 return (__m128d)__builtin_ia32_selectpd_128(
918 (__mmask8)__U, (__v2df)_mm_fnmadd_pd(__A, __B, __C), (__v2df)__A);
967919}
968920
969static __inline__ __m128d __DEFAULT_FN_ATTRS128
970_mm_maskz_fnmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
971{
972 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
973 __builtin_ia32_vfmaddpd (-(__v2df) __A,
974 (__v2df) __B,
975 -(__v2df) __C),
976 (__v2df)_mm_setzero_pd());
921static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
922_mm_mask3_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) {
923 return (__m128d)__builtin_ia32_selectpd_128(
924 (__mmask8)__U, (__v2df)_mm_fnmadd_pd(__A, __B, __C), (__v2df)__C);
977925}
978926
979static __inline__ __m256d __DEFAULT_FN_ATTRS256
980_mm256_mask_fmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
981{
982 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
983 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
984 (__v4df) __B,
985 (__v4df) __C),
986 (__v4df) __A);
927static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
928_mm_maskz_fnmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) {
929 return (__m128d)__builtin_ia32_selectpd_128(
930 (__mmask8)__U, (__v2df)_mm_fnmadd_pd(__A, __B, __C),
931 (__v2df)_mm_setzero_pd());
987932}
988933
989static __inline__ __m256d __DEFAULT_FN_ATTRS256
990_mm256_mask3_fmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
991{
992 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
993 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
994 (__v4df) __B,
995 (__v4df) __C),
996 (__v4df) __C);
934static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
935_mm_mask_fnmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) {
936 return (__m128d)__builtin_ia32_selectpd_128(
937 (__mmask8)__U, (__v2df)_mm_fnmsub_pd(__A, __B, __C), (__v2df)__A);
997938}
998939
999static __inline__ __m256d __DEFAULT_FN_ATTRS256
1000_mm256_maskz_fmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1001{
1002 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1003 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1004 (__v4df) __B,
1005 (__v4df) __C),
1006 (__v4df)_mm256_setzero_pd());
940static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
941_mm_mask3_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) {
942 return (__m128d)__builtin_ia32_selectpd_128(
943 (__mmask8)__U, (__v2df)_mm_fnmsub_pd(__A, __B, __C), (__v2df)__C);
1007944}
1008945
1009static __inline__ __m256d __DEFAULT_FN_ATTRS256
1010_mm256_mask_fmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1011{
1012 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1013 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1014 (__v4df) __B,
1015 -(__v4df) __C),
1016 (__v4df) __A);
946static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
947_mm_maskz_fnmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) {
948 return (__m128d)__builtin_ia32_selectpd_128(
949 (__mmask8)__U, (__v2df)_mm_fnmsub_pd(__A, __B, __C),
950 (__v2df)_mm_setzero_pd());
1017951}
1018952
1019static __inline__ __m256d __DEFAULT_FN_ATTRS256
1020_mm256_maskz_fmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1021{
1022 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1023 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1024 (__v4df) __B,
1025 -(__v4df) __C),
1026 (__v4df)_mm256_setzero_pd());
953static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
954_mm256_mask_fmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) {
955 return (__m256d)__builtin_ia32_selectpd_256(
956 (__mmask8)__U, (__v4df)_mm256_fmadd_pd(__A, __B, __C), (__v4df)__A);
1027957}
1028958
1029static __inline__ __m256d __DEFAULT_FN_ATTRS256
1030_mm256_mask3_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1031{
1032 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1033 __builtin_ia32_vfmaddpd256 (-(__v4df) __A,
1034 (__v4df) __B,
1035 (__v4df) __C),
1036 (__v4df) __C);
959static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
960_mm256_mask3_fmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) {
961 return (__m256d)__builtin_ia32_selectpd_256(
962 (__mmask8)__U, (__v4df)_mm256_fmadd_pd(__A, __B, __C), (__v4df)__C);
1037963}
1038964
1039static __inline__ __m256d __DEFAULT_FN_ATTRS256
1040_mm256_maskz_fnmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1041{
1042 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1043 __builtin_ia32_vfmaddpd256 (-(__v4df) __A,
1044 (__v4df) __B,
1045 (__v4df) __C),
1046 (__v4df)_mm256_setzero_pd());
965static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
966_mm256_maskz_fmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) {
967 return (__m256d)__builtin_ia32_selectpd_256(
968 (__mmask8)__U, (__v4df)_mm256_fmadd_pd(__A, __B, __C),
969 (__v4df)_mm256_setzero_pd());
1047970}
1048971
1049static __inline__ __m256d __DEFAULT_FN_ATTRS256
1050_mm256_maskz_fnmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1051{
1052 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1053 __builtin_ia32_vfmaddpd256 (-(__v4df) __A,
1054 (__v4df) __B,
1055 -(__v4df) __C),
1056 (__v4df)_mm256_setzero_pd());
972static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
973_mm256_mask_fmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) {
974 return (__m256d)__builtin_ia32_selectpd_256(
975 (__mmask8)__U, (__v4df)_mm256_fmsub_pd(__A, __B, __C), (__v4df)__A);
1057976}
1058977
1059static __inline__ __m128 __DEFAULT_FN_ATTRS128
1060_mm_mask_fmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1061{
1062 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1063 __builtin_ia32_vfmaddps ((__v4sf) __A,
1064 (__v4sf) __B,
1065 (__v4sf) __C),
1066 (__v4sf) __A);
978static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
979_mm256_mask3_fmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) {
980 return (__m256d)__builtin_ia32_selectpd_256(
981 (__mmask8)__U, (__v4df)_mm256_fmsub_pd(__A, __B, __C), (__v4df)__C);
1067982}
1068983
1069static __inline__ __m128 __DEFAULT_FN_ATTRS128
1070_mm_mask3_fmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1071{
1072 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1073 __builtin_ia32_vfmaddps ((__v4sf) __A,
1074 (__v4sf) __B,
1075 (__v4sf) __C),
1076 (__v4sf) __C);
984static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
985_mm256_maskz_fmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) {
986 return (__m256d)__builtin_ia32_selectpd_256(
987 (__mmask8)__U, (__v4df)_mm256_fmsub_pd(__A, __B, __C),
988 (__v4df)_mm256_setzero_pd());
1077989}
1078990
1079static __inline__ __m128 __DEFAULT_FN_ATTRS128
1080_mm_maskz_fmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1081{
1082 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1083 __builtin_ia32_vfmaddps ((__v4sf) __A,
1084 (__v4sf) __B,
1085 (__v4sf) __C),
1086 (__v4sf)_mm_setzero_ps());
991static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
992_mm256_mask_fnmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) {
993 return (__m256d)__builtin_ia32_selectpd_256(
994 (__mmask8)__U, (__v4df)_mm256_fnmadd_pd(__A, __B, __C), (__v4df)__A);
1087995}
1088996
1089static __inline__ __m128 __DEFAULT_FN_ATTRS128
1090_mm_mask_fmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1091{
1092 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1093 __builtin_ia32_vfmaddps ((__v4sf) __A,
1094 (__v4sf) __B,
1095 -(__v4sf) __C),
1096 (__v4sf) __A);
997static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
998_mm256_mask3_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) {
999 return (__m256d)__builtin_ia32_selectpd_256(
1000 (__mmask8)__U, (__v4df)_mm256_fnmadd_pd(__A, __B, __C), (__v4df)__C);
10971001}
10981002
1099static __inline__ __m128 __DEFAULT_FN_ATTRS128
1100_mm_maskz_fmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1101{
1102 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1103 __builtin_ia32_vfmaddps ((__v4sf) __A,
1104 (__v4sf) __B,
1105 -(__v4sf) __C),
1106 (__v4sf)_mm_setzero_ps());
1003static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1004_mm256_maskz_fnmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) {
1005 return (__m256d)__builtin_ia32_selectpd_256(
1006 (__mmask8)__U, (__v4df)_mm256_fnmadd_pd(__A, __B, __C),
1007 (__v4df)_mm256_setzero_pd());
11071008}
11081009
1109static __inline__ __m128 __DEFAULT_FN_ATTRS128
1110_mm_mask3_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1111{
1112 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1113 __builtin_ia32_vfmaddps (-(__v4sf) __A,
1114 (__v4sf) __B,
1115 (__v4sf) __C),
1116 (__v4sf) __C);
1010static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1011_mm256_mask_fnmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) {
1012 return (__m256d)__builtin_ia32_selectpd_256(
1013 (__mmask8)__U, (__v4df)_mm256_fnmsub_pd(__A, __B, __C), (__v4df)__A);
11171014}
11181015
1119static __inline__ __m128 __DEFAULT_FN_ATTRS128
1120_mm_maskz_fnmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1121{
1122 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1123 __builtin_ia32_vfmaddps (-(__v4sf) __A,
1124 (__v4sf) __B,
1125 (__v4sf) __C),
1126 (__v4sf)_mm_setzero_ps());
1016static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1017_mm256_mask3_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) {
1018 return (__m256d)__builtin_ia32_selectpd_256(
1019 (__mmask8)__U, (__v4df)_mm256_fnmsub_pd(__A, __B, __C), (__v4df)__C);
11271020}
11281021
1129static __inline__ __m128 __DEFAULT_FN_ATTRS128
1130_mm_maskz_fnmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1131{
1132 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1133 __builtin_ia32_vfmaddps (-(__v4sf) __A,
1134 (__v4sf) __B,
1135 -(__v4sf) __C),
1136 (__v4sf)_mm_setzero_ps());
1022static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1023_mm256_maskz_fnmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) {
1024 return (__m256d)__builtin_ia32_selectpd_256(
1025 (__mmask8)__U, (__v4df)_mm256_fnmsub_pd(__A, __B, __C),
1026 (__v4df)_mm256_setzero_pd());
11371027}
11381028
1139static __inline__ __m256 __DEFAULT_FN_ATTRS256
1140_mm256_mask_fmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1141{
1142 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1143 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1144 (__v8sf) __B,
1145 (__v8sf) __C),
1146 (__v8sf) __A);
1029static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1030_mm_mask_fmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) {
1031 return (__m128)__builtin_ia32_selectps_128(
1032 (__mmask8)__U, (__v4sf)_mm_fmadd_ps(__A, __B, __C), (__v4sf)__A);
11471033}
11481034
1149static __inline__ __m256 __DEFAULT_FN_ATTRS256
1150_mm256_mask3_fmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1151{
1152 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1153 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1154 (__v8sf) __B,
1155 (__v8sf) __C),
1156 (__v8sf) __C);
1035static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1036_mm_mask3_fmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) {
1037 return (__m128)__builtin_ia32_selectps_128(
1038 (__mmask8)__U, (__v4sf)_mm_fmadd_ps(__A, __B, __C), (__v4sf)__C);
11571039}
11581040
1159static __inline__ __m256 __DEFAULT_FN_ATTRS256
1160_mm256_maskz_fmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1161{
1162 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1163 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1164 (__v8sf) __B,
1165 (__v8sf) __C),
1166 (__v8sf)_mm256_setzero_ps());
1041static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1042_mm_maskz_fmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) {
1043 return (__m128)__builtin_ia32_selectps_128(
1044 (__mmask8)__U, (__v4sf)_mm_fmadd_ps(__A, __B, __C),
1045 (__v4sf)_mm_setzero_ps());
11671046}
11681047
1169static __inline__ __m256 __DEFAULT_FN_ATTRS256
1170_mm256_mask_fmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1171{
1172 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1173 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1174 (__v8sf) __B,
1175 -(__v8sf) __C),
1176 (__v8sf) __A);
1048static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1049_mm_mask_fmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) {
1050 return (__m128)__builtin_ia32_selectps_128(
1051 (__mmask8)__U, (__v4sf)_mm_fmsub_ps(__A, __B, __C), (__v4sf)__A);
11771052}
11781053
1179static __inline__ __m256 __DEFAULT_FN_ATTRS256
1180_mm256_maskz_fmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1181{
1182 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1183 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1184 (__v8sf) __B,
1185 -(__v8sf) __C),
1186 (__v8sf)_mm256_setzero_ps());
1054static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1055_mm_mask3_fmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) {
1056 return (__m128)__builtin_ia32_selectps_128(
1057 (__mmask8)__U, (__v4sf)_mm_fmsub_ps(__A, __B, __C), (__v4sf)__C);
11871058}
11881059
1189static __inline__ __m256 __DEFAULT_FN_ATTRS256
1190_mm256_mask3_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1191{
1192 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1193 __builtin_ia32_vfmaddps256 (-(__v8sf) __A,
1194 (__v8sf) __B,
1195 (__v8sf) __C),
1196 (__v8sf) __C);
1060static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1061_mm_maskz_fmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) {
1062 return (__m128)__builtin_ia32_selectps_128(
1063 (__mmask8)__U, (__v4sf)_mm_fmsub_ps(__A, __B, __C),
1064 (__v4sf)_mm_setzero_ps());
11971065}
11981066
1199static __inline__ __m256 __DEFAULT_FN_ATTRS256
1200_mm256_maskz_fnmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1201{
1202 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1203 __builtin_ia32_vfmaddps256 (-(__v8sf) __A,
1204 (__v8sf) __B,
1205 (__v8sf) __C),
1206 (__v8sf)_mm256_setzero_ps());
1067static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1068_mm_mask_fnmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) {
1069 return (__m128)__builtin_ia32_selectps_128(
1070 (__mmask8)__U, (__v4sf)_mm_fnmadd_ps(__A, __B, __C), (__v4sf)__A);
12071071}
12081072
1209static __inline__ __m256 __DEFAULT_FN_ATTRS256
1210_mm256_maskz_fnmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1211{
1212 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1213 __builtin_ia32_vfmaddps256 (-(__v8sf) __A,
1214 (__v8sf) __B,
1215 -(__v8sf) __C),
1216 (__v8sf)_mm256_setzero_ps());
1073static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1074_mm_mask3_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) {
1075 return (__m128)__builtin_ia32_selectps_128(
1076 (__mmask8)__U, (__v4sf)_mm_fnmadd_ps(__A, __B, __C), (__v4sf)__C);
1077}
1078
1079static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1080_mm_maskz_fnmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) {
1081 return (__m128)__builtin_ia32_selectps_128(
1082 (__mmask8)__U, (__v4sf)_mm_fnmadd_ps(__A, __B, __C),
1083 (__v4sf)_mm_setzero_ps());
1084}
1085
1086static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1087_mm_mask_fnmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) {
1088 return (__m128)__builtin_ia32_selectps_128(
1089 (__mmask8)__U, (__v4sf)_mm_fnmsub_ps(__A, __B, __C), (__v4sf)__A);
1090}
1091
1092static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1093_mm_mask3_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) {
1094 return (__m128)__builtin_ia32_selectps_128(
1095 (__mmask8)__U, (__v4sf)_mm_fnmsub_ps(__A, __B, __C), (__v4sf)__C);
1096}
1097
1098static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1099_mm_maskz_fnmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) {
1100 return (__m128)__builtin_ia32_selectps_128(
1101 (__mmask8)__U, (__v4sf)_mm_fnmsub_ps(__A, __B, __C),
1102 (__v4sf)_mm_setzero_ps());
1103}
1104
1105static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1106_mm256_mask_fmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) {
1107 return (__m256)__builtin_ia32_selectps_256(
1108 (__mmask8)__U, (__v8sf)_mm256_fmadd_ps(__A, __B, __C), (__v8sf)__A);
1109}
1110
1111static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1112_mm256_mask3_fmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) {
1113 return (__m256)__builtin_ia32_selectps_256(
1114 (__mmask8)__U, (__v8sf)_mm256_fmadd_ps(__A, __B, __C), (__v8sf)__C);
1115}
1116
1117static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1118_mm256_maskz_fmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) {
1119 return (__m256)__builtin_ia32_selectps_256(
1120 (__mmask8)__U, (__v8sf)_mm256_fmadd_ps(__A, __B, __C),
1121 (__v8sf)_mm256_setzero_ps());
1122}
1123
1124static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1125_mm256_mask_fmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) {
1126 return (__m256)__builtin_ia32_selectps_256(
1127 (__mmask8)__U, (__v8sf)_mm256_fmsub_ps(__A, __B, __C), (__v8sf)__A);
1128}
1129
1130static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1131_mm256_mask3_fmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) {
1132 return (__m256)__builtin_ia32_selectps_256(
1133 (__mmask8)__U, (__v8sf)_mm256_fmsub_ps(__A, __B, __C), (__v8sf)__C);
1134}
1135
1136static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1137_mm256_maskz_fmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) {
1138 return (__m256)__builtin_ia32_selectps_256(
1139 (__mmask8)__U, (__v8sf)_mm256_fmsub_ps(__A, __B, __C),
1140 (__v8sf)_mm256_setzero_ps());
1141}
1142
1143static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1144_mm256_mask_fnmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) {
1145 return (__m256)__builtin_ia32_selectps_256(
1146 (__mmask8)__U, (__v8sf)_mm256_fnmadd_ps(__A, __B, __C), (__v8sf)__A);
1147}
1148
1149static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1150_mm256_mask3_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) {
1151 return (__m256)__builtin_ia32_selectps_256(
1152 (__mmask8)__U, (__v8sf)_mm256_fnmadd_ps(__A, __B, __C), (__v8sf)__C);
1153}
1154
1155static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1156_mm256_maskz_fnmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) {
1157 return (__m256)__builtin_ia32_selectps_256(
1158 (__mmask8)__U, (__v8sf)_mm256_fnmadd_ps(__A, __B, __C),
1159 (__v8sf)_mm256_setzero_ps());
1160}
1161
1162static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1163_mm256_mask_fnmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) {
1164 return (__m256)__builtin_ia32_selectps_256(
1165 (__mmask8)__U, (__v8sf)_mm256_fnmsub_ps(__A, __B, __C), (__v8sf)__A);
1166}
1167
1168static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1169_mm256_mask3_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) {
1170 return (__m256)__builtin_ia32_selectps_256(
1171 (__mmask8)__U, (__v8sf)_mm256_fnmsub_ps(__A, __B, __C), (__v8sf)__C);
1172}
1173
1174static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1175_mm256_maskz_fnmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) {
1176 return (__m256)__builtin_ia32_selectps_256(
1177 (__mmask8)__U, (__v8sf)_mm256_fnmsub_ps(__A, __B, __C),
1178 (__v8sf)_mm256_setzero_ps());
12171179}
12181180
12191181static __inline__ __m128d __DEFAULT_FN_ATTRS128
1220_mm_mask_fmaddsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1221{
1182_mm_mask_fmaddsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) {
12221183 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
12231184 __builtin_ia32_vfmaddsubpd ((__v2df) __A,
12241185 (__v2df) __B,
......@@ -1417,46 +1378,6 @@ _mm256_maskz_fmsubadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
14171378 (__v8sf)_mm256_setzero_ps());
14181379}
14191380
1420static __inline__ __m128d __DEFAULT_FN_ATTRS128
1421_mm_mask3_fmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1422{
1423 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
1424 __builtin_ia32_vfmaddpd ((__v2df) __A,
1425 (__v2df) __B,
1426 -(__v2df) __C),
1427 (__v2df) __C);
1428}
1429
1430static __inline__ __m256d __DEFAULT_FN_ATTRS256
1431_mm256_mask3_fmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1432{
1433 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1434 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1435 (__v4df) __B,
1436 -(__v4df) __C),
1437 (__v4df) __C);
1438}
1439
1440static __inline__ __m128 __DEFAULT_FN_ATTRS128
1441_mm_mask3_fmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1442{
1443 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1444 __builtin_ia32_vfmaddps ((__v4sf) __A,
1445 (__v4sf) __B,
1446 -(__v4sf) __C),
1447 (__v4sf) __C);
1448}
1449
1450static __inline__ __m256 __DEFAULT_FN_ATTRS256
1451_mm256_mask3_fmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1452{
1453 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1454 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1455 (__v8sf) __B,
1456 -(__v8sf) __C),
1457 (__v8sf) __C);
1458}
1459
14601381static __inline__ __m128d __DEFAULT_FN_ATTRS128
14611382_mm_mask3_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
14621383{
......@@ -1497,233 +1418,113 @@ _mm256_mask3_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
14971418 (__v8sf) __C);
14981419}
14991420
1500static __inline__ __m128d __DEFAULT_FN_ATTRS128
1501_mm_mask_fnmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1502{
1503 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
1504 __builtin_ia32_vfmaddpd ((__v2df) __A,
1505 -(__v2df) __B,
1506 (__v2df) __C),
1507 (__v2df) __A);
1508}
1509
1510static __inline__ __m256d __DEFAULT_FN_ATTRS256
1511_mm256_mask_fnmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1512{
1513 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1514 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1515 -(__v4df) __B,
1516 (__v4df) __C),
1517 (__v4df) __A);
1518}
1519
1520static __inline__ __m128 __DEFAULT_FN_ATTRS128
1521_mm_mask_fnmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1522{
1523 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1524 __builtin_ia32_vfmaddps ((__v4sf) __A,
1525 -(__v4sf) __B,
1526 (__v4sf) __C),
1527 (__v4sf) __A);
1528}
1529
1530static __inline__ __m256 __DEFAULT_FN_ATTRS256
1531_mm256_mask_fnmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1532{
1533 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1534 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1535 -(__v8sf) __B,
1536 (__v8sf) __C),
1537 (__v8sf) __A);
1538}
1539
1540static __inline__ __m128d __DEFAULT_FN_ATTRS128
1541_mm_mask_fnmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1542{
1543 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
1544 __builtin_ia32_vfmaddpd ((__v2df) __A,
1545 -(__v2df) __B,
1546 -(__v2df) __C),
1547 (__v2df) __A);
1548}
1549
1550static __inline__ __m128d __DEFAULT_FN_ATTRS128
1551_mm_mask3_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1552{
1553 return (__m128d) __builtin_ia32_selectpd_128((__mmask8) __U,
1554 __builtin_ia32_vfmaddpd ((__v2df) __A,
1555 -(__v2df) __B,
1556 -(__v2df) __C),
1557 (__v2df) __C);
1558}
1559
1560static __inline__ __m256d __DEFAULT_FN_ATTRS256
1561_mm256_mask_fnmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1562{
1563 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1564 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1565 -(__v4df) __B,
1566 -(__v4df) __C),
1567 (__v4df) __A);
1568}
1569
1570static __inline__ __m256d __DEFAULT_FN_ATTRS256
1571_mm256_mask3_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1572{
1573 return (__m256d) __builtin_ia32_selectpd_256((__mmask8) __U,
1574 __builtin_ia32_vfmaddpd256 ((__v4df) __A,
1575 -(__v4df) __B,
1576 -(__v4df) __C),
1577 (__v4df) __C);
1578}
1579
1580static __inline__ __m128 __DEFAULT_FN_ATTRS128
1581_mm_mask_fnmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1582{
1583 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1584 __builtin_ia32_vfmaddps ((__v4sf) __A,
1585 -(__v4sf) __B,
1586 -(__v4sf) __C),
1587 (__v4sf) __A);
1588}
1589
1590static __inline__ __m128 __DEFAULT_FN_ATTRS128
1591_mm_mask3_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1592{
1593 return (__m128) __builtin_ia32_selectps_128((__mmask8) __U,
1594 __builtin_ia32_vfmaddps ((__v4sf) __A,
1595 -(__v4sf) __B,
1596 -(__v4sf) __C),
1597 (__v4sf) __C);
1598}
1599
1600static __inline__ __m256 __DEFAULT_FN_ATTRS256
1601_mm256_mask_fnmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1602{
1603 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1604 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1605 -(__v8sf) __B,
1606 -(__v8sf) __C),
1607 (__v8sf) __A);
1608}
1609
1610static __inline__ __m256 __DEFAULT_FN_ATTRS256
1611_mm256_mask3_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1612{
1613 return (__m256) __builtin_ia32_selectps_256((__mmask8) __U,
1614 __builtin_ia32_vfmaddps256 ((__v8sf) __A,
1615 -(__v8sf) __B,
1616 -(__v8sf) __C),
1617 (__v8sf) __C);
1618}
1619
1620static __inline__ __m128d __DEFAULT_FN_ATTRS128
1421static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
16211422_mm_mask_add_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
16221423 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
16231424 (__v2df)_mm_add_pd(__A, __B),
16241425 (__v2df)__W);
16251426}
16261427
1627static __inline__ __m128d __DEFAULT_FN_ATTRS128
1428static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
16281429_mm_maskz_add_pd(__mmask8 __U, __m128d __A, __m128d __B) {
16291430 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
16301431 (__v2df)_mm_add_pd(__A, __B),
16311432 (__v2df)_mm_setzero_pd());
16321433}
16331434
1634static __inline__ __m256d __DEFAULT_FN_ATTRS256
1435static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
16351436_mm256_mask_add_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
16361437 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
16371438 (__v4df)_mm256_add_pd(__A, __B),
16381439 (__v4df)__W);
16391440}
16401441
1641static __inline__ __m256d __DEFAULT_FN_ATTRS256
1442static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
16421443_mm256_maskz_add_pd(__mmask8 __U, __m256d __A, __m256d __B) {
16431444 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
16441445 (__v4df)_mm256_add_pd(__A, __B),
16451446 (__v4df)_mm256_setzero_pd());
16461447}
16471448
1648static __inline__ __m128 __DEFAULT_FN_ATTRS128
1449static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
16491450_mm_mask_add_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
16501451 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
16511452 (__v4sf)_mm_add_ps(__A, __B),
16521453 (__v4sf)__W);
16531454}
16541455
1655static __inline__ __m128 __DEFAULT_FN_ATTRS128
1456static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
16561457_mm_maskz_add_ps(__mmask8 __U, __m128 __A, __m128 __B) {
16571458 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
16581459 (__v4sf)_mm_add_ps(__A, __B),
16591460 (__v4sf)_mm_setzero_ps());
16601461}
16611462
1662static __inline__ __m256 __DEFAULT_FN_ATTRS256
1463static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
16631464_mm256_mask_add_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
16641465 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
16651466 (__v8sf)_mm256_add_ps(__A, __B),
16661467 (__v8sf)__W);
16671468}
16681469
1669static __inline__ __m256 __DEFAULT_FN_ATTRS256
1470static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
16701471_mm256_maskz_add_ps(__mmask8 __U, __m256 __A, __m256 __B) {
16711472 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
16721473 (__v8sf)_mm256_add_ps(__A, __B),
16731474 (__v8sf)_mm256_setzero_ps());
16741475}
16751476
1676static __inline__ __m128i __DEFAULT_FN_ATTRS128
1677_mm_mask_blend_epi32 (__mmask8 __U, __m128i __A, __m128i __W) {
1477static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1478_mm_mask_blend_epi32(__mmask8 __U, __m128i __A, __m128i __W) {
16781479 return (__m128i) __builtin_ia32_selectd_128 ((__mmask8) __U,
16791480 (__v4si) __W,
16801481 (__v4si) __A);
16811482}
16821483
1683static __inline__ __m256i __DEFAULT_FN_ATTRS256
1684_mm256_mask_blend_epi32 (__mmask8 __U, __m256i __A, __m256i __W) {
1484static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1485_mm256_mask_blend_epi32(__mmask8 __U, __m256i __A, __m256i __W) {
16851486 return (__m256i) __builtin_ia32_selectd_256 ((__mmask8) __U,
16861487 (__v8si) __W,
16871488 (__v8si) __A);
16881489}
16891490
1690static __inline__ __m128d __DEFAULT_FN_ATTRS128
1691_mm_mask_blend_pd (__mmask8 __U, __m128d __A, __m128d __W) {
1491static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1492_mm_mask_blend_pd(__mmask8 __U, __m128d __A, __m128d __W) {
16921493 return (__m128d) __builtin_ia32_selectpd_128 ((__mmask8) __U,
16931494 (__v2df) __W,
16941495 (__v2df) __A);
16951496}
16961497
1697static __inline__ __m256d __DEFAULT_FN_ATTRS256
1698_mm256_mask_blend_pd (__mmask8 __U, __m256d __A, __m256d __W) {
1498static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1499_mm256_mask_blend_pd(__mmask8 __U, __m256d __A, __m256d __W) {
16991500 return (__m256d) __builtin_ia32_selectpd_256 ((__mmask8) __U,
17001501 (__v4df) __W,
17011502 (__v4df) __A);
17021503}
17031504
1704static __inline__ __m128 __DEFAULT_FN_ATTRS128
1705_mm_mask_blend_ps (__mmask8 __U, __m128 __A, __m128 __W) {
1505static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1506_mm_mask_blend_ps(__mmask8 __U, __m128 __A, __m128 __W) {
17061507 return (__m128) __builtin_ia32_selectps_128 ((__mmask8) __U,
17071508 (__v4sf) __W,
17081509 (__v4sf) __A);
17091510}
17101511
1711static __inline__ __m256 __DEFAULT_FN_ATTRS256
1712_mm256_mask_blend_ps (__mmask8 __U, __m256 __A, __m256 __W) {
1512static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1513_mm256_mask_blend_ps(__mmask8 __U, __m256 __A, __m256 __W) {
17131514 return (__m256) __builtin_ia32_selectps_256 ((__mmask8) __U,
17141515 (__v8sf) __W,
17151516 (__v8sf) __A);
17161517}
17171518
1718static __inline__ __m128i __DEFAULT_FN_ATTRS128
1719_mm_mask_blend_epi64 (__mmask8 __U, __m128i __A, __m128i __W) {
1519static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1520_mm_mask_blend_epi64(__mmask8 __U, __m128i __A, __m128i __W) {
17201521 return (__m128i) __builtin_ia32_selectq_128 ((__mmask8) __U,
17211522 (__v2di) __W,
17221523 (__v2di) __A);
17231524}
17241525
1725static __inline__ __m256i __DEFAULT_FN_ATTRS256
1726_mm256_mask_blend_epi64 (__mmask8 __U, __m256i __A, __m256i __W) {
1526static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1527_mm256_mask_blend_epi64(__mmask8 __U, __m256i __A, __m256i __W) {
17271528 return (__m256i) __builtin_ia32_selectq_256 ((__mmask8) __U,
17281529 (__v4di) __W,
17291530 (__v4di) __A);
......@@ -1905,57 +1706,57 @@ _mm256_mask_compressstoreu_epi32 (void *__P, __mmask8 __U, __m256i __A) {
19051706 (__mmask8) __U);
19061707}
19071708
1908static __inline__ __m128d __DEFAULT_FN_ATTRS128
1909_mm_mask_cvtepi32_pd (__m128d __W, __mmask8 __U, __m128i __A) {
1709static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1710_mm_mask_cvtepi32_pd(__m128d __W, __mmask8 __U, __m128i __A) {
19101711 return (__m128d)__builtin_ia32_selectpd_128((__mmask8) __U,
19111712 (__v2df)_mm_cvtepi32_pd(__A),
19121713 (__v2df)__W);
19131714}
19141715
1915static __inline__ __m128d __DEFAULT_FN_ATTRS128
1916_mm_maskz_cvtepi32_pd (__mmask8 __U, __m128i __A) {
1716static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1717_mm_maskz_cvtepi32_pd(__mmask8 __U, __m128i __A) {
19171718 return (__m128d)__builtin_ia32_selectpd_128((__mmask8) __U,
19181719 (__v2df)_mm_cvtepi32_pd(__A),
19191720 (__v2df)_mm_setzero_pd());
19201721}
19211722
1922static __inline__ __m256d __DEFAULT_FN_ATTRS256
1923_mm256_mask_cvtepi32_pd (__m256d __W, __mmask8 __U, __m128i __A) {
1723static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1724_mm256_mask_cvtepi32_pd(__m256d __W, __mmask8 __U, __m128i __A) {
19241725 return (__m256d)__builtin_ia32_selectpd_256((__mmask8) __U,
19251726 (__v4df)_mm256_cvtepi32_pd(__A),
19261727 (__v4df)__W);
19271728}
19281729
1929static __inline__ __m256d __DEFAULT_FN_ATTRS256
1930_mm256_maskz_cvtepi32_pd (__mmask8 __U, __m128i __A) {
1730static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1731_mm256_maskz_cvtepi32_pd(__mmask8 __U, __m128i __A) {
19311732 return (__m256d)__builtin_ia32_selectpd_256((__mmask8) __U,
19321733 (__v4df)_mm256_cvtepi32_pd(__A),
19331734 (__v4df)_mm256_setzero_pd());
19341735}
19351736
1936static __inline__ __m128 __DEFAULT_FN_ATTRS128
1937_mm_mask_cvtepi32_ps (__m128 __W, __mmask8 __U, __m128i __A) {
1737static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1738_mm_mask_cvtepi32_ps(__m128 __W, __mmask8 __U, __m128i __A) {
19381739 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
19391740 (__v4sf)_mm_cvtepi32_ps(__A),
19401741 (__v4sf)__W);
19411742}
19421743
1943static __inline__ __m128 __DEFAULT_FN_ATTRS128
1944_mm_maskz_cvtepi32_ps (__mmask8 __U, __m128i __A) {
1744static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1745_mm_maskz_cvtepi32_ps(__mmask8 __U, __m128i __A) {
19451746 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
19461747 (__v4sf)_mm_cvtepi32_ps(__A),
19471748 (__v4sf)_mm_setzero_ps());
19481749}
19491750
1950static __inline__ __m256 __DEFAULT_FN_ATTRS256
1951_mm256_mask_cvtepi32_ps (__m256 __W, __mmask8 __U, __m256i __A) {
1751static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1752_mm256_mask_cvtepi32_ps(__m256 __W, __mmask8 __U, __m256i __A) {
19521753 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
19531754 (__v8sf)_mm256_cvtepi32_ps(__A),
19541755 (__v8sf)__W);
19551756}
19561757
1957static __inline__ __m256 __DEFAULT_FN_ATTRS256
1958_mm256_maskz_cvtepi32_ps (__mmask8 __U, __m256i __A) {
1758static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1759_mm256_maskz_cvtepi32_ps(__mmask8 __U, __m256i __A) {
19591760 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
19601761 (__v8sf)_mm256_cvtepi32_ps(__A),
19611762 (__v8sf)_mm256_setzero_ps());
......@@ -1990,30 +1791,30 @@ _mm256_maskz_cvtpd_epi32 (__mmask8 __U, __m256d __A) {
19901791 (__v4si)_mm_setzero_si128());
19911792}
19921793
1993static __inline__ __m128 __DEFAULT_FN_ATTRS128
1994_mm_mask_cvtpd_ps (__m128 __W, __mmask8 __U, __m128d __A) {
1794static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1795_mm_mask_cvtpd_ps(__m128 __W, __mmask8 __U, __m128d __A) {
19951796 return (__m128) __builtin_ia32_cvtpd2ps_mask ((__v2df) __A,
19961797 (__v4sf) __W,
19971798 (__mmask8) __U);
19981799}
19991800
2000static __inline__ __m128 __DEFAULT_FN_ATTRS128
2001_mm_maskz_cvtpd_ps (__mmask8 __U, __m128d __A) {
1801static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1802_mm_maskz_cvtpd_ps(__mmask8 __U, __m128d __A) {
20021803 return (__m128) __builtin_ia32_cvtpd2ps_mask ((__v2df) __A,
20031804 (__v4sf)
20041805 _mm_setzero_ps (),
20051806 (__mmask8) __U);
20061807}
20071808
2008static __inline__ __m128 __DEFAULT_FN_ATTRS256
2009_mm256_mask_cvtpd_ps (__m128 __W, __mmask8 __U, __m256d __A) {
1809static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
1810_mm256_mask_cvtpd_ps(__m128 __W, __mmask8 __U, __m256d __A) {
20101811 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
20111812 (__v4sf)_mm256_cvtpd_ps(__A),
20121813 (__v4sf)__W);
20131814}
20141815
2015static __inline__ __m128 __DEFAULT_FN_ATTRS256
2016_mm256_maskz_cvtpd_ps (__mmask8 __U, __m256d __A) {
1816static __inline__ __m128 __DEFAULT_FN_ATTRS256_CONSTEXPR
1817_mm256_maskz_cvtpd_ps(__mmask8 __U, __m256d __A) {
20171818 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
20181819 (__v4sf)_mm256_cvtpd_ps(__A),
20191820 (__v4sf)_mm_setzero_ps());
......@@ -2316,133 +2117,133 @@ _mm256_maskz_cvttps_epu32 (__mmask8 __U, __m256 __A) {
23162117 (__mmask8) __U);
23172118}
23182119
2319static __inline__ __m128d __DEFAULT_FN_ATTRS128
2320_mm_cvtepu32_pd (__m128i __A) {
2120static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2121_mm_cvtepu32_pd(__m128i __A) {
23212122 return (__m128d) __builtin_convertvector(
23222123 __builtin_shufflevector((__v4su)__A, (__v4su)__A, 0, 1), __v2df);
23232124}
23242125
2325static __inline__ __m128d __DEFAULT_FN_ATTRS128
2326_mm_mask_cvtepu32_pd (__m128d __W, __mmask8 __U, __m128i __A) {
2126static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2127_mm_mask_cvtepu32_pd(__m128d __W, __mmask8 __U, __m128i __A) {
23272128 return (__m128d)__builtin_ia32_selectpd_128((__mmask8) __U,
23282129 (__v2df)_mm_cvtepu32_pd(__A),
23292130 (__v2df)__W);
23302131}
23312132
2332static __inline__ __m128d __DEFAULT_FN_ATTRS128
2333_mm_maskz_cvtepu32_pd (__mmask8 __U, __m128i __A) {
2133static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
2134_mm_maskz_cvtepu32_pd(__mmask8 __U, __m128i __A) {
23342135 return (__m128d)__builtin_ia32_selectpd_128((__mmask8) __U,
23352136 (__v2df)_mm_cvtepu32_pd(__A),
23362137 (__v2df)_mm_setzero_pd());
23372138}
23382139
2339static __inline__ __m256d __DEFAULT_FN_ATTRS256
2340_mm256_cvtepu32_pd (__m128i __A) {
2140static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
2141_mm256_cvtepu32_pd(__m128i __A) {
23412142 return (__m256d)__builtin_convertvector((__v4su)__A, __v4df);
23422143}
23432144
2344static __inline__ __m256d __DEFAULT_FN_ATTRS256
2345_mm256_mask_cvtepu32_pd (__m256d __W, __mmask8 __U, __m128i __A) {
2145static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
2146_mm256_mask_cvtepu32_pd(__m256d __W, __mmask8 __U, __m128i __A) {
23462147 return (__m256d)__builtin_ia32_selectpd_256((__mmask8) __U,
23472148 (__v4df)_mm256_cvtepu32_pd(__A),
23482149 (__v4df)__W);
23492150}
23502151
2351static __inline__ __m256d __DEFAULT_FN_ATTRS256
2352_mm256_maskz_cvtepu32_pd (__mmask8 __U, __m128i __A) {
2152static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
2153_mm256_maskz_cvtepu32_pd(__mmask8 __U, __m128i __A) {
23532154 return (__m256d)__builtin_ia32_selectpd_256((__mmask8) __U,
23542155 (__v4df)_mm256_cvtepu32_pd(__A),
23552156 (__v4df)_mm256_setzero_pd());
23562157}
23572158
2358static __inline__ __m128 __DEFAULT_FN_ATTRS128
2359_mm_cvtepu32_ps (__m128i __A) {
2159static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2160_mm_cvtepu32_ps(__m128i __A) {
23602161 return (__m128)__builtin_convertvector((__v4su)__A, __v4sf);
23612162}
23622163
2363static __inline__ __m128 __DEFAULT_FN_ATTRS128
2364_mm_mask_cvtepu32_ps (__m128 __W, __mmask8 __U, __m128i __A) {
2164static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2165_mm_mask_cvtepu32_ps(__m128 __W, __mmask8 __U, __m128i __A) {
23652166 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
23662167 (__v4sf)_mm_cvtepu32_ps(__A),
23672168 (__v4sf)__W);
23682169}
23692170
2370static __inline__ __m128 __DEFAULT_FN_ATTRS128
2371_mm_maskz_cvtepu32_ps (__mmask8 __U, __m128i __A) {
2171static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
2172_mm_maskz_cvtepu32_ps(__mmask8 __U, __m128i __A) {
23722173 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
23732174 (__v4sf)_mm_cvtepu32_ps(__A),
23742175 (__v4sf)_mm_setzero_ps());
23752176}
23762177
2377static __inline__ __m256 __DEFAULT_FN_ATTRS256
2378_mm256_cvtepu32_ps (__m256i __A) {
2178static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
2179_mm256_cvtepu32_ps(__m256i __A) {
23792180 return (__m256)__builtin_convertvector((__v8su)__A, __v8sf);
23802181}
23812182
2382static __inline__ __m256 __DEFAULT_FN_ATTRS256
2383_mm256_mask_cvtepu32_ps (__m256 __W, __mmask8 __U, __m256i __A) {
2183static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
2184_mm256_mask_cvtepu32_ps(__m256 __W, __mmask8 __U, __m256i __A) {
23842185 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
23852186 (__v8sf)_mm256_cvtepu32_ps(__A),
23862187 (__v8sf)__W);
23872188}
23882189
2389static __inline__ __m256 __DEFAULT_FN_ATTRS256
2390_mm256_maskz_cvtepu32_ps (__mmask8 __U, __m256i __A) {
2190static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
2191_mm256_maskz_cvtepu32_ps(__mmask8 __U, __m256i __A) {
23912192 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
23922193 (__v8sf)_mm256_cvtepu32_ps(__A),
23932194 (__v8sf)_mm256_setzero_ps());
23942195}
23952196
2396static __inline__ __m128d __DEFAULT_FN_ATTRS128
2197static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
23972198_mm_mask_div_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
23982199 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
23992200 (__v2df)_mm_div_pd(__A, __B),
24002201 (__v2df)__W);
24012202}
24022203
2403static __inline__ __m128d __DEFAULT_FN_ATTRS128
2204static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
24042205_mm_maskz_div_pd(__mmask8 __U, __m128d __A, __m128d __B) {
24052206 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
24062207 (__v2df)_mm_div_pd(__A, __B),
24072208 (__v2df)_mm_setzero_pd());
24082209}
24092210
2410static __inline__ __m256d __DEFAULT_FN_ATTRS256
2211static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
24112212_mm256_mask_div_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
24122213 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
24132214 (__v4df)_mm256_div_pd(__A, __B),
24142215 (__v4df)__W);
24152216}
24162217
2417static __inline__ __m256d __DEFAULT_FN_ATTRS256
2218static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
24182219_mm256_maskz_div_pd(__mmask8 __U, __m256d __A, __m256d __B) {
24192220 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
24202221 (__v4df)_mm256_div_pd(__A, __B),
24212222 (__v4df)_mm256_setzero_pd());
24222223}
24232224
2424static __inline__ __m128 __DEFAULT_FN_ATTRS128
2225static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
24252226_mm_mask_div_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
24262227 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
24272228 (__v4sf)_mm_div_ps(__A, __B),
24282229 (__v4sf)__W);
24292230}
24302231
2431static __inline__ __m128 __DEFAULT_FN_ATTRS128
2232static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
24322233_mm_maskz_div_ps(__mmask8 __U, __m128 __A, __m128 __B) {
24332234 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
24342235 (__v4sf)_mm_div_ps(__A, __B),
24352236 (__v4sf)_mm_setzero_ps());
24362237}
24372238
2438static __inline__ __m256 __DEFAULT_FN_ATTRS256
2239static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
24392240_mm256_mask_div_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
24402241 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
24412242 (__v8sf)_mm256_div_ps(__A, __B),
24422243 (__v8sf)__W);
24432244}
24442245
2445static __inline__ __m256 __DEFAULT_FN_ATTRS256
2246static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
24462247_mm256_maskz_div_ps(__mmask8 __U, __m256 __A, __m256 __B) {
24472248 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
24482249 (__v8sf)_mm256_div_ps(__A, __B),
......@@ -2796,499 +2597,499 @@ _mm256_maskz_getexp_ps (__mmask8 __U, __m256 __A) {
27962597 (__mmask8) __U);
27972598}
27982599
2799static __inline__ __m128d __DEFAULT_FN_ATTRS128
2600static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
28002601_mm_mask_max_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
28012602 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
28022603 (__v2df)_mm_max_pd(__A, __B),
28032604 (__v2df)__W);
28042605}
28052606
2806static __inline__ __m128d __DEFAULT_FN_ATTRS128
2607static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
28072608_mm_maskz_max_pd(__mmask8 __U, __m128d __A, __m128d __B) {
28082609 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
28092610 (__v2df)_mm_max_pd(__A, __B),
28102611 (__v2df)_mm_setzero_pd());
28112612}
28122613
2813static __inline__ __m256d __DEFAULT_FN_ATTRS256
2614static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
28142615_mm256_mask_max_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
28152616 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
28162617 (__v4df)_mm256_max_pd(__A, __B),
28172618 (__v4df)__W);
28182619}
28192620
2820static __inline__ __m256d __DEFAULT_FN_ATTRS256
2621static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
28212622_mm256_maskz_max_pd(__mmask8 __U, __m256d __A, __m256d __B) {
28222623 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
28232624 (__v4df)_mm256_max_pd(__A, __B),
28242625 (__v4df)_mm256_setzero_pd());
28252626}
28262627
2827static __inline__ __m128 __DEFAULT_FN_ATTRS128
2628static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
28282629_mm_mask_max_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
28292630 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
28302631 (__v4sf)_mm_max_ps(__A, __B),
28312632 (__v4sf)__W);
28322633}
28332634
2834static __inline__ __m128 __DEFAULT_FN_ATTRS128
2635static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
28352636_mm_maskz_max_ps(__mmask8 __U, __m128 __A, __m128 __B) {
28362637 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
28372638 (__v4sf)_mm_max_ps(__A, __B),
28382639 (__v4sf)_mm_setzero_ps());
28392640}
28402641
2841static __inline__ __m256 __DEFAULT_FN_ATTRS256
2642static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
28422643_mm256_mask_max_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
28432644 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
28442645 (__v8sf)_mm256_max_ps(__A, __B),
28452646 (__v8sf)__W);
28462647}
28472648
2848static __inline__ __m256 __DEFAULT_FN_ATTRS256
2649static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
28492650_mm256_maskz_max_ps(__mmask8 __U, __m256 __A, __m256 __B) {
28502651 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
28512652 (__v8sf)_mm256_max_ps(__A, __B),
28522653 (__v8sf)_mm256_setzero_ps());
28532654}
28542655
2855static __inline__ __m128d __DEFAULT_FN_ATTRS128
2656static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
28562657_mm_mask_min_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
28572658 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
28582659 (__v2df)_mm_min_pd(__A, __B),
28592660 (__v2df)__W);
28602661}
28612662
2862static __inline__ __m128d __DEFAULT_FN_ATTRS128
2663static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
28632664_mm_maskz_min_pd(__mmask8 __U, __m128d __A, __m128d __B) {
28642665 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
28652666 (__v2df)_mm_min_pd(__A, __B),
28662667 (__v2df)_mm_setzero_pd());
28672668}
28682669
2869static __inline__ __m256d __DEFAULT_FN_ATTRS256
2670static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
28702671_mm256_mask_min_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
28712672 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
28722673 (__v4df)_mm256_min_pd(__A, __B),
28732674 (__v4df)__W);
28742675}
28752676
2876static __inline__ __m256d __DEFAULT_FN_ATTRS256
2677static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
28772678_mm256_maskz_min_pd(__mmask8 __U, __m256d __A, __m256d __B) {
28782679 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
28792680 (__v4df)_mm256_min_pd(__A, __B),
28802681 (__v4df)_mm256_setzero_pd());
28812682}
28822683
2883static __inline__ __m128 __DEFAULT_FN_ATTRS128
2684static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
28842685_mm_mask_min_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
28852686 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
28862687 (__v4sf)_mm_min_ps(__A, __B),
28872688 (__v4sf)__W);
28882689}
28892690
2890static __inline__ __m128 __DEFAULT_FN_ATTRS128
2691static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
28912692_mm_maskz_min_ps(__mmask8 __U, __m128 __A, __m128 __B) {
28922693 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
28932694 (__v4sf)_mm_min_ps(__A, __B),
28942695 (__v4sf)_mm_setzero_ps());
28952696}
28962697
2897static __inline__ __m256 __DEFAULT_FN_ATTRS256
2698static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
28982699_mm256_mask_min_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
28992700 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
29002701 (__v8sf)_mm256_min_ps(__A, __B),
29012702 (__v8sf)__W);
29022703}
29032704
2904static __inline__ __m256 __DEFAULT_FN_ATTRS256
2705static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
29052706_mm256_maskz_min_ps(__mmask8 __U, __m256 __A, __m256 __B) {
29062707 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
29072708 (__v8sf)_mm256_min_ps(__A, __B),
29082709 (__v8sf)_mm256_setzero_ps());
29092710}
29102711
2911static __inline__ __m128d __DEFAULT_FN_ATTRS128
2712static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
29122713_mm_mask_mul_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
29132714 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
29142715 (__v2df)_mm_mul_pd(__A, __B),
29152716 (__v2df)__W);
29162717}
29172718
2918static __inline__ __m128d __DEFAULT_FN_ATTRS128
2719static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
29192720_mm_maskz_mul_pd(__mmask8 __U, __m128d __A, __m128d __B) {
29202721 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
29212722 (__v2df)_mm_mul_pd(__A, __B),
29222723 (__v2df)_mm_setzero_pd());
29232724}
29242725
2925static __inline__ __m256d __DEFAULT_FN_ATTRS256
2726static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
29262727_mm256_mask_mul_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
29272728 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
29282729 (__v4df)_mm256_mul_pd(__A, __B),
29292730 (__v4df)__W);
29302731}
29312732
2932static __inline__ __m256d __DEFAULT_FN_ATTRS256
2733static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
29332734_mm256_maskz_mul_pd(__mmask8 __U, __m256d __A, __m256d __B) {
29342735 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
29352736 (__v4df)_mm256_mul_pd(__A, __B),
29362737 (__v4df)_mm256_setzero_pd());
29372738}
29382739
2939static __inline__ __m128 __DEFAULT_FN_ATTRS128
2740static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
29402741_mm_mask_mul_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
29412742 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
29422743 (__v4sf)_mm_mul_ps(__A, __B),
29432744 (__v4sf)__W);
29442745}
29452746
2946static __inline__ __m128 __DEFAULT_FN_ATTRS128
2747static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
29472748_mm_maskz_mul_ps(__mmask8 __U, __m128 __A, __m128 __B) {
29482749 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
29492750 (__v4sf)_mm_mul_ps(__A, __B),
29502751 (__v4sf)_mm_setzero_ps());
29512752}
29522753
2953static __inline__ __m256 __DEFAULT_FN_ATTRS256
2754static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
29542755_mm256_mask_mul_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
29552756 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
29562757 (__v8sf)_mm256_mul_ps(__A, __B),
29572758 (__v8sf)__W);
29582759}
29592760
2960static __inline__ __m256 __DEFAULT_FN_ATTRS256
2761static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
29612762_mm256_maskz_mul_ps(__mmask8 __U, __m256 __A, __m256 __B) {
29622763 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
29632764 (__v8sf)_mm256_mul_ps(__A, __B),
29642765 (__v8sf)_mm256_setzero_ps());
29652766}
29662767
2967static __inline__ __m128i __DEFAULT_FN_ATTRS128
2768static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
29682769_mm_mask_abs_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
29692770 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
29702771 (__v4si)_mm_abs_epi32(__A),
29712772 (__v4si)__W);
29722773}
29732774
2974static __inline__ __m128i __DEFAULT_FN_ATTRS128
2775static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
29752776_mm_maskz_abs_epi32(__mmask8 __U, __m128i __A) {
29762777 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
29772778 (__v4si)_mm_abs_epi32(__A),
29782779 (__v4si)_mm_setzero_si128());
29792780}
29802781
2981static __inline__ __m256i __DEFAULT_FN_ATTRS256
2782static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
29822783_mm256_mask_abs_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
29832784 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
29842785 (__v8si)_mm256_abs_epi32(__A),
29852786 (__v8si)__W);
29862787}
29872788
2988static __inline__ __m256i __DEFAULT_FN_ATTRS256
2789static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
29892790_mm256_maskz_abs_epi32(__mmask8 __U, __m256i __A) {
29902791 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
29912792 (__v8si)_mm256_abs_epi32(__A),
29922793 (__v8si)_mm256_setzero_si256());
29932794}
29942795
2995static __inline__ __m128i __DEFAULT_FN_ATTRS128
2996_mm_abs_epi64 (__m128i __A) {
2796static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2797_mm_abs_epi64(__m128i __A) {
29972798 return (__m128i)__builtin_elementwise_abs((__v2di)__A);
29982799}
29992800
3000static __inline__ __m128i __DEFAULT_FN_ATTRS128
3001_mm_mask_abs_epi64 (__m128i __W, __mmask8 __U, __m128i __A) {
2801static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2802_mm_mask_abs_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
30022803 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
30032804 (__v2di)_mm_abs_epi64(__A),
30042805 (__v2di)__W);
30052806}
30062807
3007static __inline__ __m128i __DEFAULT_FN_ATTRS128
3008_mm_maskz_abs_epi64 (__mmask8 __U, __m128i __A) {
2808static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2809_mm_maskz_abs_epi64(__mmask8 __U, __m128i __A) {
30092810 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
30102811 (__v2di)_mm_abs_epi64(__A),
30112812 (__v2di)_mm_setzero_si128());
30122813}
30132814
3014static __inline__ __m256i __DEFAULT_FN_ATTRS256
3015_mm256_abs_epi64 (__m256i __A) {
2815static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2816_mm256_abs_epi64(__m256i __A) {
30162817 return (__m256i)__builtin_elementwise_abs((__v4di)__A);
30172818}
30182819
3019static __inline__ __m256i __DEFAULT_FN_ATTRS256
3020_mm256_mask_abs_epi64 (__m256i __W, __mmask8 __U, __m256i __A) {
2820static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2821_mm256_mask_abs_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
30212822 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
30222823 (__v4di)_mm256_abs_epi64(__A),
30232824 (__v4di)__W);
30242825}
30252826
3026static __inline__ __m256i __DEFAULT_FN_ATTRS256
3027_mm256_maskz_abs_epi64 (__mmask8 __U, __m256i __A) {
2827static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2828_mm256_maskz_abs_epi64(__mmask8 __U, __m256i __A) {
30282829 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
30292830 (__v4di)_mm256_abs_epi64(__A),
30302831 (__v4di)_mm256_setzero_si256());
30312832}
30322833
3033static __inline__ __m128i __DEFAULT_FN_ATTRS128
2834static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
30342835_mm_maskz_max_epi32(__mmask8 __M, __m128i __A, __m128i __B) {
30352836 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
30362837 (__v4si)_mm_max_epi32(__A, __B),
30372838 (__v4si)_mm_setzero_si128());
30382839}
30392840
3040static __inline__ __m128i __DEFAULT_FN_ATTRS128
2841static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
30412842_mm_mask_max_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
30422843 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
30432844 (__v4si)_mm_max_epi32(__A, __B),
30442845 (__v4si)__W);
30452846}
30462847
3047static __inline__ __m256i __DEFAULT_FN_ATTRS256
2848static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
30482849_mm256_maskz_max_epi32(__mmask8 __M, __m256i __A, __m256i __B) {
30492850 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
30502851 (__v8si)_mm256_max_epi32(__A, __B),
30512852 (__v8si)_mm256_setzero_si256());
30522853}
30532854
3054static __inline__ __m256i __DEFAULT_FN_ATTRS256
2855static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
30552856_mm256_mask_max_epi32(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
30562857 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
30572858 (__v8si)_mm256_max_epi32(__A, __B),
30582859 (__v8si)__W);
30592860}
30602861
3061static __inline__ __m128i __DEFAULT_FN_ATTRS128
3062_mm_max_epi64 (__m128i __A, __m128i __B) {
2862static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2863_mm_max_epi64(__m128i __A, __m128i __B) {
30632864 return (__m128i)__builtin_elementwise_max((__v2di)__A, (__v2di)__B);
30642865}
30652866
3066static __inline__ __m128i __DEFAULT_FN_ATTRS128
3067_mm_maskz_max_epi64 (__mmask8 __M, __m128i __A, __m128i __B) {
2867static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2868_mm_maskz_max_epi64(__mmask8 __M, __m128i __A, __m128i __B) {
30682869 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
30692870 (__v2di)_mm_max_epi64(__A, __B),
30702871 (__v2di)_mm_setzero_si128());
30712872}
30722873
3073static __inline__ __m128i __DEFAULT_FN_ATTRS128
3074_mm_mask_max_epi64 (__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
2874static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2875_mm_mask_max_epi64(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
30752876 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
30762877 (__v2di)_mm_max_epi64(__A, __B),
30772878 (__v2di)__W);
30782879}
30792880
3080static __inline__ __m256i __DEFAULT_FN_ATTRS256
3081_mm256_max_epi64 (__m256i __A, __m256i __B) {
2881static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2882_mm256_max_epi64(__m256i __A, __m256i __B) {
30822883 return (__m256i)__builtin_elementwise_max((__v4di)__A, (__v4di)__B);
30832884}
30842885
3085static __inline__ __m256i __DEFAULT_FN_ATTRS256
3086_mm256_maskz_max_epi64 (__mmask8 __M, __m256i __A, __m256i __B) {
2886static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2887_mm256_maskz_max_epi64(__mmask8 __M, __m256i __A, __m256i __B) {
30872888 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
30882889 (__v4di)_mm256_max_epi64(__A, __B),
30892890 (__v4di)_mm256_setzero_si256());
30902891}
30912892
3092static __inline__ __m256i __DEFAULT_FN_ATTRS256
3093_mm256_mask_max_epi64 (__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
2893static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2894_mm256_mask_max_epi64(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
30942895 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
30952896 (__v4di)_mm256_max_epi64(__A, __B),
30962897 (__v4di)__W);
30972898}
30982899
3099static __inline__ __m128i __DEFAULT_FN_ATTRS128
2900static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
31002901_mm_maskz_max_epu32(__mmask8 __M, __m128i __A, __m128i __B) {
31012902 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
31022903 (__v4si)_mm_max_epu32(__A, __B),
31032904 (__v4si)_mm_setzero_si128());
31042905}
31052906
3106static __inline__ __m128i __DEFAULT_FN_ATTRS128
2907static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
31072908_mm_mask_max_epu32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
31082909 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
31092910 (__v4si)_mm_max_epu32(__A, __B),
31102911 (__v4si)__W);
31112912}
31122913
3113static __inline__ __m256i __DEFAULT_FN_ATTRS256
2914static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
31142915_mm256_maskz_max_epu32(__mmask8 __M, __m256i __A, __m256i __B) {
31152916 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
31162917 (__v8si)_mm256_max_epu32(__A, __B),
31172918 (__v8si)_mm256_setzero_si256());
31182919}
31192920
3120static __inline__ __m256i __DEFAULT_FN_ATTRS256
2921static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
31212922_mm256_mask_max_epu32(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
31222923 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
31232924 (__v8si)_mm256_max_epu32(__A, __B),
31242925 (__v8si)__W);
31252926}
31262927
3127static __inline__ __m128i __DEFAULT_FN_ATTRS128
3128_mm_max_epu64 (__m128i __A, __m128i __B) {
2928static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2929_mm_max_epu64(__m128i __A, __m128i __B) {
31292930 return (__m128i)__builtin_elementwise_max((__v2du)__A, (__v2du)__B);
31302931}
31312932
3132static __inline__ __m128i __DEFAULT_FN_ATTRS128
3133_mm_maskz_max_epu64 (__mmask8 __M, __m128i __A, __m128i __B) {
2933static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2934_mm_maskz_max_epu64(__mmask8 __M, __m128i __A, __m128i __B) {
31342935 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
31352936 (__v2di)_mm_max_epu64(__A, __B),
31362937 (__v2di)_mm_setzero_si128());
31372938}
31382939
3139static __inline__ __m128i __DEFAULT_FN_ATTRS128
3140_mm_mask_max_epu64 (__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
2940static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2941_mm_mask_max_epu64(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
31412942 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
31422943 (__v2di)_mm_max_epu64(__A, __B),
31432944 (__v2di)__W);
31442945}
31452946
3146static __inline__ __m256i __DEFAULT_FN_ATTRS256
3147_mm256_max_epu64 (__m256i __A, __m256i __B) {
2947static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2948_mm256_max_epu64(__m256i __A, __m256i __B) {
31482949 return (__m256i)__builtin_elementwise_max((__v4du)__A, (__v4du)__B);
31492950}
31502951
3151static __inline__ __m256i __DEFAULT_FN_ATTRS256
3152_mm256_maskz_max_epu64 (__mmask8 __M, __m256i __A, __m256i __B) {
2952static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2953_mm256_maskz_max_epu64(__mmask8 __M, __m256i __A, __m256i __B) {
31532954 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
31542955 (__v4di)_mm256_max_epu64(__A, __B),
31552956 (__v4di)_mm256_setzero_si256());
31562957}
31572958
3158static __inline__ __m256i __DEFAULT_FN_ATTRS256
3159_mm256_mask_max_epu64 (__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
2959static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
2960_mm256_mask_max_epu64(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
31602961 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
31612962 (__v4di)_mm256_max_epu64(__A, __B),
31622963 (__v4di)__W);
31632964}
31642965
3165static __inline__ __m128i __DEFAULT_FN_ATTRS128
2966static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
31662967_mm_maskz_min_epi32(__mmask8 __M, __m128i __A, __m128i __B) {
31672968 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
31682969 (__v4si)_mm_min_epi32(__A, __B),
31692970 (__v4si)_mm_setzero_si128());
31702971}
31712972
3172static __inline__ __m128i __DEFAULT_FN_ATTRS128
2973static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
31732974_mm_mask_min_epi32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
31742975 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
31752976 (__v4si)_mm_min_epi32(__A, __B),
31762977 (__v4si)__W);
31772978}
31782979
3179static __inline__ __m256i __DEFAULT_FN_ATTRS256
2980static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
31802981_mm256_maskz_min_epi32(__mmask8 __M, __m256i __A, __m256i __B) {
31812982 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
31822983 (__v8si)_mm256_min_epi32(__A, __B),
31832984 (__v8si)_mm256_setzero_si256());
31842985}
31852986
3186static __inline__ __m256i __DEFAULT_FN_ATTRS256
2987static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
31872988_mm256_mask_min_epi32(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
31882989 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
31892990 (__v8si)_mm256_min_epi32(__A, __B),
31902991 (__v8si)__W);
31912992}
31922993
3193static __inline__ __m128i __DEFAULT_FN_ATTRS128
3194_mm_min_epi64 (__m128i __A, __m128i __B) {
2994static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
2995_mm_min_epi64(__m128i __A, __m128i __B) {
31952996 return (__m128i)__builtin_elementwise_min((__v2di)__A, (__v2di)__B);
31962997}
31972998
3198static __inline__ __m128i __DEFAULT_FN_ATTRS128
3199_mm_mask_min_epi64 (__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
2999static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3000_mm_mask_min_epi64(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
32003001 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
32013002 (__v2di)_mm_min_epi64(__A, __B),
32023003 (__v2di)__W);
32033004}
32043005
3205static __inline__ __m128i __DEFAULT_FN_ATTRS128
3206_mm_maskz_min_epi64 (__mmask8 __M, __m128i __A, __m128i __B) {
3006static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3007_mm_maskz_min_epi64(__mmask8 __M, __m128i __A, __m128i __B) {
32073008 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
32083009 (__v2di)_mm_min_epi64(__A, __B),
32093010 (__v2di)_mm_setzero_si128());
32103011}
32113012
3212static __inline__ __m256i __DEFAULT_FN_ATTRS256
3213_mm256_min_epi64 (__m256i __A, __m256i __B) {
3013static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3014_mm256_min_epi64(__m256i __A, __m256i __B) {
32143015 return (__m256i)__builtin_elementwise_min((__v4di)__A, (__v4di)__B);
32153016}
32163017
3217static __inline__ __m256i __DEFAULT_FN_ATTRS256
3218_mm256_mask_min_epi64 (__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
3018static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3019_mm256_mask_min_epi64(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
32193020 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
32203021 (__v4di)_mm256_min_epi64(__A, __B),
32213022 (__v4di)__W);
32223023}
32233024
3224static __inline__ __m256i __DEFAULT_FN_ATTRS256
3225_mm256_maskz_min_epi64 (__mmask8 __M, __m256i __A, __m256i __B) {
3025static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3026_mm256_maskz_min_epi64(__mmask8 __M, __m256i __A, __m256i __B) {
32263027 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
32273028 (__v4di)_mm256_min_epi64(__A, __B),
32283029 (__v4di)_mm256_setzero_si256());
32293030}
32303031
3231static __inline__ __m128i __DEFAULT_FN_ATTRS128
3032static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
32323033_mm_maskz_min_epu32(__mmask8 __M, __m128i __A, __m128i __B) {
32333034 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
32343035 (__v4si)_mm_min_epu32(__A, __B),
32353036 (__v4si)_mm_setzero_si128());
32363037}
32373038
3238static __inline__ __m128i __DEFAULT_FN_ATTRS128
3039static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
32393040_mm_mask_min_epu32(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
32403041 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
32413042 (__v4si)_mm_min_epu32(__A, __B),
32423043 (__v4si)__W);
32433044}
32443045
3245static __inline__ __m256i __DEFAULT_FN_ATTRS256
3046static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
32463047_mm256_maskz_min_epu32(__mmask8 __M, __m256i __A, __m256i __B) {
32473048 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
32483049 (__v8si)_mm256_min_epu32(__A, __B),
32493050 (__v8si)_mm256_setzero_si256());
32503051}
32513052
3252static __inline__ __m256i __DEFAULT_FN_ATTRS256
3053static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
32533054_mm256_mask_min_epu32(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
32543055 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
32553056 (__v8si)_mm256_min_epu32(__A, __B),
32563057 (__v8si)__W);
32573058}
32583059
3259static __inline__ __m128i __DEFAULT_FN_ATTRS128
3260_mm_min_epu64 (__m128i __A, __m128i __B) {
3060static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3061_mm_min_epu64(__m128i __A, __m128i __B) {
32613062 return (__m128i)__builtin_elementwise_min((__v2du)__A, (__v2du)__B);
32623063}
32633064
3264static __inline__ __m128i __DEFAULT_FN_ATTRS128
3265_mm_mask_min_epu64 (__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
3065static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3066_mm_mask_min_epu64(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) {
32663067 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
32673068 (__v2di)_mm_min_epu64(__A, __B),
32683069 (__v2di)__W);
32693070}
32703071
3271static __inline__ __m128i __DEFAULT_FN_ATTRS128
3272_mm_maskz_min_epu64 (__mmask8 __M, __m128i __A, __m128i __B) {
3072static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
3073_mm_maskz_min_epu64(__mmask8 __M, __m128i __A, __m128i __B) {
32733074 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__M,
32743075 (__v2di)_mm_min_epu64(__A, __B),
32753076 (__v2di)_mm_setzero_si128());
32763077}
32773078
3278static __inline__ __m256i __DEFAULT_FN_ATTRS256
3279_mm256_min_epu64 (__m256i __A, __m256i __B) {
3079static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3080_mm256_min_epu64(__m256i __A, __m256i __B) {
32803081 return (__m256i)__builtin_elementwise_min((__v4du)__A, (__v4du)__B);
32813082}
32823083
3283static __inline__ __m256i __DEFAULT_FN_ATTRS256
3284_mm256_mask_min_epu64 (__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
3084static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3085_mm256_mask_min_epu64(__m256i __W, __mmask8 __M, __m256i __A, __m256i __B) {
32853086 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
32863087 (__v4di)_mm256_min_epu64(__A, __B),
32873088 (__v4di)__W);
32883089}
32893090
3290static __inline__ __m256i __DEFAULT_FN_ATTRS256
3291_mm256_maskz_min_epu64 (__mmask8 __M, __m256i __A, __m256i __B) {
3091static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
3092_mm256_maskz_min_epu64(__mmask8 __M, __m256i __A, __m256i __B) {
32923093 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
32933094 (__v4di)_mm256_min_epu64(__A, __B),
32943095 (__v4di)_mm256_setzero_si256());
......@@ -3691,69 +3492,69 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
36913492 (__v8sf)_mm256_setzero_ps());
36923493 }
36933494
3694 static __inline__ __m128d __DEFAULT_FN_ATTRS128
3495 static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
36953496 _mm_mask_sub_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
36963497 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
36973498 (__v2df)_mm_sub_pd(__A, __B),
36983499 (__v2df)__W);
36993500 }
37003501
3701 static __inline__ __m128d __DEFAULT_FN_ATTRS128
3502 static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
37023503 _mm_maskz_sub_pd(__mmask8 __U, __m128d __A, __m128d __B) {
37033504 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
37043505 (__v2df)_mm_sub_pd(__A, __B),
37053506 (__v2df)_mm_setzero_pd());
37063507 }
37073508
3708 static __inline__ __m256d __DEFAULT_FN_ATTRS256
3509 static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
37093510 _mm256_mask_sub_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
37103511 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
37113512 (__v4df)_mm256_sub_pd(__A, __B),
37123513 (__v4df)__W);
37133514 }
37143515
3715 static __inline__ __m256d __DEFAULT_FN_ATTRS256
3516 static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
37163517 _mm256_maskz_sub_pd(__mmask8 __U, __m256d __A, __m256d __B) {
37173518 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
37183519 (__v4df)_mm256_sub_pd(__A, __B),
37193520 (__v4df)_mm256_setzero_pd());
37203521 }
37213522
3722 static __inline__ __m128 __DEFAULT_FN_ATTRS128
3523 static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
37233524 _mm_mask_sub_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
37243525 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
37253526 (__v4sf)_mm_sub_ps(__A, __B),
37263527 (__v4sf)__W);
37273528 }
37283529
3729 static __inline__ __m128 __DEFAULT_FN_ATTRS128
3530 static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
37303531 _mm_maskz_sub_ps(__mmask8 __U, __m128 __A, __m128 __B) {
37313532 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
37323533 (__v4sf)_mm_sub_ps(__A, __B),
37333534 (__v4sf)_mm_setzero_ps());
37343535 }
37353536
3736 static __inline__ __m256 __DEFAULT_FN_ATTRS256
3537 static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
37373538 _mm256_mask_sub_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
37383539 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
37393540 (__v8sf)_mm256_sub_ps(__A, __B),
37403541 (__v8sf)__W);
37413542 }
37423543
3743 static __inline__ __m256 __DEFAULT_FN_ATTRS256
3544 static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
37443545 _mm256_maskz_sub_ps(__mmask8 __U, __m256 __A, __m256 __B) {
37453546 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
37463547 (__v8sf)_mm256_sub_ps(__A, __B),
37473548 (__v8sf)_mm256_setzero_ps());
37483549 }
37493550
3750 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3551 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
37513552 _mm_permutex2var_epi32(__m128i __A, __m128i __I, __m128i __B) {
37523553 return (__m128i)__builtin_ia32_vpermi2vard128((__v4si) __A, (__v4si)__I,
37533554 (__v4si)__B);
37543555 }
37553556
3756 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3557 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
37573558 _mm_mask_permutex2var_epi32(__m128i __A, __mmask8 __U, __m128i __I,
37583559 __m128i __B) {
37593560 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -3761,7 +3562,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
37613562 (__v4si)__A);
37623563 }
37633564
3764 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3565 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
37653566 _mm_mask2_permutex2var_epi32(__m128i __A, __m128i __I, __mmask8 __U,
37663567 __m128i __B) {
37673568 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -3769,7 +3570,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
37693570 (__v4si)__I);
37703571 }
37713572
3772 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3573 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
37733574 _mm_maskz_permutex2var_epi32(__mmask8 __U, __m128i __A, __m128i __I,
37743575 __m128i __B) {
37753576 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -3777,13 +3578,13 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
37773578 (__v4si)_mm_setzero_si128());
37783579 }
37793580
3780 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3581 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
37813582 _mm256_permutex2var_epi32(__m256i __A, __m256i __I, __m256i __B) {
37823583 return (__m256i)__builtin_ia32_vpermi2vard256((__v8si)__A, (__v8si) __I,
37833584 (__v8si) __B);
37843585 }
37853586
3786 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3587 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
37873588 _mm256_mask_permutex2var_epi32(__m256i __A, __mmask8 __U, __m256i __I,
37883589 __m256i __B) {
37893590 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -3791,7 +3592,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
37913592 (__v8si)__A);
37923593 }
37933594
3794 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3595 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
37953596 _mm256_mask2_permutex2var_epi32(__m256i __A, __m256i __I, __mmask8 __U,
37963597 __m256i __B) {
37973598 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -3799,7 +3600,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
37993600 (__v8si)__I);
38003601 }
38013602
3802 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3603 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
38033604 _mm256_maskz_permutex2var_epi32(__mmask8 __U, __m256i __A, __m256i __I,
38043605 __m256i __B) {
38053606 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -3807,40 +3608,43 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
38073608 (__v8si)_mm256_setzero_si256());
38083609 }
38093610
3810 static __inline__ __m128d __DEFAULT_FN_ATTRS128
3611 static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
38113612 _mm_permutex2var_pd(__m128d __A, __m128i __I, __m128d __B) {
38123613 return (__m128d)__builtin_ia32_vpermi2varpd128((__v2df)__A, (__v2di)__I,
38133614 (__v2df)__B);
38143615 }
38153616
3816 static __inline__ __m128d __DEFAULT_FN_ATTRS128
3817 _mm_mask_permutex2var_pd(__m128d __A, __mmask8 __U, __m128i __I, __m128d __B) {
3617 static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
3618 _mm_mask_permutex2var_pd(__m128d __A, __mmask8 __U, __m128i __I,
3619 __m128d __B) {
38183620 return (__m128d)__builtin_ia32_selectpd_128(__U,
38193621 (__v2df)_mm_permutex2var_pd(__A, __I, __B),
38203622 (__v2df)__A);
38213623 }
38223624
3823 static __inline__ __m128d __DEFAULT_FN_ATTRS128
3824 _mm_mask2_permutex2var_pd(__m128d __A, __m128i __I, __mmask8 __U, __m128d __B) {
3625 static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
3626 _mm_mask2_permutex2var_pd(__m128d __A, __m128i __I, __mmask8 __U,
3627 __m128d __B) {
38253628 return (__m128d)__builtin_ia32_selectpd_128(__U,
38263629 (__v2df)_mm_permutex2var_pd(__A, __I, __B),
38273630 (__v2df)(__m128d)__I);
38283631 }
38293632
3830 static __inline__ __m128d __DEFAULT_FN_ATTRS128
3831 _mm_maskz_permutex2var_pd(__mmask8 __U, __m128d __A, __m128i __I, __m128d __B) {
3633 static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
3634 _mm_maskz_permutex2var_pd(__mmask8 __U, __m128d __A, __m128i __I,
3635 __m128d __B) {
38323636 return (__m128d)__builtin_ia32_selectpd_128(__U,
38333637 (__v2df)_mm_permutex2var_pd(__A, __I, __B),
38343638 (__v2df)_mm_setzero_pd());
38353639 }
38363640
3837 static __inline__ __m256d __DEFAULT_FN_ATTRS256
3641 static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
38383642 _mm256_permutex2var_pd(__m256d __A, __m256i __I, __m256d __B) {
38393643 return (__m256d)__builtin_ia32_vpermi2varpd256((__v4df)__A, (__v4di)__I,
38403644 (__v4df)__B);
38413645 }
38423646
3843 static __inline__ __m256d __DEFAULT_FN_ATTRS256
3647 static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
38443648 _mm256_mask_permutex2var_pd(__m256d __A, __mmask8 __U, __m256i __I,
38453649 __m256d __B) {
38463650 return (__m256d)__builtin_ia32_selectpd_256(__U,
......@@ -3848,7 +3652,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
38483652 (__v4df)__A);
38493653 }
38503654
3851 static __inline__ __m256d __DEFAULT_FN_ATTRS256
3655 static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
38523656 _mm256_mask2_permutex2var_pd(__m256d __A, __m256i __I, __mmask8 __U,
38533657 __m256d __B) {
38543658 return (__m256d)__builtin_ia32_selectpd_256(__U,
......@@ -3856,7 +3660,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
38563660 (__v4df)(__m256d)__I);
38573661 }
38583662
3859 static __inline__ __m256d __DEFAULT_FN_ATTRS256
3663 static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
38603664 _mm256_maskz_permutex2var_pd(__mmask8 __U, __m256d __A, __m256i __I,
38613665 __m256d __B) {
38623666 return (__m256d)__builtin_ia32_selectpd_256(__U,
......@@ -3864,47 +3668,48 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
38643668 (__v4df)_mm256_setzero_pd());
38653669 }
38663670
3867 static __inline__ __m128 __DEFAULT_FN_ATTRS128
3671 static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
38683672 _mm_permutex2var_ps(__m128 __A, __m128i __I, __m128 __B) {
38693673 return (__m128)__builtin_ia32_vpermi2varps128((__v4sf)__A, (__v4si)__I,
38703674 (__v4sf)__B);
38713675 }
38723676
3873 static __inline__ __m128 __DEFAULT_FN_ATTRS128
3677 static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
38743678 _mm_mask_permutex2var_ps(__m128 __A, __mmask8 __U, __m128i __I, __m128 __B) {
38753679 return (__m128)__builtin_ia32_selectps_128(__U,
38763680 (__v4sf)_mm_permutex2var_ps(__A, __I, __B),
38773681 (__v4sf)__A);
38783682 }
38793683
3880 static __inline__ __m128 __DEFAULT_FN_ATTRS128
3684 static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
38813685 _mm_mask2_permutex2var_ps(__m128 __A, __m128i __I, __mmask8 __U, __m128 __B) {
38823686 return (__m128)__builtin_ia32_selectps_128(__U,
38833687 (__v4sf)_mm_permutex2var_ps(__A, __I, __B),
38843688 (__v4sf)(__m128)__I);
38853689 }
38863690
3887 static __inline__ __m128 __DEFAULT_FN_ATTRS128
3691 static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
38883692 _mm_maskz_permutex2var_ps(__mmask8 __U, __m128 __A, __m128i __I, __m128 __B) {
38893693 return (__m128)__builtin_ia32_selectps_128(__U,
38903694 (__v4sf)_mm_permutex2var_ps(__A, __I, __B),
38913695 (__v4sf)_mm_setzero_ps());
38923696 }
38933697
3894 static __inline__ __m256 __DEFAULT_FN_ATTRS256
3698 static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
38953699 _mm256_permutex2var_ps(__m256 __A, __m256i __I, __m256 __B) {
38963700 return (__m256)__builtin_ia32_vpermi2varps256((__v8sf)__A, (__v8si)__I,
38973701 (__v8sf) __B);
38983702 }
38993703
3900 static __inline__ __m256 __DEFAULT_FN_ATTRS256
3901 _mm256_mask_permutex2var_ps(__m256 __A, __mmask8 __U, __m256i __I, __m256 __B) {
3704 static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
3705 _mm256_mask_permutex2var_ps(__m256 __A, __mmask8 __U, __m256i __I,
3706 __m256 __B) {
39023707 return (__m256)__builtin_ia32_selectps_256(__U,
39033708 (__v8sf)_mm256_permutex2var_ps(__A, __I, __B),
39043709 (__v8sf)__A);
39053710 }
39063711
3907 static __inline__ __m256 __DEFAULT_FN_ATTRS256
3712 static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
39083713 _mm256_mask2_permutex2var_ps(__m256 __A, __m256i __I, __mmask8 __U,
39093714 __m256 __B) {
39103715 return (__m256)__builtin_ia32_selectps_256(__U,
......@@ -3912,7 +3717,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39123717 (__v8sf)(__m256)__I);
39133718 }
39143719
3915 static __inline__ __m256 __DEFAULT_FN_ATTRS256
3720 static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
39163721 _mm256_maskz_permutex2var_ps(__mmask8 __U, __m256 __A, __m256i __I,
39173722 __m256 __B) {
39183723 return (__m256)__builtin_ia32_selectps_256(__U,
......@@ -3920,13 +3725,13 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39203725 (__v8sf)_mm256_setzero_ps());
39213726 }
39223727
3923 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3728 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
39243729 _mm_permutex2var_epi64(__m128i __A, __m128i __I, __m128i __B) {
39253730 return (__m128i)__builtin_ia32_vpermi2varq128((__v2di)__A, (__v2di)__I,
39263731 (__v2di)__B);
39273732 }
39283733
3929 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3734 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
39303735 _mm_mask_permutex2var_epi64(__m128i __A, __mmask8 __U, __m128i __I,
39313736 __m128i __B) {
39323737 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -3934,7 +3739,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39343739 (__v2di)__A);
39353740 }
39363741
3937 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3742 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
39383743 _mm_mask2_permutex2var_epi64(__m128i __A, __m128i __I, __mmask8 __U,
39393744 __m128i __B) {
39403745 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -3942,7 +3747,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39423747 (__v2di)__I);
39433748 }
39443749
3945 static __inline__ __m128i __DEFAULT_FN_ATTRS128
3750 static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
39463751 _mm_maskz_permutex2var_epi64(__mmask8 __U, __m128i __A, __m128i __I,
39473752 __m128i __B) {
39483753 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -3950,14 +3755,13 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39503755 (__v2di)_mm_setzero_si128());
39513756 }
39523757
3953
3954 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3758 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
39553759 _mm256_permutex2var_epi64(__m256i __A, __m256i __I, __m256i __B) {
39563760 return (__m256i)__builtin_ia32_vpermi2varq256((__v4di)__A, (__v4di) __I,
39573761 (__v4di) __B);
39583762 }
39593763
3960 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3764 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
39613765 _mm256_mask_permutex2var_epi64(__m256i __A, __mmask8 __U, __m256i __I,
39623766 __m256i __B) {
39633767 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -3965,7 +3769,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39653769 (__v4di)__A);
39663770 }
39673771
3968 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3772 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
39693773 _mm256_mask2_permutex2var_epi64(__m256i __A, __m256i __I, __mmask8 __U,
39703774 __m256i __B) {
39713775 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -3973,7 +3777,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
39733777 (__v4di)__I);
39743778 }
39753779
3976 static __inline__ __m256i __DEFAULT_FN_ATTRS256
3780 static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
39773781 _mm256_maskz_permutex2var_epi64(__mmask8 __U, __m256i __A, __m256i __I,
39783782 __m256i __B) {
39793783 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -4355,13 +4159,13 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
43554159 (__v4di)_mm256_rol_epi64((a), (b)), \
43564160 (__v4di)_mm256_setzero_si256()))
43574161
4358static __inline__ __m128i __DEFAULT_FN_ATTRS128
4162static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
43594163_mm_rolv_epi32 (__m128i __A, __m128i __B)
43604164{
4361 return (__m128i)__builtin_ia32_prolvd128((__v4si)__A, (__v4si)__B);
4165 return (__m128i)__builtin_elementwise_fshl((__v4su)__A, (__v4su)__A, (__v4su)__B);
43624166}
43634167
4364static __inline__ __m128i __DEFAULT_FN_ATTRS128
4168static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
43654169_mm_mask_rolv_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
43664170{
43674171 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -4369,7 +4173,7 @@ _mm_mask_rolv_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
43694173 (__v4si)__W);
43704174}
43714175
4372static __inline__ __m128i __DEFAULT_FN_ATTRS128
4176static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
43734177_mm_maskz_rolv_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
43744178{
43754179 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -4377,13 +4181,13 @@ _mm_maskz_rolv_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
43774181 (__v4si)_mm_setzero_si128());
43784182}
43794183
4380static __inline__ __m256i __DEFAULT_FN_ATTRS256
4184static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
43814185_mm256_rolv_epi32 (__m256i __A, __m256i __B)
43824186{
4383 return (__m256i)__builtin_ia32_prolvd256((__v8si)__A, (__v8si)__B);
4187 return (__m256i)__builtin_elementwise_fshl((__v8su)__A, (__v8su)__A, (__v8su)__B);
43844188}
43854189
4386static __inline__ __m256i __DEFAULT_FN_ATTRS256
4190static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
43874191_mm256_mask_rolv_epi32 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
43884192{
43894193 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -4391,7 +4195,7 @@ _mm256_mask_rolv_epi32 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
43914195 (__v8si)__W);
43924196}
43934197
4394static __inline__ __m256i __DEFAULT_FN_ATTRS256
4198static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
43954199_mm256_maskz_rolv_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
43964200{
43974201 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -4399,13 +4203,13 @@ _mm256_maskz_rolv_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
43994203 (__v8si)_mm256_setzero_si256());
44004204}
44014205
4402static __inline__ __m128i __DEFAULT_FN_ATTRS128
4206static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
44034207_mm_rolv_epi64 (__m128i __A, __m128i __B)
44044208{
4405 return (__m128i)__builtin_ia32_prolvq128((__v2di)__A, (__v2di)__B);
4209 return (__m128i)__builtin_elementwise_fshl((__v2du)__A, (__v2du)__A, (__v2du)__B);
44064210}
44074211
4408static __inline__ __m128i __DEFAULT_FN_ATTRS128
4212static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
44094213_mm_mask_rolv_epi64 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
44104214{
44114215 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -4413,7 +4217,7 @@ _mm_mask_rolv_epi64 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
44134217 (__v2di)__W);
44144218}
44154219
4416static __inline__ __m128i __DEFAULT_FN_ATTRS128
4220static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
44174221_mm_maskz_rolv_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
44184222{
44194223 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -4421,13 +4225,13 @@ _mm_maskz_rolv_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
44214225 (__v2di)_mm_setzero_si128());
44224226}
44234227
4424static __inline__ __m256i __DEFAULT_FN_ATTRS256
4228static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
44254229_mm256_rolv_epi64 (__m256i __A, __m256i __B)
44264230{
4427 return (__m256i)__builtin_ia32_prolvq256((__v4di)__A, (__v4di)__B);
4231 return (__m256i)__builtin_elementwise_fshl((__v4du)__A, (__v4du)__A, (__v4du)__B);
44284232}
44294233
4430static __inline__ __m256i __DEFAULT_FN_ATTRS256
4234static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
44314235_mm256_mask_rolv_epi64 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
44324236{
44334237 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -4435,7 +4239,7 @@ _mm256_mask_rolv_epi64 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
44354239 (__v4di)__W);
44364240}
44374241
4438static __inline__ __m256i __DEFAULT_FN_ATTRS256
4242static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
44394243_mm256_maskz_rolv_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
44404244{
44414245 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -4495,33 +4299,29 @@ _mm256_maskz_rolv_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
44954299 (__v4di)_mm256_ror_epi64((a), (b)), \
44964300 (__v4di)_mm256_setzero_si256()))
44974301
4498static __inline__ __m128i __DEFAULT_FN_ATTRS128
4499_mm_mask_sll_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
4500{
4302static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4303_mm_mask_sll_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
45014304 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
45024305 (__v4si)_mm_sll_epi32(__A, __B),
45034306 (__v4si)__W);
45044307}
45054308
4506static __inline__ __m128i __DEFAULT_FN_ATTRS128
4507_mm_maskz_sll_epi32(__mmask8 __U, __m128i __A, __m128i __B)
4508{
4309static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4310_mm_maskz_sll_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
45094311 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
45104312 (__v4si)_mm_sll_epi32(__A, __B),
45114313 (__v4si)_mm_setzero_si128());
45124314}
45134315
4514static __inline__ __m256i __DEFAULT_FN_ATTRS256
4515_mm256_mask_sll_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B)
4516{
4316static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4317_mm256_mask_sll_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) {
45174318 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
45184319 (__v8si)_mm256_sll_epi32(__A, __B),
45194320 (__v8si)__W);
45204321}
45214322
4522static __inline__ __m256i __DEFAULT_FN_ATTRS256
4523_mm256_maskz_sll_epi32(__mmask8 __U, __m256i __A, __m128i __B)
4524{
4323static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4324_mm256_maskz_sll_epi32(__mmask8 __U, __m256i __A, __m128i __B) {
45254325 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
45264326 (__v8si)_mm256_sll_epi32(__A, __B),
45274327 (__v8si)_mm256_setzero_si256());
......@@ -4543,49 +4343,44 @@ _mm_maskz_slli_epi32(__mmask8 __U, __m128i __A, unsigned int __B)
45434343 (__v4si)_mm_setzero_si128());
45444344}
45454345
4546static __inline__ __m256i __DEFAULT_FN_ATTRS256
4547_mm256_mask_slli_epi32(__m256i __W, __mmask8 __U, __m256i __A, unsigned int __B)
4548{
4346static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4347_mm256_mask_slli_epi32(__m256i __W, __mmask8 __U, __m256i __A,
4348 unsigned int __B) {
45494349 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
45504350 (__v8si)_mm256_slli_epi32(__A, (int)__B),
45514351 (__v8si)__W);
45524352}
45534353
4554static __inline__ __m256i __DEFAULT_FN_ATTRS256
4555_mm256_maskz_slli_epi32(__mmask8 __U, __m256i __A, unsigned int __B)
4556{
4354static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4355_mm256_maskz_slli_epi32(__mmask8 __U, __m256i __A, unsigned int __B) {
45574356 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
45584357 (__v8si)_mm256_slli_epi32(__A, (int)__B),
45594358 (__v8si)_mm256_setzero_si256());
45604359}
45614360
4562static __inline__ __m128i __DEFAULT_FN_ATTRS128
4563_mm_mask_sll_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
4564{
4361static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4362_mm_mask_sll_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
45654363 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
45664364 (__v2di)_mm_sll_epi64(__A, __B),
45674365 (__v2di)__W);
45684366}
45694367
4570static __inline__ __m128i __DEFAULT_FN_ATTRS128
4571_mm_maskz_sll_epi64(__mmask8 __U, __m128i __A, __m128i __B)
4572{
4368static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4369_mm_maskz_sll_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
45734370 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
45744371 (__v2di)_mm_sll_epi64(__A, __B),
45754372 (__v2di)_mm_setzero_si128());
45764373}
45774374
4578static __inline__ __m256i __DEFAULT_FN_ATTRS256
4579_mm256_mask_sll_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B)
4580{
4375static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4376_mm256_mask_sll_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) {
45814377 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
45824378 (__v4di)_mm256_sll_epi64(__A, __B),
45834379 (__v4di)__W);
45844380}
45854381
4586static __inline__ __m256i __DEFAULT_FN_ATTRS256
4587_mm256_maskz_sll_epi64(__mmask8 __U, __m256i __A, __m128i __B)
4588{
4382static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4383_mm256_maskz_sll_epi64(__mmask8 __U, __m256i __A, __m128i __B) {
45894384 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
45904385 (__v4di)_mm256_sll_epi64(__A, __B),
45914386 (__v4di)_mm256_setzero_si256());
......@@ -4607,29 +4402,28 @@ _mm_maskz_slli_epi64(__mmask8 __U, __m128i __A, unsigned int __B)
46074402 (__v2di)_mm_setzero_si128());
46084403}
46094404
4610static __inline__ __m256i __DEFAULT_FN_ATTRS256
4611_mm256_mask_slli_epi64(__m256i __W, __mmask8 __U, __m256i __A, unsigned int __B)
4612{
4405static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4406_mm256_mask_slli_epi64(__m256i __W, __mmask8 __U, __m256i __A,
4407 unsigned int __B) {
46134408 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
46144409 (__v4di)_mm256_slli_epi64(__A, (int)__B),
46154410 (__v4di)__W);
46164411}
46174412
4618static __inline__ __m256i __DEFAULT_FN_ATTRS256
4619_mm256_maskz_slli_epi64(__mmask8 __U, __m256i __A, unsigned int __B)
4620{
4413static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4414_mm256_maskz_slli_epi64(__mmask8 __U, __m256i __A, unsigned int __B) {
46214415 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
46224416 (__v4di)_mm256_slli_epi64(__A, (int)__B),
46234417 (__v4di)_mm256_setzero_si256());
46244418}
46254419
4626static __inline__ __m128i __DEFAULT_FN_ATTRS128
4420static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
46274421_mm_rorv_epi32 (__m128i __A, __m128i __B)
46284422{
4629 return (__m128i)__builtin_ia32_prorvd128((__v4si)__A, (__v4si)__B);
4423 return (__m128i)__builtin_elementwise_fshr((__v4su)__A, (__v4su)__A, (__v4su)__B);
46304424}
46314425
4632static __inline__ __m128i __DEFAULT_FN_ATTRS128
4426static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
46334427_mm_mask_rorv_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
46344428{
46354429 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -4637,7 +4431,7 @@ _mm_mask_rorv_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
46374431 (__v4si)__W);
46384432}
46394433
4640static __inline__ __m128i __DEFAULT_FN_ATTRS128
4434static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
46414435_mm_maskz_rorv_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
46424436{
46434437 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -4645,13 +4439,13 @@ _mm_maskz_rorv_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
46454439 (__v4si)_mm_setzero_si128());
46464440}
46474441
4648static __inline__ __m256i __DEFAULT_FN_ATTRS256
4442static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
46494443_mm256_rorv_epi32 (__m256i __A, __m256i __B)
46504444{
4651 return (__m256i)__builtin_ia32_prorvd256((__v8si)__A, (__v8si)__B);
4445 return (__m256i)__builtin_elementwise_fshr((__v8su)__A, (__v8su)__A, (__v8su)__B);
46524446}
46534447
4654static __inline__ __m256i __DEFAULT_FN_ATTRS256
4448static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
46554449_mm256_mask_rorv_epi32 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
46564450{
46574451 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -4659,7 +4453,7 @@ _mm256_mask_rorv_epi32 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
46594453 (__v8si)__W);
46604454}
46614455
4662static __inline__ __m256i __DEFAULT_FN_ATTRS256
4456static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
46634457_mm256_maskz_rorv_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
46644458{
46654459 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -4667,13 +4461,13 @@ _mm256_maskz_rorv_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
46674461 (__v8si)_mm256_setzero_si256());
46684462}
46694463
4670static __inline__ __m128i __DEFAULT_FN_ATTRS128
4464static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
46714465_mm_rorv_epi64 (__m128i __A, __m128i __B)
46724466{
4673 return (__m128i)__builtin_ia32_prorvq128((__v2di)__A, (__v2di)__B);
4467 return (__m128i)__builtin_elementwise_fshr((__v2du)__A, (__v2du)__A, (__v2du)__B);
46744468}
46754469
4676static __inline__ __m128i __DEFAULT_FN_ATTRS128
4470static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
46774471_mm_mask_rorv_epi64 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
46784472{
46794473 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -4681,7 +4475,7 @@ _mm_mask_rorv_epi64 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
46814475 (__v2di)__W);
46824476}
46834477
4684static __inline__ __m128i __DEFAULT_FN_ATTRS128
4478static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
46854479_mm_maskz_rorv_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
46864480{
46874481 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -4689,13 +4483,13 @@ _mm_maskz_rorv_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
46894483 (__v2di)_mm_setzero_si128());
46904484}
46914485
4692static __inline__ __m256i __DEFAULT_FN_ATTRS256
4486static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
46934487_mm256_rorv_epi64 (__m256i __A, __m256i __B)
46944488{
4695 return (__m256i)__builtin_ia32_prorvq256((__v4di)__A, (__v4di)__B);
4489 return (__m256i)__builtin_elementwise_fshr((__v4du)__A, (__v4du)__A, (__v4du)__B);
46964490}
46974491
4698static __inline__ __m256i __DEFAULT_FN_ATTRS256
4492static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
46994493_mm256_mask_rorv_epi64 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
47004494{
47014495 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -4703,7 +4497,7 @@ _mm256_mask_rorv_epi64 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
47034497 (__v4di)__W);
47044498}
47054499
4706static __inline__ __m256i __DEFAULT_FN_ATTRS256
4500static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
47074501_mm256_maskz_rorv_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
47084502{
47094503 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -4711,7 +4505,7 @@ _mm256_maskz_rorv_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
47114505 (__v4di)_mm256_setzero_si256());
47124506}
47134507
4714static __inline__ __m128i __DEFAULT_FN_ATTRS128
4508static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
47154509_mm_mask_sllv_epi64(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
47164510{
47174511 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
......@@ -4719,7 +4513,7 @@ _mm_mask_sllv_epi64(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
47194513 (__v2di)__W);
47204514}
47214515
4722static __inline__ __m128i __DEFAULT_FN_ATTRS128
4516static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
47234517_mm_maskz_sllv_epi64(__mmask8 __U, __m128i __X, __m128i __Y)
47244518{
47254519 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
......@@ -4727,7 +4521,7 @@ _mm_maskz_sllv_epi64(__mmask8 __U, __m128i __X, __m128i __Y)
47274521 (__v2di)_mm_setzero_si128());
47284522}
47294523
4730static __inline__ __m256i __DEFAULT_FN_ATTRS256
4524static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
47314525_mm256_mask_sllv_epi64(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
47324526{
47334527 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
......@@ -4735,7 +4529,7 @@ _mm256_mask_sllv_epi64(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
47354529 (__v4di)__W);
47364530}
47374531
4738static __inline__ __m256i __DEFAULT_FN_ATTRS256
4532static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
47394533_mm256_maskz_sllv_epi64(__mmask8 __U, __m256i __X, __m256i __Y)
47404534{
47414535 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
......@@ -4743,7 +4537,7 @@ _mm256_maskz_sllv_epi64(__mmask8 __U, __m256i __X, __m256i __Y)
47434537 (__v4di)_mm256_setzero_si256());
47444538}
47454539
4746static __inline__ __m128i __DEFAULT_FN_ATTRS128
4540static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
47474541_mm_mask_sllv_epi32(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
47484542{
47494543 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
......@@ -4751,7 +4545,7 @@ _mm_mask_sllv_epi32(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
47514545 (__v4si)__W);
47524546}
47534547
4754static __inline__ __m128i __DEFAULT_FN_ATTRS128
4548static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
47554549_mm_maskz_sllv_epi32(__mmask8 __U, __m128i __X, __m128i __Y)
47564550{
47574551 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
......@@ -4759,7 +4553,7 @@ _mm_maskz_sllv_epi32(__mmask8 __U, __m128i __X, __m128i __Y)
47594553 (__v4si)_mm_setzero_si128());
47604554}
47614555
4762static __inline__ __m256i __DEFAULT_FN_ATTRS256
4556static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
47634557_mm256_mask_sllv_epi32(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
47644558{
47654559 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
......@@ -4767,7 +4561,7 @@ _mm256_mask_sllv_epi32(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
47674561 (__v8si)__W);
47684562}
47694563
4770static __inline__ __m256i __DEFAULT_FN_ATTRS256
4564static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
47714565_mm256_maskz_sllv_epi32(__mmask8 __U, __m256i __X, __m256i __Y)
47724566{
47734567 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
......@@ -4775,7 +4569,7 @@ _mm256_maskz_sllv_epi32(__mmask8 __U, __m256i __X, __m256i __Y)
47754569 (__v8si)_mm256_setzero_si256());
47764570}
47774571
4778static __inline__ __m128i __DEFAULT_FN_ATTRS128
4572static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
47794573_mm_mask_srlv_epi64(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
47804574{
47814575 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
......@@ -4783,7 +4577,7 @@ _mm_mask_srlv_epi64(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
47834577 (__v2di)__W);
47844578}
47854579
4786static __inline__ __m128i __DEFAULT_FN_ATTRS128
4580static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
47874581_mm_maskz_srlv_epi64(__mmask8 __U, __m128i __X, __m128i __Y)
47884582{
47894583 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
......@@ -4791,7 +4585,7 @@ _mm_maskz_srlv_epi64(__mmask8 __U, __m128i __X, __m128i __Y)
47914585 (__v2di)_mm_setzero_si128());
47924586}
47934587
4794static __inline__ __m256i __DEFAULT_FN_ATTRS256
4588static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
47954589_mm256_mask_srlv_epi64(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
47964590{
47974591 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
......@@ -4799,7 +4593,7 @@ _mm256_mask_srlv_epi64(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
47994593 (__v4di)__W);
48004594}
48014595
4802static __inline__ __m256i __DEFAULT_FN_ATTRS256
4596static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
48034597_mm256_maskz_srlv_epi64(__mmask8 __U, __m256i __X, __m256i __Y)
48044598{
48054599 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
......@@ -4807,7 +4601,7 @@ _mm256_maskz_srlv_epi64(__mmask8 __U, __m256i __X, __m256i __Y)
48074601 (__v4di)_mm256_setzero_si256());
48084602}
48094603
4810static __inline__ __m128i __DEFAULT_FN_ATTRS128
4604static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
48114605_mm_mask_srlv_epi32(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
48124606{
48134607 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
......@@ -4815,7 +4609,7 @@ _mm_mask_srlv_epi32(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
48154609 (__v4si)__W);
48164610}
48174611
4818static __inline__ __m128i __DEFAULT_FN_ATTRS128
4612static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
48194613_mm_maskz_srlv_epi32(__mmask8 __U, __m128i __X, __m128i __Y)
48204614{
48214615 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
......@@ -4823,7 +4617,7 @@ _mm_maskz_srlv_epi32(__mmask8 __U, __m128i __X, __m128i __Y)
48234617 (__v4si)_mm_setzero_si128());
48244618}
48254619
4826static __inline__ __m256i __DEFAULT_FN_ATTRS256
4620static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
48274621_mm256_mask_srlv_epi32(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
48284622{
48294623 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
......@@ -4831,7 +4625,7 @@ _mm256_mask_srlv_epi32(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
48314625 (__v8si)__W);
48324626}
48334627
4834static __inline__ __m256i __DEFAULT_FN_ATTRS256
4628static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
48354629_mm256_maskz_srlv_epi32(__mmask8 __U, __m256i __X, __m256i __Y)
48364630{
48374631 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
......@@ -4839,33 +4633,29 @@ _mm256_maskz_srlv_epi32(__mmask8 __U, __m256i __X, __m256i __Y)
48394633 (__v8si)_mm256_setzero_si256());
48404634}
48414635
4842static __inline__ __m128i __DEFAULT_FN_ATTRS128
4843_mm_mask_srl_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
4844{
4636static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4637_mm_mask_srl_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
48454638 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
48464639 (__v4si)_mm_srl_epi32(__A, __B),
48474640 (__v4si)__W);
48484641}
48494642
4850static __inline__ __m128i __DEFAULT_FN_ATTRS128
4851_mm_maskz_srl_epi32(__mmask8 __U, __m128i __A, __m128i __B)
4852{
4643static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4644_mm_maskz_srl_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
48534645 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
48544646 (__v4si)_mm_srl_epi32(__A, __B),
48554647 (__v4si)_mm_setzero_si128());
48564648}
48574649
4858static __inline__ __m256i __DEFAULT_FN_ATTRS256
4859_mm256_mask_srl_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B)
4860{
4650static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4651_mm256_mask_srl_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) {
48614652 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
48624653 (__v8si)_mm256_srl_epi32(__A, __B),
48634654 (__v8si)__W);
48644655}
48654656
4866static __inline__ __m256i __DEFAULT_FN_ATTRS256
4867_mm256_maskz_srl_epi32(__mmask8 __U, __m256i __A, __m128i __B)
4868{
4657static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4658_mm256_maskz_srl_epi32(__mmask8 __U, __m256i __A, __m128i __B) {
48694659 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
48704660 (__v8si)_mm256_srl_epi32(__A, __B),
48714661 (__v8si)_mm256_setzero_si256());
......@@ -4887,49 +4677,44 @@ _mm_maskz_srli_epi32(__mmask8 __U, __m128i __A, unsigned int __B)
48874677 (__v4si)_mm_setzero_si128());
48884678}
48894679
4890static __inline__ __m256i __DEFAULT_FN_ATTRS256
4891_mm256_mask_srli_epi32(__m256i __W, __mmask8 __U, __m256i __A, unsigned int __B)
4892{
4680static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4681_mm256_mask_srli_epi32(__m256i __W, __mmask8 __U, __m256i __A,
4682 unsigned int __B) {
48934683 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
48944684 (__v8si)_mm256_srli_epi32(__A, (int)__B),
48954685 (__v8si)__W);
48964686}
48974687
4898static __inline__ __m256i __DEFAULT_FN_ATTRS256
4899_mm256_maskz_srli_epi32(__mmask8 __U, __m256i __A, unsigned int __B)
4900{
4688static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4689_mm256_maskz_srli_epi32(__mmask8 __U, __m256i __A, unsigned int __B) {
49014690 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
49024691 (__v8si)_mm256_srli_epi32(__A, (int)__B),
49034692 (__v8si)_mm256_setzero_si256());
49044693}
49054694
4906static __inline__ __m128i __DEFAULT_FN_ATTRS128
4907_mm_mask_srl_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
4908{
4695static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4696_mm_mask_srl_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
49094697 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
49104698 (__v2di)_mm_srl_epi64(__A, __B),
49114699 (__v2di)__W);
49124700}
49134701
4914static __inline__ __m128i __DEFAULT_FN_ATTRS128
4915_mm_maskz_srl_epi64(__mmask8 __U, __m128i __A, __m128i __B)
4916{
4702static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
4703_mm_maskz_srl_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
49174704 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
49184705 (__v2di)_mm_srl_epi64(__A, __B),
49194706 (__v2di)_mm_setzero_si128());
49204707}
49214708
4922static __inline__ __m256i __DEFAULT_FN_ATTRS256
4923_mm256_mask_srl_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B)
4924{
4709static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4710_mm256_mask_srl_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) {
49254711 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
49264712 (__v4di)_mm256_srl_epi64(__A, __B),
49274713 (__v4di)__W);
49284714}
49294715
4930static __inline__ __m256i __DEFAULT_FN_ATTRS256
4931_mm256_maskz_srl_epi64(__mmask8 __U, __m256i __A, __m128i __B)
4932{
4716static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4717_mm256_maskz_srl_epi64(__mmask8 __U, __m256i __A, __m128i __B) {
49334718 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
49344719 (__v4di)_mm256_srl_epi64(__A, __B),
49354720 (__v4di)_mm256_setzero_si256());
......@@ -4951,23 +4736,22 @@ _mm_maskz_srli_epi64(__mmask8 __U, __m128i __A, unsigned int __B)
49514736 (__v2di)_mm_setzero_si128());
49524737}
49534738
4954static __inline__ __m256i __DEFAULT_FN_ATTRS256
4955_mm256_mask_srli_epi64(__m256i __W, __mmask8 __U, __m256i __A, unsigned int __B)
4956{
4739static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4740_mm256_mask_srli_epi64(__m256i __W, __mmask8 __U, __m256i __A,
4741 unsigned int __B) {
49574742 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
49584743 (__v4di)_mm256_srli_epi64(__A, (int)__B),
49594744 (__v4di)__W);
49604745}
49614746
4962static __inline__ __m256i __DEFAULT_FN_ATTRS256
4963_mm256_maskz_srli_epi64(__mmask8 __U, __m256i __A, unsigned int __B)
4964{
4747static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
4748_mm256_maskz_srli_epi64(__mmask8 __U, __m256i __A, unsigned int __B) {
49654749 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
49664750 (__v4di)_mm256_srli_epi64(__A, (int)__B),
49674751 (__v4di)_mm256_setzero_si256());
49684752}
49694753
4970static __inline__ __m128i __DEFAULT_FN_ATTRS128
4754static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
49714755_mm_mask_srav_epi32(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
49724756{
49734757 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
......@@ -4975,7 +4759,7 @@ _mm_mask_srav_epi32(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
49754759 (__v4si)__W);
49764760}
49774761
4978static __inline__ __m128i __DEFAULT_FN_ATTRS128
4762static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
49794763_mm_maskz_srav_epi32(__mmask8 __U, __m128i __X, __m128i __Y)
49804764{
49814765 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
......@@ -4983,7 +4767,7 @@ _mm_maskz_srav_epi32(__mmask8 __U, __m128i __X, __m128i __Y)
49834767 (__v4si)_mm_setzero_si128());
49844768}
49854769
4986static __inline__ __m256i __DEFAULT_FN_ATTRS256
4770static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
49874771_mm256_mask_srav_epi32(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
49884772{
49894773 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
......@@ -4991,7 +4775,7 @@ _mm256_mask_srav_epi32(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
49914775 (__v8si)__W);
49924776}
49934777
4994static __inline__ __m256i __DEFAULT_FN_ATTRS256
4778static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
49954779_mm256_maskz_srav_epi32(__mmask8 __U, __m256i __X, __m256i __Y)
49964780{
49974781 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
......@@ -4999,13 +4783,13 @@ _mm256_maskz_srav_epi32(__mmask8 __U, __m256i __X, __m256i __Y)
49994783 (__v8si)_mm256_setzero_si256());
50004784}
50014785
5002static __inline__ __m128i __DEFAULT_FN_ATTRS128
4786static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
50034787_mm_srav_epi64(__m128i __X, __m128i __Y)
50044788{
50054789 return (__m128i)__builtin_ia32_psravq128((__v2di)__X, (__v2di)__Y);
50064790}
50074791
5008static __inline__ __m128i __DEFAULT_FN_ATTRS128
4792static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
50094793_mm_mask_srav_epi64(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
50104794{
50114795 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
......@@ -5013,7 +4797,7 @@ _mm_mask_srav_epi64(__m128i __W, __mmask8 __U, __m128i __X, __m128i __Y)
50134797 (__v2di)__W);
50144798}
50154799
5016static __inline__ __m128i __DEFAULT_FN_ATTRS128
4800static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
50174801_mm_maskz_srav_epi64(__mmask8 __U, __m128i __X, __m128i __Y)
50184802{
50194803 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
......@@ -5021,13 +4805,13 @@ _mm_maskz_srav_epi64(__mmask8 __U, __m128i __X, __m128i __Y)
50214805 (__v2di)_mm_setzero_si128());
50224806}
50234807
5024static __inline__ __m256i __DEFAULT_FN_ATTRS256
4808static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
50254809_mm256_srav_epi64(__m256i __X, __m256i __Y)
50264810{
50274811 return (__m256i)__builtin_ia32_psravq256((__v4di)__X, (__v4di) __Y);
50284812}
50294813
5030static __inline__ __m256i __DEFAULT_FN_ATTRS256
4814static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
50314815_mm256_mask_srav_epi64(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
50324816{
50334817 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
......@@ -5035,7 +4819,7 @@ _mm256_mask_srav_epi64(__m256i __W, __mmask8 __U, __m256i __X, __m256i __Y)
50354819 (__v4di)__W);
50364820}
50374821
5038static __inline__ __m256i __DEFAULT_FN_ATTRS256
4822static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
50394823_mm256_maskz_srav_epi64 (__mmask8 __U, __m256i __X, __m256i __Y)
50404824{
50414825 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
......@@ -5296,69 +5080,55 @@ _mm256_maskz_movedup_pd (__mmask8 __U, __m256d __A)
52965080 (__v4df)_mm256_setzero_pd());
52975081}
52985082
5299static __inline__ __m128i __DEFAULT_FN_ATTRS128
5300_mm_mask_set1_epi32(__m128i __O, __mmask8 __M, int __A)
5301{
5302 return (__m128i)__builtin_ia32_selectd_128(__M,
5303 (__v4si) _mm_set1_epi32(__A),
5304 (__v4si)__O);
5083static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5084_mm_mask_set1_epi32(__m128i __O, __mmask8 __M, int __A) {
5085 return (__m128i)__builtin_ia32_selectd_128(__M, (__v4si)_mm_set1_epi32(__A),
5086 (__v4si)__O);
53055087}
53065088
5307static __inline__ __m128i __DEFAULT_FN_ATTRS128
5308_mm_maskz_set1_epi32( __mmask8 __M, int __A)
5309{
5310 return (__m128i)__builtin_ia32_selectd_128(__M,
5311 (__v4si) _mm_set1_epi32(__A),
5312 (__v4si)_mm_setzero_si128());
5089static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5090_mm_maskz_set1_epi32(__mmask8 __M, int __A) {
5091 return (__m128i)__builtin_ia32_selectd_128(__M, (__v4si)_mm_set1_epi32(__A),
5092 (__v4si)_mm_setzero_si128());
53135093}
53145094
5315static __inline__ __m256i __DEFAULT_FN_ATTRS256
5316_mm256_mask_set1_epi32(__m256i __O, __mmask8 __M, int __A)
5317{
5318 return (__m256i)__builtin_ia32_selectd_256(__M,
5319 (__v8si) _mm256_set1_epi32(__A),
5320 (__v8si)__O);
5095static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
5096_mm256_mask_set1_epi32(__m256i __O, __mmask8 __M, int __A) {
5097 return (__m256i)__builtin_ia32_selectd_256(
5098 __M, (__v8si)_mm256_set1_epi32(__A), (__v8si)__O);
53215099}
53225100
5323static __inline__ __m256i __DEFAULT_FN_ATTRS256
5324_mm256_maskz_set1_epi32( __mmask8 __M, int __A)
5325{
5326 return (__m256i)__builtin_ia32_selectd_256(__M,
5327 (__v8si) _mm256_set1_epi32(__A),
5328 (__v8si)_mm256_setzero_si256());
5101static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
5102_mm256_maskz_set1_epi32(__mmask8 __M, int __A) {
5103 return (__m256i)__builtin_ia32_selectd_256(
5104 __M, (__v8si)_mm256_set1_epi32(__A), (__v8si)_mm256_setzero_si256());
53295105}
53305106
5331
5332static __inline__ __m128i __DEFAULT_FN_ATTRS128
5333_mm_mask_set1_epi64 (__m128i __O, __mmask8 __M, long long __A)
5334{
5107static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5108_mm_mask_set1_epi64(__m128i __O, __mmask8 __M, long long __A) {
53355109 return (__m128i) __builtin_ia32_selectq_128(__M,
53365110 (__v2di) _mm_set1_epi64x(__A),
53375111 (__v2di) __O);
53385112}
53395113
5340static __inline__ __m128i __DEFAULT_FN_ATTRS128
5341_mm_maskz_set1_epi64 (__mmask8 __M, long long __A)
5342{
5114static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5115_mm_maskz_set1_epi64(__mmask8 __M, long long __A) {
53435116 return (__m128i) __builtin_ia32_selectq_128(__M,
53445117 (__v2di) _mm_set1_epi64x(__A),
53455118 (__v2di) _mm_setzero_si128());
53465119}
53475120
5348static __inline__ __m256i __DEFAULT_FN_ATTRS256
5349_mm256_mask_set1_epi64 (__m256i __O, __mmask8 __M, long long __A)
5350{
5121static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
5122_mm256_mask_set1_epi64(__m256i __O, __mmask8 __M, long long __A) {
53515123 return (__m256i) __builtin_ia32_selectq_256(__M,
53525124 (__v4di) _mm256_set1_epi64x(__A),
53535125 (__v4di) __O) ;
53545126}
53555127
5356static __inline__ __m256i __DEFAULT_FN_ATTRS256
5357_mm256_maskz_set1_epi64 (__mmask8 __M, long long __A)
5358{
5359 return (__m256i) __builtin_ia32_selectq_256(__M,
5360 (__v4di) _mm256_set1_epi64x(__A),
5361 (__v4di) _mm256_setzero_si256());
5128static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
5129_mm256_maskz_set1_epi64(__mmask8 __M, long long __A) {
5130 return (__m256i)__builtin_ia32_selectq_256(
5131 __M, (__v4di)_mm256_set1_epi64x(__A), (__v4di)_mm256_setzero_si256());
53625132}
53635133
53645134#define _mm_fixupimm_pd(A, B, C, imm) \
......@@ -5805,130 +5575,113 @@ _mm256_mask_storeu_ps (void *__P, __mmask8 __U, __m256 __A)
58055575 (__mmask8) __U);
58065576}
58075577
5808
5809static __inline__ __m128d __DEFAULT_FN_ATTRS128
5810_mm_mask_unpackhi_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
5811{
5578static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5579_mm_mask_unpackhi_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
58125580 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
58135581 (__v2df)_mm_unpackhi_pd(__A, __B),
58145582 (__v2df)__W);
58155583}
58165584
5817static __inline__ __m128d __DEFAULT_FN_ATTRS128
5818_mm_maskz_unpackhi_pd(__mmask8 __U, __m128d __A, __m128d __B)
5819{
5585static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5586_mm_maskz_unpackhi_pd(__mmask8 __U, __m128d __A, __m128d __B) {
58205587 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
58215588 (__v2df)_mm_unpackhi_pd(__A, __B),
58225589 (__v2df)_mm_setzero_pd());
58235590}
58245591
5825static __inline__ __m256d __DEFAULT_FN_ATTRS256
5826_mm256_mask_unpackhi_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B)
5827{
5592static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
5593_mm256_mask_unpackhi_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
58285594 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
58295595 (__v4df)_mm256_unpackhi_pd(__A, __B),
58305596 (__v4df)__W);
58315597}
58325598
5833static __inline__ __m256d __DEFAULT_FN_ATTRS256
5834_mm256_maskz_unpackhi_pd(__mmask8 __U, __m256d __A, __m256d __B)
5835{
5599static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
5600_mm256_maskz_unpackhi_pd(__mmask8 __U, __m256d __A, __m256d __B) {
58365601 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
58375602 (__v4df)_mm256_unpackhi_pd(__A, __B),
58385603 (__v4df)_mm256_setzero_pd());
58395604}
58405605
5841static __inline__ __m128 __DEFAULT_FN_ATTRS128
5842_mm_mask_unpackhi_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
5843{
5606static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
5607_mm_mask_unpackhi_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
58445608 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
58455609 (__v4sf)_mm_unpackhi_ps(__A, __B),
58465610 (__v4sf)__W);
58475611}
58485612
5849static __inline__ __m128 __DEFAULT_FN_ATTRS128
5850_mm_maskz_unpackhi_ps(__mmask8 __U, __m128 __A, __m128 __B)
5851{
5613static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
5614_mm_maskz_unpackhi_ps(__mmask8 __U, __m128 __A, __m128 __B) {
58525615 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
58535616 (__v4sf)_mm_unpackhi_ps(__A, __B),
58545617 (__v4sf)_mm_setzero_ps());
58555618}
58565619
5857static __inline__ __m256 __DEFAULT_FN_ATTRS256
5858_mm256_mask_unpackhi_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B)
5859{
5620static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
5621_mm256_mask_unpackhi_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
58605622 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
58615623 (__v8sf)_mm256_unpackhi_ps(__A, __B),
58625624 (__v8sf)__W);
58635625}
58645626
5865static __inline__ __m256 __DEFAULT_FN_ATTRS256
5866_mm256_maskz_unpackhi_ps(__mmask8 __U, __m256 __A, __m256 __B)
5867{
5627static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
5628_mm256_maskz_unpackhi_ps(__mmask8 __U, __m256 __A, __m256 __B) {
58685629 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
58695630 (__v8sf)_mm256_unpackhi_ps(__A, __B),
58705631 (__v8sf)_mm256_setzero_ps());
58715632}
58725633
5873static __inline__ __m128d __DEFAULT_FN_ATTRS128
5874_mm_mask_unpacklo_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
5875{
5634static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5635_mm_mask_unpacklo_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
58765636 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
58775637 (__v2df)_mm_unpacklo_pd(__A, __B),
58785638 (__v2df)__W);
58795639}
58805640
5881static __inline__ __m128d __DEFAULT_FN_ATTRS128
5882_mm_maskz_unpacklo_pd(__mmask8 __U, __m128d __A, __m128d __B)
5883{
5641static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5642_mm_maskz_unpacklo_pd(__mmask8 __U, __m128d __A, __m128d __B) {
58845643 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
58855644 (__v2df)_mm_unpacklo_pd(__A, __B),
58865645 (__v2df)_mm_setzero_pd());
58875646}
58885647
5889static __inline__ __m256d __DEFAULT_FN_ATTRS256
5890_mm256_mask_unpacklo_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B)
5891{
5648static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
5649_mm256_mask_unpacklo_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
58925650 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
58935651 (__v4df)_mm256_unpacklo_pd(__A, __B),
58945652 (__v4df)__W);
58955653}
58965654
5897static __inline__ __m256d __DEFAULT_FN_ATTRS256
5898_mm256_maskz_unpacklo_pd(__mmask8 __U, __m256d __A, __m256d __B)
5899{
5655static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
5656_mm256_maskz_unpacklo_pd(__mmask8 __U, __m256d __A, __m256d __B) {
59005657 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
59015658 (__v4df)_mm256_unpacklo_pd(__A, __B),
59025659 (__v4df)_mm256_setzero_pd());
59035660}
59045661
5905static __inline__ __m128 __DEFAULT_FN_ATTRS128
5906_mm_mask_unpacklo_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
5907{
5662static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
5663_mm_mask_unpacklo_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
59085664 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
59095665 (__v4sf)_mm_unpacklo_ps(__A, __B),
59105666 (__v4sf)__W);
59115667}
59125668
5913static __inline__ __m128 __DEFAULT_FN_ATTRS128
5914_mm_maskz_unpacklo_ps(__mmask8 __U, __m128 __A, __m128 __B)
5915{
5669static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
5670_mm_maskz_unpacklo_ps(__mmask8 __U, __m128 __A, __m128 __B) {
59165671 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
59175672 (__v4sf)_mm_unpacklo_ps(__A, __B),
59185673 (__v4sf)_mm_setzero_ps());
59195674}
59205675
5921static __inline__ __m256 __DEFAULT_FN_ATTRS256
5922_mm256_mask_unpacklo_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B)
5923{
5676static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
5677_mm256_mask_unpacklo_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
59245678 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
59255679 (__v8sf)_mm256_unpacklo_ps(__A, __B),
59265680 (__v8sf)__W);
59275681}
59285682
5929static __inline__ __m256 __DEFAULT_FN_ATTRS256
5930_mm256_maskz_unpacklo_ps(__mmask8 __U, __m256 __A, __m256 __B)
5931{
5683static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
5684_mm256_maskz_unpacklo_ps(__mmask8 __U, __m256 __A, __m256 __B) {
59325685 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
59335686 (__v8sf)_mm256_unpacklo_ps(__A, __B),
59345687 (__v8sf)_mm256_setzero_ps());
......@@ -6078,65 +5831,57 @@ _mm256_maskz_rcp14_ps (__mmask8 __U, __m256 __A)
60785831 (__v8sf)_mm256_permute_ps((X), (C)), \
60795832 (__v8sf)_mm256_setzero_ps()))
60805833
6081static __inline__ __m128d __DEFAULT_FN_ATTRS128
6082_mm_mask_permutevar_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128i __C)
6083{
5834static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5835_mm_mask_permutevar_pd(__m128d __W, __mmask8 __U, __m128d __A, __m128i __C) {
60845836 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
60855837 (__v2df)_mm_permutevar_pd(__A, __C),
60865838 (__v2df)__W);
60875839}
60885840
6089static __inline__ __m128d __DEFAULT_FN_ATTRS128
6090_mm_maskz_permutevar_pd(__mmask8 __U, __m128d __A, __m128i __C)
6091{
5841static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5842_mm_maskz_permutevar_pd(__mmask8 __U, __m128d __A, __m128i __C) {
60925843 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U,
60935844 (__v2df)_mm_permutevar_pd(__A, __C),
60945845 (__v2df)_mm_setzero_pd());
60955846}
60965847
6097static __inline__ __m256d __DEFAULT_FN_ATTRS256
6098_mm256_mask_permutevar_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256i __C)
6099{
5848static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
5849_mm256_mask_permutevar_pd(__m256d __W, __mmask8 __U, __m256d __A, __m256i __C) {
61005850 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
61015851 (__v4df)_mm256_permutevar_pd(__A, __C),
61025852 (__v4df)__W);
61035853}
61045854
6105static __inline__ __m256d __DEFAULT_FN_ATTRS256
6106_mm256_maskz_permutevar_pd(__mmask8 __U, __m256d __A, __m256i __C)
6107{
5855static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
5856_mm256_maskz_permutevar_pd(__mmask8 __U, __m256d __A, __m256i __C) {
61085857 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
61095858 (__v4df)_mm256_permutevar_pd(__A, __C),
61105859 (__v4df)_mm256_setzero_pd());
61115860}
61125861
6113static __inline__ __m128 __DEFAULT_FN_ATTRS128
6114_mm_mask_permutevar_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128i __C)
6115{
5862static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
5863_mm_mask_permutevar_ps(__m128 __W, __mmask8 __U, __m128 __A, __m128i __C) {
61165864 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
61175865 (__v4sf)_mm_permutevar_ps(__A, __C),
61185866 (__v4sf)__W);
61195867}
61205868
6121static __inline__ __m128 __DEFAULT_FN_ATTRS128
6122_mm_maskz_permutevar_ps(__mmask8 __U, __m128 __A, __m128i __C)
6123{
5869static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
5870_mm_maskz_permutevar_ps(__mmask8 __U, __m128 __A, __m128i __C) {
61245871 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
61255872 (__v4sf)_mm_permutevar_ps(__A, __C),
61265873 (__v4sf)_mm_setzero_ps());
61275874}
61285875
6129static __inline__ __m256 __DEFAULT_FN_ATTRS256
6130_mm256_mask_permutevar_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256i __C)
6131{
5876static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
5877_mm256_mask_permutevar_ps(__m256 __W, __mmask8 __U, __m256 __A, __m256i __C) {
61325878 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
61335879 (__v8sf)_mm256_permutevar_ps(__A, __C),
61345880 (__v8sf)__W);
61355881}
61365882
6137static __inline__ __m256 __DEFAULT_FN_ATTRS256
6138_mm256_maskz_permutevar_ps(__mmask8 __U, __m256 __A, __m256i __C)
6139{
5883static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
5884_mm256_maskz_permutevar_ps(__mmask8 __U, __m256 __A, __m256i __C) {
61405885 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
61415886 (__v8sf)_mm256_permutevar_ps(__A, __C),
61425887 (__v8sf)_mm256_setzero_ps());
......@@ -6250,282 +5995,251 @@ _mm256_mask_testn_epi64_mask (__mmask8 __U, __m256i __A, __m256i __B)
62505995 _mm256_setzero_si256());
62515996}
62525997
6253static __inline__ __m128i __DEFAULT_FN_ATTRS128
6254_mm_mask_unpackhi_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
6255{
5998static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
5999_mm_mask_unpackhi_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
62566000 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
62576001 (__v4si)_mm_unpackhi_epi32(__A, __B),
62586002 (__v4si)__W);
62596003}
62606004
6261static __inline__ __m128i __DEFAULT_FN_ATTRS128
6262_mm_maskz_unpackhi_epi32(__mmask8 __U, __m128i __A, __m128i __B)
6263{
6005static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6006_mm_maskz_unpackhi_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
62646007 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
62656008 (__v4si)_mm_unpackhi_epi32(__A, __B),
62666009 (__v4si)_mm_setzero_si128());
62676010}
62686011
6269static __inline__ __m256i __DEFAULT_FN_ATTRS256
6270_mm256_mask_unpackhi_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
6271{
6012static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6013_mm256_mask_unpackhi_epi32(__m256i __W, __mmask8 __U, __m256i __A,
6014 __m256i __B) {
62726015 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
62736016 (__v8si)_mm256_unpackhi_epi32(__A, __B),
62746017 (__v8si)__W);
62756018}
62766019
6277static __inline__ __m256i __DEFAULT_FN_ATTRS256
6278_mm256_maskz_unpackhi_epi32(__mmask8 __U, __m256i __A, __m256i __B)
6279{
6020static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6021_mm256_maskz_unpackhi_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
62806022 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
62816023 (__v8si)_mm256_unpackhi_epi32(__A, __B),
62826024 (__v8si)_mm256_setzero_si256());
62836025}
62846026
6285static __inline__ __m128i __DEFAULT_FN_ATTRS128
6286_mm_mask_unpackhi_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
6287{
6027static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6028_mm_mask_unpackhi_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
62886029 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
62896030 (__v2di)_mm_unpackhi_epi64(__A, __B),
62906031 (__v2di)__W);
62916032}
62926033
6293static __inline__ __m128i __DEFAULT_FN_ATTRS128
6294_mm_maskz_unpackhi_epi64(__mmask8 __U, __m128i __A, __m128i __B)
6295{
6034static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6035_mm_maskz_unpackhi_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
62966036 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
62976037 (__v2di)_mm_unpackhi_epi64(__A, __B),
62986038 (__v2di)_mm_setzero_si128());
62996039}
63006040
6301static __inline__ __m256i __DEFAULT_FN_ATTRS256
6302_mm256_mask_unpackhi_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
6303{
6041static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6042_mm256_mask_unpackhi_epi64(__m256i __W, __mmask8 __U, __m256i __A,
6043 __m256i __B) {
63046044 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
63056045 (__v4di)_mm256_unpackhi_epi64(__A, __B),
63066046 (__v4di)__W);
63076047}
63086048
6309static __inline__ __m256i __DEFAULT_FN_ATTRS256
6310_mm256_maskz_unpackhi_epi64(__mmask8 __U, __m256i __A, __m256i __B)
6311{
6049static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6050_mm256_maskz_unpackhi_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
63126051 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
63136052 (__v4di)_mm256_unpackhi_epi64(__A, __B),
63146053 (__v4di)_mm256_setzero_si256());
63156054}
63166055
6317static __inline__ __m128i __DEFAULT_FN_ATTRS128
6318_mm_mask_unpacklo_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
6319{
6056static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6057_mm_mask_unpacklo_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
63206058 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
63216059 (__v4si)_mm_unpacklo_epi32(__A, __B),
63226060 (__v4si)__W);
63236061}
63246062
6325static __inline__ __m128i __DEFAULT_FN_ATTRS128
6326_mm_maskz_unpacklo_epi32(__mmask8 __U, __m128i __A, __m128i __B)
6327{
6063static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6064_mm_maskz_unpacklo_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
63286065 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
63296066 (__v4si)_mm_unpacklo_epi32(__A, __B),
63306067 (__v4si)_mm_setzero_si128());
63316068}
63326069
6333static __inline__ __m256i __DEFAULT_FN_ATTRS256
6334_mm256_mask_unpacklo_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
6335{
6070static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6071_mm256_mask_unpacklo_epi32(__m256i __W, __mmask8 __U, __m256i __A,
6072 __m256i __B) {
63366073 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
63376074 (__v8si)_mm256_unpacklo_epi32(__A, __B),
63386075 (__v8si)__W);
63396076}
63406077
6341static __inline__ __m256i __DEFAULT_FN_ATTRS256
6342_mm256_maskz_unpacklo_epi32(__mmask8 __U, __m256i __A, __m256i __B)
6343{
6078static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6079_mm256_maskz_unpacklo_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
63446080 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
63456081 (__v8si)_mm256_unpacklo_epi32(__A, __B),
63466082 (__v8si)_mm256_setzero_si256());
63476083}
63486084
6349static __inline__ __m128i __DEFAULT_FN_ATTRS128
6350_mm_mask_unpacklo_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
6351{
6085static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6086_mm_mask_unpacklo_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
63526087 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
63536088 (__v2di)_mm_unpacklo_epi64(__A, __B),
63546089 (__v2di)__W);
63556090}
63566091
6357static __inline__ __m128i __DEFAULT_FN_ATTRS128
6358_mm_maskz_unpacklo_epi64(__mmask8 __U, __m128i __A, __m128i __B)
6359{
6092static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6093_mm_maskz_unpacklo_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
63606094 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
63616095 (__v2di)_mm_unpacklo_epi64(__A, __B),
63626096 (__v2di)_mm_setzero_si128());
63636097}
63646098
6365static __inline__ __m256i __DEFAULT_FN_ATTRS256
6366_mm256_mask_unpacklo_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m256i __B)
6367{
6099static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6100_mm256_mask_unpacklo_epi64(__m256i __W, __mmask8 __U, __m256i __A,
6101 __m256i __B) {
63686102 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
63696103 (__v4di)_mm256_unpacklo_epi64(__A, __B),
63706104 (__v4di)__W);
63716105}
63726106
6373static __inline__ __m256i __DEFAULT_FN_ATTRS256
6374_mm256_maskz_unpacklo_epi64(__mmask8 __U, __m256i __A, __m256i __B)
6375{
6107static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6108_mm256_maskz_unpacklo_epi64(__mmask8 __U, __m256i __A, __m256i __B) {
63766109 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
63776110 (__v4di)_mm256_unpacklo_epi64(__A, __B),
63786111 (__v4di)_mm256_setzero_si256());
63796112}
63806113
6381static __inline__ __m128i __DEFAULT_FN_ATTRS128
6382_mm_mask_sra_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
6383{
6114static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6115_mm_mask_sra_epi32(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
63846116 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
63856117 (__v4si)_mm_sra_epi32(__A, __B),
63866118 (__v4si)__W);
63876119}
63886120
6389static __inline__ __m128i __DEFAULT_FN_ATTRS128
6390_mm_maskz_sra_epi32(__mmask8 __U, __m128i __A, __m128i __B)
6391{
6121static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6122_mm_maskz_sra_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
63926123 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
63936124 (__v4si)_mm_sra_epi32(__A, __B),
63946125 (__v4si)_mm_setzero_si128());
63956126}
63966127
6397static __inline__ __m256i __DEFAULT_FN_ATTRS256
6398_mm256_mask_sra_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B)
6399{
6128static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6129_mm256_mask_sra_epi32(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) {
64006130 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
64016131 (__v8si)_mm256_sra_epi32(__A, __B),
64026132 (__v8si)__W);
64036133}
64046134
6405static __inline__ __m256i __DEFAULT_FN_ATTRS256
6406_mm256_maskz_sra_epi32(__mmask8 __U, __m256i __A, __m128i __B)
6407{
6135static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6136_mm256_maskz_sra_epi32(__mmask8 __U, __m256i __A, __m128i __B) {
64086137 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
64096138 (__v8si)_mm256_sra_epi32(__A, __B),
64106139 (__v8si)_mm256_setzero_si256());
64116140}
64126141
6413static __inline__ __m128i __DEFAULT_FN_ATTRS128
6414_mm_mask_srai_epi32(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B)
6415{
6142static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6143_mm_mask_srai_epi32(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) {
64166144 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
64176145 (__v4si)_mm_srai_epi32(__A, (int)__B),
64186146 (__v4si)__W);
64196147}
64206148
6421static __inline__ __m128i __DEFAULT_FN_ATTRS128
6422_mm_maskz_srai_epi32(__mmask8 __U, __m128i __A, unsigned int __B)
6423{
6149static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6150_mm_maskz_srai_epi32(__mmask8 __U, __m128i __A, unsigned int __B) {
64246151 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
64256152 (__v4si)_mm_srai_epi32(__A, (int)__B),
64266153 (__v4si)_mm_setzero_si128());
64276154}
64286155
6429static __inline__ __m256i __DEFAULT_FN_ATTRS256
6430_mm256_mask_srai_epi32(__m256i __W, __mmask8 __U, __m256i __A, unsigned int __B)
6431{
6156static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6157_mm256_mask_srai_epi32(__m256i __W, __mmask8 __U, __m256i __A,
6158 unsigned int __B) {
64326159 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
64336160 (__v8si)_mm256_srai_epi32(__A, (int)__B),
64346161 (__v8si)__W);
64356162}
64366163
6437static __inline__ __m256i __DEFAULT_FN_ATTRS256
6438_mm256_maskz_srai_epi32(__mmask8 __U, __m256i __A, unsigned int __B)
6439{
6164static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6165_mm256_maskz_srai_epi32(__mmask8 __U, __m256i __A, unsigned int __B) {
64406166 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
64416167 (__v8si)_mm256_srai_epi32(__A, (int)__B),
64426168 (__v8si)_mm256_setzero_si256());
64436169}
64446170
6445static __inline__ __m128i __DEFAULT_FN_ATTRS128
6446_mm_sra_epi64(__m128i __A, __m128i __B)
6447{
6171static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6172_mm_sra_epi64(__m128i __A, __m128i __B) {
64486173 return (__m128i)__builtin_ia32_psraq128((__v2di)__A, (__v2di)__B);
64496174}
64506175
6451static __inline__ __m128i __DEFAULT_FN_ATTRS128
6452_mm_mask_sra_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
6453{
6176static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6177_mm_mask_sra_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
64546178 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U, \
64556179 (__v2di)_mm_sra_epi64(__A, __B), \
64566180 (__v2di)__W);
64576181}
64586182
6459static __inline__ __m128i __DEFAULT_FN_ATTRS128
6460_mm_maskz_sra_epi64(__mmask8 __U, __m128i __A, __m128i __B)
6461{
6183static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6184_mm_maskz_sra_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
64626185 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U, \
64636186 (__v2di)_mm_sra_epi64(__A, __B), \
64646187 (__v2di)_mm_setzero_si128());
64656188}
64666189
6467static __inline__ __m256i __DEFAULT_FN_ATTRS256
6468_mm256_sra_epi64(__m256i __A, __m128i __B)
6469{
6190static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6191_mm256_sra_epi64(__m256i __A, __m128i __B) {
64706192 return (__m256i)__builtin_ia32_psraq256((__v4di) __A, (__v2di) __B);
64716193}
64726194
6473static __inline__ __m256i __DEFAULT_FN_ATTRS256
6474_mm256_mask_sra_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B)
6475{
6195static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6196_mm256_mask_sra_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) {
64766197 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U, \
64776198 (__v4di)_mm256_sra_epi64(__A, __B), \
64786199 (__v4di)__W);
64796200}
64806201
6481static __inline__ __m256i __DEFAULT_FN_ATTRS256
6482_mm256_maskz_sra_epi64(__mmask8 __U, __m256i __A, __m128i __B)
6483{
6202static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6203_mm256_maskz_sra_epi64(__mmask8 __U, __m256i __A, __m128i __B) {
64846204 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U, \
64856205 (__v4di)_mm256_sra_epi64(__A, __B), \
64866206 (__v4di)_mm256_setzero_si256());
64876207}
64886208
6489static __inline__ __m128i __DEFAULT_FN_ATTRS128
6490_mm_srai_epi64(__m128i __A, unsigned int __imm)
6491{
6209static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6210_mm_srai_epi64(__m128i __A, unsigned int __imm) {
64926211 return (__m128i)__builtin_ia32_psraqi128((__v2di)__A, (int)__imm);
64936212}
64946213
6495static __inline__ __m128i __DEFAULT_FN_ATTRS128
6496_mm_mask_srai_epi64(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __imm)
6497{
6214static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_mask_srai_epi64(
6215 __m128i __W, __mmask8 __U, __m128i __A, unsigned int __imm) {
64986216 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U, \
64996217 (__v2di)_mm_srai_epi64(__A, __imm), \
65006218 (__v2di)__W);
65016219}
65026220
6503static __inline__ __m128i __DEFAULT_FN_ATTRS128
6504_mm_maskz_srai_epi64(__mmask8 __U, __m128i __A, unsigned int __imm)
6505{
6221static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6222_mm_maskz_srai_epi64(__mmask8 __U, __m128i __A, unsigned int __imm) {
65066223 return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U, \
65076224 (__v2di)_mm_srai_epi64(__A, __imm), \
65086225 (__v2di)_mm_setzero_si128());
65096226}
65106227
6511static __inline__ __m256i __DEFAULT_FN_ATTRS256
6512_mm256_srai_epi64(__m256i __A, unsigned int __imm)
6513{
6228static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6229_mm256_srai_epi64(__m256i __A, unsigned int __imm) {
65146230 return (__m256i)__builtin_ia32_psraqi256((__v4di)__A, (int)__imm);
65156231}
65166232
6517static __inline__ __m256i __DEFAULT_FN_ATTRS256
6233static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
65186234_mm256_mask_srai_epi64(__m256i __W, __mmask8 __U, __m256i __A,
6519 unsigned int __imm)
6520{
6235 unsigned int __imm) {
65216236 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U, \
65226237 (__v4di)_mm256_srai_epi64(__A, __imm), \
65236238 (__v4di)__W);
65246239}
65256240
6526static __inline__ __m256i __DEFAULT_FN_ATTRS256
6527_mm256_maskz_srai_epi64(__mmask8 __U, __m256i __A, unsigned int __imm)
6528{
6241static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6242_mm256_maskz_srai_epi64(__mmask8 __U, __m256i __A, unsigned int __imm) {
65296243 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U, \
65306244 (__v4di)_mm256_srai_epi64(__A, __imm), \
65316245 (__v4di)_mm256_setzero_si256());
......@@ -6792,159 +6506,139 @@ _mm256_maskz_rsqrt14_ps (__mmask8 __U, __m256 __A)
67926506 (__mmask8) __U);
67936507}
67946508
6795static __inline__ __m256 __DEFAULT_FN_ATTRS256
6796_mm256_broadcast_f32x4(__m128 __A)
6797{
6509static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
6510_mm256_broadcast_f32x4(__m128 __A) {
67986511 return (__m256)__builtin_shufflevector((__v4sf)__A, (__v4sf)__A,
67996512 0, 1, 2, 3, 0, 1, 2, 3);
68006513}
68016514
6802static __inline__ __m256 __DEFAULT_FN_ATTRS256
6803_mm256_mask_broadcast_f32x4(__m256 __O, __mmask8 __M, __m128 __A)
6804{
6515static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
6516_mm256_mask_broadcast_f32x4(__m256 __O, __mmask8 __M, __m128 __A) {
68056517 return (__m256)__builtin_ia32_selectps_256((__mmask8)__M,
68066518 (__v8sf)_mm256_broadcast_f32x4(__A),
68076519 (__v8sf)__O);
68086520}
68096521
6810static __inline__ __m256 __DEFAULT_FN_ATTRS256
6811_mm256_maskz_broadcast_f32x4 (__mmask8 __M, __m128 __A)
6812{
6522static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
6523_mm256_maskz_broadcast_f32x4(__mmask8 __M, __m128 __A) {
68136524 return (__m256)__builtin_ia32_selectps_256((__mmask8)__M,
68146525 (__v8sf)_mm256_broadcast_f32x4(__A),
68156526 (__v8sf)_mm256_setzero_ps());
68166527}
68176528
6818static __inline__ __m256i __DEFAULT_FN_ATTRS256
6819_mm256_broadcast_i32x4(__m128i __A)
6820{
6529static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6530_mm256_broadcast_i32x4(__m128i __A) {
68216531 return (__m256i)__builtin_shufflevector((__v4si)__A, (__v4si)__A,
68226532 0, 1, 2, 3, 0, 1, 2, 3);
68236533}
68246534
6825static __inline__ __m256i __DEFAULT_FN_ATTRS256
6826_mm256_mask_broadcast_i32x4(__m256i __O, __mmask8 __M, __m128i __A)
6827{
6535static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6536_mm256_mask_broadcast_i32x4(__m256i __O, __mmask8 __M, __m128i __A) {
68286537 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
68296538 (__v8si)_mm256_broadcast_i32x4(__A),
68306539 (__v8si)__O);
68316540}
68326541
6833static __inline__ __m256i __DEFAULT_FN_ATTRS256
6834_mm256_maskz_broadcast_i32x4(__mmask8 __M, __m128i __A)
6835{
6542static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6543_mm256_maskz_broadcast_i32x4(__mmask8 __M, __m128i __A) {
68366544 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
68376545 (__v8si)_mm256_broadcast_i32x4(__A),
68386546 (__v8si)_mm256_setzero_si256());
68396547}
68406548
6841static __inline__ __m256d __DEFAULT_FN_ATTRS256
6842_mm256_mask_broadcastsd_pd (__m256d __O, __mmask8 __M, __m128d __A)
6843{
6549static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
6550_mm256_mask_broadcastsd_pd(__m256d __O, __mmask8 __M, __m128d __A) {
68446551 return (__m256d)__builtin_ia32_selectpd_256(__M,
68456552 (__v4df) _mm256_broadcastsd_pd(__A),
68466553 (__v4df) __O);
68476554}
68486555
6849static __inline__ __m256d __DEFAULT_FN_ATTRS256
6850_mm256_maskz_broadcastsd_pd (__mmask8 __M, __m128d __A)
6851{
6556static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
6557_mm256_maskz_broadcastsd_pd(__mmask8 __M, __m128d __A) {
68526558 return (__m256d)__builtin_ia32_selectpd_256(__M,
68536559 (__v4df) _mm256_broadcastsd_pd(__A),
68546560 (__v4df) _mm256_setzero_pd());
68556561}
68566562
6857static __inline__ __m128 __DEFAULT_FN_ATTRS128
6858_mm_mask_broadcastss_ps (__m128 __O, __mmask8 __M, __m128 __A)
6859{
6563static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
6564_mm_mask_broadcastss_ps(__m128 __O, __mmask8 __M, __m128 __A) {
68606565 return (__m128)__builtin_ia32_selectps_128(__M,
68616566 (__v4sf) _mm_broadcastss_ps(__A),
68626567 (__v4sf) __O);
68636568}
68646569
6865static __inline__ __m128 __DEFAULT_FN_ATTRS128
6866_mm_maskz_broadcastss_ps (__mmask8 __M, __m128 __A)
6867{
6570static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
6571_mm_maskz_broadcastss_ps(__mmask8 __M, __m128 __A) {
68686572 return (__m128)__builtin_ia32_selectps_128(__M,
68696573 (__v4sf) _mm_broadcastss_ps(__A),
68706574 (__v4sf) _mm_setzero_ps());
68716575}
68726576
6873static __inline__ __m256 __DEFAULT_FN_ATTRS256
6874_mm256_mask_broadcastss_ps (__m256 __O, __mmask8 __M, __m128 __A)
6875{
6577static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
6578_mm256_mask_broadcastss_ps(__m256 __O, __mmask8 __M, __m128 __A) {
68766579 return (__m256)__builtin_ia32_selectps_256(__M,
68776580 (__v8sf) _mm256_broadcastss_ps(__A),
68786581 (__v8sf) __O);
68796582}
68806583
6881static __inline__ __m256 __DEFAULT_FN_ATTRS256
6882_mm256_maskz_broadcastss_ps (__mmask8 __M, __m128 __A)
6883{
6584static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
6585_mm256_maskz_broadcastss_ps(__mmask8 __M, __m128 __A) {
68846586 return (__m256)__builtin_ia32_selectps_256(__M,
68856587 (__v8sf) _mm256_broadcastss_ps(__A),
68866588 (__v8sf) _mm256_setzero_ps());
68876589}
68886590
6889static __inline__ __m128i __DEFAULT_FN_ATTRS128
6890_mm_mask_broadcastd_epi32 (__m128i __O, __mmask8 __M, __m128i __A)
6891{
6591static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6592_mm_mask_broadcastd_epi32(__m128i __O, __mmask8 __M, __m128i __A) {
68926593 return (__m128i)__builtin_ia32_selectd_128(__M,
68936594 (__v4si) _mm_broadcastd_epi32(__A),
68946595 (__v4si) __O);
68956596}
68966597
6897static __inline__ __m128i __DEFAULT_FN_ATTRS128
6898_mm_maskz_broadcastd_epi32 (__mmask8 __M, __m128i __A)
6899{
6598static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6599_mm_maskz_broadcastd_epi32(__mmask8 __M, __m128i __A) {
69006600 return (__m128i)__builtin_ia32_selectd_128(__M,
69016601 (__v4si) _mm_broadcastd_epi32(__A),
69026602 (__v4si) _mm_setzero_si128());
69036603}
69046604
6905static __inline__ __m256i __DEFAULT_FN_ATTRS256
6906_mm256_mask_broadcastd_epi32 (__m256i __O, __mmask8 __M, __m128i __A)
6907{
6605static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6606_mm256_mask_broadcastd_epi32(__m256i __O, __mmask8 __M, __m128i __A) {
69086607 return (__m256i)__builtin_ia32_selectd_256(__M,
69096608 (__v8si) _mm256_broadcastd_epi32(__A),
69106609 (__v8si) __O);
69116610}
69126611
6913static __inline__ __m256i __DEFAULT_FN_ATTRS256
6914_mm256_maskz_broadcastd_epi32 (__mmask8 __M, __m128i __A)
6915{
6612static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6613_mm256_maskz_broadcastd_epi32(__mmask8 __M, __m128i __A) {
69166614 return (__m256i)__builtin_ia32_selectd_256(__M,
69176615 (__v8si) _mm256_broadcastd_epi32(__A),
69186616 (__v8si) _mm256_setzero_si256());
69196617}
69206618
6921static __inline__ __m128i __DEFAULT_FN_ATTRS128
6922_mm_mask_broadcastq_epi64 (__m128i __O, __mmask8 __M, __m128i __A)
6923{
6619static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6620_mm_mask_broadcastq_epi64(__m128i __O, __mmask8 __M, __m128i __A) {
69246621 return (__m128i)__builtin_ia32_selectq_128(__M,
69256622 (__v2di) _mm_broadcastq_epi64(__A),
69266623 (__v2di) __O);
69276624}
69286625
6929static __inline__ __m128i __DEFAULT_FN_ATTRS128
6930_mm_maskz_broadcastq_epi64 (__mmask8 __M, __m128i __A)
6931{
6626static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
6627_mm_maskz_broadcastq_epi64(__mmask8 __M, __m128i __A) {
69326628 return (__m128i)__builtin_ia32_selectq_128(__M,
69336629 (__v2di) _mm_broadcastq_epi64(__A),
69346630 (__v2di) _mm_setzero_si128());
69356631}
69366632
6937static __inline__ __m256i __DEFAULT_FN_ATTRS256
6938_mm256_mask_broadcastq_epi64 (__m256i __O, __mmask8 __M, __m128i __A)
6939{
6633static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6634_mm256_mask_broadcastq_epi64(__m256i __O, __mmask8 __M, __m128i __A) {
69406635 return (__m256i)__builtin_ia32_selectq_256(__M,
69416636 (__v4di) _mm256_broadcastq_epi64(__A),
69426637 (__v4di) __O);
69436638}
69446639
6945static __inline__ __m256i __DEFAULT_FN_ATTRS256
6946_mm256_maskz_broadcastq_epi64 (__mmask8 __M, __m128i __A)
6947{
6640static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
6641_mm256_maskz_broadcastq_epi64(__mmask8 __M, __m128i __A) {
69486642 return (__m256i)__builtin_ia32_selectq_256(__M,
69496643 (__v4di) _mm256_broadcastq_epi64(__A),
69506644 (__v4di) _mm256_setzero_si256());
......@@ -7536,9 +7230,8 @@ _mm256_mask_cvtusepi64_storeu_epi16 (void * __P, __mmask8 __M, __m256i __A)
75367230 __builtin_ia32_pmovusqw256mem_mask ((__v8hi *) __P, (__v4di) __A, __M);
75377231}
75387232
7539static __inline__ __m128i __DEFAULT_FN_ATTRS128
7540_mm_cvtepi32_epi8 (__m128i __A)
7541{
7233static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
7234_mm_cvtepi32_epi8(__m128i __A) {
75427235 return (__m128i)__builtin_shufflevector(
75437236 __builtin_convertvector((__v4si)__A, __v4qi), (__v4qi){0, 0, 0, 0}, 0, 1,
75447237 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7);
......@@ -7566,9 +7259,8 @@ _mm_mask_cvtepi32_storeu_epi8 (void * __P, __mmask8 __M, __m128i __A)
75667259 __builtin_ia32_pmovdb128mem_mask ((__v16qi *) __P, (__v4si) __A, __M);
75677260}
75687261
7569static __inline__ __m128i __DEFAULT_FN_ATTRS256
7570_mm256_cvtepi32_epi8 (__m256i __A)
7571{
7262static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7263_mm256_cvtepi32_epi8(__m256i __A) {
75727264 return (__m128i)__builtin_shufflevector(
75737265 __builtin_convertvector((__v8si)__A, __v8qi),
75747266 (__v8qi){0, 0, 0, 0, 0, 0, 0, 0}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
......@@ -7576,8 +7268,7 @@ _mm256_cvtepi32_epi8 (__m256i __A)
75767268}
75777269
75787270static __inline__ __m128i __DEFAULT_FN_ATTRS256
7579_mm256_mask_cvtepi32_epi8 (__m128i __O, __mmask8 __M, __m256i __A)
7580{
7271_mm256_mask_cvtepi32_epi8(__m128i __O, __mmask8 __M, __m256i __A) {
75817272 return (__m128i) __builtin_ia32_pmovdb256_mask ((__v8si) __A,
75827273 (__v16qi) __O, __M);
75837274}
......@@ -7596,9 +7287,8 @@ _mm256_mask_cvtepi32_storeu_epi8 (void * __P, __mmask8 __M, __m256i __A)
75967287 __builtin_ia32_pmovdb256mem_mask ((__v16qi *) __P, (__v8si) __A, __M);
75977288}
75987289
7599static __inline__ __m128i __DEFAULT_FN_ATTRS128
7600_mm_cvtepi32_epi16 (__m128i __A)
7601{
7290static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
7291_mm_cvtepi32_epi16(__m128i __A) {
76027292 return (__m128i)__builtin_shufflevector(
76037293 __builtin_convertvector((__v4si)__A, __v4hi), (__v4hi){0, 0, 0, 0}, 0, 1,
76047294 2, 3, 4, 5, 6, 7);
......@@ -7625,9 +7315,8 @@ _mm_mask_cvtepi32_storeu_epi16 (void * __P, __mmask8 __M, __m128i __A)
76257315 __builtin_ia32_pmovdw128mem_mask ((__v8hi *) __P, (__v4si) __A, __M);
76267316}
76277317
7628static __inline__ __m128i __DEFAULT_FN_ATTRS256
7629_mm256_cvtepi32_epi16 (__m256i __A)
7630{
7318static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7319_mm256_cvtepi32_epi16(__m256i __A) {
76317320 return (__m128i)__builtin_convertvector((__v8si)__A, __v8hi);
76327321}
76337322
......@@ -7652,9 +7341,8 @@ _mm256_mask_cvtepi32_storeu_epi16 (void * __P, __mmask8 __M, __m256i __A)
76527341 __builtin_ia32_pmovdw256mem_mask ((__v8hi *) __P, (__v8si) __A, __M);
76537342}
76547343
7655static __inline__ __m128i __DEFAULT_FN_ATTRS128
7656_mm_cvtepi64_epi8 (__m128i __A)
7657{
7344static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
7345_mm_cvtepi64_epi8(__m128i __A) {
76587346 return (__m128i)__builtin_shufflevector(
76597347 __builtin_convertvector((__v2di)__A, __v2qi), (__v2qi){0, 0}, 0, 1, 2, 3,
76607348 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3);
......@@ -7681,9 +7369,8 @@ _mm_mask_cvtepi64_storeu_epi8 (void * __P, __mmask8 __M, __m128i __A)
76817369 __builtin_ia32_pmovqb128mem_mask ((__v16qi *) __P, (__v2di) __A, __M);
76827370}
76837371
7684static __inline__ __m128i __DEFAULT_FN_ATTRS256
7685_mm256_cvtepi64_epi8 (__m256i __A)
7686{
7372static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7373_mm256_cvtepi64_epi8(__m256i __A) {
76877374 return (__m128i)__builtin_shufflevector(
76887375 __builtin_convertvector((__v4di)__A, __v4qi), (__v4qi){0, 0, 0, 0}, 0, 1,
76897376 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7);
......@@ -7710,9 +7397,8 @@ _mm256_mask_cvtepi64_storeu_epi8 (void * __P, __mmask8 __M, __m256i __A)
77107397 __builtin_ia32_pmovqb256mem_mask ((__v16qi *) __P, (__v4di) __A, __M);
77117398}
77127399
7713static __inline__ __m128i __DEFAULT_FN_ATTRS128
7714_mm_cvtepi64_epi32 (__m128i __A)
7715{
7400static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
7401_mm_cvtepi64_epi32(__m128i __A) {
77167402 return (__m128i)__builtin_shufflevector(
77177403 __builtin_convertvector((__v2di)__A, __v2si), (__v2si){0, 0}, 0, 1, 2, 3);
77187404}
......@@ -7738,23 +7424,20 @@ _mm_mask_cvtepi64_storeu_epi32 (void * __P, __mmask8 __M, __m128i __A)
77387424 __builtin_ia32_pmovqd128mem_mask ((__v4si *) __P, (__v2di) __A, __M);
77397425}
77407426
7741static __inline__ __m128i __DEFAULT_FN_ATTRS256
7742_mm256_cvtepi64_epi32 (__m256i __A)
7743{
7427static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7428_mm256_cvtepi64_epi32(__m256i __A) {
77447429 return (__m128i)__builtin_convertvector((__v4di)__A, __v4si);
77457430}
77467431
7747static __inline__ __m128i __DEFAULT_FN_ATTRS256
7748_mm256_mask_cvtepi64_epi32 (__m128i __O, __mmask8 __M, __m256i __A)
7749{
7432static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7433_mm256_mask_cvtepi64_epi32(__m128i __O, __mmask8 __M, __m256i __A) {
77507434 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
77517435 (__v4si)_mm256_cvtepi64_epi32(__A),
77527436 (__v4si)__O);
77537437}
77547438
7755static __inline__ __m128i __DEFAULT_FN_ATTRS256
7756_mm256_maskz_cvtepi64_epi32 (__mmask8 __M, __m256i __A)
7757{
7439static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7440_mm256_maskz_cvtepi64_epi32(__mmask8 __M, __m256i __A) {
77587441 return (__m128i)__builtin_ia32_selectd_128((__mmask8)__M,
77597442 (__v4si)_mm256_cvtepi64_epi32(__A),
77607443 (__v4si)_mm_setzero_si128());
......@@ -7766,9 +7449,8 @@ _mm256_mask_cvtepi64_storeu_epi32 (void * __P, __mmask8 __M, __m256i __A)
77667449 __builtin_ia32_pmovqd256mem_mask ((__v4si *) __P, (__v4di) __A, __M);
77677450}
77687451
7769static __inline__ __m128i __DEFAULT_FN_ATTRS128
7770_mm_cvtepi64_epi16 (__m128i __A)
7771{
7452static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
7453_mm_cvtepi64_epi16(__m128i __A) {
77727454 return (__m128i)__builtin_shufflevector(
77737455 __builtin_convertvector((__v2di)__A, __v2hi), (__v2hi){0, 0}, 0, 1, 2, 3,
77747456 3, 3, 3, 3);
......@@ -7796,9 +7478,8 @@ _mm_mask_cvtepi64_storeu_epi16 (void * __P, __mmask8 __M, __m128i __A)
77967478 __builtin_ia32_pmovqw128mem_mask ((__v8hi *) __P, (__v2di) __A, __M);
77977479}
77987480
7799static __inline__ __m128i __DEFAULT_FN_ATTRS256
7800_mm256_cvtepi64_epi16 (__m256i __A)
7801{
7481static __inline__ __m128i __DEFAULT_FN_ATTRS256_CONSTEXPR
7482_mm256_cvtepi64_epi16(__m256i __A) {
78027483 return (__m128i)__builtin_shufflevector(
78037484 __builtin_convertvector((__v4di)__A, __v4hi), (__v4hi){0, 0, 0, 0}, 0, 1,
78047485 2, 3, 4, 5, 6, 7);
......@@ -7825,11 +7506,10 @@ _mm256_mask_cvtepi64_storeu_epi16 (void * __P, __mmask8 __M, __m256i __A)
78257506 __builtin_ia32_pmovqw256mem_mask ((__v8hi *) __P, (__v4di) __A, __M);
78267507}
78277508
7828#define _mm256_extractf32x4_ps(A, imm) \
7829 ((__m128)__builtin_ia32_extractf32x4_256_mask((__v8sf)(__m256)(A), \
7830 (int)(imm), \
7831 (__v4sf)_mm_undefined_ps(), \
7832 (__mmask8)-1))
7509#define _mm256_extractf32x4_ps(A, imm) \
7510 ((__m128)__builtin_ia32_extractf32x4_256_mask( \
7511 (__v8sf)(__m256)(A), (int)(imm), (__v4sf)_mm_setzero_ps(), \
7512 (__mmask8) - 1))
78337513
78347514#define _mm256_mask_extractf32x4_ps(W, U, A, imm) \
78357515 ((__m128)__builtin_ia32_extractf32x4_256_mask((__v8sf)(__m256)(A), \
......@@ -7843,11 +7523,10 @@ _mm256_mask_cvtepi64_storeu_epi16 (void * __P, __mmask8 __M, __m256i __A)
78437523 (__v4sf)_mm_setzero_ps(), \
78447524 (__mmask8)(U)))
78457525
7846#define _mm256_extracti32x4_epi32(A, imm) \
7847 ((__m128i)__builtin_ia32_extracti32x4_256_mask((__v8si)(__m256i)(A), \
7848 (int)(imm), \
7849 (__v4si)_mm_undefined_si128(), \
7850 (__mmask8)-1))
7526#define _mm256_extracti32x4_epi32(A, imm) \
7527 ((__m128i)__builtin_ia32_extracti32x4_256_mask( \
7528 (__v8si)(__m256i)(A), (int)(imm), (__v4si)_mm_setzero_si128(), \
7529 (__mmask8) - 1))
78517530
78527531#define _mm256_mask_extracti32x4_epi32(W, U, A, imm) \
78537532 ((__m128i)__builtin_ia32_extracti32x4_256_mask((__v8si)(__m256i)(A), \
......@@ -8083,47 +7762,41 @@ _mm256_mask_cvtepi64_storeu_epi16 (void * __P, __mmask8 __M, __m256i __A)
80837762 (__v4di)_mm256_permutex_epi64((X), (C)), \
80847763 (__v4di)_mm256_setzero_si256()))
80857764
8086static __inline__ __m256d __DEFAULT_FN_ATTRS256
8087_mm256_permutexvar_pd (__m256i __X, __m256d __Y)
8088{
7765static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
7766_mm256_permutexvar_pd(__m256i __X, __m256d __Y) {
80897767 return (__m256d)__builtin_ia32_permvardf256((__v4df)__Y, (__v4di)__X);
80907768}
80917769
8092static __inline__ __m256d __DEFAULT_FN_ATTRS256
8093_mm256_mask_permutexvar_pd (__m256d __W, __mmask8 __U, __m256i __X,
8094 __m256d __Y)
8095{
7770static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
7771_mm256_mask_permutexvar_pd(__m256d __W, __mmask8 __U, __m256i __X,
7772 __m256d __Y) {
80967773 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
80977774 (__v4df)_mm256_permutexvar_pd(__X, __Y),
80987775 (__v4df)__W);
80997776}
81007777
8101static __inline__ __m256d __DEFAULT_FN_ATTRS256
8102_mm256_maskz_permutexvar_pd (__mmask8 __U, __m256i __X, __m256d __Y)
8103{
7778static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
7779_mm256_maskz_permutexvar_pd(__mmask8 __U, __m256i __X, __m256d __Y) {
81047780 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U,
81057781 (__v4df)_mm256_permutexvar_pd(__X, __Y),
81067782 (__v4df)_mm256_setzero_pd());
81077783}
81087784
8109static __inline__ __m256i __DEFAULT_FN_ATTRS256
8110_mm256_permutexvar_epi64 ( __m256i __X, __m256i __Y)
8111{
7785static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
7786_mm256_permutexvar_epi64(__m256i __X, __m256i __Y) {
81127787 return (__m256i)__builtin_ia32_permvardi256((__v4di) __Y, (__v4di) __X);
81137788}
81147789
8115static __inline__ __m256i __DEFAULT_FN_ATTRS256
8116_mm256_maskz_permutexvar_epi64 (__mmask8 __M, __m256i __X, __m256i __Y)
8117{
7790static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
7791_mm256_maskz_permutexvar_epi64(__mmask8 __M, __m256i __X, __m256i __Y) {
81187792 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
81197793 (__v4di)_mm256_permutexvar_epi64(__X, __Y),
81207794 (__v4di)_mm256_setzero_si256());
81217795}
81227796
8123static __inline__ __m256i __DEFAULT_FN_ATTRS256
8124_mm256_mask_permutexvar_epi64 (__m256i __W, __mmask8 __M, __m256i __X,
8125 __m256i __Y)
8126{
7797static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
7798_mm256_mask_permutexvar_epi64(__m256i __W, __mmask8 __M, __m256i __X,
7799 __m256i __Y) {
81277800 return (__m256i)__builtin_ia32_selectq_256((__mmask8)__M,
81287801 (__v4di)_mm256_permutexvar_epi64(__X, __Y),
81297802 (__v4di)__W);
......@@ -8131,17 +7804,15 @@ _mm256_mask_permutexvar_epi64 (__m256i __W, __mmask8 __M, __m256i __X,
81317804
81327805#define _mm256_permutexvar_ps(A, B) _mm256_permutevar8x32_ps((B), (A))
81337806
8134static __inline__ __m256 __DEFAULT_FN_ATTRS256
8135_mm256_mask_permutexvar_ps(__m256 __W, __mmask8 __U, __m256i __X, __m256 __Y)
8136{
7807static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
7808_mm256_mask_permutexvar_ps(__m256 __W, __mmask8 __U, __m256i __X, __m256 __Y) {
81377809 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
81387810 (__v8sf)_mm256_permutexvar_ps(__X, __Y),
81397811 (__v8sf)__W);
81407812}
81417813
8142static __inline__ __m256 __DEFAULT_FN_ATTRS256
8143_mm256_maskz_permutexvar_ps(__mmask8 __U, __m256i __X, __m256 __Y)
8144{
7814static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
7815_mm256_maskz_permutexvar_ps(__mmask8 __U, __m256i __X, __m256 __Y) {
81457816 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
81467817 (__v8sf)_mm256_permutexvar_ps(__X, __Y),
81477818 (__v8sf)_mm256_setzero_ps());
......@@ -8149,18 +7820,16 @@ _mm256_maskz_permutexvar_ps(__mmask8 __U, __m256i __X, __m256 __Y)
81497820
81507821#define _mm256_permutexvar_epi32(A, B) _mm256_permutevar8x32_epi32((B), (A))
81517822
8152static __inline__ __m256i __DEFAULT_FN_ATTRS256
7823static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
81537824_mm256_mask_permutexvar_epi32(__m256i __W, __mmask8 __M, __m256i __X,
8154 __m256i __Y)
8155{
7825 __m256i __Y) {
81567826 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
81577827 (__v8si)_mm256_permutexvar_epi32(__X, __Y),
81587828 (__v8si)__W);
81597829}
81607830
8161static __inline__ __m256i __DEFAULT_FN_ATTRS256
8162_mm256_maskz_permutexvar_epi32(__mmask8 __M, __m256i __X, __m256i __Y)
8163{
7831static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
7832_mm256_maskz_permutexvar_epi32(__mmask8 __M, __m256i __X, __m256i __Y) {
81647833 return (__m256i)__builtin_ia32_selectd_256((__mmask8)__M,
81657834 (__v8si)_mm256_permutexvar_epi32(__X, __Y),
81667835 (__v8si)_mm256_setzero_si256());
......@@ -8222,65 +7891,57 @@ _mm256_maskz_permutexvar_epi32(__mmask8 __M, __m256i __X, __m256i __Y)
82227891 (__v4di)_mm256_alignr_epi64((A), (B), (imm)), \
82237892 (__v4di)_mm256_setzero_si256()))
82247893
8225static __inline__ __m128 __DEFAULT_FN_ATTRS128
8226_mm_mask_movehdup_ps (__m128 __W, __mmask8 __U, __m128 __A)
8227{
7894static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
7895_mm_mask_movehdup_ps(__m128 __W, __mmask8 __U, __m128 __A) {
82287896 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
82297897 (__v4sf)_mm_movehdup_ps(__A),
82307898 (__v4sf)__W);
82317899}
82327900
8233static __inline__ __m128 __DEFAULT_FN_ATTRS128
8234_mm_maskz_movehdup_ps (__mmask8 __U, __m128 __A)
8235{
7901static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
7902_mm_maskz_movehdup_ps(__mmask8 __U, __m128 __A) {
82367903 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
82377904 (__v4sf)_mm_movehdup_ps(__A),
82387905 (__v4sf)_mm_setzero_ps());
82397906}
82407907
8241static __inline__ __m256 __DEFAULT_FN_ATTRS256
8242_mm256_mask_movehdup_ps (__m256 __W, __mmask8 __U, __m256 __A)
8243{
7908static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
7909_mm256_mask_movehdup_ps(__m256 __W, __mmask8 __U, __m256 __A) {
82447910 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
82457911 (__v8sf)_mm256_movehdup_ps(__A),
82467912 (__v8sf)__W);
82477913}
82487914
8249static __inline__ __m256 __DEFAULT_FN_ATTRS256
8250_mm256_maskz_movehdup_ps (__mmask8 __U, __m256 __A)
8251{
7915static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
7916_mm256_maskz_movehdup_ps(__mmask8 __U, __m256 __A) {
82527917 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
82537918 (__v8sf)_mm256_movehdup_ps(__A),
82547919 (__v8sf)_mm256_setzero_ps());
82557920}
82567921
8257static __inline__ __m128 __DEFAULT_FN_ATTRS128
8258_mm_mask_moveldup_ps (__m128 __W, __mmask8 __U, __m128 __A)
8259{
7922static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
7923_mm_mask_moveldup_ps(__m128 __W, __mmask8 __U, __m128 __A) {
82607924 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
82617925 (__v4sf)_mm_moveldup_ps(__A),
82627926 (__v4sf)__W);
82637927}
82647928
8265static __inline__ __m128 __DEFAULT_FN_ATTRS128
8266_mm_maskz_moveldup_ps (__mmask8 __U, __m128 __A)
8267{
7929static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
7930_mm_maskz_moveldup_ps(__mmask8 __U, __m128 __A) {
82687931 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
82697932 (__v4sf)_mm_moveldup_ps(__A),
82707933 (__v4sf)_mm_setzero_ps());
82717934}
82727935
8273static __inline__ __m256 __DEFAULT_FN_ATTRS256
8274_mm256_mask_moveldup_ps (__m256 __W, __mmask8 __U, __m256 __A)
8275{
7936static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
7937_mm256_mask_moveldup_ps(__m256 __W, __mmask8 __U, __m256 __A) {
82767938 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
82777939 (__v8sf)_mm256_moveldup_ps(__A),
82787940 (__v8sf)__W);
82797941}
82807942
8281static __inline__ __m256 __DEFAULT_FN_ATTRS256
8282_mm256_maskz_moveldup_ps (__mmask8 __U, __m256 __A)
8283{
7943static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
7944_mm256_maskz_moveldup_ps(__mmask8 __U, __m256 __A) {
82847945 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U,
82857946 (__v8sf)_mm256_moveldup_ps(__A),
82867947 (__v8sf)_mm256_setzero_ps());
......@@ -8306,68 +7967,52 @@ _mm256_maskz_moveldup_ps (__mmask8 __U, __m256 __A)
83067967 (__v4si)_mm_shuffle_epi32((A), (I)), \
83077968 (__v4si)_mm_setzero_si128()))
83087969
8309static __inline__ __m128d __DEFAULT_FN_ATTRS128
8310_mm_mask_mov_pd (__m128d __W, __mmask8 __U, __m128d __A)
8311{
8312 return (__m128d) __builtin_ia32_selectpd_128 ((__mmask8) __U,
8313 (__v2df) __A,
8314 (__v2df) __W);
7970static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
7971_mm_mask_mov_pd(__m128d __W, __mmask8 __U, __m128d __A) {
7972 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U, (__v2df)__A,
7973 (__v2df)__W);
83157974}
83167975
8317static __inline__ __m128d __DEFAULT_FN_ATTRS128
8318_mm_maskz_mov_pd (__mmask8 __U, __m128d __A)
8319{
8320 return (__m128d) __builtin_ia32_selectpd_128 ((__mmask8) __U,
8321 (__v2df) __A,
8322 (__v2df) _mm_setzero_pd ());
7976static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
7977_mm_maskz_mov_pd(__mmask8 __U, __m128d __A) {
7978 return (__m128d)__builtin_ia32_selectpd_128((__mmask8)__U, (__v2df)__A,
7979 (__v2df)_mm_setzero_pd());
83237980}
83247981
8325static __inline__ __m256d __DEFAULT_FN_ATTRS256
8326_mm256_mask_mov_pd (__m256d __W, __mmask8 __U, __m256d __A)
8327{
8328 return (__m256d) __builtin_ia32_selectpd_256 ((__mmask8) __U,
8329 (__v4df) __A,
8330 (__v4df) __W);
7982static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
7983_mm256_mask_mov_pd(__m256d __W, __mmask8 __U, __m256d __A) {
7984 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U, (__v4df)__A,
7985 (__v4df)__W);
83317986}
83327987
8333static __inline__ __m256d __DEFAULT_FN_ATTRS256
8334_mm256_maskz_mov_pd (__mmask8 __U, __m256d __A)
8335{
8336 return (__m256d) __builtin_ia32_selectpd_256 ((__mmask8) __U,
8337 (__v4df) __A,
8338 (__v4df) _mm256_setzero_pd ());
7988static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
7989_mm256_maskz_mov_pd(__mmask8 __U, __m256d __A) {
7990 return (__m256d)__builtin_ia32_selectpd_256((__mmask8)__U, (__v4df)__A,
7991 (__v4df)_mm256_setzero_pd());
83397992}
83407993
8341static __inline__ __m128 __DEFAULT_FN_ATTRS128
8342_mm_mask_mov_ps (__m128 __W, __mmask8 __U, __m128 __A)
8343{
8344 return (__m128) __builtin_ia32_selectps_128 ((__mmask8) __U,
8345 (__v4sf) __A,
8346 (__v4sf) __W);
7994static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
7995_mm_mask_mov_ps(__m128 __W, __mmask8 __U, __m128 __A) {
7996 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U, (__v4sf)__A,
7997 (__v4sf)__W);
83477998}
83487999
8349static __inline__ __m128 __DEFAULT_FN_ATTRS128
8350_mm_maskz_mov_ps (__mmask8 __U, __m128 __A)
8351{
8352 return (__m128) __builtin_ia32_selectps_128 ((__mmask8) __U,
8353 (__v4sf) __A,
8354 (__v4sf) _mm_setzero_ps ());
8000static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
8001_mm_maskz_mov_ps(__mmask8 __U, __m128 __A) {
8002 return (__m128)__builtin_ia32_selectps_128((__mmask8)__U, (__v4sf)__A,
8003 (__v4sf)_mm_setzero_ps());
83558004}
83568005
8357static __inline__ __m256 __DEFAULT_FN_ATTRS256
8358_mm256_mask_mov_ps (__m256 __W, __mmask8 __U, __m256 __A)
8359{
8360 return (__m256) __builtin_ia32_selectps_256 ((__mmask8) __U,
8361 (__v8sf) __A,
8362 (__v8sf) __W);
8006static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
8007_mm256_mask_mov_ps(__m256 __W, __mmask8 __U, __m256 __A) {
8008 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U, (__v8sf)__A,
8009 (__v8sf)__W);
83638010}
83648011
8365static __inline__ __m256 __DEFAULT_FN_ATTRS256
8366_mm256_maskz_mov_ps (__mmask8 __U, __m256 __A)
8367{
8368 return (__m256) __builtin_ia32_selectps_256 ((__mmask8) __U,
8369 (__v8sf) __A,
8370 (__v8sf) _mm256_setzero_ps ());
8012static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
8013_mm256_maskz_mov_ps(__mmask8 __U, __m256 __A) {
8014 return (__m256)__builtin_ia32_selectps_256((__mmask8)__U, (__v8sf)__A,
8015 (__v8sf)_mm256_setzero_ps());
83718016}
83728017
83738018static __inline__ __m128 __DEFAULT_FN_ATTRS128
......@@ -8430,8 +8075,9 @@ _mm256_maskz_cvtph_ps (__mmask8 __U, __m128i __A)
84308075#define _mm256_mask_cvtps_ph _mm256_mask_cvt_roundps_ph
84318076#define _mm256_maskz_cvtps_ph _mm256_maskz_cvt_roundps_ph
84328077
8433
84348078#undef __DEFAULT_FN_ATTRS128
84358079#undef __DEFAULT_FN_ATTRS256
8080#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
8081#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
84368082
84378083#endif /* __AVX512VLINTRIN_H */
lib/include/avx512vlvbmi2intrin.h+78-63
......@@ -17,13 +17,21 @@
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS128 \
1919 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vl,avx512vbmi2,no-evex512"), \
20 __target__("avx512vl,avx512vbmi2"), \
2121 __min_vector_width__(128)))
2222#define __DEFAULT_FN_ATTRS256 \
2323 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vl,avx512vbmi2,no-evex512"), \
24 __target__("avx512vl,avx512vbmi2"), \
2525 __min_vector_width__(256)))
2626
27#if defined(__cplusplus) && (__cplusplus >= 201103L)
28#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
29#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
30#else
31#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
32#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
33#endif
34
2735static __inline__ __m128i __DEFAULT_FN_ATTRS128
2836_mm_mask_compress_epi16(__m128i __S, __mmask8 __U, __m128i __D)
2937{
......@@ -412,14 +420,14 @@ _mm256_maskz_expandloadu_epi8(__mmask32 __U, void const *__P)
412420 (__v8hi)_mm_shrdi_epi16((A), (B), (I)), \
413421 (__v8hi)_mm_setzero_si128()))
414422
415static __inline__ __m256i __DEFAULT_FN_ATTRS256
423static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
416424_mm256_shldv_epi64(__m256i __A, __m256i __B, __m256i __C)
417425{
418 return (__m256i)__builtin_ia32_vpshldvq256((__v4di)__A, (__v4di)__B,
419 (__v4di)__C);
426 return (__m256i)__builtin_elementwise_fshl((__v4du)__A, (__v4du)__B,
427 (__v4du)__C);
420428}
421429
422static __inline__ __m256i __DEFAULT_FN_ATTRS256
430static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
423431_mm256_mask_shldv_epi64(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
424432{
425433 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -427,7 +435,7 @@ _mm256_mask_shldv_epi64(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
427435 (__v4di)__A);
428436}
429437
430static __inline__ __m256i __DEFAULT_FN_ATTRS256
438static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
431439_mm256_maskz_shldv_epi64(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
432440{
433441 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -435,14 +443,14 @@ _mm256_maskz_shldv_epi64(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
435443 (__v4di)_mm256_setzero_si256());
436444}
437445
438static __inline__ __m128i __DEFAULT_FN_ATTRS128
446static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
439447_mm_shldv_epi64(__m128i __A, __m128i __B, __m128i __C)
440448{
441 return (__m128i)__builtin_ia32_vpshldvq128((__v2di)__A, (__v2di)__B,
442 (__v2di)__C);
449 return (__m128i)__builtin_elementwise_fshl((__v2du)__A, (__v2du)__B,
450 (__v2du)__C);
443451}
444452
445static __inline__ __m128i __DEFAULT_FN_ATTRS128
453static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
446454_mm_mask_shldv_epi64(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
447455{
448456 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -450,7 +458,7 @@ _mm_mask_shldv_epi64(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
450458 (__v2di)__A);
451459}
452460
453static __inline__ __m128i __DEFAULT_FN_ATTRS128
461static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
454462_mm_maskz_shldv_epi64(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
455463{
456464 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -458,14 +466,14 @@ _mm_maskz_shldv_epi64(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
458466 (__v2di)_mm_setzero_si128());
459467}
460468
461static __inline__ __m256i __DEFAULT_FN_ATTRS256
469static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
462470_mm256_shldv_epi32(__m256i __A, __m256i __B, __m256i __C)
463471{
464 return (__m256i)__builtin_ia32_vpshldvd256((__v8si)__A, (__v8si)__B,
465 (__v8si)__C);
472 return (__m256i)__builtin_elementwise_fshl((__v8su)__A, (__v8su)__B,
473 (__v8su)__C);
466474}
467475
468static __inline__ __m256i __DEFAULT_FN_ATTRS256
476static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
469477_mm256_mask_shldv_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
470478{
471479 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -473,7 +481,7 @@ _mm256_mask_shldv_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
473481 (__v8si)__A);
474482}
475483
476static __inline__ __m256i __DEFAULT_FN_ATTRS256
484static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
477485_mm256_maskz_shldv_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
478486{
479487 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -481,14 +489,14 @@ _mm256_maskz_shldv_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
481489 (__v8si)_mm256_setzero_si256());
482490}
483491
484static __inline__ __m128i __DEFAULT_FN_ATTRS128
492static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
485493_mm_shldv_epi32(__m128i __A, __m128i __B, __m128i __C)
486494{
487 return (__m128i)__builtin_ia32_vpshldvd128((__v4si)__A, (__v4si)__B,
488 (__v4si)__C);
495 return (__m128i)__builtin_elementwise_fshl((__v4su)__A, (__v4su)__B,
496 (__v4su)__C);
489497}
490498
491static __inline__ __m128i __DEFAULT_FN_ATTRS128
499static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
492500_mm_mask_shldv_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
493501{
494502 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -496,7 +504,7 @@ _mm_mask_shldv_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
496504 (__v4si)__A);
497505}
498506
499static __inline__ __m128i __DEFAULT_FN_ATTRS128
507static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
500508_mm_maskz_shldv_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
501509{
502510 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -504,14 +512,14 @@ _mm_maskz_shldv_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
504512 (__v4si)_mm_setzero_si128());
505513}
506514
507static __inline__ __m256i __DEFAULT_FN_ATTRS256
515static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
508516_mm256_shldv_epi16(__m256i __A, __m256i __B, __m256i __C)
509517{
510 return (__m256i)__builtin_ia32_vpshldvw256((__v16hi)__A, (__v16hi)__B,
511 (__v16hi)__C);
518 return (__m256i)__builtin_elementwise_fshl((__v16hu)__A, (__v16hu)__B,
519 (__v16hu)__C);
512520}
513521
514static __inline__ __m256i __DEFAULT_FN_ATTRS256
522static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
515523_mm256_mask_shldv_epi16(__m256i __A, __mmask16 __U, __m256i __B, __m256i __C)
516524{
517525 return (__m256i)__builtin_ia32_selectw_256(__U,
......@@ -519,7 +527,7 @@ _mm256_mask_shldv_epi16(__m256i __A, __mmask16 __U, __m256i __B, __m256i __C)
519527 (__v16hi)__A);
520528}
521529
522static __inline__ __m256i __DEFAULT_FN_ATTRS256
530static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
523531_mm256_maskz_shldv_epi16(__mmask16 __U, __m256i __A, __m256i __B, __m256i __C)
524532{
525533 return (__m256i)__builtin_ia32_selectw_256(__U,
......@@ -527,14 +535,14 @@ _mm256_maskz_shldv_epi16(__mmask16 __U, __m256i __A, __m256i __B, __m256i __C)
527535 (__v16hi)_mm256_setzero_si256());
528536}
529537
530static __inline__ __m128i __DEFAULT_FN_ATTRS128
538static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
531539_mm_shldv_epi16(__m128i __A, __m128i __B, __m128i __C)
532540{
533 return (__m128i)__builtin_ia32_vpshldvw128((__v8hi)__A, (__v8hi)__B,
534 (__v8hi)__C);
541 return (__m128i)__builtin_elementwise_fshl((__v8hu)__A, (__v8hu)__B,
542 (__v8hu)__C);
535543}
536544
537static __inline__ __m128i __DEFAULT_FN_ATTRS128
545static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
538546_mm_mask_shldv_epi16(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
539547{
540548 return (__m128i)__builtin_ia32_selectw_128(__U,
......@@ -542,7 +550,7 @@ _mm_mask_shldv_epi16(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
542550 (__v8hi)__A);
543551}
544552
545static __inline__ __m128i __DEFAULT_FN_ATTRS128
553static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
546554_mm_maskz_shldv_epi16(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
547555{
548556 return (__m128i)__builtin_ia32_selectw_128(__U,
......@@ -550,14 +558,15 @@ _mm_maskz_shldv_epi16(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
550558 (__v8hi)_mm_setzero_si128());
551559}
552560
553static __inline__ __m256i __DEFAULT_FN_ATTRS256
561static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
554562_mm256_shrdv_epi64(__m256i __A, __m256i __B, __m256i __C)
555563{
556 return (__m256i)__builtin_ia32_vpshrdvq256((__v4di)__A, (__v4di)__B,
557 (__v4di)__C);
564 // Ops __A and __B are swapped.
565 return (__m256i)__builtin_elementwise_fshr((__v4du)__B, (__v4du)__A,
566 (__v4du)__C);
558567}
559568
560static __inline__ __m256i __DEFAULT_FN_ATTRS256
569static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
561570_mm256_mask_shrdv_epi64(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
562571{
563572 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -565,7 +574,7 @@ _mm256_mask_shrdv_epi64(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
565574 (__v4di)__A);
566575}
567576
568static __inline__ __m256i __DEFAULT_FN_ATTRS256
577static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
569578_mm256_maskz_shrdv_epi64(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
570579{
571580 return (__m256i)__builtin_ia32_selectq_256(__U,
......@@ -573,14 +582,15 @@ _mm256_maskz_shrdv_epi64(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
573582 (__v4di)_mm256_setzero_si256());
574583}
575584
576static __inline__ __m128i __DEFAULT_FN_ATTRS128
585static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
577586_mm_shrdv_epi64(__m128i __A, __m128i __B, __m128i __C)
578587{
579 return (__m128i)__builtin_ia32_vpshrdvq128((__v2di)__A, (__v2di)__B,
580 (__v2di)__C);
588 // Ops __A and __B are swapped.
589 return (__m128i)__builtin_elementwise_fshr((__v2du)__B, (__v2du)__A,
590 (__v2du)__C);
581591}
582592
583static __inline__ __m128i __DEFAULT_FN_ATTRS128
593static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
584594_mm_mask_shrdv_epi64(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
585595{
586596 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -588,7 +598,7 @@ _mm_mask_shrdv_epi64(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
588598 (__v2di)__A);
589599}
590600
591static __inline__ __m128i __DEFAULT_FN_ATTRS128
601static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
592602_mm_maskz_shrdv_epi64(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
593603{
594604 return (__m128i)__builtin_ia32_selectq_128(__U,
......@@ -596,14 +606,15 @@ _mm_maskz_shrdv_epi64(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
596606 (__v2di)_mm_setzero_si128());
597607}
598608
599static __inline__ __m256i __DEFAULT_FN_ATTRS256
609static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
600610_mm256_shrdv_epi32(__m256i __A, __m256i __B, __m256i __C)
601611{
602 return (__m256i)__builtin_ia32_vpshrdvd256((__v8si)__A, (__v8si)__B,
603 (__v8si)__C);
612 // Ops __A and __B are swapped.
613 return (__m256i)__builtin_elementwise_fshr((__v8su)__B, (__v8su)__A,
614 (__v8su)__C);
604615}
605616
606static __inline__ __m256i __DEFAULT_FN_ATTRS256
617static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
607618_mm256_mask_shrdv_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
608619{
609620 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -611,7 +622,7 @@ _mm256_mask_shrdv_epi32(__m256i __A, __mmask8 __U, __m256i __B, __m256i __C)
611622 (__v8si)__A);
612623}
613624
614static __inline__ __m256i __DEFAULT_FN_ATTRS256
625static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
615626_mm256_maskz_shrdv_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
616627{
617628 return (__m256i)__builtin_ia32_selectd_256(__U,
......@@ -619,14 +630,15 @@ _mm256_maskz_shrdv_epi32(__mmask8 __U, __m256i __A, __m256i __B, __m256i __C)
619630 (__v8si)_mm256_setzero_si256());
620631}
621632
622static __inline__ __m128i __DEFAULT_FN_ATTRS128
633static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
623634_mm_shrdv_epi32(__m128i __A, __m128i __B, __m128i __C)
624635{
625 return (__m128i)__builtin_ia32_vpshrdvd128((__v4si)__A, (__v4si)__B,
626 (__v4si)__C);
636 // Ops __A and __B are swapped.
637 return (__m128i)__builtin_elementwise_fshr((__v4su)__B, (__v4su)__A,
638 (__v4su)__C);
627639}
628640
629static __inline__ __m128i __DEFAULT_FN_ATTRS128
641static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
630642_mm_mask_shrdv_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
631643{
632644 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -634,7 +646,7 @@ _mm_mask_shrdv_epi32(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
634646 (__v4si)__A);
635647}
636648
637static __inline__ __m128i __DEFAULT_FN_ATTRS128
649static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
638650_mm_maskz_shrdv_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
639651{
640652 return (__m128i)__builtin_ia32_selectd_128(__U,
......@@ -642,14 +654,15 @@ _mm_maskz_shrdv_epi32(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
642654 (__v4si)_mm_setzero_si128());
643655}
644656
645static __inline__ __m256i __DEFAULT_FN_ATTRS256
657static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
646658_mm256_shrdv_epi16(__m256i __A, __m256i __B, __m256i __C)
647659{
648 return (__m256i)__builtin_ia32_vpshrdvw256((__v16hi)__A, (__v16hi)__B,
649 (__v16hi)__C);
660 // Ops __A and __B are swapped.
661 return (__m256i)__builtin_elementwise_fshr((__v16hu)__B, (__v16hu)__A,
662 (__v16hu)__C);
650663}
651664
652static __inline__ __m256i __DEFAULT_FN_ATTRS256
665static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
653666_mm256_mask_shrdv_epi16(__m256i __A, __mmask16 __U, __m256i __B, __m256i __C)
654667{
655668 return (__m256i)__builtin_ia32_selectw_256(__U,
......@@ -657,7 +670,7 @@ _mm256_mask_shrdv_epi16(__m256i __A, __mmask16 __U, __m256i __B, __m256i __C)
657670 (__v16hi)__A);
658671}
659672
660static __inline__ __m256i __DEFAULT_FN_ATTRS256
673static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
661674_mm256_maskz_shrdv_epi16(__mmask16 __U, __m256i __A, __m256i __B, __m256i __C)
662675{
663676 return (__m256i)__builtin_ia32_selectw_256(__U,
......@@ -665,14 +678,15 @@ _mm256_maskz_shrdv_epi16(__mmask16 __U, __m256i __A, __m256i __B, __m256i __C)
665678 (__v16hi)_mm256_setzero_si256());
666679}
667680
668static __inline__ __m128i __DEFAULT_FN_ATTRS128
681static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
669682_mm_shrdv_epi16(__m128i __A, __m128i __B, __m128i __C)
670683{
671 return (__m128i)__builtin_ia32_vpshrdvw128((__v8hi)__A, (__v8hi)__B,
672 (__v8hi)__C);
684 // Ops __A and __B are swapped.
685 return (__m128i)__builtin_elementwise_fshr((__v8hu)__B, (__v8hu)__A,
686 (__v8hu)__C);
673687}
674688
675static __inline__ __m128i __DEFAULT_FN_ATTRS128
689static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
676690_mm_mask_shrdv_epi16(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
677691{
678692 return (__m128i)__builtin_ia32_selectw_128(__U,
......@@ -680,7 +694,7 @@ _mm_mask_shrdv_epi16(__m128i __A, __mmask8 __U, __m128i __B, __m128i __C)
680694 (__v8hi)__A);
681695}
682696
683static __inline__ __m128i __DEFAULT_FN_ATTRS128
697static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
684698_mm_maskz_shrdv_epi16(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
685699{
686700 return (__m128i)__builtin_ia32_selectw_128(__U,
......@@ -688,8 +702,9 @@ _mm_maskz_shrdv_epi16(__mmask8 __U, __m128i __A, __m128i __B, __m128i __C)
688702 (__v8hi)_mm_setzero_si128());
689703}
690704
691
692705#undef __DEFAULT_FN_ATTRS128
693706#undef __DEFAULT_FN_ATTRS256
707#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
708#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
694709
695710#endif
lib/include/avx512vlvnniintrin.h+21-18
......@@ -17,11 +17,11 @@
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS128 \
1919 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vl,avx512vnni,no-evex512"), \
20 __target__("avx512vl,avx512vnni"), \
2121 __min_vector_width__(128)))
2222#define __DEFAULT_FN_ATTRS256 \
2323 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vl,avx512vnni,no-evex512"), \
24 __target__("avx512vl,avx512vnni"), \
2525 __min_vector_width__(256)))
2626
2727/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
......@@ -41,8 +41,8 @@
4141/// ENDFOR
4242/// DST[MAX:256] := 0
4343/// \endcode
44#define _mm256_dpbusd_epi32(S, A, B) \
45 ((__m256i)__builtin_ia32_vpdpbusd256((__v8si)(S), (__v8si)(A), (__v8si)(B)))
44#define _mm256_dpbusd_epi32(S, A, B) \
45 ((__m256i)__builtin_ia32_vpdpbusd256((__v8si)(S), (__v32qu)(A), (__v32qi)(B)))
4646
4747/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
4848/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
......@@ -61,8 +61,9 @@
6161/// ENDFOR
6262/// DST[MAX:256] := 0
6363/// \endcode
64#define _mm256_dpbusds_epi32(S, A, B) \
65 ((__m256i)__builtin_ia32_vpdpbusds256((__v8si)(S), (__v8si)(A), (__v8si)(B)))
64#define _mm256_dpbusds_epi32(S, A, B) \
65 ((__m256i)__builtin_ia32_vpdpbusds256((__v8si)(S), (__v32qu)(A), \
66 (__v32qi)(B)))
6667
6768/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
6869/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
......@@ -79,8 +80,8 @@
7980/// ENDFOR
8081/// DST[MAX:256] := 0
8182/// \endcode
82#define _mm256_dpwssd_epi32(S, A, B) \
83 ((__m256i)__builtin_ia32_vpdpwssd256((__v8si)(S), (__v8si)(A), (__v8si)(B)))
83#define _mm256_dpwssd_epi32(S, A, B) \
84 ((__m256i)__builtin_ia32_vpdpwssd256((__v8si)(S), (__v16hi)(A), (__v16hi)(B)))
8485
8586/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
8687/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
......@@ -97,8 +98,9 @@
9798/// ENDFOR
9899/// DST[MAX:256] := 0
99100/// \endcode
100#define _mm256_dpwssds_epi32(S, A, B) \
101 ((__m256i)__builtin_ia32_vpdpwssds256((__v8si)(S), (__v8si)(A), (__v8si)(B)))
101#define _mm256_dpwssds_epi32(S, A, B) \
102 ((__m256i)__builtin_ia32_vpdpwssds256((__v8si)(S), (__v16hi)(A), \
103 (__v16hi)(B)))
102104
103105/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
104106/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
......@@ -117,8 +119,8 @@
117119/// ENDFOR
118120/// DST[MAX:128] := 0
119121/// \endcode
120#define _mm_dpbusd_epi32(S, A, B) \
121 ((__m128i)__builtin_ia32_vpdpbusd128((__v4si)(S), (__v4si)(A), (__v4si)(B)))
122#define _mm_dpbusd_epi32(S, A, B) \
123 ((__m128i)__builtin_ia32_vpdpbusd128((__v4si)(S), (__v16qu)(A), (__v16qi)(B)))
122124
123125/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
124126/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
......@@ -137,8 +139,9 @@
137139/// ENDFOR
138140/// DST[MAX:128] := 0
139141/// \endcode
140#define _mm_dpbusds_epi32(S, A, B) \
141 ((__m128i)__builtin_ia32_vpdpbusds128((__v4si)(S), (__v4si)(A), (__v4si)(B)))
142#define _mm_dpbusds_epi32(S, A, B) \
143 ((__m128i)__builtin_ia32_vpdpbusds128((__v4si)(S), (__v16qu)(A), \
144 (__v16qi)(B)))
142145
143146/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
144147/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
......@@ -155,8 +158,8 @@
155158/// ENDFOR
156159/// DST[MAX:128] := 0
157160/// \endcode
158#define _mm_dpwssd_epi32(S, A, B) \
159 ((__m128i)__builtin_ia32_vpdpwssd128((__v4si)(S), (__v4si)(A), (__v4si)(B)))
161#define _mm_dpwssd_epi32(S, A, B) \
162 ((__m128i)__builtin_ia32_vpdpwssd128((__v4si)(S), (__v8hi)(A), (__v8hi)(B)))
160163
161164/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
162165/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
......@@ -173,8 +176,8 @@
173176/// ENDFOR
174177/// DST[MAX:128] := 0
175178/// \endcode
176#define _mm_dpwssds_epi32(S, A, B) \
177 ((__m128i)__builtin_ia32_vpdpwssds128((__v4si)(S), (__v4si)(A), (__v4si)(B)))
179#define _mm_dpwssds_epi32(S, A, B) \
180 ((__m128i)__builtin_ia32_vpdpwssds128((__v4si)(S), (__v8hi)(A), (__v8hi)(B)))
178181
179182static __inline__ __m256i __DEFAULT_FN_ATTRS256
180183_mm256_mask_dpbusd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
lib/include/avx512vlvp2intersectintrin.h+2-2
......@@ -30,12 +30,12 @@
3030
3131#define __DEFAULT_FN_ATTRS128 \
3232 __attribute__((__always_inline__, __nodebug__, \
33 __target__("avx512vl,avx512vp2intersect,no-evex512"), \
33 __target__("avx512vl,avx512vp2intersect"), \
3434 __min_vector_width__(128)))
3535
3636#define __DEFAULT_FN_ATTRS256 \
3737 __attribute__((__always_inline__, __nodebug__, \
38 __target__("avx512vl,avx512vp2intersect,no-evex512"), \
38 __target__("avx512vl,avx512vp2intersect"), \
3939 __min_vector_width__(256)))
4040/// Store, in an even/odd pair of mask registers, the indicators of the
4141/// locations of value matches between dwords in operands __a and __b.
lib/include/avx512vnniintrin.h+10-10
......@@ -16,14 +16,14 @@
1616
1717/* Define the default attributes for the functions in this file. */
1818#define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vnni,evex512"), __min_vector_width__(512)))
19 __attribute__((__always_inline__, __nodebug__, __target__("avx512vnni"), \
20 __min_vector_width__(512)))
2121
2222static __inline__ __m512i __DEFAULT_FN_ATTRS
2323_mm512_dpbusd_epi32(__m512i __S, __m512i __A, __m512i __B)
2424{
25 return (__m512i)__builtin_ia32_vpdpbusd512((__v16si)__S, (__v16si)__A,
26 (__v16si)__B);
25 return (__m512i)__builtin_ia32_vpdpbusd512((__v16si)__S, (__v64qu)__A,
26 (__v64qi)__B);
2727}
2828
2929static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -45,8 +45,8 @@ _mm512_maskz_dpbusd_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
4545static __inline__ __m512i __DEFAULT_FN_ATTRS
4646_mm512_dpbusds_epi32(__m512i __S, __m512i __A, __m512i __B)
4747{
48 return (__m512i)__builtin_ia32_vpdpbusds512((__v16si)__S, (__v16si)__A,
49 (__v16si)__B);
48 return (__m512i)__builtin_ia32_vpdpbusds512((__v16si)__S, (__v64qu)__A,
49 (__v64qi)__B);
5050}
5151
5252static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -68,8 +68,8 @@ _mm512_maskz_dpbusds_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
6868static __inline__ __m512i __DEFAULT_FN_ATTRS
6969_mm512_dpwssd_epi32(__m512i __S, __m512i __A, __m512i __B)
7070{
71 return (__m512i)__builtin_ia32_vpdpwssd512((__v16si)__S, (__v16si)__A,
72 (__v16si)__B);
71 return (__m512i)__builtin_ia32_vpdpwssd512((__v16si)__S, (__v32hi)__A,
72 (__v32hi)__B);
7373}
7474
7575static __inline__ __m512i __DEFAULT_FN_ATTRS
......@@ -91,8 +91,8 @@ _mm512_maskz_dpwssd_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
9191static __inline__ __m512i __DEFAULT_FN_ATTRS
9292_mm512_dpwssds_epi32(__m512i __S, __m512i __A, __m512i __B)
9393{
94 return (__m512i)__builtin_ia32_vpdpwssds512((__v16si)__S, (__v16si)__A,
95 (__v16si)__B);
94 return (__m512i)__builtin_ia32_vpdpwssds512((__v16si)__S, (__v32hi)__A,
95 (__v32hi)__B);
9696}
9797
9898static __inline__ __m512i __DEFAULT_FN_ATTRS
lib/include/avx512vp2intersectintrin.h+1-2
......@@ -30,8 +30,7 @@
3030
3131#define __DEFAULT_FN_ATTRS \
3232 __attribute__((__always_inline__, __nodebug__, \
33 __target__("avx512vp2intersect,evex512"), \
34 __min_vector_width__(512)))
33 __target__("avx512vp2intersect"), __min_vector_width__(512)))
3534
3635/// Store, in an even/odd pair of mask registers, the indicators of the
3736/// locations of value matches between dwords in operands __a and __b.
lib/include/avx512vpopcntdqintrin.h+8-10
......@@ -16,19 +16,18 @@
1616#define __AVX512VPOPCNTDQINTRIN_H
1717
1818/* Define the default attributes for the functions in this file. */
19#if defined(__cplusplus) && (__cplusplus >= 201103L)
1920#define __DEFAULT_FN_ATTRS \
2021 __attribute__((__always_inline__, __nodebug__, \
21 __target__("avx512vpopcntdq,evex512"), \
22 __min_vector_width__(512)))
23
24#if defined(__cplusplus) && (__cplusplus >= 201103L)
25#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
22 __target__("avx512vpopcntdq"), \
23 __min_vector_width__(512))) constexpr
2624#else
27#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
25#define __DEFAULT_FN_ATTRS \
26 __attribute__((__always_inline__, __nodebug__, \
27 __target__("avx512vpopcntdq"), __min_vector_width__(512)))
2828#endif
2929
30static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
31_mm512_popcnt_epi64(__m512i __A) {
30static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi64(__m512i __A) {
3231 return (__m512i)__builtin_elementwise_popcount((__v8du)__A);
3332}
3433
......@@ -43,8 +42,7 @@ _mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
4342 return _mm512_mask_popcnt_epi64((__m512i)_mm512_setzero_si512(), __U, __A);
4443}
4544
46static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
47_mm512_popcnt_epi32(__m512i __A) {
45static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi32(__m512i __A) {
4846 return (__m512i)__builtin_elementwise_popcount((__v16su)__A);
4947}
5048
lib/include/avx512vpopcntdqvlintrin.h+17-15
......@@ -16,25 +16,28 @@
1616#define __AVX512VPOPCNTDQVLINTRIN_H
1717
1818/* Define the default attributes for the functions in this file. */
19
20#if defined(__cplusplus) && (__cplusplus >= 201103L)
21#define __DEFAULT_FN_ATTRS128 \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("avx512vpopcntdq,avx512vl"), \
24 __min_vector_width__(128))) constexpr
25#define __DEFAULT_FN_ATTRS256 \
26 __attribute__((__always_inline__, __nodebug__, \
27 __target__("avx512vpopcntdq,avx512vl"), \
28 __min_vector_width__(256))) constexpr
29#else
1930#define __DEFAULT_FN_ATTRS128 \
2031 __attribute__((__always_inline__, __nodebug__, \
21 __target__("avx512vpopcntdq,avx512vl,no-evex512"), \
32 __target__("avx512vpopcntdq,avx512vl"), \
2233 __min_vector_width__(128)))
2334#define __DEFAULT_FN_ATTRS256 \
2435 __attribute__((__always_inline__, __nodebug__, \
25 __target__("avx512vpopcntdq,avx512vl,no-evex512"), \
36 __target__("avx512vpopcntdq,avx512vl"), \
2637 __min_vector_width__(256)))
27
28#if defined(__cplusplus) && (__cplusplus >= 201103L)
29#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
30#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
31#else
32#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
33#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
3438#endif
3539
36static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
37_mm_popcnt_epi64(__m128i __A) {
40static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_popcnt_epi64(__m128i __A) {
3841 return (__m128i)__builtin_elementwise_popcount((__v2du)__A);
3942}
4043
......@@ -49,8 +52,7 @@ _mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) {
4952 return _mm_mask_popcnt_epi64((__m128i)_mm_setzero_si128(), __U, __A);
5053}
5154
52static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
53_mm_popcnt_epi32(__m128i __A) {
55static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_popcnt_epi32(__m128i __A) {
5456 return (__m128i)__builtin_elementwise_popcount((__v4su)__A);
5557}
5658
......@@ -65,7 +67,7 @@ _mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) {
6567 return _mm_mask_popcnt_epi32((__m128i)_mm_setzero_si128(), __U, __A);
6668}
6769
68static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
70static __inline__ __m256i __DEFAULT_FN_ATTRS256
6971_mm256_popcnt_epi64(__m256i __A) {
7072 return (__m256i)__builtin_elementwise_popcount((__v4du)__A);
7173}
......@@ -81,7 +83,7 @@ _mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) {
8183 return _mm256_mask_popcnt_epi64((__m256i)_mm256_setzero_si256(), __U, __A);
8284}
8385
84static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
86static __inline__ __m256i __DEFAULT_FN_ATTRS256
8587_mm256_popcnt_epi32(__m256i __A) {
8688 return (__m256i)__builtin_elementwise_popcount((__v8su)__A);
8789}
lib/include/avxifmaintrin.h+16
......@@ -15,12 +15,28 @@
1515#define __AVXIFMAINTRIN_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__, __target__("avxifma"), \
21 __min_vector_width__(128))) constexpr
22#define __DEFAULT_FN_ATTRS256 \
23 __attribute__((__always_inline__, __nodebug__, __target__("avxifma"), \
24 __min_vector_width__(256))) constexpr
25#else
1826#define __DEFAULT_FN_ATTRS128 \
1927 __attribute__((__always_inline__, __nodebug__, __target__("avxifma"), \
2028 __min_vector_width__(128)))
2129#define __DEFAULT_FN_ATTRS256 \
2230 __attribute__((__always_inline__, __nodebug__, __target__("avxifma"), \
2331 __min_vector_width__(256)))
32#endif
33
34#if !defined(__AVX512IFMA__) && defined(__AVXIFMA__)
35#define _mm_madd52hi_epu64(X, Y, Z) _mm_madd52hi_avx_epu64(X, Y, Z)
36#define _mm_madd52lo_epu64(X, Y, Z) _mm_madd52lo_avx_epu64(X, Y, Z)
37#define _mm256_madd52hi_epu64(X, Y, Z) _mm256_madd52hi_avx_epu64(X, Y, Z)
38#define _mm256_madd52lo_epu64(X, Y, Z) _mm256_madd52lo_avx_epu64(X, Y, Z)
39#endif
2440
2541// must vex-encoding
2642
lib/include/avxintrin.h+165-241
......@@ -50,28 +50,19 @@ typedef __bf16 __m256bh __attribute__((__vector_size__(32), __aligned__(32)));
5050#endif
5151
5252/* Define the default attributes for the functions in this file. */
53#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
54#define __DEFAULT_FN_ATTRS \
55 __attribute__((__always_inline__, __nodebug__, __target__("avx,no-evex512"), \
56 __min_vector_width__(256)))
57#define __DEFAULT_FN_ATTRS128 \
58 __attribute__((__always_inline__, __nodebug__, __target__("avx,no-evex512"), \
59 __min_vector_width__(128)))
60#else
6153#define __DEFAULT_FN_ATTRS \
6254 __attribute__((__always_inline__, __nodebug__, __target__("avx"), \
6355 __min_vector_width__(256)))
6456#define __DEFAULT_FN_ATTRS128 \
6557 __attribute__((__always_inline__, __nodebug__, __target__("avx"), \
6658 __min_vector_width__(128)))
67#endif
6859
6960#if defined(__cplusplus) && (__cplusplus >= 201103L)
7061#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
7162#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
7263#else
73#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS128
74#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS
64#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
65#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
7566#endif
7667
7768/* Arithmetic */
......@@ -87,9 +78,8 @@ typedef __bf16 __m256bh __attribute__((__vector_size__(32), __aligned__(32)));
8778/// A 256-bit vector of [4 x double] containing one of the source operands.
8879/// \returns A 256-bit vector of [4 x double] containing the sums of both
8980/// operands.
90static __inline __m256d __DEFAULT_FN_ATTRS
91_mm256_add_pd(__m256d __a, __m256d __b)
92{
81static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
82_mm256_add_pd(__m256d __a, __m256d __b) {
9383 return (__m256d)((__v4df)__a+(__v4df)__b);
9484}
9585
......@@ -105,9 +95,8 @@ _mm256_add_pd(__m256d __a, __m256d __b)
10595/// A 256-bit vector of [8 x float] containing one of the source operands.
10696/// \returns A 256-bit vector of [8 x float] containing the sums of both
10797/// operands.
108static __inline __m256 __DEFAULT_FN_ATTRS
109_mm256_add_ps(__m256 __a, __m256 __b)
110{
98static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_add_ps(__m256 __a,
99 __m256 __b) {
111100 return (__m256)((__v8sf)__a+(__v8sf)__b);
112101}
113102
......@@ -123,9 +112,8 @@ _mm256_add_ps(__m256 __a, __m256 __b)
123112/// A 256-bit vector of [4 x double] containing the subtrahend.
124113/// \returns A 256-bit vector of [4 x double] containing the differences between
125114/// both operands.
126static __inline __m256d __DEFAULT_FN_ATTRS
127_mm256_sub_pd(__m256d __a, __m256d __b)
128{
115static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
116_mm256_sub_pd(__m256d __a, __m256d __b) {
129117 return (__m256d)((__v4df)__a-(__v4df)__b);
130118}
131119
......@@ -141,9 +129,8 @@ _mm256_sub_pd(__m256d __a, __m256d __b)
141129/// A 256-bit vector of [8 x float] containing the subtrahend.
142130/// \returns A 256-bit vector of [8 x float] containing the differences between
143131/// both operands.
144static __inline __m256 __DEFAULT_FN_ATTRS
145_mm256_sub_ps(__m256 __a, __m256 __b)
146{
132static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_sub_ps(__m256 __a,
133 __m256 __b) {
147134 return (__m256)((__v8sf)__a-(__v8sf)__b);
148135}
149136
......@@ -160,9 +147,8 @@ _mm256_sub_ps(__m256 __a, __m256 __b)
160147/// A 256-bit vector of [4 x double] containing the right source operand.
161148/// \returns A 256-bit vector of [4 x double] containing the alternating sums
162149/// and differences between both operands.
163static __inline __m256d __DEFAULT_FN_ATTRS
164_mm256_addsub_pd(__m256d __a, __m256d __b)
165{
150static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
151_mm256_addsub_pd(__m256d __a, __m256d __b) {
166152 return (__m256d)__builtin_ia32_addsubpd256((__v4df)__a, (__v4df)__b);
167153}
168154
......@@ -179,9 +165,8 @@ _mm256_addsub_pd(__m256d __a, __m256d __b)
179165/// A 256-bit vector of [8 x float] containing the right source operand.
180166/// \returns A 256-bit vector of [8 x float] containing the alternating sums and
181167/// differences between both operands.
182static __inline __m256 __DEFAULT_FN_ATTRS
183_mm256_addsub_ps(__m256 __a, __m256 __b)
184{
168static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
169_mm256_addsub_ps(__m256 __a, __m256 __b) {
185170 return (__m256)__builtin_ia32_addsubps256((__v8sf)__a, (__v8sf)__b);
186171}
187172
......@@ -197,9 +182,8 @@ _mm256_addsub_ps(__m256 __a, __m256 __b)
197182/// A 256-bit vector of [4 x double] containing the divisor.
198183/// \returns A 256-bit vector of [4 x double] containing the quotients of both
199184/// operands.
200static __inline __m256d __DEFAULT_FN_ATTRS
201_mm256_div_pd(__m256d __a, __m256d __b)
202{
185static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
186_mm256_div_pd(__m256d __a, __m256d __b) {
203187 return (__m256d)((__v4df)__a/(__v4df)__b);
204188}
205189
......@@ -215,9 +199,8 @@ _mm256_div_pd(__m256d __a, __m256d __b)
215199/// A 256-bit vector of [8 x float] containing the divisor.
216200/// \returns A 256-bit vector of [8 x float] containing the quotients of both
217201/// operands.
218static __inline __m256 __DEFAULT_FN_ATTRS
219_mm256_div_ps(__m256 __a, __m256 __b)
220{
202static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_div_ps(__m256 __a,
203 __m256 __b) {
221204 return (__m256)((__v8sf)__a/(__v8sf)__b);
222205}
223206
......@@ -236,9 +219,8 @@ _mm256_div_ps(__m256 __a, __m256 __b)
236219/// A 256-bit vector of [4 x double] containing one of the operands.
237220/// \returns A 256-bit vector of [4 x double] containing the maximum values
238221/// between both operands.
239static __inline __m256d __DEFAULT_FN_ATTRS
240_mm256_max_pd(__m256d __a, __m256d __b)
241{
222static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
223_mm256_max_pd(__m256d __a, __m256d __b) {
242224 return (__m256d)__builtin_ia32_maxpd256((__v4df)__a, (__v4df)__b);
243225}
244226
......@@ -257,9 +239,8 @@ _mm256_max_pd(__m256d __a, __m256d __b)
257239/// A 256-bit vector of [8 x float] containing one of the operands.
258240/// \returns A 256-bit vector of [8 x float] containing the maximum values
259241/// between both operands.
260static __inline __m256 __DEFAULT_FN_ATTRS
261_mm256_max_ps(__m256 __a, __m256 __b)
262{
242static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_max_ps(__m256 __a,
243 __m256 __b) {
263244 return (__m256)__builtin_ia32_maxps256((__v8sf)__a, (__v8sf)__b);
264245}
265246
......@@ -278,9 +259,8 @@ _mm256_max_ps(__m256 __a, __m256 __b)
278259/// A 256-bit vector of [4 x double] containing one of the operands.
279260/// \returns A 256-bit vector of [4 x double] containing the minimum values
280261/// between both operands.
281static __inline __m256d __DEFAULT_FN_ATTRS
282_mm256_min_pd(__m256d __a, __m256d __b)
283{
262static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
263_mm256_min_pd(__m256d __a, __m256d __b) {
284264 return (__m256d)__builtin_ia32_minpd256((__v4df)__a, (__v4df)__b);
285265}
286266
......@@ -299,9 +279,8 @@ _mm256_min_pd(__m256d __a, __m256d __b)
299279/// A 256-bit vector of [8 x float] containing one of the operands.
300280/// \returns A 256-bit vector of [8 x float] containing the minimum values
301281/// between both operands.
302static __inline __m256 __DEFAULT_FN_ATTRS
303_mm256_min_ps(__m256 __a, __m256 __b)
304{
282static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_min_ps(__m256 __a,
283 __m256 __b) {
305284 return (__m256)__builtin_ia32_minps256((__v8sf)__a, (__v8sf)__b);
306285}
307286
......@@ -317,9 +296,8 @@ _mm256_min_ps(__m256 __a, __m256 __b)
317296/// A 256-bit vector of [4 x double] containing one of the operands.
318297/// \returns A 256-bit vector of [4 x double] containing the products of both
319298/// operands.
320static __inline __m256d __DEFAULT_FN_ATTRS
321_mm256_mul_pd(__m256d __a, __m256d __b)
322{
299static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
300_mm256_mul_pd(__m256d __a, __m256d __b) {
323301 return (__m256d)((__v4df)__a * (__v4df)__b);
324302}
325303
......@@ -335,9 +313,8 @@ _mm256_mul_pd(__m256d __a, __m256d __b)
335313/// A 256-bit vector of [8 x float] containing one of the operands.
336314/// \returns A 256-bit vector of [8 x float] containing the products of both
337315/// operands.
338static __inline __m256 __DEFAULT_FN_ATTRS
339_mm256_mul_ps(__m256 __a, __m256 __b)
340{
316static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_mul_ps(__m256 __a,
317 __m256 __b) {
341318 return (__m256)((__v8sf)__a * (__v8sf)__b);
342319}
343320
......@@ -352,10 +329,8 @@ _mm256_mul_ps(__m256 __a, __m256 __b)
352329/// A 256-bit vector of [4 x double].
353330/// \returns A 256-bit vector of [4 x double] containing the square roots of the
354331/// values in the operand.
355static __inline __m256d __DEFAULT_FN_ATTRS
356_mm256_sqrt_pd(__m256d __a)
357{
358 return (__m256d)__builtin_ia32_sqrtpd256((__v4df)__a);
332static __inline __m256d __DEFAULT_FN_ATTRS _mm256_sqrt_pd(__m256d __a) {
333 return __builtin_elementwise_sqrt(__a);
359334}
360335
361336/// Calculates the square roots of the values in a 256-bit vector of
......@@ -369,10 +344,8 @@ _mm256_sqrt_pd(__m256d __a)
369344/// A 256-bit vector of [8 x float].
370345/// \returns A 256-bit vector of [8 x float] containing the square roots of the
371346/// values in the operand.
372static __inline __m256 __DEFAULT_FN_ATTRS
373_mm256_sqrt_ps(__m256 __a)
374{
375 return (__m256)__builtin_ia32_sqrtps256((__v8sf)__a);
347static __inline __m256 __DEFAULT_FN_ATTRS _mm256_sqrt_ps(__m256 __a) {
348 return __builtin_elementwise_sqrt(__a);
376349}
377350
378351/// Calculates the reciprocal square roots of the values in a 256-bit
......@@ -555,7 +528,7 @@ _mm256_rcp_ps(__m256 __a)
555528/// A 256-bit vector of [4 x double] containing one of the source operands.
556529/// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
557530/// values between both operands.
558static __inline __m256d __DEFAULT_FN_ATTRS
531static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
559532_mm256_and_pd(__m256d __a, __m256d __b)
560533{
561534 return (__m256d)((__v4du)__a & (__v4du)__b);
......@@ -573,7 +546,7 @@ _mm256_and_pd(__m256d __a, __m256d __b)
573546/// A 256-bit vector of [8 x float] containing one of the source operands.
574547/// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
575548/// values between both operands.
576static __inline __m256 __DEFAULT_FN_ATTRS
549static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
577550_mm256_and_ps(__m256 __a, __m256 __b)
578551{
579552 return (__m256)((__v8su)__a & (__v8su)__b);
......@@ -594,7 +567,7 @@ _mm256_and_ps(__m256 __a, __m256 __b)
594567/// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
595568/// values of the second operand and the one's complement of the first
596569/// operand.
597static __inline __m256d __DEFAULT_FN_ATTRS
570static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
598571_mm256_andnot_pd(__m256d __a, __m256d __b)
599572{
600573 return (__m256d)(~(__v4du)__a & (__v4du)__b);
......@@ -615,7 +588,7 @@ _mm256_andnot_pd(__m256d __a, __m256d __b)
615588/// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
616589/// values of the second operand and the one's complement of the first
617590/// operand.
618static __inline __m256 __DEFAULT_FN_ATTRS
591static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
619592_mm256_andnot_ps(__m256 __a, __m256 __b)
620593{
621594 return (__m256)(~(__v8su)__a & (__v8su)__b);
......@@ -633,7 +606,7 @@ _mm256_andnot_ps(__m256 __a, __m256 __b)
633606/// A 256-bit vector of [4 x double] containing one of the source operands.
634607/// \returns A 256-bit vector of [4 x double] containing the bitwise OR of the
635608/// values between both operands.
636static __inline __m256d __DEFAULT_FN_ATTRS
609static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
637610_mm256_or_pd(__m256d __a, __m256d __b)
638611{
639612 return (__m256d)((__v4du)__a | (__v4du)__b);
......@@ -651,7 +624,7 @@ _mm256_or_pd(__m256d __a, __m256d __b)
651624/// A 256-bit vector of [8 x float] containing one of the source operands.
652625/// \returns A 256-bit vector of [8 x float] containing the bitwise OR of the
653626/// values between both operands.
654static __inline __m256 __DEFAULT_FN_ATTRS
627static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
655628_mm256_or_ps(__m256 __a, __m256 __b)
656629{
657630 return (__m256)((__v8su)__a | (__v8su)__b);
......@@ -669,7 +642,7 @@ _mm256_or_ps(__m256 __a, __m256 __b)
669642/// A 256-bit vector of [4 x double] containing one of the source operands.
670643/// \returns A 256-bit vector of [4 x double] containing the bitwise XOR of the
671644/// values between both operands.
672static __inline __m256d __DEFAULT_FN_ATTRS
645static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
673646_mm256_xor_pd(__m256d __a, __m256d __b)
674647{
675648 return (__m256d)((__v4du)__a ^ (__v4du)__b);
......@@ -687,7 +660,7 @@ _mm256_xor_pd(__m256d __a, __m256d __b)
687660/// A 256-bit vector of [8 x float] containing one of the source operands.
688661/// \returns A 256-bit vector of [8 x float] containing the bitwise XOR of the
689662/// values between both operands.
690static __inline __m256 __DEFAULT_FN_ATTRS
663static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
691664_mm256_xor_ps(__m256 __a, __m256 __b)
692665{
693666 return (__m256)((__v8su)__a ^ (__v8su)__b);
......@@ -711,9 +684,8 @@ _mm256_xor_ps(__m256 __a, __m256 __b)
711684/// elements of a vector of [4 x double].
712685/// \returns A 256-bit vector of [4 x double] containing the horizontal sums of
713686/// both operands.
714static __inline __m256d __DEFAULT_FN_ATTRS
715_mm256_hadd_pd(__m256d __a, __m256d __b)
716{
687static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
688_mm256_hadd_pd(__m256d __a, __m256d __b) {
717689 return (__m256d)__builtin_ia32_haddpd256((__v4df)__a, (__v4df)__b);
718690}
719691
......@@ -734,9 +706,8 @@ _mm256_hadd_pd(__m256d __a, __m256d __b)
734706/// index 2, 3, 6, 7 of a vector of [8 x float].
735707/// \returns A 256-bit vector of [8 x float] containing the horizontal sums of
736708/// both operands.
737static __inline __m256 __DEFAULT_FN_ATTRS
738_mm256_hadd_ps(__m256 __a, __m256 __b)
739{
709static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hadd_ps(__m256 __a,
710 __m256 __b) {
740711 return (__m256)__builtin_ia32_haddps256((__v8sf)__a, (__v8sf)__b);
741712}
742713
......@@ -757,9 +728,8 @@ _mm256_hadd_ps(__m256 __a, __m256 __b)
757728/// odd-indexed elements of a vector of [4 x double].
758729/// \returns A 256-bit vector of [4 x double] containing the horizontal
759730/// differences of both operands.
760static __inline __m256d __DEFAULT_FN_ATTRS
761_mm256_hsub_pd(__m256d __a, __m256d __b)
762{
731static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
732_mm256_hsub_pd(__m256d __a, __m256d __b) {
763733 return (__m256d)__builtin_ia32_hsubpd256((__v4df)__a, (__v4df)__b);
764734}
765735
......@@ -780,9 +750,8 @@ _mm256_hsub_pd(__m256d __a, __m256d __b)
780750/// elements with index 2, 3, 6, 7 of a vector of [8 x float].
781751/// \returns A 256-bit vector of [8 x float] containing the horizontal
782752/// differences of both operands.
783static __inline __m256 __DEFAULT_FN_ATTRS
784_mm256_hsub_ps(__m256 __a, __m256 __b)
785{
753static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hsub_ps(__m256 __a,
754 __m256 __b) {
786755 return (__m256)__builtin_ia32_hsubps256((__v8sf)__a, (__v8sf)__b);
787756}
788757
......@@ -810,9 +779,8 @@ _mm256_hsub_ps(__m256 __a, __m256 __b)
810779/// 1: Bits [127:64] of the source are copied to bits [127:64] of the
811780/// returned vector.
812781/// \returns A 128-bit vector of [2 x double] containing the copied values.
813static __inline __m128d __DEFAULT_FN_ATTRS128
814_mm_permutevar_pd(__m128d __a, __m128i __c)
815{
782static __inline __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
783_mm_permutevar_pd(__m128d __a, __m128i __c) {
816784 return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)__a, (__v2di)__c);
817785}
818786
......@@ -849,9 +817,8 @@ _mm_permutevar_pd(__m128d __a, __m128i __c)
849817/// 1: Bits [255:192] of the source are copied to bits [255:192] of the
850818/// returned vector.
851819/// \returns A 256-bit vector of [4 x double] containing the copied values.
852static __inline __m256d __DEFAULT_FN_ATTRS
853_mm256_permutevar_pd(__m256d __a, __m256i __c)
854{
820static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
821_mm256_permutevar_pd(__m256d __a, __m256i __c) {
855822 return (__m256d)__builtin_ia32_vpermilvarpd256((__v4df)__a, (__v4di)__c);
856823}
857824
......@@ -904,9 +871,8 @@ _mm256_permutevar_pd(__m256d __a, __m256i __c)
904871/// 11: Bits [127:96] of the source are copied to bits [127:96] of the
905872/// returned vector.
906873/// \returns A 128-bit vector of [4 x float] containing the copied values.
907static __inline __m128 __DEFAULT_FN_ATTRS128
908_mm_permutevar_ps(__m128 __a, __m128i __c)
909{
874static __inline __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
875_mm_permutevar_ps(__m128 __a, __m128i __c) {
910876 return (__m128)__builtin_ia32_vpermilvarps((__v4sf)__a, (__v4si)__c);
911877}
912878
......@@ -995,9 +961,8 @@ _mm_permutevar_ps(__m128 __a, __m128i __c)
995961/// 11: Bits [255:224] of the source are copied to bits [255:224] of the
996962/// returned vector.
997963/// \returns A 256-bit vector of [8 x float] containing the copied values.
998static __inline __m256 __DEFAULT_FN_ATTRS
999_mm256_permutevar_ps(__m256 __a, __m256i __c)
1000{
964static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
965_mm256_permutevar_ps(__m256 __a, __m256i __c) {
1001966 return (__m256)__builtin_ia32_vpermilvarps256((__v8sf)__a, (__v8si)__c);
1002967}
1003968
......@@ -1419,9 +1384,8 @@ _mm256_permutevar_ps(__m256 __a, __m256i __c)
14191384/// 64-bit element in operand \a __b is copied to the same position in the
14201385/// destination.
14211386/// \returns A 256-bit vector of [4 x double] containing the copied values.
1422static __inline __m256d __DEFAULT_FN_ATTRS
1423_mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c)
1424{
1387static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
1388_mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c) {
14251389 return (__m256d)__builtin_ia32_blendvpd256(
14261390 (__v4df)__a, (__v4df)__b, (__v4df)__c);
14271391}
......@@ -1447,9 +1411,8 @@ _mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c)
14471411/// corresponding 32-bit element in operand \a __b is copied to the same
14481412/// position in the destination.
14491413/// \returns A 256-bit vector of [8 x float] containing the copied values.
1450static __inline __m256 __DEFAULT_FN_ATTRS
1451_mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
1452{
1414static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
1415_mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c) {
14531416 return (__m256)__builtin_ia32_blendvps256(
14541417 (__v8sf)__a, (__v8sf)__b, (__v8sf)__c);
14551418}
......@@ -2190,9 +2153,8 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
21902153/// \param __a
21912154/// A 128-bit integer vector of [4 x i32].
21922155/// \returns A 256-bit vector of [4 x double] containing the converted values.
2193static __inline __m256d __DEFAULT_FN_ATTRS
2194_mm256_cvtepi32_pd(__m128i __a)
2195{
2156static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2157_mm256_cvtepi32_pd(__m128i __a) {
21962158 return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
21972159}
21982160
......@@ -2205,9 +2167,8 @@ _mm256_cvtepi32_pd(__m128i __a)
22052167/// \param __a
22062168/// A 256-bit integer vector.
22072169/// \returns A 256-bit vector of [8 x float] containing the converted values.
2208static __inline __m256 __DEFAULT_FN_ATTRS
2209_mm256_cvtepi32_ps(__m256i __a)
2210{
2170static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2171_mm256_cvtepi32_ps(__m256i __a) {
22112172 return (__m256)__builtin_convertvector((__v8si)__a, __v8sf);
22122173}
22132174
......@@ -2221,9 +2182,8 @@ _mm256_cvtepi32_ps(__m256i __a)
22212182/// \param __a
22222183/// A 256-bit vector of [4 x double].
22232184/// \returns A 128-bit vector of [4 x float] containing the converted values.
2224static __inline __m128 __DEFAULT_FN_ATTRS
2225_mm256_cvtpd_ps(__m256d __a)
2226{
2185static __inline __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2186_mm256_cvtpd_ps(__m256d __a) {
22272187 return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
22282188}
22292189
......@@ -2256,9 +2216,8 @@ _mm256_cvtps_epi32(__m256 __a)
22562216/// \param __a
22572217/// A 128-bit vector of [4 x float].
22582218/// \returns A 256-bit vector of [4 x double] containing the converted values.
2259static __inline __m256d __DEFAULT_FN_ATTRS
2260_mm256_cvtps_pd(__m128 __a)
2261{
2219static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2220_mm256_cvtps_pd(__m128 __a) {
22622221 return (__m256d)__builtin_convertvector((__v4sf)__a, __v4df);
22632222}
22642223
......@@ -2333,10 +2292,9 @@ _mm256_cvttps_epi32(__m256 __a)
23332292/// \param __a
23342293/// A 256-bit vector of [4 x double].
23352294/// \returns A 64 bit double containing the first element of the input vector.
2336static __inline double __DEFAULT_FN_ATTRS
2337_mm256_cvtsd_f64(__m256d __a)
2338{
2339 return __a[0];
2295static __inline double __DEFAULT_FN_ATTRS_CONSTEXPR
2296_mm256_cvtsd_f64(__m256d __a) {
2297 return __a[0];
23402298}
23412299
23422300/// Returns the first element of the input vector of [8 x i32].
......@@ -2349,11 +2307,10 @@ _mm256_cvtsd_f64(__m256d __a)
23492307/// \param __a
23502308/// A 256-bit vector of [8 x i32].
23512309/// \returns A 32 bit integer containing the first element of the input vector.
2352static __inline int __DEFAULT_FN_ATTRS
2353_mm256_cvtsi256_si32(__m256i __a)
2354{
2355 __v8si __b = (__v8si)__a;
2356 return __b[0];
2310static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2311_mm256_cvtsi256_si32(__m256i __a) {
2312 __v8si __b = (__v8si)__a;
2313 return __b[0];
23572314}
23582315
23592316/// Returns the first element of the input vector of [8 x float].
......@@ -2366,10 +2323,9 @@ _mm256_cvtsi256_si32(__m256i __a)
23662323/// \param __a
23672324/// A 256-bit vector of [8 x float].
23682325/// \returns A 32 bit float containing the first element of the input vector.
2369static __inline float __DEFAULT_FN_ATTRS
2370_mm256_cvtss_f32(__m256 __a)
2371{
2372 return __a[0];
2326static __inline float __DEFAULT_FN_ATTRS_CONSTEXPR
2327_mm256_cvtss_f32(__m256 __a) {
2328 return __a[0];
23732329}
23742330
23752331/* Vector replicate */
......@@ -2392,7 +2348,7 @@ _mm256_cvtss_f32(__m256 __a)
23922348/// return value.
23932349/// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
23942350/// values.
2395static __inline __m256 __DEFAULT_FN_ATTRS
2351static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
23962352_mm256_movehdup_ps(__m256 __a)
23972353{
23982354 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 1, 1, 3, 3, 5, 5, 7, 7);
......@@ -2417,7 +2373,7 @@ _mm256_movehdup_ps(__m256 __a)
24172373/// return value.
24182374/// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
24192375/// values.
2420static __inline __m256 __DEFAULT_FN_ATTRS
2376static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
24212377_mm256_moveldup_ps(__m256 __a)
24222378{
24232379 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 0, 0, 2, 2, 4, 4, 6, 6);
......@@ -2439,7 +2395,7 @@ _mm256_moveldup_ps(__m256 __a)
24392395/// the return value.
24402396/// \returns A 256-bit vector of [4 x double] containing the moved and
24412397/// duplicated values.
2442static __inline __m256d __DEFAULT_FN_ATTRS
2398static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
24432399_mm256_movedup_pd(__m256d __a)
24442400{
24452401 return __builtin_shufflevector((__v4df)__a, (__v4df)__a, 0, 0, 2, 2);
......@@ -2462,9 +2418,8 @@ _mm256_movedup_pd(__m256d __a)
24622418/// Bits [127:64] are written to bits [127:64] of the return value. \n
24632419/// Bits [255:192] are written to bits [255:192] of the return value. \n
24642420/// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2465static __inline __m256d __DEFAULT_FN_ATTRS
2466_mm256_unpackhi_pd(__m256d __a, __m256d __b)
2467{
2421static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2422_mm256_unpackhi_pd(__m256d __a, __m256d __b) {
24682423 return __builtin_shufflevector((__v4df)__a, (__v4df)__b, 1, 5, 1+2, 5+2);
24692424}
24702425
......@@ -2484,9 +2439,8 @@ _mm256_unpackhi_pd(__m256d __a, __m256d __b)
24842439/// Bits [63:0] are written to bits [127:64] of the return value. \n
24852440/// Bits [191:128] are written to bits [255:192] of the return value. \n
24862441/// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2487static __inline __m256d __DEFAULT_FN_ATTRS
2488_mm256_unpacklo_pd(__m256d __a, __m256d __b)
2489{
2442static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2443_mm256_unpacklo_pd(__m256d __a, __m256d __b) {
24902444 return __builtin_shufflevector((__v4df)__a, (__v4df)__b, 0, 4, 0+2, 4+2);
24912445}
24922446
......@@ -2511,9 +2465,8 @@ _mm256_unpacklo_pd(__m256d __a, __m256d __b)
25112465/// Bits [223:192] are written to bits [191:160] of the return value. \n
25122466/// Bits [255:224] are written to bits [255:224] of the return value.
25132467/// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2514static __inline __m256 __DEFAULT_FN_ATTRS
2515_mm256_unpackhi_ps(__m256 __a, __m256 __b)
2516{
2468static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2469_mm256_unpackhi_ps(__m256 __a, __m256 __b) {
25172470 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__b, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);
25182471}
25192472
......@@ -2538,9 +2491,8 @@ _mm256_unpackhi_ps(__m256 __a, __m256 __b)
25382491/// Bits [159:128] are written to bits [191:160] of the return value. \n
25392492/// Bits [191:160] are written to bits [255:224] of the return value.
25402493/// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2541static __inline __m256 __DEFAULT_FN_ATTRS
2542_mm256_unpacklo_ps(__m256 __a, __m256 __b)
2543{
2494static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2495_mm256_unpacklo_ps(__m256 __a, __m256 __b) {
25442496 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__b, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);
25452497}
25462498
......@@ -2568,9 +2520,8 @@ _mm256_unpacklo_ps(__m256 __a, __m256 __b)
25682520/// \param __b
25692521/// A 128-bit vector of [2 x double].
25702522/// \returns the ZF flag in the EFLAGS register.
2571static __inline int __DEFAULT_FN_ATTRS128
2572_mm_testz_pd(__m128d __a, __m128d __b)
2573{
2523static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testz_pd(__m128d __a,
2524 __m128d __b) {
25742525 return __builtin_ia32_vtestzpd((__v2df)__a, (__v2df)__b);
25752526}
25762527
......@@ -2597,9 +2548,8 @@ _mm_testz_pd(__m128d __a, __m128d __b)
25972548/// \param __b
25982549/// A 128-bit vector of [2 x double].
25992550/// \returns the CF flag in the EFLAGS register.
2600static __inline int __DEFAULT_FN_ATTRS128
2601_mm_testc_pd(__m128d __a, __m128d __b)
2602{
2551static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testc_pd(__m128d __a,
2552 __m128d __b) {
26032553 return __builtin_ia32_vtestcpd((__v2df)__a, (__v2df)__b);
26042554}
26052555
......@@ -2627,9 +2577,8 @@ _mm_testc_pd(__m128d __a, __m128d __b)
26272577/// \param __b
26282578/// A 128-bit vector of [2 x double].
26292579/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2630static __inline int __DEFAULT_FN_ATTRS128
2631_mm_testnzc_pd(__m128d __a, __m128d __b)
2632{
2580static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR
2581_mm_testnzc_pd(__m128d __a, __m128d __b) {
26332582 return __builtin_ia32_vtestnzcpd((__v2df)__a, (__v2df)__b);
26342583}
26352584
......@@ -2656,9 +2605,8 @@ _mm_testnzc_pd(__m128d __a, __m128d __b)
26562605/// \param __b
26572606/// A 128-bit vector of [4 x float].
26582607/// \returns the ZF flag.
2659static __inline int __DEFAULT_FN_ATTRS128
2660_mm_testz_ps(__m128 __a, __m128 __b)
2661{
2608static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testz_ps(__m128 __a,
2609 __m128 __b) {
26622610 return __builtin_ia32_vtestzps((__v4sf)__a, (__v4sf)__b);
26632611}
26642612
......@@ -2685,9 +2633,8 @@ _mm_testz_ps(__m128 __a, __m128 __b)
26852633/// \param __b
26862634/// A 128-bit vector of [4 x float].
26872635/// \returns the CF flag.
2688static __inline int __DEFAULT_FN_ATTRS128
2689_mm_testc_ps(__m128 __a, __m128 __b)
2690{
2636static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testc_ps(__m128 __a,
2637 __m128 __b) {
26912638 return __builtin_ia32_vtestcps((__v4sf)__a, (__v4sf)__b);
26922639}
26932640
......@@ -2715,9 +2662,8 @@ _mm_testc_ps(__m128 __a, __m128 __b)
27152662/// \param __b
27162663/// A 128-bit vector of [4 x float].
27172664/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2718static __inline int __DEFAULT_FN_ATTRS128
2719_mm_testnzc_ps(__m128 __a, __m128 __b)
2720{
2665static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testnzc_ps(__m128 __a,
2666 __m128 __b) {
27212667 return __builtin_ia32_vtestnzcps((__v4sf)__a, (__v4sf)__b);
27222668}
27232669
......@@ -2744,9 +2690,8 @@ _mm_testnzc_ps(__m128 __a, __m128 __b)
27442690/// \param __b
27452691/// A 256-bit vector of [4 x double].
27462692/// \returns the ZF flag.
2747static __inline int __DEFAULT_FN_ATTRS
2748_mm256_testz_pd(__m256d __a, __m256d __b)
2749{
2693static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testz_pd(__m256d __a,
2694 __m256d __b) {
27502695 return __builtin_ia32_vtestzpd256((__v4df)__a, (__v4df)__b);
27512696}
27522697
......@@ -2773,9 +2718,8 @@ _mm256_testz_pd(__m256d __a, __m256d __b)
27732718/// \param __b
27742719/// A 256-bit vector of [4 x double].
27752720/// \returns the CF flag.
2776static __inline int __DEFAULT_FN_ATTRS
2777_mm256_testc_pd(__m256d __a, __m256d __b)
2778{
2721static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testc_pd(__m256d __a,
2722 __m256d __b) {
27792723 return __builtin_ia32_vtestcpd256((__v4df)__a, (__v4df)__b);
27802724}
27812725
......@@ -2803,9 +2747,8 @@ _mm256_testc_pd(__m256d __a, __m256d __b)
28032747/// \param __b
28042748/// A 256-bit vector of [4 x double].
28052749/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2806static __inline int __DEFAULT_FN_ATTRS
2807_mm256_testnzc_pd(__m256d __a, __m256d __b)
2808{
2750static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2751_mm256_testnzc_pd(__m256d __a, __m256d __b) {
28092752 return __builtin_ia32_vtestnzcpd256((__v4df)__a, (__v4df)__b);
28102753}
28112754
......@@ -2832,9 +2775,8 @@ _mm256_testnzc_pd(__m256d __a, __m256d __b)
28322775/// \param __b
28332776/// A 256-bit vector of [8 x float].
28342777/// \returns the ZF flag.
2835static __inline int __DEFAULT_FN_ATTRS
2836_mm256_testz_ps(__m256 __a, __m256 __b)
2837{
2778static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testz_ps(__m256 __a,
2779 __m256 __b) {
28382780 return __builtin_ia32_vtestzps256((__v8sf)__a, (__v8sf)__b);
28392781}
28402782
......@@ -2861,9 +2803,8 @@ _mm256_testz_ps(__m256 __a, __m256 __b)
28612803/// \param __b
28622804/// A 256-bit vector of [8 x float].
28632805/// \returns the CF flag.
2864static __inline int __DEFAULT_FN_ATTRS
2865_mm256_testc_ps(__m256 __a, __m256 __b)
2866{
2806static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testc_ps(__m256 __a,
2807 __m256 __b) {
28672808 return __builtin_ia32_vtestcps256((__v8sf)__a, (__v8sf)__b);
28682809}
28692810
......@@ -2891,9 +2832,8 @@ _mm256_testc_ps(__m256 __a, __m256 __b)
28912832/// \param __b
28922833/// A 256-bit vector of [8 x float].
28932834/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2894static __inline int __DEFAULT_FN_ATTRS
2895_mm256_testnzc_ps(__m256 __a, __m256 __b)
2896{
2835static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testnzc_ps(__m256 __a,
2836 __m256 __b) {
28972837 return __builtin_ia32_vtestnzcps256((__v8sf)__a, (__v8sf)__b);
28982838}
28992839
......@@ -2917,9 +2857,8 @@ _mm256_testnzc_ps(__m256 __a, __m256 __b)
29172857/// \param __b
29182858/// A 256-bit integer vector.
29192859/// \returns the ZF flag.
2920static __inline int __DEFAULT_FN_ATTRS
2921_mm256_testz_si256(__m256i __a, __m256i __b)
2922{
2860static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2861_mm256_testz_si256(__m256i __a, __m256i __b) {
29232862 return __builtin_ia32_ptestz256((__v4di)__a, (__v4di)__b);
29242863}
29252864
......@@ -2943,9 +2882,8 @@ _mm256_testz_si256(__m256i __a, __m256i __b)
29432882/// \param __b
29442883/// A 256-bit integer vector.
29452884/// \returns the CF flag.
2946static __inline int __DEFAULT_FN_ATTRS
2947_mm256_testc_si256(__m256i __a, __m256i __b)
2948{
2885static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2886_mm256_testc_si256(__m256i __a, __m256i __b) {
29492887 return __builtin_ia32_ptestc256((__v4di)__a, (__v4di)__b);
29502888}
29512889
......@@ -2970,9 +2908,8 @@ _mm256_testc_si256(__m256i __a, __m256i __b)
29702908/// \param __b
29712909/// A 256-bit integer vector.
29722910/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2973static __inline int __DEFAULT_FN_ATTRS
2974_mm256_testnzc_si256(__m256i __a, __m256i __b)
2975{
2911static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2912_mm256_testnzc_si256(__m256i __a, __m256i __b) {
29762913 return __builtin_ia32_ptestnzc256((__v4di)__a, (__v4di)__b);
29772914}
29782915
......@@ -2989,9 +2926,8 @@ _mm256_testnzc_si256(__m256i __a, __m256i __b)
29892926/// A 256-bit vector of [4 x double] containing the double-precision
29902927/// floating point values with sign bits to be extracted.
29912928/// \returns The sign bits from the operand, written to bits [3:0].
2992static __inline int __DEFAULT_FN_ATTRS
2993_mm256_movemask_pd(__m256d __a)
2994{
2929static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2930_mm256_movemask_pd(__m256d __a) {
29952931 return __builtin_ia32_movmskpd256((__v4df)__a);
29962932}
29972933
......@@ -3007,9 +2943,8 @@ _mm256_movemask_pd(__m256d __a)
30072943/// A 256-bit vector of [8 x float] containing the single-precision floating
30082944/// point values with sign bits to be extracted.
30092945/// \returns The sign bits from the operand, written to bits [7:0].
3010static __inline int __DEFAULT_FN_ATTRS
3011_mm256_movemask_ps(__m256 __a)
3012{
2946static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2947_mm256_movemask_ps(__m256 __a) {
30132948 return __builtin_ia32_movmskps256((__v8sf)__a);
30142949}
30152950
......@@ -3666,9 +3601,7 @@ _mm256_undefined_pd(void)
36663601/// This intrinsic has no corresponding instruction.
36673602///
36683603/// \returns A 256-bit vector of [8 x float] containing undefined values.
3669static __inline__ __m256 __DEFAULT_FN_ATTRS
3670_mm256_undefined_ps(void)
3671{
3604static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_undefined_ps(void) {
36723605 return (__m256)__builtin_ia32_undef256();
36733606}
36743607
......@@ -3777,7 +3710,7 @@ _mm256_set_ps(float __a, float __b, float __c, float __d,
37773710/// \param __i7
37783711/// A 32-bit integral value used to initialize bits [31:0] of the result.
37793712/// \returns An initialized 256-bit integer vector.
3780static __inline __m256i __DEFAULT_FN_ATTRS
3713static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
37813714_mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
37823715 int __i4, int __i5, int __i6, int __i7)
37833716{
......@@ -3825,7 +3758,7 @@ _mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
38253758/// \param __w00
38263759/// A 16-bit integral value used to initialize bits [15:0] of the result.
38273760/// \returns An initialized 256-bit integer vector.
3828static __inline __m256i __DEFAULT_FN_ATTRS
3761static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
38293762_mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
38303763 short __w11, short __w10, short __w09, short __w08,
38313764 short __w07, short __w06, short __w05, short __w04,
......@@ -3908,7 +3841,7 @@ _mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
39083841/// \param __b00
39093842/// An 8-bit integral value used to initialize bits [7:0] of the result.
39103843/// \returns An initialized 256-bit integer vector.
3911static __inline __m256i __DEFAULT_FN_ATTRS
3844static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
39123845_mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
39133846 char __b27, char __b26, char __b25, char __b24,
39143847 char __b23, char __b22, char __b21, char __b20,
......@@ -3943,7 +3876,7 @@ _mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
39433876/// \param __d
39443877/// A 64-bit integral value used to initialize bits [63:0] of the result.
39453878/// \returns An initialized 256-bit integer vector.
3946static __inline __m256i __DEFAULT_FN_ATTRS
3879static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
39473880_mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
39483881{
39493882 return __extension__ (__m256i)(__v4di){ __d, __c, __b, __a };
......@@ -4044,7 +3977,7 @@ _mm256_setr_ps(float __a, float __b, float __c, float __d,
40443977/// \param __i7
40453978/// A 32-bit integral value used to initialize bits [255:224] of the result.
40463979/// \returns An initialized 256-bit integer vector.
4047static __inline __m256i __DEFAULT_FN_ATTRS
3980static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
40483981_mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
40493982 int __i4, int __i5, int __i6, int __i7)
40503983{
......@@ -4092,7 +4025,7 @@ _mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
40924025/// \param __w00
40934026/// A 16-bit integral value used to initialize bits [255:240] of the result.
40944027/// \returns An initialized 256-bit integer vector.
4095static __inline __m256i __DEFAULT_FN_ATTRS
4028static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
40964029_mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
40974030 short __w11, short __w10, short __w09, short __w08,
40984031 short __w07, short __w06, short __w05, short __w04,
......@@ -4177,7 +4110,7 @@ _mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
41774110/// \param __b00
41784111/// An 8-bit integral value used to initialize bits [255:248] of the result.
41794112/// \returns An initialized 256-bit integer vector.
4180static __inline __m256i __DEFAULT_FN_ATTRS
4113static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
41814114_mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
41824115 char __b27, char __b26, char __b25, char __b24,
41834116 char __b23, char __b22, char __b21, char __b20,
......@@ -4210,7 +4143,7 @@ _mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
42104143/// \param __d
42114144/// A 64-bit integral value used to initialize bits [255:192] of the result.
42124145/// \returns An initialized 256-bit integer vector.
4213static __inline __m256i __DEFAULT_FN_ATTRS
4146static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
42144147_mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
42154148{
42164149 return _mm256_set_epi64x(__d, __c, __b, __a);
......@@ -4267,7 +4200,7 @@ _mm256_set1_ps(float __w)
42674200/// A 32-bit integral value used to initialize each vector element of the
42684201/// result.
42694202/// \returns An initialized 256-bit integer vector of [8 x i32].
4270static __inline __m256i __DEFAULT_FN_ATTRS
4203static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
42714204_mm256_set1_epi32(int __i)
42724205{
42734206 return _mm256_set_epi32(__i, __i, __i, __i, __i, __i, __i, __i);
......@@ -4285,7 +4218,7 @@ _mm256_set1_epi32(int __i)
42854218/// A 16-bit integral value used to initialize each vector element of the
42864219/// result.
42874220/// \returns An initialized 256-bit integer vector of [16 x i16].
4288static __inline __m256i __DEFAULT_FN_ATTRS
4221static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
42894222_mm256_set1_epi16(short __w)
42904223{
42914224 return _mm256_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w,
......@@ -4303,7 +4236,7 @@ _mm256_set1_epi16(short __w)
43034236/// An 8-bit integral value used to initialize each vector element of the
43044237/// result.
43054238/// \returns An initialized 256-bit integer vector of [32 x i8].
4306static __inline __m256i __DEFAULT_FN_ATTRS
4239static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
43074240_mm256_set1_epi8(char __b)
43084241{
43094242 return _mm256_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b,
......@@ -4324,7 +4257,7 @@ _mm256_set1_epi8(char __b)
43244257/// A 64-bit integral value used to initialize each vector element of the
43254258/// result.
43264259/// \returns An initialized 256-bit integer vector of [4 x i64].
4327static __inline __m256i __DEFAULT_FN_ATTRS
4260static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
43284261_mm256_set1_epi64x(long long __q)
43294262{
43304263 return _mm256_set_epi64x(__q, __q, __q, __q);
......@@ -4379,7 +4312,7 @@ _mm256_setzero_si256(void) {
43794312/// A 256-bit floating-point vector of [4 x double].
43804313/// \returns A 256-bit floating-point vector of [8 x float] containing the same
43814314/// bitwise pattern as the parameter.
4382static __inline __m256 __DEFAULT_FN_ATTRS
4315static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
43834316_mm256_castpd_ps(__m256d __a)
43844317{
43854318 return (__m256)__a;
......@@ -4396,7 +4329,7 @@ _mm256_castpd_ps(__m256d __a)
43964329/// A 256-bit floating-point vector of [4 x double].
43974330/// \returns A 256-bit integer vector containing the same bitwise pattern as the
43984331/// parameter.
4399static __inline __m256i __DEFAULT_FN_ATTRS
4332static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
44004333_mm256_castpd_si256(__m256d __a)
44014334{
44024335 return (__m256i)__a;
......@@ -4413,7 +4346,7 @@ _mm256_castpd_si256(__m256d __a)
44134346/// A 256-bit floating-point vector of [8 x float].
44144347/// \returns A 256-bit floating-point vector of [4 x double] containing the same
44154348/// bitwise pattern as the parameter.
4416static __inline __m256d __DEFAULT_FN_ATTRS
4349static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
44174350_mm256_castps_pd(__m256 __a)
44184351{
44194352 return (__m256d)__a;
......@@ -4430,7 +4363,7 @@ _mm256_castps_pd(__m256 __a)
44304363/// A 256-bit floating-point vector of [8 x float].
44314364/// \returns A 256-bit integer vector containing the same bitwise pattern as the
44324365/// parameter.
4433static __inline __m256i __DEFAULT_FN_ATTRS
4366static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
44344367_mm256_castps_si256(__m256 __a)
44354368{
44364369 return (__m256i)__a;
......@@ -4447,7 +4380,7 @@ _mm256_castps_si256(__m256 __a)
44474380/// A 256-bit integer vector.
44484381/// \returns A 256-bit floating-point vector of [8 x float] containing the same
44494382/// bitwise pattern as the parameter.
4450static __inline __m256 __DEFAULT_FN_ATTRS
4383static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
44514384_mm256_castsi256_ps(__m256i __a)
44524385{
44534386 return (__m256)__a;
......@@ -4464,7 +4397,7 @@ _mm256_castsi256_ps(__m256i __a)
44644397/// A 256-bit integer vector.
44654398/// \returns A 256-bit floating-point vector of [4 x double] containing the same
44664399/// bitwise pattern as the parameter.
4467static __inline __m256d __DEFAULT_FN_ATTRS
4400static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
44684401_mm256_castsi256_pd(__m256i __a)
44694402{
44704403 return (__m256d)__a;
......@@ -4481,7 +4414,7 @@ _mm256_castsi256_pd(__m256i __a)
44814414/// A 256-bit floating-point vector of [4 x double].
44824415/// \returns A 128-bit floating-point vector of [2 x double] containing the
44834416/// lower 128 bits of the parameter.
4484static __inline __m128d __DEFAULT_FN_ATTRS
4417static __inline __m128d __DEFAULT_FN_ATTRS_CONSTEXPR
44854418_mm256_castpd256_pd128(__m256d __a)
44864419{
44874420 return __builtin_shufflevector((__v4df)__a, (__v4df)__a, 0, 1);
......@@ -4498,7 +4431,7 @@ _mm256_castpd256_pd128(__m256d __a)
44984431/// A 256-bit floating-point vector of [8 x float].
44994432/// \returns A 128-bit floating-point vector of [4 x float] containing the
45004433/// lower 128 bits of the parameter.
4501static __inline __m128 __DEFAULT_FN_ATTRS
4434static __inline __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
45024435_mm256_castps256_ps128(__m256 __a)
45034436{
45044437 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 0, 1, 2, 3);
......@@ -4514,7 +4447,7 @@ _mm256_castps256_ps128(__m256 __a)
45144447/// A 256-bit integer vector.
45154448/// \returns A 128-bit integer vector containing the lower 128 bits of the
45164449/// parameter.
4517static __inline __m128i __DEFAULT_FN_ATTRS
4450static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
45184451_mm256_castsi256_si128(__m256i __a)
45194452{
45204453 return __builtin_shufflevector((__v4di)__a, (__v4di)__a, 0, 1);
......@@ -4598,9 +4531,8 @@ _mm256_castsi128_si256(__m128i __a)
45984531/// A 128-bit vector of [2 x double].
45994532/// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
46004533/// contain the value of the parameter. The upper 128 bits are set to zero.
4601static __inline __m256d __DEFAULT_FN_ATTRS
4602_mm256_zextpd128_pd256(__m128d __a)
4603{
4534static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4535_mm256_zextpd128_pd256(__m128d __a) {
46044536 return __builtin_shufflevector((__v2df)__a, (__v2df)_mm_setzero_pd(), 0, 1, 2, 3);
46054537}
46064538
......@@ -4616,9 +4548,8 @@ _mm256_zextpd128_pd256(__m128d __a)
46164548/// A 128-bit vector of [4 x float].
46174549/// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
46184550/// contain the value of the parameter. The upper 128 bits are set to zero.
4619static __inline __m256 __DEFAULT_FN_ATTRS
4620_mm256_zextps128_ps256(__m128 __a)
4621{
4551static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4552_mm256_zextps128_ps256(__m128 __a) {
46224553 return __builtin_shufflevector((__v4sf)__a, (__v4sf)_mm_setzero_ps(), 0, 1, 2, 3, 4, 5, 6, 7);
46234554}
46244555
......@@ -4634,9 +4565,8 @@ _mm256_zextps128_ps256(__m128 __a)
46344565/// A 128-bit integer vector.
46354566/// \returns A 256-bit integer vector. The lower 128 bits contain the value of
46364567/// the parameter. The upper 128 bits are set to zero.
4637static __inline __m256i __DEFAULT_FN_ATTRS
4638_mm256_zextsi128_si256(__m128i __a)
4639{
4568static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4569_mm256_zextsi128_si256(__m128i __a) {
46404570 return __builtin_shufflevector((__v2di)__a, (__v2di)_mm_setzero_si128(), 0, 1, 2, 3);
46414571}
46424572
......@@ -4851,9 +4781,8 @@ _mm256_zextsi128_si256(__m128i __a)
48514781/// 128 bits of the result.
48524782/// \returns A 256-bit floating-point vector of [8 x float] containing the
48534783/// concatenated result.
4854static __inline __m256 __DEFAULT_FN_ATTRS
4855_mm256_set_m128 (__m128 __hi, __m128 __lo)
4856{
4784static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4785_mm256_set_m128(__m128 __hi, __m128 __lo) {
48574786 return (__m256) __builtin_shufflevector((__v4sf)__lo, (__v4sf)__hi, 0, 1, 2, 3, 4, 5, 6, 7);
48584787}
48594788
......@@ -4872,9 +4801,8 @@ _mm256_set_m128 (__m128 __hi, __m128 __lo)
48724801/// 128 bits of the result.
48734802/// \returns A 256-bit floating-point vector of [4 x double] containing the
48744803/// concatenated result.
4875static __inline __m256d __DEFAULT_FN_ATTRS
4876_mm256_set_m128d (__m128d __hi, __m128d __lo)
4877{
4804static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4805_mm256_set_m128d(__m128d __hi, __m128d __lo) {
48784806 return (__m256d) __builtin_shufflevector((__v2df)__lo, (__v2df)__hi, 0, 1, 2, 3);
48794807}
48804808
......@@ -4892,9 +4820,8 @@ _mm256_set_m128d (__m128d __hi, __m128d __lo)
48924820/// A 128-bit integer vector to be copied to the lower 128 bits of the
48934821/// result.
48944822/// \returns A 256-bit integer vector containing the concatenated result.
4895static __inline __m256i __DEFAULT_FN_ATTRS
4896_mm256_set_m128i (__m128i __hi, __m128i __lo)
4897{
4823static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4824_mm256_set_m128i(__m128i __hi, __m128i __lo) {
48984825 return (__m256i) __builtin_shufflevector((__v2di)__lo, (__v2di)__hi, 0, 1, 2, 3);
48994826}
49004827
......@@ -4915,9 +4842,8 @@ _mm256_set_m128i (__m128i __hi, __m128i __lo)
49154842/// 128 bits of the result.
49164843/// \returns A 256-bit floating-point vector of [8 x float] containing the
49174844/// concatenated result.
4918static __inline __m256 __DEFAULT_FN_ATTRS
4919_mm256_setr_m128 (__m128 __lo, __m128 __hi)
4920{
4845static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4846_mm256_setr_m128(__m128 __lo, __m128 __hi) {
49214847 return _mm256_set_m128(__hi, __lo);
49224848}
49234849
......@@ -4938,9 +4864,8 @@ _mm256_setr_m128 (__m128 __lo, __m128 __hi)
49384864/// 128 bits of the result.
49394865/// \returns A 256-bit floating-point vector of [4 x double] containing the
49404866/// concatenated result.
4941static __inline __m256d __DEFAULT_FN_ATTRS
4942_mm256_setr_m128d (__m128d __lo, __m128d __hi)
4943{
4867static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4868_mm256_setr_m128d(__m128d __lo, __m128d __hi) {
49444869 return (__m256d)_mm256_set_m128d(__hi, __lo);
49454870}
49464871
......@@ -4959,9 +4884,8 @@ _mm256_setr_m128d (__m128d __lo, __m128d __hi)
49594884/// A 128-bit integer vector to be copied to the upper 128 bits of the
49604885/// result.
49614886/// \returns A 256-bit integer vector containing the concatenated result.
4962static __inline __m256i __DEFAULT_FN_ATTRS
4963_mm256_setr_m128i (__m128i __lo, __m128i __hi)
4964{
4887static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4888_mm256_setr_m128i(__m128i __lo, __m128i __hi) {
49654889 return (__m256i)_mm256_set_m128i(__hi, __lo);
49664890}
49674891
lib/include/avxvnniint16intrin.h+118-99
......@@ -16,9 +16,10 @@
1616#define __AVXVNNIINT16INTRIN_H
1717
1818/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
19/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
20/// signed 16-bit results. Sum these 2 results with the corresponding
21/// 32-bit integer in \a __W, and store the packed 32-bit results in \a dst.
19/// corresponding unsigned 16-bit integers in \a __B, producing 2
20/// intermediate signed 16-bit results. Sum these 2 results with the
21/// corresponding 32-bit integer in \a __W, and store the packed 32-bit
22/// results in \a dst.
2223///
2324/// \headerfile <immintrin.h>
2425///
......@@ -40,19 +41,21 @@
4041/// \code{.operation}
4142/// FOR j := 0 to 3
4243/// tmp1.dword := SignExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
43/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
44/// tmp2.dword :=
45/// SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
4446/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
4547/// ENDFOR
4648/// dst[MAX:128] := 0
4749/// \endcode
4850#define _mm_dpwsud_epi32(__W, __A, __B) \
49 ((__m128i)__builtin_ia32_vpdpwsud128((__v4si)(__W), (__v4si)(__A), \
50 (__v4si)(__B)))
51 ((__m128i)__builtin_ia32_vpdpwsud128((__v4si)(__W), (__v8hi)(__A), \
52 (__v8hu)(__B)))
5153
5254/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
53/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
54/// signed 16-bit results. Sum these 2 results with the corresponding
55/// 32-bit integer in \a __W, and store the packed 32-bit results in \a dst.
55/// corresponding unsigned 16-bit integers in \a __B, producing 2
56/// intermediate signed 16-bit results. Sum these 2 results with the
57/// corresponding 32-bit integer in \a __W, and store the packed 32-bit
58/// results in \a dst.
5659///
5760/// \headerfile <immintrin.h>
5861///
......@@ -74,20 +77,21 @@
7477/// \code{.operation}
7578/// FOR j := 0 to 7
7679/// tmp1.dword := SignExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
77/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
78/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
80/// tmp2.dword :=
81/// SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
82/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
7983/// ENDFOR
8084/// dst[MAX:256] := 0
8185/// \endcode
8286#define _mm256_dpwsud_epi32(__W, __A, __B) \
83 ((__m256i)__builtin_ia32_vpdpwsud256((__v8si)(__W), (__v8si)(__A), \
84 (__v8si)(__B)))
87 ((__m256i)__builtin_ia32_vpdpwsud256((__v8si)(__W), (__v16hi)(__A), \
88 (__v16hu)(__B)))
8589
8690/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
87/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
88/// signed 16-bit results. Sum these 2 results with the corresponding
89/// 32-bit integer in \a __W with signed saturation, and store the packed
90/// 32-bit results in \a dst.
91/// corresponding unsigned 16-bit integers in \a __B, producing 2
92/// intermediate signed 16-bit results. Sum these 2 results with the
93/// corresponding 32-bit integer in \a __W with signed saturation, and store
94/// the packed 32-bit results in \a dst.
9195///
9296/// \headerfile <immintrin.h>
9397///
......@@ -109,20 +113,22 @@
109113/// \code{.operation}
110114/// FOR j := 0 to 3
111115/// tmp1.dword := SignExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
112/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
116/// tmp2.dword :=
117/// SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
113118/// dst.dword[j] := SIGNED_DWORD_SATURATE(__W.dword[j] + tmp1 + tmp2)
114119/// ENDFOR
115120/// dst[MAX:128] := 0
116121/// \endcode
122/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
117123#define _mm_dpwsuds_epi32(__W, __A, __B) \
118 ((__m128i)__builtin_ia32_vpdpwsuds128((__v4si)(__W), (__v4si)(__A), \
119 (__v4si)(__B)))
124 ((__m128i)__builtin_ia32_vpdpwsuds128((__v4si)(__W), (__v8hi)(__A), \
125 (__v8hu)(__B)))
120126
121127/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
122/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
123/// signed 16-bit results. Sum these 2 results with the corresponding
124/// 32-bit integer in \a __W with signed saturation, and store the packed
125/// 32-bit results in \a dst.
128/// corresponding unsigned 16-bit integers in \a __B, producing 2
129/// intermediate signed 16-bit results. Sum these 2 results with the
130/// corresponding 32-bit integer in \a __W with signed saturation, and store
131/// the packed 32-bit results in \a dst.
126132///
127133/// \headerfile <immintrin.h>
128134///
......@@ -144,19 +150,21 @@
144150/// \code{.operation}
145151/// FOR j := 0 to 7
146152/// tmp1.dword := SignExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
147/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
153/// tmp2.dword :=
154/// SignExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
148155/// dst.dword[j] := SIGNED_DWORD_SATURATE(__W.dword[j] + tmp1 + tmp2)
149156/// ENDFOR
150157/// dst[MAX:256] := 0
151158/// \endcode
152159#define _mm256_dpwsuds_epi32(__W, __A, __B) \
153 ((__m256i)__builtin_ia32_vpdpwsuds256((__v8si)(__W), (__v8si)(__A), \
154 (__v8si)(__B)))
160 ((__m256i)__builtin_ia32_vpdpwsuds256((__v8si)(__W), (__v16hi)(__A), \
161 (__v16hu)(__B)))
155162
156/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
157/// corresponding signed 16-bit integers in \a __B, producing 2 intermediate
158/// signed 16-bit results. Sum these 2 results with the corresponding
159/// 32-bit integer in \a __W, and store the packed 32-bit results in \a dst.
163/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
164/// with corresponding signed 16-bit integers in \a __B, producing 2
165/// intermediate signed 16-bit results. Sum these 2 results with the
166/// corresponding 32-bit integer in \a __W, and store the packed 32-bit
167/// results in \a dst.
160168///
161169/// \headerfile <immintrin.h>
162170///
......@@ -178,19 +186,21 @@
178186/// \code{.operation}
179187/// FOR j := 0 to 3
180188/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
181/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
189/// tmp2.dword :=
190/// ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
182191/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
183192/// ENDFOR
184193/// dst[MAX:128] := 0
185194/// \endcode
186195#define _mm_dpwusd_epi32(__W, __A, __B) \
187 ((__m128i)__builtin_ia32_vpdpwusd128((__v4si)(__W), (__v4si)(__A), \
188 (__v4si)(__B)))
196 ((__m128i)__builtin_ia32_vpdpwusd128((__v4si)(__W), (__v8hu)(__A), \
197 (__v8hi)(__B)))
189198
190/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
191/// corresponding signed 16-bit integers in \a __B, producing 2 intermediate
192/// signed 16-bit results. Sum these 2 results with the corresponding
193/// 32-bit integer in \a __W, and store the packed 32-bit results in \a dst.
199/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
200/// with corresponding signed 16-bit integers in \a __B, producing 2
201/// intermediate signed 16-bit results. Sum these 2 results with the
202/// corresponding 32-bit integer in \a __W, and store the packed 32-bit
203/// results in \a dst.
194204///
195205/// \headerfile <immintrin.h>
196206///
......@@ -212,20 +222,21 @@
212222/// \code{.operation}
213223/// FOR j := 0 to 7
214224/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
215/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
225/// tmp2.dword :=
226/// ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
216227/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
217228/// ENDFOR
218229/// dst[MAX:256] := 0
219230/// \endcode
220231#define _mm256_dpwusd_epi32(__W, __A, __B) \
221 ((__m256i)__builtin_ia32_vpdpwusd256((__v8si)(__W), (__v8si)(__A), \
222 (__v8si)(__B)))
232 ((__m256i)__builtin_ia32_vpdpwusd256((__v8si)(__W), (__v16hu)(__A), \
233 (__v16hi)(__B)))
223234
224/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
225/// corresponding signed 16-bit integers in \a __B, producing 2 intermediate
226/// signed 16-bit results. Sum these 2 results with the corresponding
227/// 32-bit integer in \a __W with signed saturation, and store the packed
228/// 32-bit results in \a dst.
235/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
236/// with corresponding signed 16-bit integers in \a __B, producing 2
237/// intermediate signed 16-bit results. Sum these 2 results with the
238/// corresponding 32-bit integer in \a __W with signed saturation, and
239/// store the packed 32-bit results in \a dst.
229240///
230241/// \headerfile <immintrin.h>
231242///
......@@ -233,7 +244,7 @@
233244/// __m128i _mm_dpwusds_epi32(__m128i __W, __m128i __A, __m128i __B)
234245/// \endcode
235246///
236/// This intrinsic corresponds to the \c VPDPWSUDS instruction.
247/// This intrinsic corresponds to the \c VPDPWUSDS instruction.
237248///
238249/// \param __W
239250/// A 128-bit vector of [4 x int].
......@@ -247,20 +258,21 @@
247258/// \code{.operation}
248259/// FOR j := 0 to 3
249260/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
250/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
261/// tmp2.dword :=
262/// ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
251263/// dst.dword[j] := SIGNED_DWORD_SATURATE(__W.dword[j] + tmp1 + tmp2)
252264/// ENDFOR
253265/// dst[MAX:128] := 0
254266/// \endcode
255267#define _mm_dpwusds_epi32(__W, __A, __B) \
256 ((__m128i)__builtin_ia32_vpdpwusds128((__v4si)(__W), (__v4si)(__A), \
257 (__v4si)(__B)))
268 ((__m128i)__builtin_ia32_vpdpwusds128((__v4si)(__W), (__v8hu)(__A), \
269 (__v8hi)(__B)))
258270
259/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
260/// corresponding signed 16-bit integers in \a __B, producing 2 intermediate
261/// signed 16-bit results. Sum these 2 results with the corresponding
262/// 32-bit integer in \a __W with signed saturation, and store the packed
263/// 32-bit results in \a dst.
271/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
272/// with corresponding signed 16-bit integers in \a __B, producing 2
273/// intermediate signed 16-bit results. Sum these 2 results with the
274/// corresponding 32-bit integer in \a __W with signed saturation, and
275/// store the packed 32-bit results in \a dst.
264276///
265277/// \headerfile <immintrin.h>
266278///
......@@ -268,7 +280,7 @@
268280/// __m256i _mm256_dpwsuds_epi32(__m256i __W, __m256i __A, __m256i __B)
269281/// \endcode
270282///
271/// This intrinsic corresponds to the \c VPDPWSUDS instruction.
283/// This intrinsic corresponds to the \c VPDPWUSDS instruction.
272284///
273285/// \param __W
274286/// A 256-bit vector of [8 x int].
......@@ -282,19 +294,21 @@
282294/// \code{.operation}
283295/// FOR j := 0 to 7
284296/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
285/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
297/// tmp2.dword :=
298/// ZeroExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
286299/// dst.dword[j] := SIGNED_DWORD_SATURATE(__W.dword[j] + tmp1 + tmp2)
287300/// ENDFOR
288301/// dst[MAX:256] := 0
289302/// \endcode
290303#define _mm256_dpwusds_epi32(__W, __A, __B) \
291 ((__m256i)__builtin_ia32_vpdpwusds256((__v8si)(__W), (__v8si)(__A), \
292 (__v8si)(__B)))
304 ((__m256i)__builtin_ia32_vpdpwusds256((__v8si)(__W), (__v16hu)(__A), \
305 (__v16hi)(__B)))
293306
294/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
295/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
296/// signed 16-bit results. Sum these 2 results with the corresponding
297/// 32-bit integer in \a __W, and store the packed 32-bit results in \a dst.
307/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
308/// with corresponding unsigned 16-bit integers in \a __B, producing 2
309/// intermediate signed 16-bit results. Sum these 2 results with the
310/// corresponding 32-bit integer in \a __W, and store the packed 32-bit
311/// results in \a dst.
298312///
299313/// \headerfile <immintrin.h>
300314///
......@@ -305,30 +319,32 @@
305319/// This intrinsic corresponds to the \c VPDPWUUD instruction.
306320///
307321/// \param __W
308/// A 128-bit vector of [4 x unsigned int].
322/// A 128-bit vector of [4 x int].
309323/// \param __A
310324/// A 128-bit vector of [8 x unsigned short].
311325/// \param __B
312326/// A 128-bit vector of [8 x unsigned short].
313327/// \returns
314/// A 128-bit vector of [4 x unsigned int].
328/// A 128-bit vector of [4 x int].
315329///
316330/// \code{.operation}
317331/// FOR j := 0 to 3
318332/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
319/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
333/// tmp2.dword :=
334/// ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
320335/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
321336/// ENDFOR
322337/// dst[MAX:128] := 0
323338/// \endcode
324339#define _mm_dpwuud_epi32(__W, __A, __B) \
325 ((__m128i)__builtin_ia32_vpdpwuud128((__v4si)(__W), (__v4si)(__A), \
326 (__v4si)(__B)))
340 ((__m128i)__builtin_ia32_vpdpwuud128((__v4si)(__W), (__v8hu)(__A), \
341 (__v8hu)(__B)))
327342
328/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
329/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
330/// signed 16-bit results. Sum these 2 results with the corresponding
331/// 32-bit integer in \a __W, and store the packed 32-bit results in \a dst.
343/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
344/// with corresponding unsigned 16-bit integers in \a __B, producing 2
345/// intermediate signed 16-bit results. Sum these 2 results with the
346/// corresponding 32-bit integer in \a __W, and store the packed 32-bit
347/// results in \a dst.
332348///
333349/// \headerfile <immintrin.h>
334350///
......@@ -339,31 +355,32 @@
339355/// This intrinsic corresponds to the \c VPDPWUUD instruction.
340356///
341357/// \param __W
342/// A 256-bit vector of [8 x unsigned int].
358/// A 256-bit vector of [8 x int].
343359/// \param __A
344360/// A 256-bit vector of [16 x unsigned short].
345361/// \param __B
346362/// A 256-bit vector of [16 x unsigned short].
347363/// \returns
348/// A 256-bit vector of [8 x unsigned int].
364/// A 256-bit vector of [8 x int].
349365///
350366/// \code{.operation}
351367/// FOR j := 0 to 7
352368/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
353/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
369/// tmp2.dword :=
370/// ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
354371/// dst.dword[j] := __W.dword[j] + tmp1 + tmp2
355372/// ENDFOR
356373/// dst[MAX:256] := 0
357374/// \endcode
358375#define _mm256_dpwuud_epi32(__W, __A, __B) \
359 ((__m256i)__builtin_ia32_vpdpwuud256((__v8si)(__W), (__v8si)(__A), \
360 (__v8si)(__B)))
376 ((__m256i)__builtin_ia32_vpdpwuud256((__v8si)(__W), (__v16hu)(__A), \
377 (__v16hu)(__B)))
361378
362/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
363/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
364/// signed 16-bit results. Sum these 2 results with the corresponding
365/// 32-bit integer in \a __W with signed saturation, and store the packed
366/// 32-bit results in \a dst.
379/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
380/// with corresponding unsigned 16-bit integers in \a __B, producing 2
381/// intermediate signed 16-bit results. Sum these 2 results with the
382/// corresponding 32-bit integer in \a __W with signed saturation, and store
383/// the packed 32-bit results in \a dst.
367384///
368385/// \headerfile <immintrin.h>
369386///
......@@ -371,34 +388,35 @@
371388/// __m128i _mm_dpwsuds_epi32(__m128i __W, __m128i __A, __m128i __B)
372389/// \endcode
373390///
374/// This intrinsic corresponds to the \c VPDPWSUDS instruction.
391/// This intrinsic corresponds to the \c VPDPWUUDS instruction.
375392///
376393/// \param __W
377/// A 128-bit vector of [4 x unsigned int].
394/// A 128-bit vector of [4 x int].
378395/// \param __A
379396/// A 128-bit vector of [8 x unsigned short].
380397/// \param __B
381398/// A 128-bit vector of [8 x unsigned short].
382399/// \returns
383/// A 128-bit vector of [4 x unsigned int].
400/// A 128-bit vector of [4 x int].
384401///
385402/// \code{.operation}
386403/// FOR j := 0 to 3
387404/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
388/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
405/// tmp2.dword :=
406/// ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
389407/// dst.dword[j] := UNSIGNED_DWORD_SATURATE(__W.dword[j] + tmp1 + tmp2)
390408/// ENDFOR
391409/// dst[MAX:128] := 0
392410/// \endcode
393411#define _mm_dpwuuds_epi32(__W, __A, __B) \
394 ((__m128i)__builtin_ia32_vpdpwuuds128((__v4si)(__W), (__v4si)(__A), \
395 (__v4si)(__B)))
412 ((__m128i)__builtin_ia32_vpdpwuuds128((__v4si)(__W), (__v8hu)(__A), \
413 (__v8hu)(__B)))
396414
397/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A with
398/// corresponding unsigned 16-bit integers in \a __B, producing 2 intermediate
399/// signed 16-bit results. Sum these 2 results with the corresponding
400/// 32-bit integer in \a __W with signed saturation, and store the packed
401/// 32-bit results in \a dst.
415/// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in \a __A
416/// with corresponding unsigned 16-bit integers in \a __B, producing 2
417/// intermediate signed 16-bit results. Sum these 2 results with the
418/// corresponding 32-bit integer in \a __W with signed saturation, and store
419/// the packed 32-bit results in \a dst.
402420///
403421/// \headerfile <immintrin.h>
404422///
......@@ -406,27 +424,28 @@
406424/// __m256i _mm256_dpwuuds_epi32(__m256i __W, __m256i __A, __m256i __B)
407425/// \endcode
408426///
409/// This intrinsic corresponds to the \c VPDPWSUDS instruction.
427/// This intrinsic corresponds to the \c VPDPWUUDS instruction.
410428///
411429/// \param __W
412/// A 256-bit vector of [8 x unsigned int].
430/// A 256-bit vector of [8 x int].
413431/// \param __A
414432/// A 256-bit vector of [16 x unsigned short].
415433/// \param __B
416434/// A 256-bit vector of [16 x unsigned short].
417435/// \returns
418/// A 256-bit vector of [8 x unsigned int].
436/// A 256-bit vector of [8 x int].
419437///
420438/// \code{.operation}
421439/// FOR j := 0 to 7
422440/// tmp1.dword := ZeroExtend32(__A.word[2*j]) * ZeroExtend32(__B.word[2*j])
423/// tmp2.dword := ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
441/// tmp2.dword :=
442/// ZeroExtend32(__A.word[2*j+1]) * ZeroExtend32(__B.word[2*j+1])
424443/// dst.dword[j] := UNSIGNED_DWORD_SATURATE(__W.dword[j] + tmp1 + tmp2)
425444/// ENDFOR
426445/// dst[MAX:256] := 0
427446/// \endcode
428447#define _mm256_dpwuuds_epi32(__W, __A, __B) \
429 ((__m256i)__builtin_ia32_vpdpwuuds256((__v8si)(__W), (__v8si)(__A), \
430 (__v8si)(__B)))
448 ((__m256i)__builtin_ia32_vpdpwuuds256((__v8si)(__W), (__v16hu)(__A), \
449 (__v16hu)(__B)))
431450
432451#endif // __AVXVNNIINT16INTRIN_H
lib/include/avxvnniint8intrin.h+56-32
......@@ -14,6 +14,7 @@
1414#ifndef __AVXVNNIINT8INTRIN_H
1515#define __AVXVNNIINT8INTRIN_H
1616
17// clang-format off
1718/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
1819/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate
1920/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -44,10 +45,12 @@
4445/// ENDFOR
4546/// dst[MAX:128] := 0
4647/// \endcode
48// clang-format on
4749#define _mm_dpbssd_epi32(__W, __A, __B) \
48 ((__m128i)__builtin_ia32_vpdpbssd128((__v4si)(__W), (__v4si)(__A), \
49 (__v4si)(__B)))
50 ((__m128i)__builtin_ia32_vpdpbssd128((__v4si)(__W), (__v16qi)(__A), \
51 (__v16qi)(__B)))
5052
53// clang-format off
5154/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
5255/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate
5356/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -78,10 +81,12 @@
7881/// ENDFOR
7982/// dst[MAX:256] := 0
8083/// \endcode
84// clang-format on
8185#define _mm256_dpbssd_epi32(__W, __A, __B) \
82 ((__m256i)__builtin_ia32_vpdpbssd256((__v8si)(__W), (__v8si)(__A), \
83 (__v8si)(__B)))
86 ((__m256i)__builtin_ia32_vpdpbssd256((__v8si)(__W), (__v32qi)(__A), \
87 (__v32qi)(__B)))
8488
89// clang-format off
8590/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
8691/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate
8792/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -94,7 +99,7 @@
9499/// _mm_dpbssds_epi32( __m128i __W, __m128i __A, __m128i __B);
95100/// \endcode
96101///
97/// This intrinsic corresponds to the \c VPDPBSSD instruction.
102/// This intrinsic corresponds to the \c VPDPBSSDS instruction.
98103///
99104/// \param __A
100105/// A 128-bit vector of [16 x char].
......@@ -113,10 +118,12 @@
113118/// ENDFOR
114119/// dst[MAX:128] := 0
115120/// \endcode
121// clang-format on
116122#define _mm_dpbssds_epi32(__W, __A, __B) \
117 ((__m128i)__builtin_ia32_vpdpbssds128((__v4si)(__W), (__v4si)(__A), \
118 (__v4si)(__B)))
123 ((__m128i)__builtin_ia32_vpdpbssds128((__v4si)(__W), (__v16qi)(__A), \
124 (__v16qi)(__B)))
119125
126// clang-format off
120127/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
121128/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate
122129/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -129,7 +136,7 @@
129136/// _mm256_dpbssds_epi32(__m256i __W, __m256i __A, __m256i __B);
130137/// \endcode
131138///
132/// This intrinsic corresponds to the \c VPDPBSSD instruction.
139/// This intrinsic corresponds to the \c VPDPBSSDS instruction.
133140///
134141/// \param __A
135142/// A 256-bit vector of [32 x char].
......@@ -148,10 +155,12 @@
148155/// ENDFOR
149156/// dst[MAX:256] := 0
150157/// \endcode
158// clang-format on
151159#define _mm256_dpbssds_epi32(__W, __A, __B) \
152 ((__m256i)__builtin_ia32_vpdpbssds256((__v8si)(__W), (__v8si)(__A), \
153 (__v8si)(__B)))
160 ((__m256i)__builtin_ia32_vpdpbssds256((__v8si)(__W), (__v32qi)(__A), \
161 (__v32qi)(__B)))
154162
163// clang-format off
155164/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
156165/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
157166/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -163,7 +172,7 @@
163172/// _mm_dpbsud_epi32(__m128i __W, __m128i __A, __m128i __B);
164173/// \endcode
165174///
166/// This intrinsic corresponds to the \c VPDPBSSD instruction.
175/// This intrinsic corresponds to the \c VPDPBSUD instruction.
167176///
168177/// \param __A
169178/// A 128-bit vector of [16 x char].
......@@ -182,10 +191,12 @@
182191/// ENDFOR
183192/// dst[MAX:128] := 0
184193/// \endcode
194// clang-format on
185195#define _mm_dpbsud_epi32(__W, __A, __B) \
186 ((__m128i)__builtin_ia32_vpdpbsud128((__v4si)(__W), (__v4si)(__A), \
187 (__v4si)(__B)))
196 ((__m128i)__builtin_ia32_vpdpbsud128((__v4si)(__W), (__v16qi)(__A), \
197 (__v16qu)(__B)))
188198
199// clang-format off
189200/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
190201/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
191202/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -197,7 +208,7 @@
197208/// _mm256_dpbsud_epi32(__m256i __W, __m256i __A, __m256i __B);
198209/// \endcode
199210///
200/// This intrinsic corresponds to the \c VPDPBSSD instruction.
211/// This intrinsic corresponds to the \c VPDPBSUD instruction.
201212///
202213/// \param __A
203214/// A 256-bit vector of [32 x char].
......@@ -216,10 +227,12 @@
216227/// ENDFOR
217228/// dst[MAX:256] := 0
218229/// \endcode
230// clang-format on
219231#define _mm256_dpbsud_epi32(__W, __A, __B) \
220 ((__m256i)__builtin_ia32_vpdpbsud256((__v8si)(__W), (__v8si)(__A), \
221 (__v8si)(__B)))
232 ((__m256i)__builtin_ia32_vpdpbsud256((__v8si)(__W), (__v32qi)(__A), \
233 (__v32qu)(__B)))
222234
235// clang-format off
223236/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
224237/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
225238/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -232,7 +245,7 @@
232245/// _mm_dpbsuds_epi32( __m128i __W, __m128i __A, __m128i __B);
233246/// \endcode
234247///
235/// This intrinsic corresponds to the \c VPDPBSSD instruction.
248/// This intrinsic corresponds to the \c VPDPBSUDS instruction.
236249///
237250/// \param __A
238251/// A 128-bit vector of [16 x char].
......@@ -251,10 +264,12 @@
251264/// ENDFOR
252265/// dst[MAX:128] := 0
253266/// \endcode
267// clang-format on
254268#define _mm_dpbsuds_epi32(__W, __A, __B) \
255 ((__m128i)__builtin_ia32_vpdpbsuds128((__v4si)(__W), (__v4si)(__A), \
256 (__v4si)(__B)))
269 ((__m128i)__builtin_ia32_vpdpbsuds128((__v4si)(__W), (__v16qi)(__A), \
270 (__v16qu)(__B)))
257271
272// clang-format off
258273/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in \a __A with
259274/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
260275/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -267,7 +282,7 @@
267282/// _mm256_dpbsuds_epi32(__m256i __W, __m256i __A, __m256i __B);
268283/// \endcode
269284///
270/// This intrinsic corresponds to the \c VPDPBSSD instruction.
285/// This intrinsic corresponds to the \c VPDPBSUDS instruction.
271286///
272287/// \param __A
273288/// A 256-bit vector of [32 x char].
......@@ -286,10 +301,12 @@
286301/// ENDFOR
287302/// dst[MAX:256] := 0
288303/// \endcode
304// clang-format on
289305#define _mm256_dpbsuds_epi32(__W, __A, __B) \
290 ((__m256i)__builtin_ia32_vpdpbsuds256((__v8si)(__W), (__v8si)(__A), \
291 (__v8si)(__B)))
306 ((__m256i)__builtin_ia32_vpdpbsuds256((__v8si)(__W), (__v32qi)(__A), \
307 (__v32qu)(__B)))
292308
309// clang-format off
293310/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
294311/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
295312/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -301,7 +318,7 @@
301318/// _mm_dpbuud_epi32(__m128i __W, __m128i __A, __m128i __B);
302319/// \endcode
303320///
304/// This intrinsic corresponds to the \c VPDPBSSD instruction.
321/// This intrinsic corresponds to the \c VPDPBUUD instruction.
305322///
306323/// \param __A
307324/// A 128-bit vector of [16 x unsigned char].
......@@ -320,10 +337,12 @@
320337/// ENDFOR
321338/// dst[MAX:128] := 0
322339/// \endcode
340// clang-format on
323341#define _mm_dpbuud_epi32(__W, __A, __B) \
324 ((__m128i)__builtin_ia32_vpdpbuud128((__v4si)(__W), (__v4si)(__A), \
325 (__v4si)(__B)))
342 ((__m128i)__builtin_ia32_vpdpbuud128((__v4si)(__W), (__v16qu)(__A), \
343 (__v16qu)(__B)))
326344
345// clang-format off
327346/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
328347/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
329348/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -335,7 +354,7 @@
335354/// _mm256_dpbuud_epi32(__m256i __W, __m256i __A, __m256i __B);
336355/// \endcode
337356///
338/// This intrinsic corresponds to the \c VPDPBSSD instruction.
357/// This intrinsic corresponds to the \c VPDPBUUD instruction.
339358///
340359/// \param __A
341360/// A 256-bit vector of [32 x unsigned char].
......@@ -354,10 +373,12 @@
354373/// ENDFOR
355374/// dst[MAX:256] := 0
356375/// \endcode
376// clang-format on
357377#define _mm256_dpbuud_epi32(__W, __A, __B) \
358 ((__m256i)__builtin_ia32_vpdpbuud256((__v8si)(__W), (__v8si)(__A), \
359 (__v8si)(__B)))
378 ((__m256i)__builtin_ia32_vpdpbuud256((__v8si)(__W), (__v32qu)(__A), \
379 (__v32qu)(__B)))
360380
381// clang-format off
361382/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
362383/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
363384/// signed 16-bit results. Sum these 4 results with the corresponding
......@@ -389,10 +410,12 @@
389410/// ENDFOR
390411/// dst[MAX:128] := 0
391412/// \endcode
413// clang-format on
392414#define _mm_dpbuuds_epi32(__W, __A, __B) \
393 ((__m128i)__builtin_ia32_vpdpbuuds128((__v4si)(__W), (__v4si)(__A), \
394 (__v4si)(__B)))
415 ((__m128i)__builtin_ia32_vpdpbuuds128((__v4si)(__W), (__v16qu)(__A), \
416 (__v16qu)(__B)))
395417
418// clang-format off
396419/// corresponding unsigned 8-bit integers in \a __B, producing 4 intermediate
397420/// signed 16-bit results. Sum these 4 results with the corresponding
398421/// 32-bit integer in \a __W with signed saturation, and store the packed
......@@ -423,8 +446,9 @@
423446/// ENDFOR
424447/// dst[MAX:256] := 0
425448/// \endcode
449// clang-format on
426450#define _mm256_dpbuuds_epi32(__W, __A, __B) \
427 ((__m256i)__builtin_ia32_vpdpbuuds256((__v8si)(__W), (__v8si)(__A), \
428 (__v8si)(__B)))
451 ((__m256i)__builtin_ia32_vpdpbuuds256((__v8si)(__W), (__v32qu)(__A), \
452 (__v32qu)(__B)))
429453
430454#endif // __AVXVNNIINT8INTRIN_H
lib/include/avxvnniintrin.h+16-8
......@@ -63,7 +63,8 @@
6363static __inline__ __m256i __DEFAULT_FN_ATTRS256
6464_mm256_dpbusd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
6565{
66 return (__m256i)__builtin_ia32_vpdpbusd256((__v8si)__S, (__v8si)__A, (__v8si)__B);
66 return (__m256i)__builtin_ia32_vpdpbusd256((__v8si)__S, (__v32qu)__A,
67 (__v32qi)__B);
6768}
6869
6970/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
......@@ -86,7 +87,8 @@ _mm256_dpbusd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
8687static __inline__ __m256i __DEFAULT_FN_ATTRS256
8788_mm256_dpbusds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
8889{
89 return (__m256i)__builtin_ia32_vpdpbusds256((__v8si)__S, (__v8si)__A, (__v8si)__B);
90 return (__m256i)__builtin_ia32_vpdpbusds256((__v8si)__S, (__v32qu)__A,
91 (__v32qi)__B);
9092}
9193
9294/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
......@@ -107,7 +109,8 @@ _mm256_dpbusds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
107109static __inline__ __m256i __DEFAULT_FN_ATTRS256
108110_mm256_dpwssd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
109111{
110 return (__m256i)__builtin_ia32_vpdpwssd256((__v8si)__S, (__v8si)__A, (__v8si)__B);
112 return (__m256i)__builtin_ia32_vpdpwssd256((__v8si)__S, (__v16hi)__A,
113 (__v16hi)__B);
111114}
112115
113116/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
......@@ -128,7 +131,8 @@ _mm256_dpwssd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
128131static __inline__ __m256i __DEFAULT_FN_ATTRS256
129132_mm256_dpwssds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
130133{
131 return (__m256i)__builtin_ia32_vpdpwssds256((__v8si)__S, (__v8si)__A, (__v8si)__B);
134 return (__m256i)__builtin_ia32_vpdpwssds256((__v8si)__S, (__v16hi)__A,
135 (__v16hi)__B);
132136}
133137
134138/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
......@@ -151,7 +155,8 @@ _mm256_dpwssds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
151155static __inline__ __m128i __DEFAULT_FN_ATTRS128
152156_mm_dpbusd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
153157{
154 return (__m128i)__builtin_ia32_vpdpbusd128((__v4si)__S, (__v4si)__A, (__v4si)__B);
158 return (__m128i)__builtin_ia32_vpdpbusd128((__v4si)__S, (__v16qu)__A,
159 (__v16qi)__B);
155160}
156161
157162/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
......@@ -174,7 +179,8 @@ _mm_dpbusd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
174179static __inline__ __m128i __DEFAULT_FN_ATTRS128
175180_mm_dpbusds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
176181{
177 return (__m128i)__builtin_ia32_vpdpbusds128((__v4si)__S, (__v4si)__A, (__v4si)__B);
182 return (__m128i)__builtin_ia32_vpdpbusds128((__v4si)__S, (__v16qu)__A,
183 (__v16qi)__B);
178184}
179185
180186/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
......@@ -195,7 +201,8 @@ _mm_dpbusds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
195201static __inline__ __m128i __DEFAULT_FN_ATTRS128
196202_mm_dpwssd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
197203{
198 return (__m128i)__builtin_ia32_vpdpwssd128((__v4si)__S, (__v4si)__A, (__v4si)__B);
204 return (__m128i)__builtin_ia32_vpdpwssd128((__v4si)__S, (__v8hi)__A,
205 (__v8hi)__B);
199206}
200207
201208/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
......@@ -216,7 +223,8 @@ _mm_dpwssd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
216223static __inline__ __m128i __DEFAULT_FN_ATTRS128
217224_mm_dpwssds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
218225{
219 return (__m128i)__builtin_ia32_vpdpwssds128((__v4si)__S, (__v4si)__A, (__v4si)__B);
226 return (__m128i)__builtin_ia32_vpdpwssds128((__v4si)__S, (__v8hi)__A,
227 (__v8hi)__B);
220228}
221229
222230#undef __DEFAULT_FN_ATTRS128
lib/include/cpuid.h+101-4
......@@ -253,10 +253,6 @@
253253#define bit_RDPRU 0x00000010
254254#define bit_WBNOINVD 0x00000200
255255
256/* Features in %ebx for leaf 0x24 */
257#define bit_AVX10_256 0x00020000
258#define bit_AVX10_512 0x00040000
259
260256#ifdef __i386__
261257#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx) \
262258 __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
......@@ -282,6 +278,24 @@
282278 : "0"(__leaf), "2"(__count))
283279#endif
284280
281/// Queries the processor to determine the highest supported \c CPUID leaf.
282/// This intrinsic is only available on x86 and x64.
283///
284/// \headerfile <cpuid.h>
285///
286/// This intrinsic corresponds to the <c> CPUID </c> instruction.
287///
288/// \param __leaf
289/// \a __leaf can be either 0x0 or 0x8000000. If \a __leaf == 0x0, the
290/// highest supported value for basic \c CPUID information is returned.
291/// If \a __leaf == 0x8000000, the highest supported value for extended
292/// \c CPUID information is returned.
293/// \param __sig
294/// If the \a __sig pointer is non-null, the first four bytes of the
295/// signature (as found in the \c EBX register) are returned in the
296/// location pointed to by \a __sig.
297/// \returns Returns 0 if \c CPUID is supported; otherwise returns the value
298/// that \c CPUID returns in the \c EAX register.
285299static __inline unsigned int __get_cpuid_max (unsigned int __leaf,
286300 unsigned int *__sig)
287301{
......@@ -315,6 +329,32 @@ static __inline unsigned int __get_cpuid_max (unsigned int __leaf,
315329 return __eax;
316330}
317331
332/// For the requested \c CPUID leaf, queries the processor for information
333/// about the CPU type and CPU features (such as processor vendor, supported
334/// instruction sets, CPU capabilities, cache sizes, CPU model and family, and
335/// other hardware details). This intrinsic is only available on x86 and x64.
336///
337/// \headerfile <cpuid.h>
338///
339/// This intrinsic corresponds to the <c> CPUID </c> instruction.
340///
341/// \param __leaf
342/// An unsigned integer that identifies the level (also called "leaf") at
343/// which the \c CPUID instruction will be executed.
344/// \param __eax
345/// A pointer to an integer that corresponds to the \c EAX register where
346/// \c CPUID stores output results.
347/// \param __ebx
348/// A pointer to an integer that corresponds to the \c EBX register where
349/// \c CPUID stores output results.
350/// \param __ecx
351/// A pointer to an integer that corresponds to the \c ECX register where
352/// \c CPUID stores output results.
353/// \param __edx
354/// A pointer to an integer that corresponds to the \c EDX register where
355/// \c CPUID stores output results.
356/// \returns Returns 1 if the requested \c CPUID leaf is supported; otherwise
357/// returns 0.
318358static __inline int __get_cpuid (unsigned int __leaf, unsigned int *__eax,
319359 unsigned int *__ebx, unsigned int *__ecx,
320360 unsigned int *__edx)
......@@ -328,6 +368,36 @@ static __inline int __get_cpuid (unsigned int __leaf, unsigned int *__eax,
328368 return 1;
329369}
330370
371/// For the requested \c CPUID leaf and subleaf, queries the processor for
372/// information about the CPU type and CPU features (such as processor vendor,
373/// supported instruction sets, CPU capabilities, cache sizes, CPU model and
374/// family, and other hardware details). This intrinsic is only available on
375/// x86 and x64.
376///
377/// \headerfile <cpuid.h>
378///
379/// This intrinsic corresponds to the <c> CPUID </c> instruction.
380///
381/// \param __leaf
382/// An unsigned integer that identifies the level (also called "leaf") at
383/// which the \c CPUID instruction will be executed.
384/// \param __subleaf
385/// An unsigned integer that identifies the sublevel (also called
386/// "subleaf") at which the \c CPUID instruction will be executed.
387/// \param __eax
388/// A pointer to an integer that corresponds to the \c EAX register where
389/// \c CPUID stores output results.
390/// \param __ebx
391/// A pointer to an integer that corresponds to the \c EBX register where
392/// \c CPUID stores output results.
393/// \param __ecx
394/// A pointer to an integer that corresponds to the \c ECX register where
395/// \c CPUID stores output results.
396/// \param __edx
397/// A pointer to an integer that corresponds to the \c EDX register where
398/// \c CPUID stores output results.
399/// \returns Returns 1 if the requested \c CPUID leaf is supported; otherwise
400/// returns 0.
331401static __inline int __get_cpuid_count (unsigned int __leaf,
332402 unsigned int __subleaf,
333403 unsigned int *__eax, unsigned int *__ebx,
......@@ -345,10 +415,37 @@ static __inline int __get_cpuid_count (unsigned int __leaf,
345415// In some configurations, __cpuidex is defined as a builtin (primarily
346416// -fms-extensions) which will conflict with the __cpuidex definition below.
347417#if !(__has_builtin(__cpuidex))
418// In some cases, offloading will set the host as the aux triple and define the
419// builtin. Given __has_builtin does not detect builtins on aux triples, we need
420// to explicitly check for some offloading cases.
421#if !defined(__NVPTX__) && !defined(__AMDGPU__) && !defined(__SPIRV__)
422/// Executes the \c CPUID instruction with the specified leaf and subleaf
423/// values, and returns the results from the CPU's registers. This intrinsic
424/// is only available on x86 and x64.
425///
426/// \headerfile <cpuid.h>
427///
428/// This intrinsic corresponds to the <c> CPUID </c> instruction.
429///
430/// \param __cpu_info
431/// An output array of four integers:
432/// <ul>
433/// <li>\a __cpuInfo[0] receives the value of the \c EAX register.</li>
434/// <li>\a __cpuInfo[1] receives the value of the \c EBX register.</li>
435/// <li>\a __cpuInfo[2] receives the value of the \c ECX register.</li>
436/// <li>\a __cpuInfo[3] receives the value of the \c EDX register.</li>
437/// </ul>
438/// \param __leaf
439/// An unsigned integer that identifies the level (also called the "leaf")
440/// at which the \c CPUID instruction will be executed.
441/// \param __subleaf
442/// An unsigned integer that identifies the sublevel (also called the
443/// "subleaf") at which the \c CPUID instruction will be executed.
348444static __inline void __cpuidex(int __cpu_info[4], int __leaf, int __subleaf) {
349445 __cpuid_count(__leaf, __subleaf, __cpu_info[0], __cpu_info[1], __cpu_info[2],
350446 __cpu_info[3]);
351447}
352448#endif
449#endif
353450
354451#endif /* __CPUID_H */
lib/include/emmintrin.h+168-168
......@@ -17,7 +17,6 @@
1717#include <xmmintrin.h>
1818
1919typedef double __m128d __attribute__((__vector_size__(16), __aligned__(16)));
20typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16)));
2120
2221typedef double __m128d_u __attribute__((__vector_size__(16), __aligned__(1)));
2322typedef long long __m128i_u
......@@ -25,14 +24,9 @@ typedef long long __m128i_u
2524
2625/* Type defines. */
2726typedef double __v2df __attribute__((__vector_size__(16)));
28typedef long long __v2di __attribute__((__vector_size__(16)));
29typedef short __v8hi __attribute__((__vector_size__(16)));
30typedef char __v16qi __attribute__((__vector_size__(16)));
3127
3228/* Unsigned types */
3329typedef unsigned long long __v2du __attribute__((__vector_size__(16)));
34typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
35typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
3630
3731/* We need an explicitly signed variant for char. Note that this shouldn't
3832 * appear in the interface though. */
......@@ -49,15 +43,9 @@ typedef __bf16 __m128bh __attribute__((__vector_size__(16), __aligned__(16)));
4943#endif
5044
5145/* Define the default attributes for the functions in this file. */
52#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
53#define __DEFAULT_FN_ATTRS \
54 __attribute__((__always_inline__, __nodebug__, \
55 __target__("sse2,no-evex512"), __min_vector_width__(128)))
56#else
5746#define __DEFAULT_FN_ATTRS \
5847 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), \
5948 __min_vector_width__(128)))
60#endif
6149
6250#if defined(__cplusplus) && (__cplusplus >= 201103L)
6351#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
......@@ -67,6 +55,9 @@ typedef __bf16 __m128bh __attribute__((__vector_size__(16), __aligned__(16)));
6755
6856#define __trunc64(x) \
6957 (__m64) __builtin_shufflevector((__v2di)(x), __extension__(__v2di){}, 0)
58#define __zext128(x) \
59 (__m128i) __builtin_shufflevector((__v2si)(x), __extension__(__v2si){}, 0, \
60 1, 2, 3)
7061#define __anyext128(x) \
7162 (__m128i) __builtin_shufflevector((__v2si)(x), __extension__(__v2si){}, 0, \
7263 1, -1, -1)
......@@ -250,8 +241,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_div_pd(__m128d __a,
250241/// bits are copied from the upper 64 bits of operand \a __a.
251242static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sqrt_sd(__m128d __a,
252243 __m128d __b) {
253 __m128d __c = __builtin_ia32_sqrtsd((__v2df)__b);
254 return __extension__(__m128d){__c[0], __a[1]};
244 return __extension__(__m128d){__builtin_elementwise_sqrt(__b[0]), __a[1]};
255245}
256246
257247/// Calculates the square root of the each of two values stored in a
......@@ -266,7 +256,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sqrt_sd(__m128d __a,
266256/// \returns A 128-bit vector of [2 x double] containing the square roots of the
267257/// values in the operand.
268258static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sqrt_pd(__m128d __a) {
269 return __builtin_ia32_sqrtpd((__v2df)__a);
259 return __builtin_elementwise_sqrt(__a);
270260}
271261
272262/// Compares lower 64-bit double-precision values of both operands, and
......@@ -310,8 +300,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_min_sd(__m128d __a,
310300/// A 128-bit vector of [2 x double] containing one of the operands.
311301/// \returns A 128-bit vector of [2 x double] containing the minimum values
312302/// between both operands.
313static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_min_pd(__m128d __a,
314 __m128d __b) {
303static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_min_pd(__m128d __a,
304 __m128d __b) {
315305 return __builtin_ia32_minpd((__v2df)__a, (__v2df)__b);
316306}
317307
......@@ -356,8 +346,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_max_sd(__m128d __a,
356346/// A 128-bit vector of [2 x double] containing one of the operands.
357347/// \returns A 128-bit vector of [2 x double] containing the maximum values
358348/// between both operands.
359static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_max_pd(__m128d __a,
360 __m128d __b) {
349static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_max_pd(__m128d __a,
350 __m128d __b) {
361351 return __builtin_ia32_maxpd((__v2df)__a, (__v2df)__b);
362352}
363353
......@@ -1288,7 +1278,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomineq_sd(__m128d __a,
12881278/// A 128-bit vector of [2 x double].
12891279/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
12901280/// converted values. The upper 64 bits are set to zero.
1291static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cvtpd_ps(__m128d __a) {
1281static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1282_mm_cvtpd_ps(__m128d __a) {
12921283 return __builtin_ia32_cvtpd2ps((__v2df)__a);
12931284}
12941285
......@@ -1393,8 +1384,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_cvtsd_si32(__m128d __a) {
13931384/// \returns A 128-bit vector of [4 x float]. The lower 32 bits contain the
13941385/// converted value from the second parameter. The upper 96 bits are copied
13951386/// from the upper 96 bits of the first parameter.
1396static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cvtsd_ss(__m128 __a,
1397 __m128d __b) {
1387static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1388_mm_cvtsd_ss(__m128 __a, __m128d __b) {
13981389 return (__m128)__builtin_ia32_cvtsd2ss((__v4sf)__a, (__v2df)__b);
13991390}
14001391
......@@ -2068,8 +2059,8 @@ static __inline__ void __DEFAULT_FN_ATTRS _mm_storel_pd(double *__dp,
20682059/// A 128-bit vector of [16 x i8].
20692060/// \returns A 128-bit vector of [16 x i8] containing the sums of both
20702061/// parameters.
2071static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_add_epi8(__m128i __a,
2072 __m128i __b) {
2062static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2063_mm_add_epi8(__m128i __a, __m128i __b) {
20732064 return (__m128i)((__v16qu)__a + (__v16qu)__b);
20742065}
20752066
......@@ -2089,8 +2080,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_add_epi8(__m128i __a,
20892080/// A 128-bit vector of [8 x i16].
20902081/// \returns A 128-bit vector of [8 x i16] containing the sums of both
20912082/// parameters.
2092static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_add_epi16(__m128i __a,
2093 __m128i __b) {
2083static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2084_mm_add_epi16(__m128i __a, __m128i __b) {
20942085 return (__m128i)((__v8hu)__a + (__v8hu)__b);
20952086}
20962087
......@@ -2127,8 +2118,9 @@ _mm_add_epi32(__m128i __a, __m128i __b) {
21272118/// \param __b
21282119/// A 64-bit integer.
21292120/// \returns A 64-bit integer containing the sum of both parameters.
2130static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_add_si64(__m64 __a, __m64 __b) {
2131 return (__m64)(((unsigned long long)__a) + ((unsigned long long)__b));
2121static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_add_si64(__m64 __a,
2122 __m64 __b) {
2123 return (__m64)(((__v1du)__a)[0] + ((__v1du)__b)[0]);
21322124}
21332125
21342126/// Adds the corresponding elements of two 128-bit vectors of [2 x i64],
......@@ -2169,8 +2161,8 @@ _mm_add_epi64(__m128i __a, __m128i __b) {
21692161/// A 128-bit signed [16 x i8] vector.
21702162/// \returns A 128-bit signed [16 x i8] vector containing the saturated sums of
21712163/// both parameters.
2172static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epi8(__m128i __a,
2173 __m128i __b) {
2164static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2165_mm_adds_epi8(__m128i __a, __m128i __b) {
21742166 return (__m128i)__builtin_elementwise_add_sat((__v16qs)__a, (__v16qs)__b);
21752167}
21762168
......@@ -2191,8 +2183,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epi8(__m128i __a,
21912183/// A 128-bit signed [8 x i16] vector.
21922184/// \returns A 128-bit signed [8 x i16] vector containing the saturated sums of
21932185/// both parameters.
2194static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epi16(__m128i __a,
2195 __m128i __b) {
2186static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2187_mm_adds_epi16(__m128i __a, __m128i __b) {
21962188 return (__m128i)__builtin_elementwise_add_sat((__v8hi)__a, (__v8hi)__b);
21972189}
21982190
......@@ -2213,8 +2205,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epi16(__m128i __a,
22132205/// A 128-bit unsigned [16 x i8] vector.
22142206/// \returns A 128-bit unsigned [16 x i8] vector containing the saturated sums
22152207/// of both parameters.
2216static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epu8(__m128i __a,
2217 __m128i __b) {
2208static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2209_mm_adds_epu8(__m128i __a, __m128i __b) {
22182210 return (__m128i)__builtin_elementwise_add_sat((__v16qu)__a, (__v16qu)__b);
22192211}
22202212
......@@ -2235,8 +2227,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epu8(__m128i __a,
22352227/// A 128-bit unsigned [8 x i16] vector.
22362228/// \returns A 128-bit unsigned [8 x i16] vector containing the saturated sums
22372229/// of both parameters.
2238static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epu16(__m128i __a,
2239 __m128i __b) {
2230static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2231_mm_adds_epu16(__m128i __a, __m128i __b) {
22402232 return (__m128i)__builtin_elementwise_add_sat((__v8hu)__a, (__v8hu)__b);
22412233}
22422234
......@@ -2254,9 +2246,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_adds_epu16(__m128i __a,
22542246/// A 128-bit unsigned [16 x i8] vector.
22552247/// \returns A 128-bit unsigned [16 x i8] vector containing the rounded
22562248/// averages of both parameters.
2257static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_avg_epu8(__m128i __a,
2258 __m128i __b) {
2259 return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b);
2249static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2250_mm_avg_epu8(__m128i __a, __m128i __b) {
2251 return (__m128i)__builtin_ia32_pavgb128((__v16qu)__a, (__v16qu)__b);
22602252}
22612253
22622254/// Computes the rounded averages of corresponding elements of two
......@@ -2273,9 +2265,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_avg_epu8(__m128i __a,
22732265/// A 128-bit unsigned [8 x i16] vector.
22742266/// \returns A 128-bit unsigned [8 x i16] vector containing the rounded
22752267/// averages of both parameters.
2276static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_avg_epu16(__m128i __a,
2277 __m128i __b) {
2278 return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b);
2268static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2269_mm_avg_epu16(__m128i __a, __m128i __b) {
2270 return (__m128i)__builtin_ia32_pavgw128((__v8hu)__a, (__v8hu)__b);
22792271}
22802272
22812273/// Multiplies the corresponding elements of two 128-bit signed [8 x i16]
......@@ -2298,8 +2290,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_avg_epu16(__m128i __a,
22982290/// A 128-bit signed [8 x i16] vector.
22992291/// \returns A 128-bit signed [4 x i32] vector containing the sums of products
23002292/// of both parameters.
2301static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_madd_epi16(__m128i __a,
2302 __m128i __b) {
2293static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2294_mm_madd_epi16(__m128i __a, __m128i __b) {
23032295 return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b);
23042296}
23052297
......@@ -2317,8 +2309,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_madd_epi16(__m128i __a,
23172309/// A 128-bit signed [8 x i16] vector.
23182310/// \returns A 128-bit signed [8 x i16] vector containing the greater value of
23192311/// each comparison.
2320static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epi16(__m128i __a,
2321 __m128i __b) {
2312static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2313_mm_max_epi16(__m128i __a, __m128i __b) {
23222314 return (__m128i)__builtin_elementwise_max((__v8hi)__a, (__v8hi)__b);
23232315}
23242316
......@@ -2336,8 +2328,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epi16(__m128i __a,
23362328/// A 128-bit unsigned [16 x i8] vector.
23372329/// \returns A 128-bit unsigned [16 x i8] vector containing the greater value of
23382330/// each comparison.
2339static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epu8(__m128i __a,
2340 __m128i __b) {
2331static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2332_mm_max_epu8(__m128i __a, __m128i __b) {
23412333 return (__m128i)__builtin_elementwise_max((__v16qu)__a, (__v16qu)__b);
23422334}
23432335
......@@ -2355,8 +2347,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epu8(__m128i __a,
23552347/// A 128-bit signed [8 x i16] vector.
23562348/// \returns A 128-bit signed [8 x i16] vector containing the smaller value of
23572349/// each comparison.
2358static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epi16(__m128i __a,
2359 __m128i __b) {
2350static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2351_mm_min_epi16(__m128i __a, __m128i __b) {
23602352 return (__m128i)__builtin_elementwise_min((__v8hi)__a, (__v8hi)__b);
23612353}
23622354
......@@ -2374,8 +2366,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epi16(__m128i __a,
23742366/// A 128-bit unsigned [16 x i8] vector.
23752367/// \returns A 128-bit unsigned [16 x i8] vector containing the smaller value of
23762368/// each comparison.
2377static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epu8(__m128i __a,
2378 __m128i __b) {
2369static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2370_mm_min_epu8(__m128i __a, __m128i __b) {
23792371 return (__m128i)__builtin_elementwise_min((__v16qu)__a, (__v16qu)__b);
23802372}
23812373
......@@ -2393,8 +2385,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epu8(__m128i __a,
23932385/// A 128-bit signed [8 x i16] vector.
23942386/// \returns A 128-bit signed [8 x i16] vector containing the upper 16 bits of
23952387/// each of the eight 32-bit products.
2396static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mulhi_epi16(__m128i __a,
2397 __m128i __b) {
2388static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2389_mm_mulhi_epi16(__m128i __a, __m128i __b) {
23982390 return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b);
23992391}
24002392
......@@ -2412,9 +2404,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mulhi_epi16(__m128i __a,
24122404/// A 128-bit unsigned [8 x i16] vector.
24132405/// \returns A 128-bit unsigned [8 x i16] vector containing the upper 16 bits
24142406/// of each of the eight 32-bit products.
2415static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mulhi_epu16(__m128i __a,
2416 __m128i __b) {
2417 return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b);
2407static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2408_mm_mulhi_epu16(__m128i __a, __m128i __b) {
2409 return (__m128i)__builtin_ia32_pmulhuw128((__v8hu)__a, (__v8hu)__b);
24182410}
24192411
24202412/// Multiplies the corresponding elements of two signed [8 x i16]
......@@ -2431,8 +2423,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mulhi_epu16(__m128i __a,
24312423/// A 128-bit signed [8 x i16] vector.
24322424/// \returns A 128-bit signed [8 x i16] vector containing the lower 16 bits of
24332425/// each of the eight 32-bit products.
2434static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mullo_epi16(__m128i __a,
2435 __m128i __b) {
2426static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2427_mm_mullo_epi16(__m128i __a, __m128i __b) {
24362428 return (__m128i)((__v8hu)__a * (__v8hu)__b);
24372429}
24382430
......@@ -2449,9 +2441,10 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mullo_epi16(__m128i __a,
24492441/// \param __b
24502442/// A 64-bit integer containing one of the source operands.
24512443/// \returns A 64-bit integer vector containing the product of both operands.
2452static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_mul_su32(__m64 __a, __m64 __b) {
2453 return __trunc64(__builtin_ia32_pmuludq128((__v4si)__anyext128(__a),
2454 (__v4si)__anyext128(__b)));
2444static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_mul_su32(__m64 __a,
2445 __m64 __b) {
2446 return __trunc64(__builtin_ia32_pmuludq128((__v4si)__zext128(__a),
2447 (__v4si)__zext128(__b)));
24552448}
24562449
24572450/// Multiplies 32-bit unsigned integer values contained in the lower
......@@ -2467,8 +2460,8 @@ static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_mul_su32(__m64 __a, __m64 __b) {
24672460/// \param __b
24682461/// A [2 x i64] vector containing one of the source operands.
24692462/// \returns A [2 x i64] vector containing the product of both operands.
2470static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mul_epu32(__m128i __a,
2471 __m128i __b) {
2463static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2464_mm_mul_epu32(__m128i __a, __m128i __b) {
24722465 return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b);
24732466}
24742467
......@@ -2505,8 +2498,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sad_epu8(__m128i __a,
25052498/// A 128-bit integer vector containing the subtrahends.
25062499/// \returns A 128-bit integer vector containing the differences of the values
25072500/// in the operands.
2508static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sub_epi8(__m128i __a,
2509 __m128i __b) {
2501static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2502_mm_sub_epi8(__m128i __a, __m128i __b) {
25102503 return (__m128i)((__v16qu)__a - (__v16qu)__b);
25112504}
25122505
......@@ -2522,8 +2515,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sub_epi8(__m128i __a,
25222515/// A 128-bit integer vector containing the subtrahends.
25232516/// \returns A 128-bit integer vector containing the differences of the values
25242517/// in the operands.
2525static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sub_epi16(__m128i __a,
2526 __m128i __b) {
2518static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2519_mm_sub_epi16(__m128i __a, __m128i __b) {
25272520 return (__m128i)((__v8hu)__a - (__v8hu)__b);
25282521}
25292522
......@@ -2557,8 +2550,9 @@ _mm_sub_epi32(__m128i __a, __m128i __b) {
25572550/// A 64-bit integer vector containing the subtrahend.
25582551/// \returns A 64-bit integer vector containing the difference of the values in
25592552/// the operands.
2560static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_sub_si64(__m64 __a, __m64 __b) {
2561 return (__m64)((unsigned long long)__a - (unsigned long long)__b);
2553static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_sub_si64(__m64 __a,
2554 __m64 __b) {
2555 return (__m64)(((__v1du)__a)[0] - ((__v1du)__b)[0]);
25622556}
25632557
25642558/// Subtracts the corresponding elements of two [2 x i64] vectors.
......@@ -2595,8 +2589,8 @@ _mm_sub_epi64(__m128i __a, __m128i __b) {
25952589/// A 128-bit integer vector containing the subtrahends.
25962590/// \returns A 128-bit integer vector containing the differences of the values
25972591/// in the operands.
2598static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epi8(__m128i __a,
2599 __m128i __b) {
2592static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2593_mm_subs_epi8(__m128i __a, __m128i __b) {
26002594 return (__m128i)__builtin_elementwise_sub_sat((__v16qs)__a, (__v16qs)__b);
26012595}
26022596
......@@ -2617,8 +2611,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epi8(__m128i __a,
26172611/// A 128-bit integer vector containing the subtrahends.
26182612/// \returns A 128-bit integer vector containing the differences of the values
26192613/// in the operands.
2620static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epi16(__m128i __a,
2621 __m128i __b) {
2614static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2615_mm_subs_epi16(__m128i __a, __m128i __b) {
26222616 return (__m128i)__builtin_elementwise_sub_sat((__v8hi)__a, (__v8hi)__b);
26232617}
26242618
......@@ -2638,8 +2632,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epi16(__m128i __a,
26382632/// A 128-bit integer vector containing the subtrahends.
26392633/// \returns A 128-bit integer vector containing the unsigned integer
26402634/// differences of the values in the operands.
2641static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epu8(__m128i __a,
2642 __m128i __b) {
2635static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2636_mm_subs_epu8(__m128i __a, __m128i __b) {
26432637 return (__m128i)__builtin_elementwise_sub_sat((__v16qu)__a, (__v16qu)__b);
26442638}
26452639
......@@ -2659,8 +2653,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epu8(__m128i __a,
26592653/// A 128-bit integer vector containing the subtrahends.
26602654/// \returns A 128-bit integer vector containing the unsigned integer
26612655/// differences of the values in the operands.
2662static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epu16(__m128i __a,
2663 __m128i __b) {
2656static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2657_mm_subs_epu16(__m128i __a, __m128i __b) {
26642658 return (__m128i)__builtin_elementwise_sub_sat((__v8hu)__a, (__v8hu)__b);
26652659}
26662660
......@@ -2676,8 +2670,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_subs_epu16(__m128i __a,
26762670/// A 128-bit integer vector containing one of the source operands.
26772671/// \returns A 128-bit integer vector containing the bitwise AND of the values
26782672/// in both operands.
2679static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_and_si128(__m128i __a,
2680 __m128i __b) {
2673static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2674_mm_and_si128(__m128i __a, __m128i __b) {
26812675 return (__m128i)((__v2du)__a & (__v2du)__b);
26822676}
26832677
......@@ -2695,8 +2689,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_and_si128(__m128i __a,
26952689/// A 128-bit vector containing the right source operand.
26962690/// \returns A 128-bit integer vector containing the bitwise AND of the one's
26972691/// complement of the first operand and the values in the second operand.
2698static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_andnot_si128(__m128i __a,
2699 __m128i __b) {
2692static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2693_mm_andnot_si128(__m128i __a, __m128i __b) {
27002694 return (__m128i)(~(__v2du)__a & (__v2du)__b);
27012695}
27022696/// Performs a bitwise OR of two 128-bit integer vectors.
......@@ -2711,8 +2705,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_andnot_si128(__m128i __a,
27112705/// A 128-bit integer vector containing one of the source operands.
27122706/// \returns A 128-bit integer vector containing the bitwise OR of the values
27132707/// in both operands.
2714static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_or_si128(__m128i __a,
2715 __m128i __b) {
2708static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2709_mm_or_si128(__m128i __a, __m128i __b) {
27162710 return (__m128i)((__v2du)__a | (__v2du)__b);
27172711}
27182712
......@@ -2728,8 +2722,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_or_si128(__m128i __a,
27282722/// A 128-bit integer vector containing one of the source operands.
27292723/// \returns A 128-bit integer vector containing the bitwise exclusive OR of the
27302724/// values in both operands.
2731static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_xor_si128(__m128i __a,
2732 __m128i __b) {
2725static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2726_mm_xor_si128(__m128i __a, __m128i __b) {
27332727 return (__m128i)((__v2du)__a ^ (__v2du)__b);
27342728}
27352729
......@@ -2751,11 +2745,11 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_xor_si128(__m128i __a,
27512745/// \a a.
27522746/// \returns A 128-bit integer vector containing the left-shifted value.
27532747#define _mm_slli_si128(a, imm) \
2754 ((__m128i)__builtin_ia32_pslldqi128_byteshift((__v2di)(__m128i)(a), \
2748 ((__m128i)__builtin_ia32_pslldqi128_byteshift((__v16qi)(__m128i)(a), \
27552749 (int)(imm)))
27562750
27572751#define _mm_bslli_si128(a, imm) \
2758 ((__m128i)__builtin_ia32_pslldqi128_byteshift((__v2di)(__m128i)(a), \
2752 ((__m128i)__builtin_ia32_pslldqi128_byteshift((__v16qi)(__m128i)(a), \
27592753 (int)(imm)))
27602754
27612755/// Left-shifts each 16-bit value in the 128-bit integer vector operand
......@@ -2771,8 +2765,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_xor_si128(__m128i __a,
27712765/// An integer value specifying the number of bits to left-shift each value
27722766/// in operand \a __a.
27732767/// \returns A 128-bit integer vector containing the left-shifted values.
2774static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_slli_epi16(__m128i __a,
2775 int __count) {
2768static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2769_mm_slli_epi16(__m128i __a, int __count) {
27762770 return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count);
27772771}
27782772
......@@ -2789,8 +2783,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_slli_epi16(__m128i __a,
27892783/// A 128-bit integer vector in which bits [63:0] specify the number of bits
27902784/// to left-shift each value in operand \a __a.
27912785/// \returns A 128-bit integer vector containing the left-shifted values.
2792static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sll_epi16(__m128i __a,
2793 __m128i __count) {
2786static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2787_mm_sll_epi16(__m128i __a, __m128i __count) {
27942788 return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count);
27952789}
27962790
......@@ -2807,8 +2801,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sll_epi16(__m128i __a,
28072801/// An integer value specifying the number of bits to left-shift each value
28082802/// in operand \a __a.
28092803/// \returns A 128-bit integer vector containing the left-shifted values.
2810static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_slli_epi32(__m128i __a,
2811 int __count) {
2804static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2805_mm_slli_epi32(__m128i __a, int __count) {
28122806 return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count);
28132807}
28142808
......@@ -2825,8 +2819,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_slli_epi32(__m128i __a,
28252819/// A 128-bit integer vector in which bits [63:0] specify the number of bits
28262820/// to left-shift each value in operand \a __a.
28272821/// \returns A 128-bit integer vector containing the left-shifted values.
2828static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sll_epi32(__m128i __a,
2829 __m128i __count) {
2822static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2823_mm_sll_epi32(__m128i __a, __m128i __count) {
28302824 return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count);
28312825}
28322826
......@@ -2843,8 +2837,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sll_epi32(__m128i __a,
28432837/// An integer value specifying the number of bits to left-shift each value
28442838/// in operand \a __a.
28452839/// \returns A 128-bit integer vector containing the left-shifted values.
2846static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_slli_epi64(__m128i __a,
2847 int __count) {
2840static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2841_mm_slli_epi64(__m128i __a, int __count) {
28482842 return __builtin_ia32_psllqi128((__v2di)__a, __count);
28492843}
28502844
......@@ -2861,8 +2855,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_slli_epi64(__m128i __a,
28612855/// A 128-bit integer vector in which bits [63:0] specify the number of bits
28622856/// to left-shift each value in operand \a __a.
28632857/// \returns A 128-bit integer vector containing the left-shifted values.
2864static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sll_epi64(__m128i __a,
2865 __m128i __count) {
2858static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2859_mm_sll_epi64(__m128i __a, __m128i __count) {
28662860 return __builtin_ia32_psllq128((__v2di)__a, (__v2di)__count);
28672861}
28682862
......@@ -2880,8 +2874,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sll_epi64(__m128i __a,
28802874/// An integer value specifying the number of bits to right-shift each value
28812875/// in operand \a __a.
28822876/// \returns A 128-bit integer vector containing the right-shifted values.
2883static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srai_epi16(__m128i __a,
2884 int __count) {
2877static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2878_mm_srai_epi16(__m128i __a, int __count) {
28852879 return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count);
28862880}
28872881
......@@ -2899,8 +2893,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srai_epi16(__m128i __a,
28992893/// A 128-bit integer vector in which bits [63:0] specify the number of bits
29002894/// to right-shift each value in operand \a __a.
29012895/// \returns A 128-bit integer vector containing the right-shifted values.
2902static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sra_epi16(__m128i __a,
2903 __m128i __count) {
2896static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2897_mm_sra_epi16(__m128i __a, __m128i __count) {
29042898 return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count);
29052899}
29062900
......@@ -2918,8 +2912,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sra_epi16(__m128i __a,
29182912/// An integer value specifying the number of bits to right-shift each value
29192913/// in operand \a __a.
29202914/// \returns A 128-bit integer vector containing the right-shifted values.
2921static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srai_epi32(__m128i __a,
2922 int __count) {
2915static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2916_mm_srai_epi32(__m128i __a, int __count) {
29232917 return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count);
29242918}
29252919
......@@ -2937,8 +2931,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srai_epi32(__m128i __a,
29372931/// A 128-bit integer vector in which bits [63:0] specify the number of bits
29382932/// to right-shift each value in operand \a __a.
29392933/// \returns A 128-bit integer vector containing the right-shifted values.
2940static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sra_epi32(__m128i __a,
2941 __m128i __count) {
2934static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2935_mm_sra_epi32(__m128i __a, __m128i __count) {
29422936 return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count);
29432937}
29442938
......@@ -2960,11 +2954,11 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sra_epi32(__m128i __a,
29602954/// \a a.
29612955/// \returns A 128-bit integer vector containing the right-shifted value.
29622956#define _mm_srli_si128(a, imm) \
2963 ((__m128i)__builtin_ia32_psrldqi128_byteshift((__v2di)(__m128i)(a), \
2957 ((__m128i)__builtin_ia32_psrldqi128_byteshift((__v16qi)(__m128i)(a), \
29642958 (int)(imm)))
29652959
29662960#define _mm_bsrli_si128(a, imm) \
2967 ((__m128i)__builtin_ia32_psrldqi128_byteshift((__v2di)(__m128i)(a), \
2961 ((__m128i)__builtin_ia32_psrldqi128_byteshift((__v16qi)(__m128i)(a), \
29682962 (int)(imm)))
29692963
29702964/// Right-shifts each of 16-bit values in the 128-bit integer vector
......@@ -2980,8 +2974,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sra_epi32(__m128i __a,
29802974/// An integer value specifying the number of bits to right-shift each value
29812975/// in operand \a __a.
29822976/// \returns A 128-bit integer vector containing the right-shifted values.
2983static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srli_epi16(__m128i __a,
2984 int __count) {
2977static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2978_mm_srli_epi16(__m128i __a, int __count) {
29852979 return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count);
29862980}
29872981
......@@ -2998,8 +2992,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srli_epi16(__m128i __a,
29982992/// A 128-bit integer vector in which bits [63:0] specify the number of bits
29992993/// to right-shift each value in operand \a __a.
30002994/// \returns A 128-bit integer vector containing the right-shifted values.
3001static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi16(__m128i __a,
3002 __m128i __count) {
2995static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2996_mm_srl_epi16(__m128i __a, __m128i __count) {
30032997 return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count);
30042998}
30052999
......@@ -3016,8 +3010,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi16(__m128i __a,
30163010/// An integer value specifying the number of bits to right-shift each value
30173011/// in operand \a __a.
30183012/// \returns A 128-bit integer vector containing the right-shifted values.
3019static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srli_epi32(__m128i __a,
3020 int __count) {
3013static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3014_mm_srli_epi32(__m128i __a, int __count) {
30213015 return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count);
30223016}
30233017
......@@ -3034,8 +3028,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srli_epi32(__m128i __a,
30343028/// A 128-bit integer vector in which bits [63:0] specify the number of bits
30353029/// to right-shift each value in operand \a __a.
30363030/// \returns A 128-bit integer vector containing the right-shifted values.
3037static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi32(__m128i __a,
3038 __m128i __count) {
3031static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3032_mm_srl_epi32(__m128i __a, __m128i __count) {
30393033 return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count);
30403034}
30413035
......@@ -3052,8 +3046,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi32(__m128i __a,
30523046/// An integer value specifying the number of bits to right-shift each value
30533047/// in operand \a __a.
30543048/// \returns A 128-bit integer vector containing the right-shifted values.
3055static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srli_epi64(__m128i __a,
3056 int __count) {
3049static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3050_mm_srli_epi64(__m128i __a, int __count) {
30573051 return __builtin_ia32_psrlqi128((__v2di)__a, __count);
30583052}
30593053
......@@ -3070,8 +3064,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srli_epi64(__m128i __a,
30703064/// A 128-bit integer vector in which bits [63:0] specify the number of bits
30713065/// to right-shift each value in operand \a __a.
30723066/// \returns A 128-bit integer vector containing the right-shifted values.
3073static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi64(__m128i __a,
3074 __m128i __count) {
3067static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3068_mm_srl_epi64(__m128i __a, __m128i __count) {
30753069 return __builtin_ia32_psrlq128((__v2di)__a, (__v2di)__count);
30763070}
30773071
......@@ -3089,8 +3083,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi64(__m128i __a,
30893083/// \param __b
30903084/// A 128-bit integer vector.
30913085/// \returns A 128-bit integer vector containing the comparison results.
3092static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi8(__m128i __a,
3093 __m128i __b) {
3086static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3087_mm_cmpeq_epi8(__m128i __a, __m128i __b) {
30943088 return (__m128i)((__v16qi)__a == (__v16qi)__b);
30953089}
30963090
......@@ -3108,8 +3102,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi8(__m128i __a,
31083102/// \param __b
31093103/// A 128-bit integer vector.
31103104/// \returns A 128-bit integer vector containing the comparison results.
3111static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi16(__m128i __a,
3112 __m128i __b) {
3105static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3106_mm_cmpeq_epi16(__m128i __a, __m128i __b) {
31133107 return (__m128i)((__v8hi)__a == (__v8hi)__b);
31143108}
31153109
......@@ -3127,8 +3121,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi16(__m128i __a,
31273121/// \param __b
31283122/// A 128-bit integer vector.
31293123/// \returns A 128-bit integer vector containing the comparison results.
3130static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi32(__m128i __a,
3131 __m128i __b) {
3124static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3125_mm_cmpeq_epi32(__m128i __a, __m128i __b) {
31323126 return (__m128i)((__v4si)__a == (__v4si)__b);
31333127}
31343128
......@@ -3147,8 +3141,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi32(__m128i __a,
31473141/// \param __b
31483142/// A 128-bit integer vector.
31493143/// \returns A 128-bit integer vector containing the comparison results.
3150static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi8(__m128i __a,
3151 __m128i __b) {
3144static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3145_mm_cmpgt_epi8(__m128i __a, __m128i __b) {
31523146 /* This function always performs a signed comparison, but __v16qi is a char
31533147 which may be signed or unsigned, so use __v16qs. */
31543148 return (__m128i)((__v16qs)__a > (__v16qs)__b);
......@@ -3169,8 +3163,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi8(__m128i __a,
31693163/// \param __b
31703164/// A 128-bit integer vector.
31713165/// \returns A 128-bit integer vector containing the comparison results.
3172static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi16(__m128i __a,
3173 __m128i __b) {
3166static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3167_mm_cmpgt_epi16(__m128i __a, __m128i __b) {
31743168 return (__m128i)((__v8hi)__a > (__v8hi)__b);
31753169}
31763170
......@@ -3189,8 +3183,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi16(__m128i __a,
31893183/// \param __b
31903184/// A 128-bit integer vector.
31913185/// \returns A 128-bit integer vector containing the comparison results.
3192static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi32(__m128i __a,
3193 __m128i __b) {
3186static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3187_mm_cmpgt_epi32(__m128i __a, __m128i __b) {
31943188 return (__m128i)((__v4si)__a > (__v4si)__b);
31953189}
31963190
......@@ -3209,8 +3203,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi32(__m128i __a,
32093203/// \param __b
32103204/// A 128-bit integer vector.
32113205/// \returns A 128-bit integer vector containing the comparison results.
3212static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmplt_epi8(__m128i __a,
3213 __m128i __b) {
3206static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3207_mm_cmplt_epi8(__m128i __a, __m128i __b) {
32143208 return _mm_cmpgt_epi8(__b, __a);
32153209}
32163210
......@@ -3229,8 +3223,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmplt_epi8(__m128i __a,
32293223/// \param __b
32303224/// A 128-bit integer vector.
32313225/// \returns A 128-bit integer vector containing the comparison results.
3232static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmplt_epi16(__m128i __a,
3233 __m128i __b) {
3226static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3227_mm_cmplt_epi16(__m128i __a, __m128i __b) {
32343228 return _mm_cmpgt_epi16(__b, __a);
32353229}
32363230
......@@ -3249,8 +3243,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmplt_epi16(__m128i __a,
32493243/// \param __b
32503244/// A 128-bit integer vector.
32513245/// \returns A 128-bit integer vector containing the comparison results.
3252static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmplt_epi32(__m128i __a,
3253 __m128i __b) {
3246static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3247_mm_cmplt_epi32(__m128i __a, __m128i __b) {
32543248 return _mm_cmpgt_epi32(__b, __a);
32553249}
32563250
......@@ -3379,7 +3373,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvttps_epi32(__m128 __a) {
33793373/// \param __a
33803374/// A 32-bit signed integer operand.
33813375/// \returns A 128-bit vector of [4 x i32].
3382static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtsi32_si128(int __a) {
3376static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3377_mm_cvtsi32_si128(int __a) {
33833378 return __extension__(__m128i)(__v4si){__a, 0, 0, 0};
33843379}
33853380
......@@ -3394,7 +3389,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtsi32_si128(int __a) {
33943389/// \param __a
33953390/// A 64-bit signed integer operand containing the value to be converted.
33963391/// \returns A 128-bit vector of [2 x i64] containing the converted value.
3397static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtsi64_si128(long long __a) {
3392static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
3393_mm_cvtsi64_si128(long long __a) {
33983394 return __extension__(__m128i)(__v2di){__a, 0};
33993395}
34003396
......@@ -3409,7 +3405,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtsi64_si128(long long __a) {
34093405/// A vector of [4 x i32]. The least significant 32 bits are moved to the
34103406/// destination.
34113407/// \returns A 32-bit signed integer containing the moved value.
3412static __inline__ int __DEFAULT_FN_ATTRS _mm_cvtsi128_si32(__m128i __a) {
3408static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
3409_mm_cvtsi128_si32(__m128i __a) {
34133410 __v4si __b = (__v4si)__a;
34143411 return __b[0];
34153412}
......@@ -3425,7 +3422,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_cvtsi128_si32(__m128i __a) {
34253422/// A vector of [2 x i64]. The least significant 64 bits are moved to the
34263423/// destination.
34273424/// \returns A 64-bit signed integer containing the moved value.
3428static __inline__ long long __DEFAULT_FN_ATTRS _mm_cvtsi128_si64(__m128i __a) {
3425static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
3426_mm_cvtsi128_si64(__m128i __a) {
34293427 return __a[0];
34303428}
34313429
......@@ -4161,8 +4159,8 @@ void _mm_mfence(void);
41614159/// A 128-bit integer vector of [8 x i16]. The converted [8 x i8] values are
41624160/// written to the higher 64 bits of the result.
41634161/// \returns A 128-bit vector of [16 x i8] containing the converted values.
4164static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packs_epi16(__m128i __a,
4165 __m128i __b) {
4162static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4163_mm_packs_epi16(__m128i __a, __m128i __b) {
41664164 return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b);
41674165}
41684166
......@@ -4184,8 +4182,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packs_epi16(__m128i __a,
41844182/// A 128-bit integer vector of [4 x i32]. The converted [4 x i16] values
41854183/// are written to the higher 64 bits of the result.
41864184/// \returns A 128-bit vector of [8 x i16] containing the converted values.
4187static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packs_epi32(__m128i __a,
4188 __m128i __b) {
4185static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4186_mm_packs_epi32(__m128i __a, __m128i __b) {
41894187 return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b);
41904188}
41914189
......@@ -4207,8 +4205,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packs_epi32(__m128i __a,
42074205/// A 128-bit integer vector of [8 x i16]. The converted [8 x i8] values are
42084206/// written to the higher 64 bits of the result.
42094207/// \returns A 128-bit vector of [16 x i8] containing the converted values.
4210static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packus_epi16(__m128i __a,
4211 __m128i __b) {
4208static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4209_mm_packus_epi16(__m128i __a, __m128i __b) {
42124210 return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b);
42134211}
42144212
......@@ -4282,7 +4280,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packus_epi16(__m128i __a,
42824280/// A 128-bit integer vector containing the values with bits to be extracted.
42834281/// \returns The most significant bits from each 8-bit element in \a __a,
42844282/// written to bits [15:0]. The other bits are assigned zeros.
4285static __inline__ int __DEFAULT_FN_ATTRS _mm_movemask_epi8(__m128i __a) {
4283static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
4284_mm_movemask_epi8(__m128i __a) {
42864285 return __builtin_ia32_pmovmskb128((__v16qi)__a);
42874286}
42884287
......@@ -4415,8 +4414,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_movemask_epi8(__m128i __a) {
44154414/// Bits [119:112] are written to bits [111:104] of the result. \n
44164415/// Bits [127:120] are written to bits [127:120] of the result.
44174416/// \returns A 128-bit vector of [16 x i8] containing the interleaved values.
4418static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi8(__m128i __a,
4419 __m128i __b) {
4417static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4418_mm_unpackhi_epi8(__m128i __a, __m128i __b) {
44204419 return (__m128i)__builtin_shufflevector(
44214420 (__v16qi)__a, (__v16qi)__b, 8, 16 + 8, 9, 16 + 9, 10, 16 + 10, 11,
44224421 16 + 11, 12, 16 + 12, 13, 16 + 13, 14, 16 + 14, 15, 16 + 15);
......@@ -4443,8 +4442,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi8(__m128i __a,
44434442/// Bits [111:96] are written to bits [95:80] of the result. \n
44444443/// Bits [127:112] are written to bits [127:112] of the result.
44454444/// \returns A 128-bit vector of [8 x i16] containing the interleaved values.
4446static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi16(__m128i __a,
4447 __m128i __b) {
4445static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4446_mm_unpackhi_epi16(__m128i __a, __m128i __b) {
44484447 return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8 + 4, 5,
44494448 8 + 5, 6, 8 + 6, 7, 8 + 7);
44504449}
......@@ -4466,8 +4465,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi16(__m128i __a,
44664465/// Bits [95:64] are written to bits [64:32] of the destination. \n
44674466/// Bits [127:96] are written to bits [127:96] of the destination.
44684467/// \returns A 128-bit vector of [4 x i32] containing the interleaved values.
4469static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi32(__m128i __a,
4470 __m128i __b) {
4468static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4469_mm_unpackhi_epi32(__m128i __a, __m128i __b) {
44714470 return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4 + 2, 3,
44724471 4 + 3);
44734472}
......@@ -4487,8 +4486,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi32(__m128i __a,
44874486/// A 128-bit vector of [2 x i64]. \n
44884487/// Bits [127:64] are written to bits [127:64] of the destination.
44894488/// \returns A 128-bit vector of [2 x i64] containing the interleaved values.
4490static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi64(__m128i __a,
4491 __m128i __b) {
4489static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4490_mm_unpackhi_epi64(__m128i __a, __m128i __b) {
44924491 return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 1, 2 + 1);
44934492}
44944493
......@@ -4521,8 +4520,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpackhi_epi64(__m128i __a,
45214520/// Bits [55:48] are written to bits [111:104] of the result. \n
45224521/// Bits [63:56] are written to bits [127:120] of the result.
45234522/// \returns A 128-bit vector of [16 x i8] containing the interleaved values.
4524static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi8(__m128i __a,
4525 __m128i __b) {
4523static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4524_mm_unpacklo_epi8(__m128i __a, __m128i __b) {
45264525 return (__m128i)__builtin_shufflevector(
45274526 (__v16qi)__a, (__v16qi)__b, 0, 16 + 0, 1, 16 + 1, 2, 16 + 2, 3, 16 + 3, 4,
45284527 16 + 4, 5, 16 + 5, 6, 16 + 6, 7, 16 + 7);
......@@ -4550,8 +4549,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi8(__m128i __a,
45504549/// Bits [47:32] are written to bits [95:80] of the result. \n
45514550/// Bits [63:48] are written to bits [127:112] of the result.
45524551/// \returns A 128-bit vector of [8 x i16] containing the interleaved values.
4553static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi16(__m128i __a,
4554 __m128i __b) {
4552static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4553_mm_unpacklo_epi16(__m128i __a, __m128i __b) {
45554554 return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8 + 0, 1,
45564555 8 + 1, 2, 8 + 2, 3, 8 + 3);
45574556}
......@@ -4573,8 +4572,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi16(__m128i __a,
45734572/// Bits [31:0] are written to bits [64:32] of the destination. \n
45744573/// Bits [63:32] are written to bits [127:96] of the destination.
45754574/// \returns A 128-bit vector of [4 x i32] containing the interleaved values.
4576static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi32(__m128i __a,
4577 __m128i __b) {
4575static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4576_mm_unpacklo_epi32(__m128i __a, __m128i __b) {
45784577 return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4 + 0, 1,
45794578 4 + 1);
45804579}
......@@ -4594,8 +4593,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi32(__m128i __a,
45944593/// A 128-bit vector of [2 x i64]. \n
45954594/// Bits [63:0] are written to bits [127:64] of the destination. \n
45964595/// \returns A 128-bit vector of [2 x i64] containing the interleaved values.
4597static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_unpacklo_epi64(__m128i __a,
4598 __m128i __b) {
4596static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4597_mm_unpacklo_epi64(__m128i __a, __m128i __b) {
45994598 return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 0, 2 + 0);
46004599}
46014600
......@@ -4701,7 +4700,8 @@ _mm_unpacklo_pd(__m128d __a, __m128d __b) {
47014700/// be extracted.
47024701/// \returns The sign bits from each of the double-precision elements in \a __a,
47034702/// written to bits [1:0]. The remaining bits are assigned values of zero.
4704static __inline__ int __DEFAULT_FN_ATTRS _mm_movemask_pd(__m128d __a) {
4703static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
4704_mm_movemask_pd(__m128d __a) {
47054705 return __builtin_ia32_movmskpd((__v2df)__a);
47064706}
47074707
lib/include/f16cintrin.h+23-9
......@@ -15,10 +15,21 @@
1515#define __F16CINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, __target__("f16c"), __min_vector_width__(128)))
20#define __DEFAULT_FN_ATTRS256 \
21 __attribute__((__always_inline__, __nodebug__, __target__("f16c"), __min_vector_width__(256)))
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
19#define __DEFAULT_FN_ATTRS128 \
20 __attribute__((__always_inline__, __nodebug__, __target__("f16c"), \
21 __min_vector_width__(128))) constexpr
22#define __DEFAULT_FN_ATTRS256 \
23 __attribute__((__always_inline__, __nodebug__, __target__("f16c"), \
24 __min_vector_width__(256))) constexpr
25#else
26#define __DEFAULT_FN_ATTRS128 \
27 __attribute__((__always_inline__, __nodebug__, __target__("f16c"), \
28 __min_vector_width__(128)))
29#define __DEFAULT_FN_ATTRS256 \
30 __attribute__((__always_inline__, __nodebug__, __target__("f16c"), \
31 __min_vector_width__(256)))
32#endif
2233
2334/* NOTE: Intel documents the 128-bit versions of these as being in emmintrin.h,
2435 * but that's because icc can emulate these without f16c using a library call.
......@@ -38,9 +49,7 @@
3849static __inline float __DEFAULT_FN_ATTRS128
3950_cvtsh_ss(unsigned short __a)
4051{
41 __v8hi __v = {(short)__a, 0, 0, 0, 0, 0, 0, 0};
42 __v4sf __r = __builtin_ia32_vcvtph2ps(__v);
43 return __r[0];
52 return (float)__builtin_bit_cast(__fp16, __a);
4453}
4554
4655/// Converts a 32-bit single-precision float value to a 16-bit
......@@ -109,7 +118,10 @@ _cvtsh_ss(unsigned short __a)
109118static __inline __m128 __DEFAULT_FN_ATTRS128
110119_mm_cvtph_ps(__m128i __a)
111120{
112 return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a);
121 typedef __fp16 __v4fp16 __attribute__((__vector_size__(8)));
122
123 __v4hi __v = __builtin_shufflevector((__v8hi)__a, (__v8hi)__a, 0, 1, 2, 3);
124 return (__m128) __builtin_convertvector((__v4fp16)__v, __v4sf);
113125}
114126
115127/// Converts a 256-bit vector of [8 x float] into a 128-bit vector
......@@ -153,7 +165,9 @@ _mm_cvtph_ps(__m128i __a)
153165static __inline __m256 __DEFAULT_FN_ATTRS256
154166_mm256_cvtph_ps(__m128i __a)
155167{
156 return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
168 typedef __fp16 __v8fp16 __attribute__((__vector_size__(16), __aligned__(16)));
169
170 return (__m256) __builtin_convertvector((__v8fp16)__a, __v8sf);
157171}
158172
159173#undef __DEFAULT_FN_ATTRS128
lib/include/float.h+16-155
......@@ -7,13 +7,21 @@
77 *===-----------------------------------------------------------------------===
88 */
99
10#ifndef __CLANG_FLOAT_H
11#define __CLANG_FLOAT_H
12
1310#if defined(__MVS__) && __has_include_next(<float.h>)
11#include <__float_header_macro.h>
1412#include_next <float.h>
1513#else
1614
15#if !defined(__need_infinity_nan)
16#define __need_float_float
17#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
18 !defined(__STRICT_ANSI__)
19#define __need_infinity_nan
20#endif
21#include <__float_header_macro.h>
22#endif
23
24#ifdef __need_float_float
1725/* If we're on MinGW, fall back to the system's float.h, which might have
1826 * additional definitions provided for Windows.
1927 * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
......@@ -26,162 +34,15 @@
2634
2735# include_next <float.h>
2836
29/* Undefine anything that we'll be redefining below. */
30# undef FLT_EVAL_METHOD
31# undef FLT_ROUNDS
32# undef FLT_RADIX
33# undef FLT_MANT_DIG
34# undef DBL_MANT_DIG
35# undef LDBL_MANT_DIG
36#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
37 !defined(__STRICT_ANSI__) || \
38 (defined(__cplusplus) && __cplusplus >= 201103L) || \
39 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
40# undef DECIMAL_DIG
41# endif
42# undef FLT_DIG
43# undef DBL_DIG
44# undef LDBL_DIG
45# undef FLT_MIN_EXP
46# undef DBL_MIN_EXP
47# undef LDBL_MIN_EXP
48# undef FLT_MIN_10_EXP
49# undef DBL_MIN_10_EXP
50# undef LDBL_MIN_10_EXP
51# undef FLT_MAX_EXP
52# undef DBL_MAX_EXP
53# undef LDBL_MAX_EXP
54# undef FLT_MAX_10_EXP
55# undef DBL_MAX_10_EXP
56# undef LDBL_MAX_10_EXP
57# undef FLT_MAX
58# undef DBL_MAX
59# undef LDBL_MAX
60# undef FLT_EPSILON
61# undef DBL_EPSILON
62# undef LDBL_EPSILON
63# undef FLT_MIN
64# undef DBL_MIN
65# undef LDBL_MIN
66#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
67 !defined(__STRICT_ANSI__) || \
68 (defined(__cplusplus) && __cplusplus >= 201703L) || \
69 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
70# undef FLT_TRUE_MIN
71# undef DBL_TRUE_MIN
72# undef LDBL_TRUE_MIN
73# undef FLT_DECIMAL_DIG
74# undef DBL_DECIMAL_DIG
75# undef LDBL_DECIMAL_DIG
76# undef FLT_HAS_SUBNORM
77# undef DBL_HAS_SUBNORM
78# undef LDBL_HAS_SUBNORM
79# endif
80#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
81 !defined(__STRICT_ANSI__)
82# undef FLT_NORM_MAX
83# undef DBL_NORM_MAX
84# undef LDBL_NORM_MAX
85#endif
86#endif
87
88#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
89 !defined(__STRICT_ANSI__)
90# undef INFINITY
91# undef NAN
92#endif
93
94/* Characteristics of floating point types, C99 5.2.4.2.2 */
95
96#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
97 (defined(__cplusplus) && __cplusplus >= 201103L)
98#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
9937#endif
100#define FLT_ROUNDS (__builtin_flt_rounds())
101#define FLT_RADIX __FLT_RADIX__
102
103#define FLT_MANT_DIG __FLT_MANT_DIG__
104#define DBL_MANT_DIG __DBL_MANT_DIG__
105#define LDBL_MANT_DIG __LDBL_MANT_DIG__
10638
107#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
108 !defined(__STRICT_ANSI__) || \
109 (defined(__cplusplus) && __cplusplus >= 201103L) || \
110 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
111# define DECIMAL_DIG __DECIMAL_DIG__
39#include <__float_float.h>
40#undef __need_float_float
11241#endif
11342
114#define FLT_DIG __FLT_DIG__
115#define DBL_DIG __DBL_DIG__
116#define LDBL_DIG __LDBL_DIG__
117
118#define FLT_MIN_EXP __FLT_MIN_EXP__
119#define DBL_MIN_EXP __DBL_MIN_EXP__
120#define LDBL_MIN_EXP __LDBL_MIN_EXP__
121
122#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
123#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
124#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
125
126#define FLT_MAX_EXP __FLT_MAX_EXP__
127#define DBL_MAX_EXP __DBL_MAX_EXP__
128#define LDBL_MAX_EXP __LDBL_MAX_EXP__
129
130#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
131#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
132#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
133
134#define FLT_MAX __FLT_MAX__
135#define DBL_MAX __DBL_MAX__
136#define LDBL_MAX __LDBL_MAX__
137
138#define FLT_EPSILON __FLT_EPSILON__
139#define DBL_EPSILON __DBL_EPSILON__
140#define LDBL_EPSILON __LDBL_EPSILON__
141
142#define FLT_MIN __FLT_MIN__
143#define DBL_MIN __DBL_MIN__
144#define LDBL_MIN __LDBL_MIN__
145
146#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
147 !defined(__STRICT_ANSI__) || \
148 (defined(__cplusplus) && __cplusplus >= 201703L) || \
149 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
150# define FLT_TRUE_MIN __FLT_DENORM_MIN__
151# define DBL_TRUE_MIN __DBL_DENORM_MIN__
152# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
153# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
154# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
155# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
156# define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
157# define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
158# define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
43#ifdef __need_infinity_nan
44#include <__float_infinity_nan.h>
45#undef __need_infinity_nan
15946#endif
16047
161#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
162 !defined(__STRICT_ANSI__)
163 /* C23 5.2.5.3.3p29-30 */
164# define INFINITY (__builtin_inff())
165# define NAN (__builtin_nanf(""))
166 /* C23 5.2.5.3.3p32 */
167# define FLT_NORM_MAX __FLT_NORM_MAX__
168# define DBL_NORM_MAX __DBL_NORM_MAX__
169# define LDBL_NORM_MAX __LDBL_NORM_MAX__
170#endif
171
172#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
173# define FLT16_MANT_DIG __FLT16_MANT_DIG__
174# define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
175# define FLT16_DIG __FLT16_DIG__
176# define FLT16_MIN_EXP __FLT16_MIN_EXP__
177# define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
178# define FLT16_MAX_EXP __FLT16_MAX_EXP__
179# define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
180# define FLT16_MAX __FLT16_MAX__
181# define FLT16_EPSILON __FLT16_EPSILON__
182# define FLT16_MIN __FLT16_MIN__
183# define FLT16_TRUE_MIN __FLT16_TRUE_MIN__
184#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */
185
18648#endif /* __MVS__ */
187#endif /* __CLANG_FLOAT_H */
lib/include/fma4intrin.h+98-96
......@@ -20,100 +20,100 @@
2020#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("fma4"), __min_vector_width__(128)))
2121#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("fma4"), __min_vector_width__(256)))
2222
23static __inline__ __m128 __DEFAULT_FN_ATTRS128
24_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
25{
26 return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
23#if defined(__cplusplus) && (__cplusplus >= 201103L)
24#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
25#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
26#else
27#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
28#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
29#endif
30
31static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
32_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C) {
33 return (__m128)__builtin_elementwise_fma((__v4sf)__A, (__v4sf)__B,
34 (__v4sf)__C);
2735}
2836
29static __inline__ __m128d __DEFAULT_FN_ATTRS128
30_mm_macc_pd(__m128d __A, __m128d __B, __m128d __C)
31{
32 return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
37static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
38_mm_macc_pd(__m128d __A, __m128d __B, __m128d __C) {
39 return (__m128d)__builtin_elementwise_fma((__v2df)__A, (__v2df)__B,
40 (__v2df)__C);
3341}
3442
35static __inline__ __m128 __DEFAULT_FN_ATTRS128
36_mm_macc_ss(__m128 __A, __m128 __B, __m128 __C)
37{
38 return (__m128)__builtin_ia32_vfmaddss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
43static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
44_mm_macc_ss(__m128 __A, __m128 __B, __m128 __C) {
45 return _mm_set_ss(__builtin_elementwise_fma(__A[0], __B[0], __C[0]));
3946}
4047
41static __inline__ __m128d __DEFAULT_FN_ATTRS128
42_mm_macc_sd(__m128d __A, __m128d __B, __m128d __C)
43{
44 return (__m128d)__builtin_ia32_vfmaddsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
48static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
49_mm_macc_sd(__m128d __A, __m128d __B, __m128d __C) {
50 return _mm_set_sd(__builtin_elementwise_fma(__A[0], __B[0], __C[0]));
4551}
4652
47static __inline__ __m128 __DEFAULT_FN_ATTRS128
48_mm_msub_ps(__m128 __A, __m128 __B, __m128 __C)
49{
50 return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
53static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
54_mm_msub_ps(__m128 __A, __m128 __B, __m128 __C) {
55 return (__m128)__builtin_elementwise_fma((__v4sf)__A, (__v4sf)__B,
56 -(__v4sf)__C);
5157}
5258
53static __inline__ __m128d __DEFAULT_FN_ATTRS128
54_mm_msub_pd(__m128d __A, __m128d __B, __m128d __C)
55{
56 return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
59static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
60_mm_msub_pd(__m128d __A, __m128d __B, __m128d __C) {
61 return (__m128d)__builtin_elementwise_fma((__v2df)__A, (__v2df)__B,
62 -(__v2df)__C);
5763}
5864
59static __inline__ __m128 __DEFAULT_FN_ATTRS128
60_mm_msub_ss(__m128 __A, __m128 __B, __m128 __C)
61{
62 return (__m128)__builtin_ia32_vfmaddss((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
65static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
66_mm_msub_ss(__m128 __A, __m128 __B, __m128 __C) {
67 return _mm_set_ss(__builtin_elementwise_fma(__A[0], __B[0], -__C[0]));
6368}
6469
65static __inline__ __m128d __DEFAULT_FN_ATTRS128
66_mm_msub_sd(__m128d __A, __m128d __B, __m128d __C)
67{
68 return (__m128d)__builtin_ia32_vfmaddsd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
70static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
71_mm_msub_sd(__m128d __A, __m128d __B, __m128d __C) {
72 return _mm_set_sd(__builtin_elementwise_fma(__A[0], __B[0], -__C[0]));
6973}
7074
71static __inline__ __m128 __DEFAULT_FN_ATTRS128
72_mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C)
73{
74 return (__m128)__builtin_ia32_vfmaddps(-(__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
75static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
76_mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C) {
77 return (__m128)__builtin_elementwise_fma(-(__v4sf)__A, (__v4sf)__B,
78 (__v4sf)__C);
7579}
7680
77static __inline__ __m128d __DEFAULT_FN_ATTRS128
78_mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C)
79{
80 return (__m128d)__builtin_ia32_vfmaddpd(-(__v2df)__A, (__v2df)__B, (__v2df)__C);
81static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
82_mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C) {
83 return (__m128d)__builtin_elementwise_fma(-(__v2df)__A, (__v2df)__B,
84 (__v2df)__C);
8185}
8286
83static __inline__ __m128 __DEFAULT_FN_ATTRS128
84_mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C)
85{
86 return (__m128)__builtin_ia32_vfmaddss(-(__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
87static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
88_mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C) {
89 return _mm_set_ss(__builtin_elementwise_fma(-__A[0], __B[0], __C[0]));
8790}
8891
89static __inline__ __m128d __DEFAULT_FN_ATTRS128
90_mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C)
91{
92 return (__m128d)__builtin_ia32_vfmaddsd(-(__v2df)__A, (__v2df)__B, (__v2df)__C);
92static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
93_mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C) {
94 return _mm_set_sd(__builtin_elementwise_fma(-__A[0], __B[0], __C[0]));
9395}
9496
95static __inline__ __m128 __DEFAULT_FN_ATTRS128
96_mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C)
97{
98 return (__m128)__builtin_ia32_vfmaddps(-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
97static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
98_mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C) {
99 return (__m128)__builtin_elementwise_fma(-(__v4sf)__A, (__v4sf)__B,
100 -(__v4sf)__C);
99101}
100102
101static __inline__ __m128d __DEFAULT_FN_ATTRS128
102_mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C)
103{
104 return (__m128d)__builtin_ia32_vfmaddpd(-(__v2df)__A, (__v2df)__B, -(__v2df)__C);
103static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
104_mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C) {
105 return (__m128d)__builtin_elementwise_fma(-(__v2df)__A, (__v2df)__B,
106 -(__v2df)__C);
105107}
106108
107static __inline__ __m128 __DEFAULT_FN_ATTRS128
108_mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C)
109{
110 return (__m128)__builtin_ia32_vfmaddss(-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
109static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
110_mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C) {
111 return _mm_set_ss(__builtin_elementwise_fma(-__A[0], __B[0], -__C[0]));
111112}
112113
113static __inline__ __m128d __DEFAULT_FN_ATTRS128
114_mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C)
115{
116 return (__m128d)__builtin_ia32_vfmaddsd(-(__v2df)__A, (__v2df)__B, -(__v2df)__C);
114static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
115_mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C) {
116 return _mm_set_sd(__builtin_elementwise_fma(-__A[0], __B[0], -__C[0]));
117117}
118118
119119static __inline__ __m128 __DEFAULT_FN_ATTRS128
......@@ -140,52 +140,52 @@ _mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C)
140140 return (__m128d)__builtin_ia32_vfmaddsubpd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
141141}
142142
143static __inline__ __m256 __DEFAULT_FN_ATTRS256
144_mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C)
145{
146 return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
143static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
144_mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C) {
145 return (__m256)__builtin_elementwise_fma((__v8sf)__A, (__v8sf)__B,
146 (__v8sf)__C);
147147}
148148
149static __inline__ __m256d __DEFAULT_FN_ATTRS256
150_mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C)
151{
152 return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
149static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
150_mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C) {
151 return (__m256d)__builtin_elementwise_fma((__v4df)__A, (__v4df)__B,
152 (__v4df)__C);
153153}
154154
155static __inline__ __m256 __DEFAULT_FN_ATTRS256
156_mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C)
157{
158 return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
155static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
156_mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C) {
157 return (__m256)__builtin_elementwise_fma((__v8sf)__A, (__v8sf)__B,
158 -(__v8sf)__C);
159159}
160160
161static __inline__ __m256d __DEFAULT_FN_ATTRS256
162_mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C)
163{
164 return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, -(__v4df)__C);
161static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
162_mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C) {
163 return (__m256d)__builtin_elementwise_fma((__v4df)__A, (__v4df)__B,
164 -(__v4df)__C);
165165}
166166
167static __inline__ __m256 __DEFAULT_FN_ATTRS256
168_mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C)
169{
170 return (__m256)__builtin_ia32_vfmaddps256(-(__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
167static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
168_mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C) {
169 return (__m256)__builtin_elementwise_fma(-(__v8sf)__A, (__v8sf)__B,
170 (__v8sf)__C);
171171}
172172
173static __inline__ __m256d __DEFAULT_FN_ATTRS256
174_mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C)
175{
176 return (__m256d)__builtin_ia32_vfmaddpd256(-(__v4df)__A, (__v4df)__B, (__v4df)__C);
173static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
174_mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C) {
175 return (__m256d)__builtin_elementwise_fma(-(__v4df)__A, (__v4df)__B,
176 (__v4df)__C);
177177}
178178
179static __inline__ __m256 __DEFAULT_FN_ATTRS256
180_mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C)
181{
182 return (__m256)__builtin_ia32_vfmaddps256(-(__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
179static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
180_mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C) {
181 return (__m256)__builtin_elementwise_fma(-(__v8sf)__A, (__v8sf)__B,
182 -(__v8sf)__C);
183183}
184184
185static __inline__ __m256d __DEFAULT_FN_ATTRS256
186_mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C)
187{
188 return (__m256d)__builtin_ia32_vfmaddpd256(-(__v4df)__A, (__v4df)__B, -(__v4df)__C);
185static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
186_mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C) {
187 return (__m256d)__builtin_elementwise_fma(-(__v4df)__A, (__v4df)__B,
188 -(__v4df)__C);
189189}
190190
191191static __inline__ __m256 __DEFAULT_FN_ATTRS256
......@@ -214,5 +214,7 @@ _mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
214214
215215#undef __DEFAULT_FN_ATTRS128
216216#undef __DEFAULT_FN_ATTRS256
217#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
218#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
217219
218220#endif /* __FMA4INTRIN_H */
lib/include/fmaintrin.h+96-66
......@@ -15,8 +15,20 @@
1515#define __FMAINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("fma"), __min_vector_width__(128)))
19#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("fma"), __min_vector_width__(256)))
18#define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, __target__("fma"), \
20 __min_vector_width__(128)))
21#define __DEFAULT_FN_ATTRS256 \
22 __attribute__((__always_inline__, __nodebug__, __target__("fma"), \
23 __min_vector_width__(256)))
24
25#if defined(__cplusplus) && (__cplusplus >= 201103L)
26#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
27#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
28#else
29#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
30#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
31#endif
2032
2133/// Computes a multiply-add of 128-bit vectors of [4 x float].
2234/// For each element, computes <c> (__A * __B) + __C </c>.
......@@ -32,10 +44,11 @@
3244/// \param __C
3345/// A 128-bit vector of [4 x float] containing the addend.
3446/// \returns A 128-bit vector of [4 x float] containing the result.
35static __inline__ __m128 __DEFAULT_FN_ATTRS128
47static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
3648_mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
3749{
38 return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
50 return (__m128)__builtin_elementwise_fma((__v4sf)__A, (__v4sf)__B,
51 (__v4sf)__C);
3952}
4053
4154/// Computes a multiply-add of 128-bit vectors of [2 x double].
......@@ -52,10 +65,11 @@ _mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
5265/// \param __C
5366/// A 128-bit vector of [2 x double] containing the addend.
5467/// \returns A 128-bit [2 x double] vector containing the result.
55static __inline__ __m128d __DEFAULT_FN_ATTRS128
68static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
5669_mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
5770{
58 return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
71 return (__m128d)__builtin_elementwise_fma((__v2df)__A, (__v2df)__B,
72 (__v2df)__C);
5973}
6074
6175/// Computes a scalar multiply-add of the single-precision values in the
......@@ -81,10 +95,10 @@ _mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
8195/// 32 bits.
8296/// \returns A 128-bit vector of [4 x float] containing the result in the low
8397/// 32 bits and a copy of \a __A[127:32] in the upper 96 bits.
84static __inline__ __m128 __DEFAULT_FN_ATTRS128
85_mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
86{
87 return (__m128)__builtin_ia32_vfmaddss3((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
98static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
99_mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C) {
100 __A[0] = __builtin_elementwise_fma(__A[0], __B[0], __C[0]);
101 return __A;
88102}
89103
90104/// Computes a scalar multiply-add of the double-precision values in the
......@@ -110,10 +124,10 @@ _mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
110124/// 64 bits.
111125/// \returns A 128-bit vector of [2 x double] containing the result in the low
112126/// 64 bits and a copy of \a __A[127:64] in the upper 64 bits.
113static __inline__ __m128d __DEFAULT_FN_ATTRS128
114_mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
115{
116 return (__m128d)__builtin_ia32_vfmaddsd3((__v2df)__A, (__v2df)__B, (__v2df)__C);
127static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
128_mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C) {
129 __A[0] = __builtin_elementwise_fma(__A[0], __B[0], __C[0]);
130 return __A;
117131}
118132
119133/// Computes a multiply-subtract of 128-bit vectors of [4 x float].
......@@ -130,10 +144,11 @@ _mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
130144/// \param __C
131145/// A 128-bit vector of [4 x float] containing the subtrahend.
132146/// \returns A 128-bit vector of [4 x float] containing the result.
133static __inline__ __m128 __DEFAULT_FN_ATTRS128
147static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
134148_mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
135149{
136 return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
150 return (__m128)__builtin_elementwise_fma((__v4sf)__A, (__v4sf)__B,
151 -(__v4sf)__C);
137152}
138153
139154/// Computes a multiply-subtract of 128-bit vectors of [2 x double].
......@@ -150,10 +165,11 @@ _mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
150165/// \param __C
151166/// A 128-bit vector of [2 x double] containing the addend.
152167/// \returns A 128-bit vector of [2 x double] containing the result.
153static __inline__ __m128d __DEFAULT_FN_ATTRS128
168static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
154169_mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
155170{
156 return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
171 return (__m128d)__builtin_elementwise_fma((__v2df)__A, (__v2df)__B,
172 -(__v2df)__C);
157173}
158174
159175/// Computes a scalar multiply-subtract of the single-precision values in
......@@ -179,10 +195,10 @@ _mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
179195/// 32 bits.
180196/// \returns A 128-bit vector of [4 x float] containing the result in the low
181197/// 32 bits, and a copy of \a __A[127:32] in the upper 96 bits.
182static __inline__ __m128 __DEFAULT_FN_ATTRS128
183_mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
184{
185 return (__m128)__builtin_ia32_vfmaddss3((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
198static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
199_mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C) {
200 __A[0] = __builtin_elementwise_fma(__A[0], __B[0], -__C[0]);
201 return __A;
186202}
187203
188204/// Computes a scalar multiply-subtract of the double-precision values in
......@@ -208,10 +224,10 @@ _mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
208224/// 64 bits.
209225/// \returns A 128-bit vector of [2 x double] containing the result in the low
210226/// 64 bits, and a copy of \a __A[127:64] in the upper 64 bits.
211static __inline__ __m128d __DEFAULT_FN_ATTRS128
212_mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
213{
214 return (__m128d)__builtin_ia32_vfmaddsd3((__v2df)__A, (__v2df)__B, -(__v2df)__C);
227static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
228_mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C) {
229 __A[0] = __builtin_elementwise_fma(__A[0], __B[0], -__C[0]);
230 return __A;
215231}
216232
217233/// Computes a negated multiply-add of 128-bit vectors of [4 x float].
......@@ -228,10 +244,11 @@ _mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
228244/// \param __C
229245/// A 128-bit vector of [4 x float] containing the addend.
230246/// \returns A 128-bit [4 x float] vector containing the result.
231static __inline__ __m128 __DEFAULT_FN_ATTRS128
247static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
232248_mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
233249{
234 return (__m128)__builtin_ia32_vfmaddps(-(__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
250 return (__m128)__builtin_elementwise_fma(-(__v4sf)__A, (__v4sf)__B,
251 (__v4sf)__C);
235252}
236253
237254/// Computes a negated multiply-add of 128-bit vectors of [2 x double].
......@@ -248,10 +265,11 @@ _mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
248265/// \param __C
249266/// A 128-bit vector of [2 x double] containing the addend.
250267/// \returns A 128-bit vector of [2 x double] containing the result.
251static __inline__ __m128d __DEFAULT_FN_ATTRS128
268static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
252269_mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
253270{
254 return (__m128d)__builtin_ia32_vfmaddpd(-(__v2df)__A, (__v2df)__B, (__v2df)__C);
271 return (__m128d)__builtin_elementwise_fma(-(__v2df)__A, (__v2df)__B,
272 (__v2df)__C);
255273}
256274
257275/// Computes a scalar negated multiply-add of the single-precision values in
......@@ -277,10 +295,10 @@ _mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
277295/// 32 bits.
278296/// \returns A 128-bit vector of [4 x float] containing the result in the low
279297/// 32 bits, and a copy of \a __A[127:32] in the upper 96 bits.
280static __inline__ __m128 __DEFAULT_FN_ATTRS128
281_mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
282{
283 return (__m128)__builtin_ia32_vfmaddss3((__v4sf)__A, -(__v4sf)__B, (__v4sf)__C);
298static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
299_mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C) {
300 __A[0] = __builtin_elementwise_fma(__A[0], -__B[0], __C[0]);
301 return __A;
284302}
285303
286304/// Computes a scalar negated multiply-add of the double-precision values
......@@ -306,10 +324,10 @@ _mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
306324/// 64 bits.
307325/// \returns A 128-bit vector of [2 x double] containing the result in the low
308326/// 64 bits, and a copy of \a __A[127:64] in the upper 64 bits.
309static __inline__ __m128d __DEFAULT_FN_ATTRS128
310_mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
311{
312 return (__m128d)__builtin_ia32_vfmaddsd3((__v2df)__A, -(__v2df)__B, (__v2df)__C);
327static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
328_mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C) {
329 __A[0] = __builtin_elementwise_fma(__A[0], -__B[0], __C[0]);
330 return __A;
313331}
314332
315333/// Computes a negated multiply-subtract of 128-bit vectors of [4 x float].
......@@ -326,10 +344,11 @@ _mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
326344/// \param __C
327345/// A 128-bit vector of [4 x float] containing the subtrahend.
328346/// \returns A 128-bit vector of [4 x float] containing the result.
329static __inline__ __m128 __DEFAULT_FN_ATTRS128
347static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
330348_mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
331349{
332 return (__m128)__builtin_ia32_vfmaddps(-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
350 return (__m128)__builtin_elementwise_fma(-(__v4sf)__A, (__v4sf)__B,
351 -(__v4sf)__C);
333352}
334353
335354/// Computes a negated multiply-subtract of 128-bit vectors of [2 x double].
......@@ -346,10 +365,11 @@ _mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
346365/// \param __C
347366/// A 128-bit vector of [2 x double] containing the subtrahend.
348367/// \returns A 128-bit vector of [2 x double] containing the result.
349static __inline__ __m128d __DEFAULT_FN_ATTRS128
368static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
350369_mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
351370{
352 return (__m128d)__builtin_ia32_vfmaddpd(-(__v2df)__A, (__v2df)__B, -(__v2df)__C);
371 return (__m128d)__builtin_elementwise_fma(-(__v2df)__A, (__v2df)__B,
372 -(__v2df)__C);
353373}
354374
355375/// Computes a scalar negated multiply-subtract of the single-precision
......@@ -375,10 +395,10 @@ _mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
375395/// 32 bits.
376396/// \returns A 128-bit vector of [4 x float] containing the result in the low
377397/// 32 bits, and a copy of \a __A[127:32] in the upper 96 bits.
378static __inline__ __m128 __DEFAULT_FN_ATTRS128
379_mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
380{
381 return (__m128)__builtin_ia32_vfmaddss3((__v4sf)__A, -(__v4sf)__B, -(__v4sf)__C);
398static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
399_mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C) {
400 __A[0] = __builtin_elementwise_fma(__A[0], -__B[0], -__C[0]);
401 return __A;
382402}
383403
384404/// Computes a scalar negated multiply-subtract of the double-precision
......@@ -404,10 +424,10 @@ _mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
404424/// 64 bits.
405425/// \returns A 128-bit vector of [2 x double] containing the result in the low
406426/// 64 bits, and a copy of \a __A[127:64] in the upper 64 bits.
407static __inline__ __m128d __DEFAULT_FN_ATTRS128
408_mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C)
409{
410 return (__m128d)__builtin_ia32_vfmaddsd3((__v2df)__A, -(__v2df)__B, -(__v2df)__C);
427static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
428_mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C) {
429 __A[0] = __builtin_elementwise_fma(__A[0], -__B[0], -__C[0]);
430 return __A;
411431}
412432
413433/// Computes a multiply with alternating add/subtract of 128-bit vectors of
......@@ -528,10 +548,11 @@ _mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C)
528548/// \param __C
529549/// A 256-bit vector of [8 x float] containing the addend.
530550/// \returns A 256-bit vector of [8 x float] containing the result.
531static __inline__ __m256 __DEFAULT_FN_ATTRS256
551static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
532552_mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
533553{
534 return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
554 return (__m256)__builtin_elementwise_fma((__v8sf)__A, (__v8sf)__B,
555 (__v8sf)__C);
535556}
536557
537558/// Computes a multiply-add of 256-bit vectors of [4 x double].
......@@ -548,10 +569,11 @@ _mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
548569/// \param __C
549570/// A 256-bit vector of [4 x double] containing the addend.
550571/// \returns A 256-bit vector of [4 x double] containing the result.
551static __inline__ __m256d __DEFAULT_FN_ATTRS256
572static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
552573_mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
553574{
554 return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
575 return (__m256d)__builtin_elementwise_fma((__v4df)__A, (__v4df)__B,
576 (__v4df)__C);
555577}
556578
557579/// Computes a multiply-subtract of 256-bit vectors of [8 x float].
......@@ -568,10 +590,11 @@ _mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
568590/// \param __C
569591/// A 256-bit vector of [8 x float] containing the subtrahend.
570592/// \returns A 256-bit vector of [8 x float] containing the result.
571static __inline__ __m256 __DEFAULT_FN_ATTRS256
593static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
572594_mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
573595{
574 return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
596 return (__m256)__builtin_elementwise_fma((__v8sf)__A, (__v8sf)__B,
597 -(__v8sf)__C);
575598}
576599
577600/// Computes a multiply-subtract of 256-bit vectors of [4 x double].
......@@ -588,10 +611,11 @@ _mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
588611/// \param __C
589612/// A 256-bit vector of [4 x double] containing the subtrahend.
590613/// \returns A 256-bit vector of [4 x double] containing the result.
591static __inline__ __m256d __DEFAULT_FN_ATTRS256
614static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
592615_mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
593616{
594 return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, -(__v4df)__C);
617 return (__m256d)__builtin_elementwise_fma((__v4df)__A, (__v4df)__B,
618 -(__v4df)__C);
595619}
596620
597621/// Computes a negated multiply-add of 256-bit vectors of [8 x float].
......@@ -608,10 +632,11 @@ _mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
608632/// \param __C
609633/// A 256-bit vector of [8 x float] containing the addend.
610634/// \returns A 256-bit vector of [8 x float] containing the result.
611static __inline__ __m256 __DEFAULT_FN_ATTRS256
635static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
612636_mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
613637{
614 return (__m256)__builtin_ia32_vfmaddps256(-(__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
638 return (__m256)__builtin_elementwise_fma(-(__v8sf)__A, (__v8sf)__B,
639 (__v8sf)__C);
615640}
616641
617642/// Computes a negated multiply-add of 256-bit vectors of [4 x double].
......@@ -628,10 +653,11 @@ _mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
628653/// \param __C
629654/// A 256-bit vector of [4 x double] containing the addend.
630655/// \returns A 256-bit vector of [4 x double] containing the result.
631static __inline__ __m256d __DEFAULT_FN_ATTRS256
656static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
632657_mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
633658{
634 return (__m256d)__builtin_ia32_vfmaddpd256(-(__v4df)__A, (__v4df)__B, (__v4df)__C);
659 return (__m256d)__builtin_elementwise_fma(-(__v4df)__A, (__v4df)__B,
660 (__v4df)__C);
635661}
636662
637663/// Computes a negated multiply-subtract of 256-bit vectors of [8 x float].
......@@ -648,10 +674,11 @@ _mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
648674/// \param __C
649675/// A 256-bit vector of [8 x float] containing the subtrahend.
650676/// \returns A 256-bit vector of [8 x float] containing the result.
651static __inline__ __m256 __DEFAULT_FN_ATTRS256
677static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
652678_mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
653679{
654 return (__m256)__builtin_ia32_vfmaddps256(-(__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
680 return (__m256)__builtin_elementwise_fma(-(__v8sf)__A, (__v8sf)__B,
681 -(__v8sf)__C);
655682}
656683
657684/// Computes a negated multiply-subtract of 256-bit vectors of [4 x double].
......@@ -668,10 +695,11 @@ _mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
668695/// \param __C
669696/// A 256-bit vector of [4 x double] containing the subtrahend.
670697/// \returns A 256-bit vector of [4 x double] containing the result.
671static __inline__ __m256d __DEFAULT_FN_ATTRS256
698static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
672699_mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C)
673700{
674 return (__m256d)__builtin_ia32_vfmaddpd256(-(__v4df)__A, (__v4df)__B, -(__v4df)__C);
701 return (__m256d)__builtin_elementwise_fma(-(__v4df)__A, (__v4df)__B,
702 -(__v4df)__C);
675703}
676704
677705/// Computes a multiply with alternating add/subtract of 256-bit vectors of
......@@ -792,5 +820,7 @@ _mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
792820
793821#undef __DEFAULT_FN_ATTRS128
794822#undef __DEFAULT_FN_ATTRS256
823#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
824#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
795825
796826#endif /* __FMAINTRIN_H */
lib/include/gfniintrin.h+21-16
......@@ -14,29 +14,36 @@
1414#ifndef __GFNIINTRIN_H
1515#define __GFNIINTRIN_H
1616
17#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
1817/* Default attributes for simple form (no masking). */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
1919#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("gfni,no-evex512"), __min_vector_width__(128)))
20 __attribute__((__always_inline__, __nodebug__, __target__("gfni"), \
21 __min_vector_width__(128))) constexpr
2222
2323/* Default attributes for YMM unmasked form. */
2424#define __DEFAULT_FN_ATTRS_Y \
25 __attribute__((__always_inline__, __nodebug__, \
26 __target__("avx,gfni,no-evex512"), \
27 __min_vector_width__(256)))
25 __attribute__((__always_inline__, __nodebug__, __target__("avx,gfni"), \
26 __min_vector_width__(256))) constexpr
2827
2928/* Default attributes for VLX masked forms. */
3029#define __DEFAULT_FN_ATTRS_VL128 \
3130 __attribute__((__always_inline__, __nodebug__, \
32 __target__("avx512bw,avx512vl,gfni,no-evex512"), \
33 __min_vector_width__(128)))
31 __target__("avx512bw,avx512vl,gfni"), \
32 __min_vector_width__(128))) constexpr
3433#define __DEFAULT_FN_ATTRS_VL256 \
3534 __attribute__((__always_inline__, __nodebug__, \
36 __target__("avx512bw,avx512vl,gfni,no-evex512"), \
37 __min_vector_width__(256)))
35 __target__("avx512bw,avx512vl,gfni"), \
36 __min_vector_width__(256))) constexpr
37
38/* Default attributes for ZMM unmasked forms. */
39#define __DEFAULT_FN_ATTRS_Z \
40 __attribute__((__always_inline__, __nodebug__, __target__("avx512f,gfni"), \
41 __min_vector_width__(512))) constexpr
42/* Default attributes for ZMM masked forms. */
43#define __DEFAULT_FN_ATTRS_Z_MASK \
44 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,gfni"), \
45 __min_vector_width__(512))) constexpr
3846#else
39/* Default attributes for simple form (no masking). */
4047#define __DEFAULT_FN_ATTRS \
4148 __attribute__((__always_inline__, __nodebug__, __target__("gfni"), \
4249 __min_vector_width__(128)))
......@@ -55,18 +62,16 @@
5562 __attribute__((__always_inline__, __nodebug__, \
5663 __target__("avx512bw,avx512vl,gfni"), \
5764 __min_vector_width__(256)))
58#endif
5965
6066/* Default attributes for ZMM unmasked forms. */
6167#define __DEFAULT_FN_ATTRS_Z \
62 __attribute__((__always_inline__, __nodebug__, \
63 __target__("avx512f,evex512,gfni"), \
68 __attribute__((__always_inline__, __nodebug__, __target__("avx512f,gfni"), \
6469 __min_vector_width__(512)))
6570/* Default attributes for ZMM masked forms. */
6671#define __DEFAULT_FN_ATTRS_Z_MASK \
67 __attribute__((__always_inline__, __nodebug__, \
68 __target__("avx512bw,evex512,gfni"), \
72 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,gfni"), \
6973 __min_vector_width__(512)))
74#endif
7075
7176#define _mm_gf2p8affineinv_epi64_epi8(A, B, I) \
7277 ((__m128i)__builtin_ia32_vgf2p8affineinvqb_v16qi((__v16qi)(__m128i)(A), \
lib/include/hexagon_types.h+23-20
......@@ -11,6 +11,11 @@
1111
1212#include <hexagon_protos.h>
1313
14// Save and undefine B0 to avoid conflicts with POSIX termios.h which
15// defines B0 as a macro for baud rate 0.
16#pragma push_macro("B0")
17#undef B0
18
1419/* Hexagon names */
1520#define HEXAGON_Vect HEXAGON_Vect64
1621#define HEXAGON_V_GET_D HEXAGON_V64_GET_D
......@@ -697,9 +702,8 @@ public:
697702 };
698703
699704 // Extract byte methods
700 signed char B0(void) {
701 return HEXAGON_V64_GET_B0(data);
702 };
705 signed char b0(void) { return HEXAGON_V64_GET_B0(data); };
706 signed char B0(void) { return b0(); };
703707 signed char B1(void) {
704708 return HEXAGON_V64_GET_B1(data);
705709 };
......@@ -776,9 +780,10 @@ public:
776780 };
777781
778782 // Set byte methods
779 HEXAGON_Vect64C B0(signed char b) {
783 HEXAGON_Vect64C b0(signed char b) {
780784 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B0(data, b));
781785 };
786 HEXAGON_Vect64C B0(signed char b) { return b0(b); };
782787 HEXAGON_Vect64C B1(signed char b) {
783788 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B1(data, b));
784789 };
......@@ -1121,9 +1126,8 @@ public:
11211126 };
11221127
11231128 // Extract byte methods
1124 signed char B0(void) {
1125 return HEXAGON_V32_GET_B0(data);
1126 };
1129 signed char b0(void) { return HEXAGON_V32_GET_B0(data); };
1130 signed char B0(void) { return b0(); };
11271131 signed char B1(void) {
11281132 return HEXAGON_V32_GET_B1(data);
11291133 };
......@@ -1162,9 +1166,10 @@ public:
11621166 };
11631167
11641168 // Set byte methods
1165 HEXAGON_Vect32C B0(signed char b) {
1169 HEXAGON_Vect32C b0(signed char b) {
11661170 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B0(data, b));
11671171 };
1172 HEXAGON_Vect32C B0(signed char b) { return b0(b); };
11681173 HEXAGON_Vect32C B1(signed char b) {
11691174 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B1(data, b));
11701175 };
......@@ -1924,9 +1929,8 @@ public:
19241929 };
19251930
19261931 // Extract byte methods
1927 signed char B0(void) {
1928 return Q6V64_GET_B0(data);
1929 };
1932 signed char b0(void) { return Q6V64_GET_B0(data); };
1933 signed char B0(void) { return b0(); };
19301934 signed char B1(void) {
19311935 return Q6V64_GET_B1(data);
19321936 };
......@@ -2003,9 +2007,8 @@ public:
20032007 };
20042008
20052009 // Set byte methods
2006 Q6Vect64C B0(signed char b) {
2007 return Q6Vect64C(Q6V64_PUT_B0(data, b));
2008 };
2010 Q6Vect64C b0(signed char b) { return Q6Vect64C(Q6V64_PUT_B0(data, b)); };
2011 Q6Vect64C B0(signed char b) { return b0(b); };
20092012 Q6Vect64C B1(signed char b) {
20102013 return Q6Vect64C(Q6V64_PUT_B1(data, b));
20112014 };
......@@ -2348,9 +2351,8 @@ public:
23482351 };
23492352
23502353 // Extract byte methods
2351 signed char B0(void) {
2352 return Q6V32_GET_B0(data);
2353 };
2354 signed char b0(void) { return Q6V32_GET_B0(data); };
2355 signed char B0(void) { return b0(); };
23542356 signed char B1(void) {
23552357 return Q6V32_GET_B1(data);
23562358 };
......@@ -2389,9 +2391,8 @@ public:
23892391 };
23902392
23912393 // Set byte methods
2392 Q6Vect32C B0(signed char b) {
2393 return Q6Vect32C(Q6V32_PUT_B0(data, b));
2394 };
2394 Q6Vect32C b0(signed char b) { return Q6Vect32C(Q6V32_PUT_B0(data, b)); };
2395 Q6Vect32C B0(signed char b) { return b0(b); };
23952396 Q6Vect32C B1(signed char b) {
23962397 return Q6Vect32C(Q6V32_PUT_B1(data, b));
23972398 };
......@@ -2622,4 +2623,6 @@ typedef struct hexagon_udma_descriptor_type1_s
26222623 unsigned int dstwidthoffset:16;
26232624} hexagon_udma_descriptor_type1_t;
26242625
2626#pragma pop_macro("B0")
2627
26252628#endif /* !HEXAGON_TYPES_H */
lib/include/hvx_hexagon_protos.h+649-860
......@@ -19,7 +19,6 @@
1919#define __BUILTIN_VECTOR_WRAP(a) a
2020#endif
2121
22#if __HVX_ARCH__ >= 60
2322/* ==========================================================================
2423 Assembly Syntax: Rd32=vextract(Vu32,Rs32)
2524 C Intrinsic Prototype: Word32 Q6_R_vextract_VR(HVX_Vector Vu, Word32 Rs)
......@@ -28,9 +27,7 @@
2827 ========================================================================== */
2928
3029#define Q6_R_vextract_VR(Vu,Rs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_extractw)(Vu,Rs)
31#endif /* __HEXAGON_ARCH___ >= 60 */
3230
33#if __HVX_ARCH__ >= 60
3431/* ==========================================================================
3532 Assembly Syntax: Vd32=hi(Vss32)
3633 C Intrinsic Prototype: HVX_Vector Q6_V_hi_W(HVX_VectorPair Vss)
......@@ -39,9 +36,7 @@
3936 ========================================================================== */
4037
4138#define Q6_V_hi_W(Vss) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_hi)(Vss)
42#endif /* __HEXAGON_ARCH___ >= 60 */
4339
44#if __HVX_ARCH__ >= 60
4540/* ==========================================================================
4641 Assembly Syntax: Vd32=lo(Vss32)
4742 C Intrinsic Prototype: HVX_Vector Q6_V_lo_W(HVX_VectorPair Vss)
......@@ -50,9 +45,7 @@
5045 ========================================================================== */
5146
5247#define Q6_V_lo_W(Vss) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_lo)(Vss)
53#endif /* __HEXAGON_ARCH___ >= 60 */
5448
55#if __HVX_ARCH__ >= 60
5649/* ==========================================================================
5750 Assembly Syntax: Vd32=vsplat(Rt32)
5851 C Intrinsic Prototype: HVX_Vector Q6_V_vsplat_R(Word32 Rt)
......@@ -61,9 +54,7 @@
6154 ========================================================================== */
6255
6356#define Q6_V_vsplat_R(Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_lvsplatw)(Rt)
64#endif /* __HEXAGON_ARCH___ >= 60 */
6557
66#if __HVX_ARCH__ >= 60
6758/* ==========================================================================
6859 Assembly Syntax: Qd4=and(Qs4,Qt4)
6960 C Intrinsic Prototype: HVX_VectorPred Q6_Q_and_QQ(HVX_VectorPred Qs, HVX_VectorPred Qt)
......@@ -72,9 +63,7 @@
7263 ========================================================================== */
7364
7465#define Q6_Q_and_QQ(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
75#endif /* __HEXAGON_ARCH___ >= 60 */
7666
77#if __HVX_ARCH__ >= 60
7867/* ==========================================================================
7968 Assembly Syntax: Qd4=and(Qs4,!Qt4)
8069 C Intrinsic Prototype: HVX_VectorPred Q6_Q_and_QQn(HVX_VectorPred Qs, HVX_VectorPred Qt)
......@@ -83,9 +72,7 @@
8372 ========================================================================== */
8473
8574#define Q6_Q_and_QQn(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_and_n)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
86#endif /* __HEXAGON_ARCH___ >= 60 */
8775
88#if __HVX_ARCH__ >= 60
8976/* ==========================================================================
9077 Assembly Syntax: Qd4=not(Qs4)
9178 C Intrinsic Prototype: HVX_VectorPred Q6_Q_not_Q(HVX_VectorPred Qs)
......@@ -94,9 +81,7 @@
9481 ========================================================================== */
9582
9683#define Q6_Q_not_Q(Qs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_not)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1))),-1)
97#endif /* __HEXAGON_ARCH___ >= 60 */
9884
99#if __HVX_ARCH__ >= 60
10085/* ==========================================================================
10186 Assembly Syntax: Qd4=or(Qs4,Qt4)
10287 C Intrinsic Prototype: HVX_VectorPred Q6_Q_or_QQ(HVX_VectorPred Qs, HVX_VectorPred Qt)
......@@ -105,9 +90,7 @@
10590 ========================================================================== */
10691
10792#define Q6_Q_or_QQ(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
108#endif /* __HEXAGON_ARCH___ >= 60 */
10993
110#if __HVX_ARCH__ >= 60
11194/* ==========================================================================
11295 Assembly Syntax: Qd4=or(Qs4,!Qt4)
11396 C Intrinsic Prototype: HVX_VectorPred Q6_Q_or_QQn(HVX_VectorPred Qs, HVX_VectorPred Qt)
......@@ -116,9 +99,7 @@
11699 ========================================================================== */
117100
118101#define Q6_Q_or_QQn(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_or_n)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
119#endif /* __HEXAGON_ARCH___ >= 60 */
120102
121#if __HVX_ARCH__ >= 60
122103/* ==========================================================================
123104 Assembly Syntax: Qd4=vsetq(Rt32)
124105 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vsetq_R(Word32 Rt)
......@@ -127,9 +108,7 @@
127108 ========================================================================== */
128109
129110#define Q6_Q_vsetq_R(Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_scalar2)(Rt)),-1)
130#endif /* __HEXAGON_ARCH___ >= 60 */
131111
132#if __HVX_ARCH__ >= 60
133112/* ==========================================================================
134113 Assembly Syntax: Qd4=xor(Qs4,Qt4)
135114 C Intrinsic Prototype: HVX_VectorPred Q6_Q_xor_QQ(HVX_VectorPred Qs, HVX_VectorPred Qt)
......@@ -138,9 +117,7 @@
138117 ========================================================================== */
139118
140119#define Q6_Q_xor_QQ(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
141#endif /* __HEXAGON_ARCH___ >= 60 */
142120
143#if __HVX_ARCH__ >= 60
144121/* ==========================================================================
145122 Assembly Syntax: if (!Qv4) vmem(Rt32+#s4)=Vs32
146123 C Intrinsic Prototype: void Q6_vmem_QnRIV(HVX_VectorPred Qv, HVX_Vector* Rt, HVX_Vector Vs)
......@@ -149,9 +126,7 @@
149126 ========================================================================== */
150127
151128#define Q6_vmem_QnRIV(Qv,Rt,Vs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vS32b_nqpred_ai)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Rt,Vs)
152#endif /* __HEXAGON_ARCH___ >= 60 */
153129
154#if __HVX_ARCH__ >= 60
155130/* ==========================================================================
156131 Assembly Syntax: if (!Qv4) vmem(Rt32+#s4):nt=Vs32
157132 C Intrinsic Prototype: void Q6_vmem_QnRIV_nt(HVX_VectorPred Qv, HVX_Vector* Rt, HVX_Vector Vs)
......@@ -160,9 +135,7 @@
160135 ========================================================================== */
161136
162137#define Q6_vmem_QnRIV_nt(Qv,Rt,Vs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vS32b_nt_nqpred_ai)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Rt,Vs)
163#endif /* __HEXAGON_ARCH___ >= 60 */
164138
165#if __HVX_ARCH__ >= 60
166139/* ==========================================================================
167140 Assembly Syntax: if (Qv4) vmem(Rt32+#s4):nt=Vs32
168141 C Intrinsic Prototype: void Q6_vmem_QRIV_nt(HVX_VectorPred Qv, HVX_Vector* Rt, HVX_Vector Vs)
......@@ -171,9 +144,7 @@
171144 ========================================================================== */
172145
173146#define Q6_vmem_QRIV_nt(Qv,Rt,Vs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vS32b_nt_qpred_ai)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Rt,Vs)
174#endif /* __HEXAGON_ARCH___ >= 60 */
175147
176#if __HVX_ARCH__ >= 60
177148/* ==========================================================================
178149 Assembly Syntax: if (Qv4) vmem(Rt32+#s4)=Vs32
179150 C Intrinsic Prototype: void Q6_vmem_QRIV(HVX_VectorPred Qv, HVX_Vector* Rt, HVX_Vector Vs)
......@@ -182,9 +153,7 @@
182153 ========================================================================== */
183154
184155#define Q6_vmem_QRIV(Qv,Rt,Vs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vS32b_qpred_ai)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Rt,Vs)
185#endif /* __HEXAGON_ARCH___ >= 60 */
186156
187#if __HVX_ARCH__ >= 60
188157/* ==========================================================================
189158 Assembly Syntax: Vd32.uh=vabsdiff(Vu32.h,Vv32.h)
190159 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vabsdiff_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -193,9 +162,7 @@
193162 ========================================================================== */
194163
195164#define Q6_Vuh_vabsdiff_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsdiffh)(Vu,Vv)
196#endif /* __HEXAGON_ARCH___ >= 60 */
197165
198#if __HVX_ARCH__ >= 60
199166/* ==========================================================================
200167 Assembly Syntax: Vd32.ub=vabsdiff(Vu32.ub,Vv32.ub)
201168 C Intrinsic Prototype: HVX_Vector Q6_Vub_vabsdiff_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -204,9 +171,7 @@
204171 ========================================================================== */
205172
206173#define Q6_Vub_vabsdiff_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsdiffub)(Vu,Vv)
207#endif /* __HEXAGON_ARCH___ >= 60 */
208174
209#if __HVX_ARCH__ >= 60
210175/* ==========================================================================
211176 Assembly Syntax: Vd32.uh=vabsdiff(Vu32.uh,Vv32.uh)
212177 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vabsdiff_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -215,9 +180,7 @@
215180 ========================================================================== */
216181
217182#define Q6_Vuh_vabsdiff_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsdiffuh)(Vu,Vv)
218#endif /* __HEXAGON_ARCH___ >= 60 */
219183
220#if __HVX_ARCH__ >= 60
221184/* ==========================================================================
222185 Assembly Syntax: Vd32.uw=vabsdiff(Vu32.w,Vv32.w)
223186 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vabsdiff_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -226,9 +189,7 @@
226189 ========================================================================== */
227190
228191#define Q6_Vuw_vabsdiff_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsdiffw)(Vu,Vv)
229#endif /* __HEXAGON_ARCH___ >= 60 */
230192
231#if __HVX_ARCH__ >= 60
232193/* ==========================================================================
233194 Assembly Syntax: Vd32.h=vabs(Vu32.h)
234195 C Intrinsic Prototype: HVX_Vector Q6_Vh_vabs_Vh(HVX_Vector Vu)
......@@ -237,9 +198,7 @@
237198 ========================================================================== */
238199
239200#define Q6_Vh_vabs_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsh)(Vu)
240#endif /* __HEXAGON_ARCH___ >= 60 */
241201
242#if __HVX_ARCH__ >= 60
243202/* ==========================================================================
244203 Assembly Syntax: Vd32.h=vabs(Vu32.h):sat
245204 C Intrinsic Prototype: HVX_Vector Q6_Vh_vabs_Vh_sat(HVX_Vector Vu)
......@@ -248,9 +207,7 @@
248207 ========================================================================== */
249208
250209#define Q6_Vh_vabs_Vh_sat(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsh_sat)(Vu)
251#endif /* __HEXAGON_ARCH___ >= 60 */
252210
253#if __HVX_ARCH__ >= 60
254211/* ==========================================================================
255212 Assembly Syntax: Vd32.w=vabs(Vu32.w)
256213 C Intrinsic Prototype: HVX_Vector Q6_Vw_vabs_Vw(HVX_Vector Vu)
......@@ -259,9 +216,7 @@
259216 ========================================================================== */
260217
261218#define Q6_Vw_vabs_Vw(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsw)(Vu)
262#endif /* __HEXAGON_ARCH___ >= 60 */
263219
264#if __HVX_ARCH__ >= 60
265220/* ==========================================================================
266221 Assembly Syntax: Vd32.w=vabs(Vu32.w):sat
267222 C Intrinsic Prototype: HVX_Vector Q6_Vw_vabs_Vw_sat(HVX_Vector Vu)
......@@ -270,9 +225,7 @@
270225 ========================================================================== */
271226
272227#define Q6_Vw_vabs_Vw_sat(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsw_sat)(Vu)
273#endif /* __HEXAGON_ARCH___ >= 60 */
274228
275#if __HVX_ARCH__ >= 60
276229/* ==========================================================================
277230 Assembly Syntax: Vd32.b=vadd(Vu32.b,Vv32.b)
278231 C Intrinsic Prototype: HVX_Vector Q6_Vb_vadd_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -281,9 +234,7 @@
281234 ========================================================================== */
282235
283236#define Q6_Vb_vadd_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddb)(Vu,Vv)
284#endif /* __HEXAGON_ARCH___ >= 60 */
285237
286#if __HVX_ARCH__ >= 60
287238/* ==========================================================================
288239 Assembly Syntax: Vdd32.b=vadd(Vuu32.b,Vvv32.b)
289240 C Intrinsic Prototype: HVX_VectorPair Q6_Wb_vadd_WbWb(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -292,9 +243,7 @@
292243 ========================================================================== */
293244
294245#define Q6_Wb_vadd_WbWb(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddb_dv)(Vuu,Vvv)
295#endif /* __HEXAGON_ARCH___ >= 60 */
296246
297#if __HVX_ARCH__ >= 60
298247/* ==========================================================================
299248 Assembly Syntax: if (!Qv4) Vx32.b+=Vu32.b
300249 C Intrinsic Prototype: HVX_Vector Q6_Vb_condacc_QnVbVb(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -303,9 +252,7 @@
303252 ========================================================================== */
304253
305254#define Q6_Vb_condacc_QnVbVb(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddbnq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
306#endif /* __HEXAGON_ARCH___ >= 60 */
307255
308#if __HVX_ARCH__ >= 60
309256/* ==========================================================================
310257 Assembly Syntax: if (Qv4) Vx32.b+=Vu32.b
311258 C Intrinsic Prototype: HVX_Vector Q6_Vb_condacc_QVbVb(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -314,9 +261,7 @@
314261 ========================================================================== */
315262
316263#define Q6_Vb_condacc_QVbVb(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddbq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
317#endif /* __HEXAGON_ARCH___ >= 60 */
318264
319#if __HVX_ARCH__ >= 60
320265/* ==========================================================================
321266 Assembly Syntax: Vd32.h=vadd(Vu32.h,Vv32.h)
322267 C Intrinsic Prototype: HVX_Vector Q6_Vh_vadd_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -325,9 +270,7 @@
325270 ========================================================================== */
326271
327272#define Q6_Vh_vadd_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddh)(Vu,Vv)
328#endif /* __HEXAGON_ARCH___ >= 60 */
329273
330#if __HVX_ARCH__ >= 60
331274/* ==========================================================================
332275 Assembly Syntax: Vdd32.h=vadd(Vuu32.h,Vvv32.h)
333276 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vadd_WhWh(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -336,9 +279,7 @@
336279 ========================================================================== */
337280
338281#define Q6_Wh_vadd_WhWh(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddh_dv)(Vuu,Vvv)
339#endif /* __HEXAGON_ARCH___ >= 60 */
340282
341#if __HVX_ARCH__ >= 60
342283/* ==========================================================================
343284 Assembly Syntax: if (!Qv4) Vx32.h+=Vu32.h
344285 C Intrinsic Prototype: HVX_Vector Q6_Vh_condacc_QnVhVh(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -347,9 +288,7 @@
347288 ========================================================================== */
348289
349290#define Q6_Vh_condacc_QnVhVh(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddhnq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
350#endif /* __HEXAGON_ARCH___ >= 60 */
351291
352#if __HVX_ARCH__ >= 60
353292/* ==========================================================================
354293 Assembly Syntax: if (Qv4) Vx32.h+=Vu32.h
355294 C Intrinsic Prototype: HVX_Vector Q6_Vh_condacc_QVhVh(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -358,9 +297,7 @@
358297 ========================================================================== */
359298
360299#define Q6_Vh_condacc_QVhVh(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddhq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
361#endif /* __HEXAGON_ARCH___ >= 60 */
362300
363#if __HVX_ARCH__ >= 60
364301/* ==========================================================================
365302 Assembly Syntax: Vd32.h=vadd(Vu32.h,Vv32.h):sat
366303 C Intrinsic Prototype: HVX_Vector Q6_Vh_vadd_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -369,9 +306,7 @@
369306 ========================================================================== */
370307
371308#define Q6_Vh_vadd_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddhsat)(Vu,Vv)
372#endif /* __HEXAGON_ARCH___ >= 60 */
373309
374#if __HVX_ARCH__ >= 60
375310/* ==========================================================================
376311 Assembly Syntax: Vdd32.h=vadd(Vuu32.h,Vvv32.h):sat
377312 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vadd_WhWh_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -380,9 +315,7 @@
380315 ========================================================================== */
381316
382317#define Q6_Wh_vadd_WhWh_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddhsat_dv)(Vuu,Vvv)
383#endif /* __HEXAGON_ARCH___ >= 60 */
384318
385#if __HVX_ARCH__ >= 60
386319/* ==========================================================================
387320 Assembly Syntax: Vdd32.w=vadd(Vu32.h,Vv32.h)
388321 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vadd_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -391,9 +324,7 @@
391324 ========================================================================== */
392325
393326#define Q6_Ww_vadd_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddhw)(Vu,Vv)
394#endif /* __HEXAGON_ARCH___ >= 60 */
395327
396#if __HVX_ARCH__ >= 60
397328/* ==========================================================================
398329 Assembly Syntax: Vdd32.h=vadd(Vu32.ub,Vv32.ub)
399330 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vadd_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -402,9 +333,7 @@
402333 ========================================================================== */
403334
404335#define Q6_Wh_vadd_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddubh)(Vu,Vv)
405#endif /* __HEXAGON_ARCH___ >= 60 */
406336
407#if __HVX_ARCH__ >= 60
408337/* ==========================================================================
409338 Assembly Syntax: Vd32.ub=vadd(Vu32.ub,Vv32.ub):sat
410339 C Intrinsic Prototype: HVX_Vector Q6_Vub_vadd_VubVub_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -413,9 +342,7 @@
413342 ========================================================================== */
414343
415344#define Q6_Vub_vadd_VubVub_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddubsat)(Vu,Vv)
416#endif /* __HEXAGON_ARCH___ >= 60 */
417345
418#if __HVX_ARCH__ >= 60
419346/* ==========================================================================
420347 Assembly Syntax: Vdd32.ub=vadd(Vuu32.ub,Vvv32.ub):sat
421348 C Intrinsic Prototype: HVX_VectorPair Q6_Wub_vadd_WubWub_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -424,9 +351,7 @@
424351 ========================================================================== */
425352
426353#define Q6_Wub_vadd_WubWub_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddubsat_dv)(Vuu,Vvv)
427#endif /* __HEXAGON_ARCH___ >= 60 */
428354
429#if __HVX_ARCH__ >= 60
430355/* ==========================================================================
431356 Assembly Syntax: Vd32.uh=vadd(Vu32.uh,Vv32.uh):sat
432357 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vadd_VuhVuh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -435,9 +360,7 @@
435360 ========================================================================== */
436361
437362#define Q6_Vuh_vadd_VuhVuh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadduhsat)(Vu,Vv)
438#endif /* __HEXAGON_ARCH___ >= 60 */
439363
440#if __HVX_ARCH__ >= 60
441364/* ==========================================================================
442365 Assembly Syntax: Vdd32.uh=vadd(Vuu32.uh,Vvv32.uh):sat
443366 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vadd_WuhWuh_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -446,9 +369,7 @@
446369 ========================================================================== */
447370
448371#define Q6_Wuh_vadd_WuhWuh_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadduhsat_dv)(Vuu,Vvv)
449#endif /* __HEXAGON_ARCH___ >= 60 */
450372
451#if __HVX_ARCH__ >= 60
452373/* ==========================================================================
453374 Assembly Syntax: Vdd32.w=vadd(Vu32.uh,Vv32.uh)
454375 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vadd_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -457,9 +378,7 @@
457378 ========================================================================== */
458379
459380#define Q6_Ww_vadd_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadduhw)(Vu,Vv)
460#endif /* __HEXAGON_ARCH___ >= 60 */
461381
462#if __HVX_ARCH__ >= 60
463382/* ==========================================================================
464383 Assembly Syntax: Vd32.w=vadd(Vu32.w,Vv32.w)
465384 C Intrinsic Prototype: HVX_Vector Q6_Vw_vadd_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -468,9 +387,7 @@
468387 ========================================================================== */
469388
470389#define Q6_Vw_vadd_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddw)(Vu,Vv)
471#endif /* __HEXAGON_ARCH___ >= 60 */
472390
473#if __HVX_ARCH__ >= 60
474391/* ==========================================================================
475392 Assembly Syntax: Vdd32.w=vadd(Vuu32.w,Vvv32.w)
476393 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vadd_WwWw(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -479,9 +396,7 @@
479396 ========================================================================== */
480397
481398#define Q6_Ww_vadd_WwWw(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddw_dv)(Vuu,Vvv)
482#endif /* __HEXAGON_ARCH___ >= 60 */
483399
484#if __HVX_ARCH__ >= 60
485400/* ==========================================================================
486401 Assembly Syntax: if (!Qv4) Vx32.w+=Vu32.w
487402 C Intrinsic Prototype: HVX_Vector Q6_Vw_condacc_QnVwVw(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -490,9 +405,7 @@
490405 ========================================================================== */
491406
492407#define Q6_Vw_condacc_QnVwVw(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddwnq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
493#endif /* __HEXAGON_ARCH___ >= 60 */
494408
495#if __HVX_ARCH__ >= 60
496409/* ==========================================================================
497410 Assembly Syntax: if (Qv4) Vx32.w+=Vu32.w
498411 C Intrinsic Prototype: HVX_Vector Q6_Vw_condacc_QVwVw(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -501,9 +414,7 @@
501414 ========================================================================== */
502415
503416#define Q6_Vw_condacc_QVwVw(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddwq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
504#endif /* __HEXAGON_ARCH___ >= 60 */
505417
506#if __HVX_ARCH__ >= 60
507418/* ==========================================================================
508419 Assembly Syntax: Vd32.w=vadd(Vu32.w,Vv32.w):sat
509420 C Intrinsic Prototype: HVX_Vector Q6_Vw_vadd_VwVw_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -512,9 +423,7 @@
512423 ========================================================================== */
513424
514425#define Q6_Vw_vadd_VwVw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddwsat)(Vu,Vv)
515#endif /* __HEXAGON_ARCH___ >= 60 */
516426
517#if __HVX_ARCH__ >= 60
518427/* ==========================================================================
519428 Assembly Syntax: Vdd32.w=vadd(Vuu32.w,Vvv32.w):sat
520429 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vadd_WwWw_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -523,9 +432,7 @@
523432 ========================================================================== */
524433
525434#define Q6_Ww_vadd_WwWw_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddwsat_dv)(Vuu,Vvv)
526#endif /* __HEXAGON_ARCH___ >= 60 */
527435
528#if __HVX_ARCH__ >= 60
529436/* ==========================================================================
530437 Assembly Syntax: Vd32=valign(Vu32,Vv32,Rt8)
531438 C Intrinsic Prototype: HVX_Vector Q6_V_valign_VVR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -534,9 +441,7 @@
534441 ========================================================================== */
535442
536443#define Q6_V_valign_VVR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_valignb)(Vu,Vv,Rt)
537#endif /* __HEXAGON_ARCH___ >= 60 */
538444
539#if __HVX_ARCH__ >= 60
540445/* ==========================================================================
541446 Assembly Syntax: Vd32=valign(Vu32,Vv32,#u3)
542447 C Intrinsic Prototype: HVX_Vector Q6_V_valign_VVI(HVX_Vector Vu, HVX_Vector Vv, Word32 Iu3)
......@@ -545,9 +450,7 @@
545450 ========================================================================== */
546451
547452#define Q6_V_valign_VVI(Vu,Vv,Iu3) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_valignbi)(Vu,Vv,Iu3)
548#endif /* __HEXAGON_ARCH___ >= 60 */
549453
550#if __HVX_ARCH__ >= 60
551454/* ==========================================================================
552455 Assembly Syntax: Vd32=vand(Vu32,Vv32)
553456 C Intrinsic Prototype: HVX_Vector Q6_V_vand_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -556,9 +459,7 @@
556459 ========================================================================== */
557460
558461#define Q6_V_vand_VV(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vand)(Vu,Vv)
559#endif /* __HEXAGON_ARCH___ >= 60 */
560462
561#if __HVX_ARCH__ >= 60
562463/* ==========================================================================
563464 Assembly Syntax: Vd32=vand(Qu4,Rt32)
564465 C Intrinsic Prototype: HVX_Vector Q6_V_vand_QR(HVX_VectorPred Qu, Word32 Rt)
......@@ -567,9 +468,7 @@
567468 ========================================================================== */
568469
569470#define Q6_V_vand_QR(Qu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qu),-1),Rt)
570#endif /* __HEXAGON_ARCH___ >= 60 */
571471
572#if __HVX_ARCH__ >= 60
573472/* ==========================================================================
574473 Assembly Syntax: Vx32|=vand(Qu4,Rt32)
575474 C Intrinsic Prototype: HVX_Vector Q6_V_vandor_VQR(HVX_Vector Vx, HVX_VectorPred Qu, Word32 Rt)
......@@ -578,9 +477,7 @@
578477 ========================================================================== */
579478
580479#define Q6_V_vandor_VQR(Vx,Qu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt_acc)(Vx,__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qu),-1),Rt)
581#endif /* __HEXAGON_ARCH___ >= 60 */
582480
583#if __HVX_ARCH__ >= 60
584481/* ==========================================================================
585482 Assembly Syntax: Qd4=vand(Vu32,Rt32)
586483 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vand_VR(HVX_Vector Vu, Word32 Rt)
......@@ -589,9 +486,7 @@
589486 ========================================================================== */
590487
591488#define Q6_Q_vand_VR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)(Vu,Rt)),-1)
592#endif /* __HEXAGON_ARCH___ >= 60 */
593489
594#if __HVX_ARCH__ >= 60
595490/* ==========================================================================
596491 Assembly Syntax: Qx4|=vand(Vu32,Rt32)
597492 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vandor_QVR(HVX_VectorPred Qx, HVX_Vector Vu, Word32 Rt)
......@@ -600,9 +495,7 @@
600495 ========================================================================== */
601496
602497#define Q6_Q_vandor_QVR(Qx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt_acc)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Rt)),-1)
603#endif /* __HEXAGON_ARCH___ >= 60 */
604498
605#if __HVX_ARCH__ >= 60
606499/* ==========================================================================
607500 Assembly Syntax: Vd32.h=vasl(Vu32.h,Rt32)
608501 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasl_VhR(HVX_Vector Vu, Word32 Rt)
......@@ -611,9 +504,7 @@
611504 ========================================================================== */
612505
613506#define Q6_Vh_vasl_VhR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaslh)(Vu,Rt)
614#endif /* __HEXAGON_ARCH___ >= 60 */
615507
616#if __HVX_ARCH__ >= 60
617508/* ==========================================================================
618509 Assembly Syntax: Vd32.h=vasl(Vu32.h,Vv32.h)
619510 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasl_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -622,9 +513,7 @@
622513 ========================================================================== */
623514
624515#define Q6_Vh_vasl_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaslhv)(Vu,Vv)
625#endif /* __HEXAGON_ARCH___ >= 60 */
626516
627#if __HVX_ARCH__ >= 60
628517/* ==========================================================================
629518 Assembly Syntax: Vd32.w=vasl(Vu32.w,Rt32)
630519 C Intrinsic Prototype: HVX_Vector Q6_Vw_vasl_VwR(HVX_Vector Vu, Word32 Rt)
......@@ -633,9 +522,7 @@
633522 ========================================================================== */
634523
635524#define Q6_Vw_vasl_VwR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaslw)(Vu,Rt)
636#endif /* __HEXAGON_ARCH___ >= 60 */
637525
638#if __HVX_ARCH__ >= 60
639526/* ==========================================================================
640527 Assembly Syntax: Vx32.w+=vasl(Vu32.w,Rt32)
641528 C Intrinsic Prototype: HVX_Vector Q6_Vw_vaslacc_VwVwR(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -644,9 +531,7 @@
644531 ========================================================================== */
645532
646533#define Q6_Vw_vaslacc_VwVwR(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaslw_acc)(Vx,Vu,Rt)
647#endif /* __HEXAGON_ARCH___ >= 60 */
648534
649#if __HVX_ARCH__ >= 60
650535/* ==========================================================================
651536 Assembly Syntax: Vd32.w=vasl(Vu32.w,Vv32.w)
652537 C Intrinsic Prototype: HVX_Vector Q6_Vw_vasl_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -655,9 +540,7 @@
655540 ========================================================================== */
656541
657542#define Q6_Vw_vasl_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaslwv)(Vu,Vv)
658#endif /* __HEXAGON_ARCH___ >= 60 */
659543
660#if __HVX_ARCH__ >= 60
661544/* ==========================================================================
662545 Assembly Syntax: Vd32.h=vasr(Vu32.h,Rt32)
663546 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasr_VhR(HVX_Vector Vu, Word32 Rt)
......@@ -666,9 +549,7 @@
666549 ========================================================================== */
667550
668551#define Q6_Vh_vasr_VhR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrh)(Vu,Rt)
669#endif /* __HEXAGON_ARCH___ >= 60 */
670552
671#if __HVX_ARCH__ >= 60
672553/* ==========================================================================
673554 Assembly Syntax: Vd32.b=vasr(Vu32.h,Vv32.h,Rt8):rnd:sat
674555 C Intrinsic Prototype: HVX_Vector Q6_Vb_vasr_VhVhR_rnd_sat(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -677,9 +558,7 @@
677558 ========================================================================== */
678559
679560#define Q6_Vb_vasr_VhVhR_rnd_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrhbrndsat)(Vu,Vv,Rt)
680#endif /* __HEXAGON_ARCH___ >= 60 */
681561
682#if __HVX_ARCH__ >= 60
683562/* ==========================================================================
684563 Assembly Syntax: Vd32.ub=vasr(Vu32.h,Vv32.h,Rt8):rnd:sat
685564 C Intrinsic Prototype: HVX_Vector Q6_Vub_vasr_VhVhR_rnd_sat(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -688,9 +567,7 @@
688567 ========================================================================== */
689568
690569#define Q6_Vub_vasr_VhVhR_rnd_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrhubrndsat)(Vu,Vv,Rt)
691#endif /* __HEXAGON_ARCH___ >= 60 */
692570
693#if __HVX_ARCH__ >= 60
694571/* ==========================================================================
695572 Assembly Syntax: Vd32.ub=vasr(Vu32.h,Vv32.h,Rt8):sat
696573 C Intrinsic Prototype: HVX_Vector Q6_Vub_vasr_VhVhR_sat(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -699,9 +576,7 @@
699576 ========================================================================== */
700577
701578#define Q6_Vub_vasr_VhVhR_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrhubsat)(Vu,Vv,Rt)
702#endif /* __HEXAGON_ARCH___ >= 60 */
703579
704#if __HVX_ARCH__ >= 60
705580/* ==========================================================================
706581 Assembly Syntax: Vd32.h=vasr(Vu32.h,Vv32.h)
707582 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasr_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -710,9 +585,7 @@
710585 ========================================================================== */
711586
712587#define Q6_Vh_vasr_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrhv)(Vu,Vv)
713#endif /* __HEXAGON_ARCH___ >= 60 */
714588
715#if __HVX_ARCH__ >= 60
716589/* ==========================================================================
717590 Assembly Syntax: Vd32.w=vasr(Vu32.w,Rt32)
718591 C Intrinsic Prototype: HVX_Vector Q6_Vw_vasr_VwR(HVX_Vector Vu, Word32 Rt)
......@@ -721,9 +594,7 @@
721594 ========================================================================== */
722595
723596#define Q6_Vw_vasr_VwR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrw)(Vu,Rt)
724#endif /* __HEXAGON_ARCH___ >= 60 */
725597
726#if __HVX_ARCH__ >= 60
727598/* ==========================================================================
728599 Assembly Syntax: Vx32.w+=vasr(Vu32.w,Rt32)
729600 C Intrinsic Prototype: HVX_Vector Q6_Vw_vasracc_VwVwR(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -732,9 +603,7 @@
732603 ========================================================================== */
733604
734605#define Q6_Vw_vasracc_VwVwR(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrw_acc)(Vx,Vu,Rt)
735#endif /* __HEXAGON_ARCH___ >= 60 */
736606
737#if __HVX_ARCH__ >= 60
738607/* ==========================================================================
739608 Assembly Syntax: Vd32.h=vasr(Vu32.w,Vv32.w,Rt8)
740609 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasr_VwVwR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -743,9 +612,7 @@
743612 ========================================================================== */
744613
745614#define Q6_Vh_vasr_VwVwR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrwh)(Vu,Vv,Rt)
746#endif /* __HEXAGON_ARCH___ >= 60 */
747615
748#if __HVX_ARCH__ >= 60
749616/* ==========================================================================
750617 Assembly Syntax: Vd32.h=vasr(Vu32.w,Vv32.w,Rt8):rnd:sat
751618 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasr_VwVwR_rnd_sat(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -754,9 +621,7 @@
754621 ========================================================================== */
755622
756623#define Q6_Vh_vasr_VwVwR_rnd_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrwhrndsat)(Vu,Vv,Rt)
757#endif /* __HEXAGON_ARCH___ >= 60 */
758624
759#if __HVX_ARCH__ >= 60
760625/* ==========================================================================
761626 Assembly Syntax: Vd32.h=vasr(Vu32.w,Vv32.w,Rt8):sat
762627 C Intrinsic Prototype: HVX_Vector Q6_Vh_vasr_VwVwR_sat(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -765,9 +630,7 @@
765630 ========================================================================== */
766631
767632#define Q6_Vh_vasr_VwVwR_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrwhsat)(Vu,Vv,Rt)
768#endif /* __HEXAGON_ARCH___ >= 60 */
769633
770#if __HVX_ARCH__ >= 60
771634/* ==========================================================================
772635 Assembly Syntax: Vd32.uh=vasr(Vu32.w,Vv32.w,Rt8):sat
773636 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vasr_VwVwR_sat(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -776,9 +639,7 @@
776639 ========================================================================== */
777640
778641#define Q6_Vuh_vasr_VwVwR_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrwuhsat)(Vu,Vv,Rt)
779#endif /* __HEXAGON_ARCH___ >= 60 */
780642
781#if __HVX_ARCH__ >= 60
782643/* ==========================================================================
783644 Assembly Syntax: Vd32.w=vasr(Vu32.w,Vv32.w)
784645 C Intrinsic Prototype: HVX_Vector Q6_Vw_vasr_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -787,9 +648,7 @@
787648 ========================================================================== */
788649
789650#define Q6_Vw_vasr_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrwv)(Vu,Vv)
790#endif /* __HEXAGON_ARCH___ >= 60 */
791651
792#if __HVX_ARCH__ >= 60
793652/* ==========================================================================
794653 Assembly Syntax: Vd32=Vu32
795654 C Intrinsic Prototype: HVX_Vector Q6_V_equals_V(HVX_Vector Vu)
......@@ -798,9 +657,7 @@
798657 ========================================================================== */
799658
800659#define Q6_V_equals_V(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vassign)(Vu)
801#endif /* __HEXAGON_ARCH___ >= 60 */
802660
803#if __HVX_ARCH__ >= 60
804661/* ==========================================================================
805662 Assembly Syntax: Vdd32=Vuu32
806663 C Intrinsic Prototype: HVX_VectorPair Q6_W_equals_W(HVX_VectorPair Vuu)
......@@ -809,9 +666,7 @@
809666 ========================================================================== */
810667
811668#define Q6_W_equals_W(Vuu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vassignp)(Vuu)
812#endif /* __HEXAGON_ARCH___ >= 60 */
813669
814#if __HVX_ARCH__ >= 60
815670/* ==========================================================================
816671 Assembly Syntax: Vd32.h=vavg(Vu32.h,Vv32.h)
817672 C Intrinsic Prototype: HVX_Vector Q6_Vh_vavg_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -820,9 +675,7 @@
820675 ========================================================================== */
821676
822677#define Q6_Vh_vavg_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgh)(Vu,Vv)
823#endif /* __HEXAGON_ARCH___ >= 60 */
824678
825#if __HVX_ARCH__ >= 60
826679/* ==========================================================================
827680 Assembly Syntax: Vd32.h=vavg(Vu32.h,Vv32.h):rnd
828681 C Intrinsic Prototype: HVX_Vector Q6_Vh_vavg_VhVh_rnd(HVX_Vector Vu, HVX_Vector Vv)
......@@ -831,9 +684,7 @@
831684 ========================================================================== */
832685
833686#define Q6_Vh_vavg_VhVh_rnd(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavghrnd)(Vu,Vv)
834#endif /* __HEXAGON_ARCH___ >= 60 */
835687
836#if __HVX_ARCH__ >= 60
837688/* ==========================================================================
838689 Assembly Syntax: Vd32.ub=vavg(Vu32.ub,Vv32.ub)
839690 C Intrinsic Prototype: HVX_Vector Q6_Vub_vavg_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -842,9 +693,7 @@
842693 ========================================================================== */
843694
844695#define Q6_Vub_vavg_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgub)(Vu,Vv)
845#endif /* __HEXAGON_ARCH___ >= 60 */
846696
847#if __HVX_ARCH__ >= 60
848697/* ==========================================================================
849698 Assembly Syntax: Vd32.ub=vavg(Vu32.ub,Vv32.ub):rnd
850699 C Intrinsic Prototype: HVX_Vector Q6_Vub_vavg_VubVub_rnd(HVX_Vector Vu, HVX_Vector Vv)
......@@ -853,9 +702,7 @@
853702 ========================================================================== */
854703
855704#define Q6_Vub_vavg_VubVub_rnd(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgubrnd)(Vu,Vv)
856#endif /* __HEXAGON_ARCH___ >= 60 */
857705
858#if __HVX_ARCH__ >= 60
859706/* ==========================================================================
860707 Assembly Syntax: Vd32.uh=vavg(Vu32.uh,Vv32.uh)
861708 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vavg_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -864,9 +711,7 @@
864711 ========================================================================== */
865712
866713#define Q6_Vuh_vavg_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavguh)(Vu,Vv)
867#endif /* __HEXAGON_ARCH___ >= 60 */
868714
869#if __HVX_ARCH__ >= 60
870715/* ==========================================================================
871716 Assembly Syntax: Vd32.uh=vavg(Vu32.uh,Vv32.uh):rnd
872717 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vavg_VuhVuh_rnd(HVX_Vector Vu, HVX_Vector Vv)
......@@ -875,9 +720,7 @@
875720 ========================================================================== */
876721
877722#define Q6_Vuh_vavg_VuhVuh_rnd(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavguhrnd)(Vu,Vv)
878#endif /* __HEXAGON_ARCH___ >= 60 */
879723
880#if __HVX_ARCH__ >= 60
881724/* ==========================================================================
882725 Assembly Syntax: Vd32.w=vavg(Vu32.w,Vv32.w)
883726 C Intrinsic Prototype: HVX_Vector Q6_Vw_vavg_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -886,9 +729,7 @@
886729 ========================================================================== */
887730
888731#define Q6_Vw_vavg_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgw)(Vu,Vv)
889#endif /* __HEXAGON_ARCH___ >= 60 */
890732
891#if __HVX_ARCH__ >= 60
892733/* ==========================================================================
893734 Assembly Syntax: Vd32.w=vavg(Vu32.w,Vv32.w):rnd
894735 C Intrinsic Prototype: HVX_Vector Q6_Vw_vavg_VwVw_rnd(HVX_Vector Vu, HVX_Vector Vv)
......@@ -897,9 +738,7 @@
897738 ========================================================================== */
898739
899740#define Q6_Vw_vavg_VwVw_rnd(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgwrnd)(Vu,Vv)
900#endif /* __HEXAGON_ARCH___ >= 60 */
901741
902#if __HVX_ARCH__ >= 60
903742/* ==========================================================================
904743 Assembly Syntax: Vd32.uh=vcl0(Vu32.uh)
905744 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vcl0_Vuh(HVX_Vector Vu)
......@@ -908,9 +747,7 @@
908747 ========================================================================== */
909748
910749#define Q6_Vuh_vcl0_Vuh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcl0h)(Vu)
911#endif /* __HEXAGON_ARCH___ >= 60 */
912750
913#if __HVX_ARCH__ >= 60
914751/* ==========================================================================
915752 Assembly Syntax: Vd32.uw=vcl0(Vu32.uw)
916753 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vcl0_Vuw(HVX_Vector Vu)
......@@ -919,9 +756,7 @@
919756 ========================================================================== */
920757
921758#define Q6_Vuw_vcl0_Vuw(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcl0w)(Vu)
922#endif /* __HEXAGON_ARCH___ >= 60 */
923759
924#if __HVX_ARCH__ >= 60
925760/* ==========================================================================
926761 Assembly Syntax: Vdd32=vcombine(Vu32,Vv32)
927762 C Intrinsic Prototype: HVX_VectorPair Q6_W_vcombine_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -930,9 +765,7 @@
930765 ========================================================================== */
931766
932767#define Q6_W_vcombine_VV(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcombine)(Vu,Vv)
933#endif /* __HEXAGON_ARCH___ >= 60 */
934768
935#if __HVX_ARCH__ >= 60
936769/* ==========================================================================
937770 Assembly Syntax: Vd32=#0
938771 C Intrinsic Prototype: HVX_Vector Q6_V_vzero()
......@@ -941,9 +774,7 @@
941774 ========================================================================== */
942775
943776#define Q6_V_vzero() __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vd0)()
944#endif /* __HEXAGON_ARCH___ >= 60 */
945777
946#if __HVX_ARCH__ >= 60
947778/* ==========================================================================
948779 Assembly Syntax: Vd32.b=vdeal(Vu32.b)
949780 C Intrinsic Prototype: HVX_Vector Q6_Vb_vdeal_Vb(HVX_Vector Vu)
......@@ -952,9 +783,7 @@
952783 ========================================================================== */
953784
954785#define Q6_Vb_vdeal_Vb(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdealb)(Vu)
955#endif /* __HEXAGON_ARCH___ >= 60 */
956786
957#if __HVX_ARCH__ >= 60
958787/* ==========================================================================
959788 Assembly Syntax: Vd32.b=vdeale(Vu32.b,Vv32.b)
960789 C Intrinsic Prototype: HVX_Vector Q6_Vb_vdeale_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -963,9 +792,7 @@
963792 ========================================================================== */
964793
965794#define Q6_Vb_vdeale_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdealb4w)(Vu,Vv)
966#endif /* __HEXAGON_ARCH___ >= 60 */
967795
968#if __HVX_ARCH__ >= 60
969796/* ==========================================================================
970797 Assembly Syntax: Vd32.h=vdeal(Vu32.h)
971798 C Intrinsic Prototype: HVX_Vector Q6_Vh_vdeal_Vh(HVX_Vector Vu)
......@@ -974,9 +801,7 @@
974801 ========================================================================== */
975802
976803#define Q6_Vh_vdeal_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdealh)(Vu)
977#endif /* __HEXAGON_ARCH___ >= 60 */
978804
979#if __HVX_ARCH__ >= 60
980805/* ==========================================================================
981806 Assembly Syntax: Vdd32=vdeal(Vu32,Vv32,Rt8)
982807 C Intrinsic Prototype: HVX_VectorPair Q6_W_vdeal_VVR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -985,9 +810,7 @@
985810 ========================================================================== */
986811
987812#define Q6_W_vdeal_VVR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdealvdd)(Vu,Vv,Rt)
988#endif /* __HEXAGON_ARCH___ >= 60 */
989813
990#if __HVX_ARCH__ >= 60
991814/* ==========================================================================
992815 Assembly Syntax: Vd32=vdelta(Vu32,Vv32)
993816 C Intrinsic Prototype: HVX_Vector Q6_V_vdelta_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -996,9 +819,7 @@
996819 ========================================================================== */
997820
998821#define Q6_V_vdelta_VV(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdelta)(Vu,Vv)
999#endif /* __HEXAGON_ARCH___ >= 60 */
1000822
1001#if __HVX_ARCH__ >= 60
1002823/* ==========================================================================
1003824 Assembly Syntax: Vd32.h=vdmpy(Vu32.ub,Rt32.b)
1004825 C Intrinsic Prototype: HVX_Vector Q6_Vh_vdmpy_VubRb(HVX_Vector Vu, Word32 Rt)
......@@ -1007,9 +828,7 @@
1007828 ========================================================================== */
1008829
1009830#define Q6_Vh_vdmpy_VubRb(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpybus)(Vu,Rt)
1010#endif /* __HEXAGON_ARCH___ >= 60 */
1011831
1012#if __HVX_ARCH__ >= 60
1013832/* ==========================================================================
1014833 Assembly Syntax: Vx32.h+=vdmpy(Vu32.ub,Rt32.b)
1015834 C Intrinsic Prototype: HVX_Vector Q6_Vh_vdmpyacc_VhVubRb(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -1018,9 +837,7 @@
1018837 ========================================================================== */
1019838
1020839#define Q6_Vh_vdmpyacc_VhVubRb(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpybus_acc)(Vx,Vu,Rt)
1021#endif /* __HEXAGON_ARCH___ >= 60 */
1022840
1023#if __HVX_ARCH__ >= 60
1024841/* ==========================================================================
1025842 Assembly Syntax: Vdd32.h=vdmpy(Vuu32.ub,Rt32.b)
1026843 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vdmpy_WubRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1029,9 +846,7 @@
1029846 ========================================================================== */
1030847
1031848#define Q6_Wh_vdmpy_WubRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpybus_dv)(Vuu,Rt)
1032#endif /* __HEXAGON_ARCH___ >= 60 */
1033849
1034#if __HVX_ARCH__ >= 60
1035850/* ==========================================================================
1036851 Assembly Syntax: Vxx32.h+=vdmpy(Vuu32.ub,Rt32.b)
1037852 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vdmpyacc_WhWubRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1040,9 +855,7 @@
1040855 ========================================================================== */
1041856
1042857#define Q6_Wh_vdmpyacc_WhWubRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpybus_dv_acc)(Vxx,Vuu,Rt)
1043#endif /* __HEXAGON_ARCH___ >= 60 */
1044858
1045#if __HVX_ARCH__ >= 60
1046859/* ==========================================================================
1047860 Assembly Syntax: Vd32.w=vdmpy(Vu32.h,Rt32.b)
1048861 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpy_VhRb(HVX_Vector Vu, Word32 Rt)
......@@ -1051,9 +864,7 @@
1051864 ========================================================================== */
1052865
1053866#define Q6_Vw_vdmpy_VhRb(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhb)(Vu,Rt)
1054#endif /* __HEXAGON_ARCH___ >= 60 */
1055867
1056#if __HVX_ARCH__ >= 60
1057868/* ==========================================================================
1058869 Assembly Syntax: Vx32.w+=vdmpy(Vu32.h,Rt32.b)
1059870 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpyacc_VwVhRb(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -1062,9 +873,7 @@
1062873 ========================================================================== */
1063874
1064875#define Q6_Vw_vdmpyacc_VwVhRb(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhb_acc)(Vx,Vu,Rt)
1065#endif /* __HEXAGON_ARCH___ >= 60 */
1066876
1067#if __HVX_ARCH__ >= 60
1068877/* ==========================================================================
1069878 Assembly Syntax: Vdd32.w=vdmpy(Vuu32.h,Rt32.b)
1070879 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vdmpy_WhRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1073,9 +882,7 @@
1073882 ========================================================================== */
1074883
1075884#define Q6_Ww_vdmpy_WhRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhb_dv)(Vuu,Rt)
1076#endif /* __HEXAGON_ARCH___ >= 60 */
1077885
1078#if __HVX_ARCH__ >= 60
1079886/* ==========================================================================
1080887 Assembly Syntax: Vxx32.w+=vdmpy(Vuu32.h,Rt32.b)
1081888 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vdmpyacc_WwWhRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1084,9 +891,7 @@
1084891 ========================================================================== */
1085892
1086893#define Q6_Ww_vdmpyacc_WwWhRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhb_dv_acc)(Vxx,Vuu,Rt)
1087#endif /* __HEXAGON_ARCH___ >= 60 */
1088894
1089#if __HVX_ARCH__ >= 60
1090895/* ==========================================================================
1091896 Assembly Syntax: Vd32.w=vdmpy(Vuu32.h,Rt32.h):sat
1092897 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpy_WhRh_sat(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1095,9 +900,7 @@
1095900 ========================================================================== */
1096901
1097902#define Q6_Vw_vdmpy_WhRh_sat(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhisat)(Vuu,Rt)
1098#endif /* __HEXAGON_ARCH___ >= 60 */
1099903
1100#if __HVX_ARCH__ >= 60
1101904/* ==========================================================================
1102905 Assembly Syntax: Vx32.w+=vdmpy(Vuu32.h,Rt32.h):sat
1103906 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpyacc_VwWhRh_sat(HVX_Vector Vx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1106,9 +909,7 @@
1106909 ========================================================================== */
1107910
1108911#define Q6_Vw_vdmpyacc_VwWhRh_sat(Vx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhisat_acc)(Vx,Vuu,Rt)
1109#endif /* __HEXAGON_ARCH___ >= 60 */
1110912
1111#if __HVX_ARCH__ >= 60
1112913/* ==========================================================================
1113914 Assembly Syntax: Vd32.w=vdmpy(Vu32.h,Rt32.h):sat
1114915 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpy_VhRh_sat(HVX_Vector Vu, Word32 Rt)
......@@ -1117,9 +918,7 @@
1117918 ========================================================================== */
1118919
1119920#define Q6_Vw_vdmpy_VhRh_sat(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhsat)(Vu,Rt)
1120#endif /* __HEXAGON_ARCH___ >= 60 */
1121921
1122#if __HVX_ARCH__ >= 60
1123922/* ==========================================================================
1124923 Assembly Syntax: Vx32.w+=vdmpy(Vu32.h,Rt32.h):sat
1125924 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpyacc_VwVhRh_sat(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -1128,9 +927,7 @@
1128927 ========================================================================== */
1129928
1130929#define Q6_Vw_vdmpyacc_VwVhRh_sat(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhsat_acc)(Vx,Vu,Rt)
1131#endif /* __HEXAGON_ARCH___ >= 60 */
1132930
1133#if __HVX_ARCH__ >= 60
1134931/* ==========================================================================
1135932 Assembly Syntax: Vd32.w=vdmpy(Vuu32.h,Rt32.uh,#1):sat
1136933 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpy_WhRuh_sat(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1139,9 +936,7 @@
1139936 ========================================================================== */
1140937
1141938#define Q6_Vw_vdmpy_WhRuh_sat(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhsuisat)(Vuu,Rt)
1142#endif /* __HEXAGON_ARCH___ >= 60 */
1143939
1144#if __HVX_ARCH__ >= 60
1145940/* ==========================================================================
1146941 Assembly Syntax: Vx32.w+=vdmpy(Vuu32.h,Rt32.uh,#1):sat
1147942 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpyacc_VwWhRuh_sat(HVX_Vector Vx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1150,9 +945,7 @@
1150945 ========================================================================== */
1151946
1152947#define Q6_Vw_vdmpyacc_VwWhRuh_sat(Vx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhsuisat_acc)(Vx,Vuu,Rt)
1153#endif /* __HEXAGON_ARCH___ >= 60 */
1154948
1155#if __HVX_ARCH__ >= 60
1156949/* ==========================================================================
1157950 Assembly Syntax: Vd32.w=vdmpy(Vu32.h,Rt32.uh):sat
1158951 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpy_VhRuh_sat(HVX_Vector Vu, Word32 Rt)
......@@ -1161,9 +954,7 @@
1161954 ========================================================================== */
1162955
1163956#define Q6_Vw_vdmpy_VhRuh_sat(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhsusat)(Vu,Rt)
1164#endif /* __HEXAGON_ARCH___ >= 60 */
1165957
1166#if __HVX_ARCH__ >= 60
1167958/* ==========================================================================
1168959 Assembly Syntax: Vx32.w+=vdmpy(Vu32.h,Rt32.uh):sat
1169960 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpyacc_VwVhRuh_sat(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -1172,9 +963,7 @@
1172963 ========================================================================== */
1173964
1174965#define Q6_Vw_vdmpyacc_VwVhRuh_sat(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhsusat_acc)(Vx,Vu,Rt)
1175#endif /* __HEXAGON_ARCH___ >= 60 */
1176966
1177#if __HVX_ARCH__ >= 60
1178967/* ==========================================================================
1179968 Assembly Syntax: Vd32.w=vdmpy(Vu32.h,Vv32.h):sat
1180969 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpy_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1183,9 +972,7 @@
1183972 ========================================================================== */
1184973
1185974#define Q6_Vw_vdmpy_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhvsat)(Vu,Vv)
1186#endif /* __HEXAGON_ARCH___ >= 60 */
1187975
1188#if __HVX_ARCH__ >= 60
1189976/* ==========================================================================
1190977 Assembly Syntax: Vx32.w+=vdmpy(Vu32.h,Vv32.h):sat
1191978 C Intrinsic Prototype: HVX_Vector Q6_Vw_vdmpyacc_VwVhVh_sat(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1194,9 +981,7 @@
1194981 ========================================================================== */
1195982
1196983#define Q6_Vw_vdmpyacc_VwVhVh_sat(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpyhvsat_acc)(Vx,Vu,Vv)
1197#endif /* __HEXAGON_ARCH___ >= 60 */
1198984
1199#if __HVX_ARCH__ >= 60
1200985/* ==========================================================================
1201986 Assembly Syntax: Vdd32.uw=vdsad(Vuu32.uh,Rt32.uh)
1202987 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vdsad_WuhRuh(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1205,9 +990,7 @@
1205990 ========================================================================== */
1206991
1207992#define Q6_Wuw_vdsad_WuhRuh(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdsaduh)(Vuu,Rt)
1208#endif /* __HEXAGON_ARCH___ >= 60 */
1209993
1210#if __HVX_ARCH__ >= 60
1211994/* ==========================================================================
1212995 Assembly Syntax: Vxx32.uw+=vdsad(Vuu32.uh,Rt32.uh)
1213996 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vdsadacc_WuwWuhRuh(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1216,9 +999,7 @@
1216999 ========================================================================== */
12171000
12181001#define Q6_Wuw_vdsadacc_WuwWuhRuh(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdsaduh_acc)(Vxx,Vuu,Rt)
1219#endif /* __HEXAGON_ARCH___ >= 60 */
12201002
1221#if __HVX_ARCH__ >= 60
12221003/* ==========================================================================
12231004 Assembly Syntax: Qd4=vcmp.eq(Vu32.b,Vv32.b)
12241005 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1227,9 +1008,7 @@
12271008 ========================================================================== */
12281009
12291010#define Q6_Q_vcmp_eq_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqb)(Vu,Vv)),-1)
1230#endif /* __HEXAGON_ARCH___ >= 60 */
12311011
1232#if __HVX_ARCH__ >= 60
12331012/* ==========================================================================
12341013 Assembly Syntax: Qx4&=vcmp.eq(Vu32.b,Vv32.b)
12351014 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVbVb(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1238,9 +1017,7 @@
12381017 ========================================================================== */
12391018
12401019#define Q6_Q_vcmp_eqand_QVbVb(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqb_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1241#endif /* __HEXAGON_ARCH___ >= 60 */
12421020
1243#if __HVX_ARCH__ >= 60
12441021/* ==========================================================================
12451022 Assembly Syntax: Qx4|=vcmp.eq(Vu32.b,Vv32.b)
12461023 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVbVb(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1249,9 +1026,7 @@
12491026 ========================================================================== */
12501027
12511028#define Q6_Q_vcmp_eqor_QVbVb(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqb_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1252#endif /* __HEXAGON_ARCH___ >= 60 */
12531029
1254#if __HVX_ARCH__ >= 60
12551030/* ==========================================================================
12561031 Assembly Syntax: Qx4^=vcmp.eq(Vu32.b,Vv32.b)
12571032 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVbVb(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1260,9 +1035,7 @@
12601035 ========================================================================== */
12611036
12621037#define Q6_Q_vcmp_eqxacc_QVbVb(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqb_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1263#endif /* __HEXAGON_ARCH___ >= 60 */
12641038
1265#if __HVX_ARCH__ >= 60
12661039/* ==========================================================================
12671040 Assembly Syntax: Qd4=vcmp.eq(Vu32.h,Vv32.h)
12681041 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1271,9 +1044,7 @@
12711044 ========================================================================== */
12721045
12731046#define Q6_Q_vcmp_eq_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqh)(Vu,Vv)),-1)
1274#endif /* __HEXAGON_ARCH___ >= 60 */
12751047
1276#if __HVX_ARCH__ >= 60
12771048/* ==========================================================================
12781049 Assembly Syntax: Qx4&=vcmp.eq(Vu32.h,Vv32.h)
12791050 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVhVh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1282,9 +1053,7 @@
12821053 ========================================================================== */
12831054
12841055#define Q6_Q_vcmp_eqand_QVhVh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqh_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1285#endif /* __HEXAGON_ARCH___ >= 60 */
12861056
1287#if __HVX_ARCH__ >= 60
12881057/* ==========================================================================
12891058 Assembly Syntax: Qx4|=vcmp.eq(Vu32.h,Vv32.h)
12901059 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVhVh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1293,9 +1062,7 @@
12931062 ========================================================================== */
12941063
12951064#define Q6_Q_vcmp_eqor_QVhVh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqh_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1296#endif /* __HEXAGON_ARCH___ >= 60 */
12971065
1298#if __HVX_ARCH__ >= 60
12991066/* ==========================================================================
13001067 Assembly Syntax: Qx4^=vcmp.eq(Vu32.h,Vv32.h)
13011068 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVhVh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1304,9 +1071,7 @@
13041071 ========================================================================== */
13051072
13061073#define Q6_Q_vcmp_eqxacc_QVhVh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqh_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1307#endif /* __HEXAGON_ARCH___ >= 60 */
13081074
1309#if __HVX_ARCH__ >= 60
13101075/* ==========================================================================
13111076 Assembly Syntax: Qd4=vcmp.eq(Vu32.w,Vv32.w)
13121077 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1315,9 +1080,7 @@
13151080 ========================================================================== */
13161081
13171082#define Q6_Q_vcmp_eq_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqw)(Vu,Vv)),-1)
1318#endif /* __HEXAGON_ARCH___ >= 60 */
13191083
1320#if __HVX_ARCH__ >= 60
13211084/* ==========================================================================
13221085 Assembly Syntax: Qx4&=vcmp.eq(Vu32.w,Vv32.w)
13231086 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVwVw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1326,9 +1089,7 @@
13261089 ========================================================================== */
13271090
13281091#define Q6_Q_vcmp_eqand_QVwVw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqw_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1329#endif /* __HEXAGON_ARCH___ >= 60 */
13301092
1331#if __HVX_ARCH__ >= 60
13321093/* ==========================================================================
13331094 Assembly Syntax: Qx4|=vcmp.eq(Vu32.w,Vv32.w)
13341095 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVwVw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1337,9 +1098,7 @@
13371098 ========================================================================== */
13381099
13391100#define Q6_Q_vcmp_eqor_QVwVw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqw_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1340#endif /* __HEXAGON_ARCH___ >= 60 */
13411101
1342#if __HVX_ARCH__ >= 60
13431102/* ==========================================================================
13441103 Assembly Syntax: Qx4^=vcmp.eq(Vu32.w,Vv32.w)
13451104 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVwVw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1348,9 +1107,7 @@
13481107 ========================================================================== */
13491108
13501109#define Q6_Q_vcmp_eqxacc_QVwVw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqw_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1351#endif /* __HEXAGON_ARCH___ >= 60 */
13521110
1353#if __HVX_ARCH__ >= 60
13541111/* ==========================================================================
13551112 Assembly Syntax: Qd4=vcmp.gt(Vu32.b,Vv32.b)
13561113 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1359,9 +1116,7 @@
13591116 ========================================================================== */
13601117
13611118#define Q6_Q_vcmp_gt_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtb)(Vu,Vv)),-1)
1362#endif /* __HEXAGON_ARCH___ >= 60 */
13631119
1364#if __HVX_ARCH__ >= 60
13651120/* ==========================================================================
13661121 Assembly Syntax: Qx4&=vcmp.gt(Vu32.b,Vv32.b)
13671122 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVbVb(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1370,9 +1125,7 @@
13701125 ========================================================================== */
13711126
13721127#define Q6_Q_vcmp_gtand_QVbVb(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtb_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1373#endif /* __HEXAGON_ARCH___ >= 60 */
13741128
1375#if __HVX_ARCH__ >= 60
13761129/* ==========================================================================
13771130 Assembly Syntax: Qx4|=vcmp.gt(Vu32.b,Vv32.b)
13781131 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVbVb(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1381,9 +1134,7 @@
13811134 ========================================================================== */
13821135
13831136#define Q6_Q_vcmp_gtor_QVbVb(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtb_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1384#endif /* __HEXAGON_ARCH___ >= 60 */
13851137
1386#if __HVX_ARCH__ >= 60
13871138/* ==========================================================================
13881139 Assembly Syntax: Qx4^=vcmp.gt(Vu32.b,Vv32.b)
13891140 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVbVb(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1392,9 +1143,7 @@
13921143 ========================================================================== */
13931144
13941145#define Q6_Q_vcmp_gtxacc_QVbVb(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtb_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1395#endif /* __HEXAGON_ARCH___ >= 60 */
13961146
1397#if __HVX_ARCH__ >= 60
13981147/* ==========================================================================
13991148 Assembly Syntax: Qd4=vcmp.gt(Vu32.h,Vv32.h)
14001149 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1403,9 +1152,7 @@
14031152 ========================================================================== */
14041153
14051154#define Q6_Q_vcmp_gt_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgth)(Vu,Vv)),-1)
1406#endif /* __HEXAGON_ARCH___ >= 60 */
14071155
1408#if __HVX_ARCH__ >= 60
14091156/* ==========================================================================
14101157 Assembly Syntax: Qx4&=vcmp.gt(Vu32.h,Vv32.h)
14111158 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVhVh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1414,9 +1161,7 @@
14141161 ========================================================================== */
14151162
14161163#define Q6_Q_vcmp_gtand_QVhVh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgth_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1417#endif /* __HEXAGON_ARCH___ >= 60 */
14181164
1419#if __HVX_ARCH__ >= 60
14201165/* ==========================================================================
14211166 Assembly Syntax: Qx4|=vcmp.gt(Vu32.h,Vv32.h)
14221167 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVhVh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1425,9 +1170,7 @@
14251170 ========================================================================== */
14261171
14271172#define Q6_Q_vcmp_gtor_QVhVh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgth_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1428#endif /* __HEXAGON_ARCH___ >= 60 */
14291173
1430#if __HVX_ARCH__ >= 60
14311174/* ==========================================================================
14321175 Assembly Syntax: Qx4^=vcmp.gt(Vu32.h,Vv32.h)
14331176 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVhVh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1436,9 +1179,7 @@
14361179 ========================================================================== */
14371180
14381181#define Q6_Q_vcmp_gtxacc_QVhVh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgth_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1439#endif /* __HEXAGON_ARCH___ >= 60 */
14401182
1441#if __HVX_ARCH__ >= 60
14421183/* ==========================================================================
14431184 Assembly Syntax: Qd4=vcmp.gt(Vu32.ub,Vv32.ub)
14441185 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1447,9 +1188,7 @@
14471188 ========================================================================== */
14481189
14491190#define Q6_Q_vcmp_gt_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtub)(Vu,Vv)),-1)
1450#endif /* __HEXAGON_ARCH___ >= 60 */
14511191
1452#if __HVX_ARCH__ >= 60
14531192/* ==========================================================================
14541193 Assembly Syntax: Qx4&=vcmp.gt(Vu32.ub,Vv32.ub)
14551194 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVubVub(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1458,9 +1197,7 @@
14581197 ========================================================================== */
14591198
14601199#define Q6_Q_vcmp_gtand_QVubVub(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtub_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1461#endif /* __HEXAGON_ARCH___ >= 60 */
14621200
1463#if __HVX_ARCH__ >= 60
14641201/* ==========================================================================
14651202 Assembly Syntax: Qx4|=vcmp.gt(Vu32.ub,Vv32.ub)
14661203 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVubVub(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1469,9 +1206,7 @@
14691206 ========================================================================== */
14701207
14711208#define Q6_Q_vcmp_gtor_QVubVub(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtub_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1472#endif /* __HEXAGON_ARCH___ >= 60 */
14731209
1474#if __HVX_ARCH__ >= 60
14751210/* ==========================================================================
14761211 Assembly Syntax: Qx4^=vcmp.gt(Vu32.ub,Vv32.ub)
14771212 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVubVub(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1480,9 +1215,7 @@
14801215 ========================================================================== */
14811216
14821217#define Q6_Q_vcmp_gtxacc_QVubVub(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtub_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1483#endif /* __HEXAGON_ARCH___ >= 60 */
14841218
1485#if __HVX_ARCH__ >= 60
14861219/* ==========================================================================
14871220 Assembly Syntax: Qd4=vcmp.gt(Vu32.uh,Vv32.uh)
14881221 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1491,9 +1224,7 @@
14911224 ========================================================================== */
14921225
14931226#define Q6_Q_vcmp_gt_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuh)(Vu,Vv)),-1)
1494#endif /* __HEXAGON_ARCH___ >= 60 */
14951227
1496#if __HVX_ARCH__ >= 60
14971228/* ==========================================================================
14981229 Assembly Syntax: Qx4&=vcmp.gt(Vu32.uh,Vv32.uh)
14991230 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVuhVuh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1502,9 +1233,7 @@
15021233 ========================================================================== */
15031234
15041235#define Q6_Q_vcmp_gtand_QVuhVuh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuh_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1505#endif /* __HEXAGON_ARCH___ >= 60 */
15061236
1507#if __HVX_ARCH__ >= 60
15081237/* ==========================================================================
15091238 Assembly Syntax: Qx4|=vcmp.gt(Vu32.uh,Vv32.uh)
15101239 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVuhVuh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1513,9 +1242,7 @@
15131242 ========================================================================== */
15141243
15151244#define Q6_Q_vcmp_gtor_QVuhVuh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuh_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1516#endif /* __HEXAGON_ARCH___ >= 60 */
15171245
1518#if __HVX_ARCH__ >= 60
15191246/* ==========================================================================
15201247 Assembly Syntax: Qx4^=vcmp.gt(Vu32.uh,Vv32.uh)
15211248 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVuhVuh(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1524,9 +1251,7 @@
15241251 ========================================================================== */
15251252
15261253#define Q6_Q_vcmp_gtxacc_QVuhVuh(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuh_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1527#endif /* __HEXAGON_ARCH___ >= 60 */
15281254
1529#if __HVX_ARCH__ >= 60
15301255/* ==========================================================================
15311256 Assembly Syntax: Qd4=vcmp.gt(Vu32.uw,Vv32.uw)
15321257 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VuwVuw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1535,9 +1260,7 @@
15351260 ========================================================================== */
15361261
15371262#define Q6_Q_vcmp_gt_VuwVuw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuw)(Vu,Vv)),-1)
1538#endif /* __HEXAGON_ARCH___ >= 60 */
15391263
1540#if __HVX_ARCH__ >= 60
15411264/* ==========================================================================
15421265 Assembly Syntax: Qx4&=vcmp.gt(Vu32.uw,Vv32.uw)
15431266 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVuwVuw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1546,9 +1269,7 @@
15461269 ========================================================================== */
15471270
15481271#define Q6_Q_vcmp_gtand_QVuwVuw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuw_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1549#endif /* __HEXAGON_ARCH___ >= 60 */
15501272
1551#if __HVX_ARCH__ >= 60
15521273/* ==========================================================================
15531274 Assembly Syntax: Qx4|=vcmp.gt(Vu32.uw,Vv32.uw)
15541275 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVuwVuw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1557,9 +1278,7 @@
15571278 ========================================================================== */
15581279
15591280#define Q6_Q_vcmp_gtor_QVuwVuw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuw_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1560#endif /* __HEXAGON_ARCH___ >= 60 */
15611281
1562#if __HVX_ARCH__ >= 60
15631282/* ==========================================================================
15641283 Assembly Syntax: Qx4^=vcmp.gt(Vu32.uw,Vv32.uw)
15651284 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVuwVuw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1568,9 +1287,7 @@
15681287 ========================================================================== */
15691288
15701289#define Q6_Q_vcmp_gtxacc_QVuwVuw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtuw_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1571#endif /* __HEXAGON_ARCH___ >= 60 */
15721290
1573#if __HVX_ARCH__ >= 60
15741291/* ==========================================================================
15751292 Assembly Syntax: Qd4=vcmp.gt(Vu32.w,Vv32.w)
15761293 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1579,9 +1296,7 @@
15791296 ========================================================================== */
15801297
15811298#define Q6_Q_vcmp_gt_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtw)(Vu,Vv)),-1)
1582#endif /* __HEXAGON_ARCH___ >= 60 */
15831299
1584#if __HVX_ARCH__ >= 60
15851300/* ==========================================================================
15861301 Assembly Syntax: Qx4&=vcmp.gt(Vu32.w,Vv32.w)
15871302 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVwVw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1590,9 +1305,7 @@
15901305 ========================================================================== */
15911306
15921307#define Q6_Q_vcmp_gtand_QVwVw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtw_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1593#endif /* __HEXAGON_ARCH___ >= 60 */
15941308
1595#if __HVX_ARCH__ >= 60
15961309/* ==========================================================================
15971310 Assembly Syntax: Qx4|=vcmp.gt(Vu32.w,Vv32.w)
15981311 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVwVw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1601,9 +1314,7 @@
16011314 ========================================================================== */
16021315
16031316#define Q6_Q_vcmp_gtor_QVwVw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtw_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1604#endif /* __HEXAGON_ARCH___ >= 60 */
16051317
1606#if __HVX_ARCH__ >= 60
16071318/* ==========================================================================
16081319 Assembly Syntax: Qx4^=vcmp.gt(Vu32.w,Vv32.w)
16091320 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVwVw(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1612,9 +1323,7 @@
16121323 ========================================================================== */
16131324
16141325#define Q6_Q_vcmp_gtxacc_QVwVw(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtw_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
1615#endif /* __HEXAGON_ARCH___ >= 60 */
16161326
1617#if __HVX_ARCH__ >= 60
16181327/* ==========================================================================
16191328 Assembly Syntax: Vx32.w=vinsert(Rt32)
16201329 C Intrinsic Prototype: HVX_Vector Q6_Vw_vinsert_VwR(HVX_Vector Vx, Word32 Rt)
......@@ -1623,9 +1332,7 @@
16231332 ========================================================================== */
16241333
16251334#define Q6_Vw_vinsert_VwR(Vx,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vinsertwr)(Vx,Rt)
1626#endif /* __HEXAGON_ARCH___ >= 60 */
16271335
1628#if __HVX_ARCH__ >= 60
16291336/* ==========================================================================
16301337 Assembly Syntax: Vd32=vlalign(Vu32,Vv32,Rt8)
16311338 C Intrinsic Prototype: HVX_Vector Q6_V_vlalign_VVR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -1634,9 +1341,7 @@
16341341 ========================================================================== */
16351342
16361343#define Q6_V_vlalign_VVR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlalignb)(Vu,Vv,Rt)
1637#endif /* __HEXAGON_ARCH___ >= 60 */
16381344
1639#if __HVX_ARCH__ >= 60
16401345/* ==========================================================================
16411346 Assembly Syntax: Vd32=vlalign(Vu32,Vv32,#u3)
16421347 C Intrinsic Prototype: HVX_Vector Q6_V_vlalign_VVI(HVX_Vector Vu, HVX_Vector Vv, Word32 Iu3)
......@@ -1645,9 +1350,7 @@
16451350 ========================================================================== */
16461351
16471352#define Q6_V_vlalign_VVI(Vu,Vv,Iu3) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlalignbi)(Vu,Vv,Iu3)
1648#endif /* __HEXAGON_ARCH___ >= 60 */
16491353
1650#if __HVX_ARCH__ >= 60
16511354/* ==========================================================================
16521355 Assembly Syntax: Vd32.uh=vlsr(Vu32.uh,Rt32)
16531356 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vlsr_VuhR(HVX_Vector Vu, Word32 Rt)
......@@ -1656,9 +1359,7 @@
16561359 ========================================================================== */
16571360
16581361#define Q6_Vuh_vlsr_VuhR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlsrh)(Vu,Rt)
1659#endif /* __HEXAGON_ARCH___ >= 60 */
16601362
1661#if __HVX_ARCH__ >= 60
16621363/* ==========================================================================
16631364 Assembly Syntax: Vd32.h=vlsr(Vu32.h,Vv32.h)
16641365 C Intrinsic Prototype: HVX_Vector Q6_Vh_vlsr_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1667,9 +1368,7 @@
16671368 ========================================================================== */
16681369
16691370#define Q6_Vh_vlsr_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlsrhv)(Vu,Vv)
1670#endif /* __HEXAGON_ARCH___ >= 60 */
16711371
1672#if __HVX_ARCH__ >= 60
16731372/* ==========================================================================
16741373 Assembly Syntax: Vd32.uw=vlsr(Vu32.uw,Rt32)
16751374 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vlsr_VuwR(HVX_Vector Vu, Word32 Rt)
......@@ -1678,9 +1377,7 @@
16781377 ========================================================================== */
16791378
16801379#define Q6_Vuw_vlsr_VuwR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlsrw)(Vu,Rt)
1681#endif /* __HEXAGON_ARCH___ >= 60 */
16821380
1683#if __HVX_ARCH__ >= 60
16841381/* ==========================================================================
16851382 Assembly Syntax: Vd32.w=vlsr(Vu32.w,Vv32.w)
16861383 C Intrinsic Prototype: HVX_Vector Q6_Vw_vlsr_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1689,9 +1386,7 @@
16891386 ========================================================================== */
16901387
16911388#define Q6_Vw_vlsr_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlsrwv)(Vu,Vv)
1692#endif /* __HEXAGON_ARCH___ >= 60 */
16931389
1694#if __HVX_ARCH__ >= 60
16951390/* ==========================================================================
16961391 Assembly Syntax: Vd32.b=vlut32(Vu32.b,Vv32.b,Rt8)
16971392 C Intrinsic Prototype: HVX_Vector Q6_Vb_vlut32_VbVbR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -1700,9 +1395,7 @@
17001395 ========================================================================== */
17011396
17021397#define Q6_Vb_vlut32_VbVbR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvvb)(Vu,Vv,Rt)
1703#endif /* __HEXAGON_ARCH___ >= 60 */
17041398
1705#if __HVX_ARCH__ >= 60
17061399/* ==========================================================================
17071400 Assembly Syntax: Vx32.b|=vlut32(Vu32.b,Vv32.b,Rt8)
17081401 C Intrinsic Prototype: HVX_Vector Q6_Vb_vlut32or_VbVbVbR(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -1711,9 +1404,7 @@
17111404 ========================================================================== */
17121405
17131406#define Q6_Vb_vlut32or_VbVbVbR(Vx,Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvvb_oracc)(Vx,Vu,Vv,Rt)
1714#endif /* __HEXAGON_ARCH___ >= 60 */
17151407
1716#if __HVX_ARCH__ >= 60
17171408/* ==========================================================================
17181409 Assembly Syntax: Vdd32.h=vlut16(Vu32.b,Vv32.h,Rt8)
17191410 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vlut16_VbVhR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -1722,9 +1413,7 @@
17221413 ========================================================================== */
17231414
17241415#define Q6_Wh_vlut16_VbVhR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvwh)(Vu,Vv,Rt)
1725#endif /* __HEXAGON_ARCH___ >= 60 */
17261416
1727#if __HVX_ARCH__ >= 60
17281417/* ==========================================================================
17291418 Assembly Syntax: Vxx32.h|=vlut16(Vu32.b,Vv32.h,Rt8)
17301419 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vlut16or_WhVbVhR(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -1733,9 +1422,7 @@
17331422 ========================================================================== */
17341423
17351424#define Q6_Wh_vlut16or_WhVbVhR(Vxx,Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvwh_oracc)(Vxx,Vu,Vv,Rt)
1736#endif /* __HEXAGON_ARCH___ >= 60 */
17371425
1738#if __HVX_ARCH__ >= 60
17391426/* ==========================================================================
17401427 Assembly Syntax: Vd32.h=vmax(Vu32.h,Vv32.h)
17411428 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmax_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1744,9 +1431,7 @@
17441431 ========================================================================== */
17451432
17461433#define Q6_Vh_vmax_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmaxh)(Vu,Vv)
1747#endif /* __HEXAGON_ARCH___ >= 60 */
17481434
1749#if __HVX_ARCH__ >= 60
17501435/* ==========================================================================
17511436 Assembly Syntax: Vd32.ub=vmax(Vu32.ub,Vv32.ub)
17521437 C Intrinsic Prototype: HVX_Vector Q6_Vub_vmax_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1755,9 +1440,7 @@
17551440 ========================================================================== */
17561441
17571442#define Q6_Vub_vmax_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmaxub)(Vu,Vv)
1758#endif /* __HEXAGON_ARCH___ >= 60 */
17591443
1760#if __HVX_ARCH__ >= 60
17611444/* ==========================================================================
17621445 Assembly Syntax: Vd32.uh=vmax(Vu32.uh,Vv32.uh)
17631446 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vmax_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1766,9 +1449,7 @@
17661449 ========================================================================== */
17671450
17681451#define Q6_Vuh_vmax_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmaxuh)(Vu,Vv)
1769#endif /* __HEXAGON_ARCH___ >= 60 */
17701452
1771#if __HVX_ARCH__ >= 60
17721453/* ==========================================================================
17731454 Assembly Syntax: Vd32.w=vmax(Vu32.w,Vv32.w)
17741455 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmax_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1777,9 +1458,7 @@
17771458 ========================================================================== */
17781459
17791460#define Q6_Vw_vmax_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmaxw)(Vu,Vv)
1780#endif /* __HEXAGON_ARCH___ >= 60 */
17811461
1782#if __HVX_ARCH__ >= 60
17831462/* ==========================================================================
17841463 Assembly Syntax: Vd32.h=vmin(Vu32.h,Vv32.h)
17851464 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmin_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1788,9 +1467,7 @@
17881467 ========================================================================== */
17891468
17901469#define Q6_Vh_vmin_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vminh)(Vu,Vv)
1791#endif /* __HEXAGON_ARCH___ >= 60 */
17921470
1793#if __HVX_ARCH__ >= 60
17941471/* ==========================================================================
17951472 Assembly Syntax: Vd32.ub=vmin(Vu32.ub,Vv32.ub)
17961473 C Intrinsic Prototype: HVX_Vector Q6_Vub_vmin_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1799,9 +1476,7 @@
17991476 ========================================================================== */
18001477
18011478#define Q6_Vub_vmin_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vminub)(Vu,Vv)
1802#endif /* __HEXAGON_ARCH___ >= 60 */
18031479
1804#if __HVX_ARCH__ >= 60
18051480/* ==========================================================================
18061481 Assembly Syntax: Vd32.uh=vmin(Vu32.uh,Vv32.uh)
18071482 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vmin_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1810,9 +1485,7 @@
18101485 ========================================================================== */
18111486
18121487#define Q6_Vuh_vmin_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vminuh)(Vu,Vv)
1813#endif /* __HEXAGON_ARCH___ >= 60 */
18141488
1815#if __HVX_ARCH__ >= 60
18161489/* ==========================================================================
18171490 Assembly Syntax: Vd32.w=vmin(Vu32.w,Vv32.w)
18181491 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmin_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1821,9 +1494,7 @@
18211494 ========================================================================== */
18221495
18231496#define Q6_Vw_vmin_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vminw)(Vu,Vv)
1824#endif /* __HEXAGON_ARCH___ >= 60 */
18251497
1826#if __HVX_ARCH__ >= 60
18271498/* ==========================================================================
18281499 Assembly Syntax: Vdd32.h=vmpa(Vuu32.ub,Rt32.b)
18291500 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpa_WubRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1832,9 +1503,7 @@
18321503 ========================================================================== */
18331504
18341505#define Q6_Wh_vmpa_WubRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpabus)(Vuu,Rt)
1835#endif /* __HEXAGON_ARCH___ >= 60 */
18361506
1837#if __HVX_ARCH__ >= 60
18381507/* ==========================================================================
18391508 Assembly Syntax: Vxx32.h+=vmpa(Vuu32.ub,Rt32.b)
18401509 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpaacc_WhWubRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1843,9 +1512,7 @@
18431512 ========================================================================== */
18441513
18451514#define Q6_Wh_vmpaacc_WhWubRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpabus_acc)(Vxx,Vuu,Rt)
1846#endif /* __HEXAGON_ARCH___ >= 60 */
18471515
1848#if __HVX_ARCH__ >= 60
18491516/* ==========================================================================
18501517 Assembly Syntax: Vdd32.h=vmpa(Vuu32.ub,Vvv32.b)
18511518 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpa_WubWb(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -1854,9 +1521,7 @@
18541521 ========================================================================== */
18551522
18561523#define Q6_Wh_vmpa_WubWb(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpabusv)(Vuu,Vvv)
1857#endif /* __HEXAGON_ARCH___ >= 60 */
18581524
1859#if __HVX_ARCH__ >= 60
18601525/* ==========================================================================
18611526 Assembly Syntax: Vdd32.h=vmpa(Vuu32.ub,Vvv32.ub)
18621527 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpa_WubWub(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -1865,9 +1530,7 @@
18651530 ========================================================================== */
18661531
18671532#define Q6_Wh_vmpa_WubWub(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpabuuv)(Vuu,Vvv)
1868#endif /* __HEXAGON_ARCH___ >= 60 */
18691533
1870#if __HVX_ARCH__ >= 60
18711534/* ==========================================================================
18721535 Assembly Syntax: Vdd32.w=vmpa(Vuu32.h,Rt32.b)
18731536 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpa_WhRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -1876,9 +1539,7 @@
18761539 ========================================================================== */
18771540
18781541#define Q6_Ww_vmpa_WhRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpahb)(Vuu,Rt)
1879#endif /* __HEXAGON_ARCH___ >= 60 */
18801542
1881#if __HVX_ARCH__ >= 60
18821543/* ==========================================================================
18831544 Assembly Syntax: Vxx32.w+=vmpa(Vuu32.h,Rt32.b)
18841545 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpaacc_WwWhRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -1887,9 +1548,7 @@
18871548 ========================================================================== */
18881549
18891550#define Q6_Ww_vmpaacc_WwWhRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpahb_acc)(Vxx,Vuu,Rt)
1890#endif /* __HEXAGON_ARCH___ >= 60 */
18911551
1892#if __HVX_ARCH__ >= 60
18931552/* ==========================================================================
18941553 Assembly Syntax: Vdd32.h=vmpy(Vu32.ub,Rt32.b)
18951554 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpy_VubRb(HVX_Vector Vu, Word32 Rt)
......@@ -1898,9 +1557,7 @@
18981557 ========================================================================== */
18991558
19001559#define Q6_Wh_vmpy_VubRb(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpybus)(Vu,Rt)
1901#endif /* __HEXAGON_ARCH___ >= 60 */
19021560
1903#if __HVX_ARCH__ >= 60
19041561/* ==========================================================================
19051562 Assembly Syntax: Vxx32.h+=vmpy(Vu32.ub,Rt32.b)
19061563 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpyacc_WhVubRb(HVX_VectorPair Vxx, HVX_Vector Vu, Word32 Rt)
......@@ -1909,9 +1566,7 @@
19091566 ========================================================================== */
19101567
19111568#define Q6_Wh_vmpyacc_WhVubRb(Vxx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpybus_acc)(Vxx,Vu,Rt)
1912#endif /* __HEXAGON_ARCH___ >= 60 */
19131569
1914#if __HVX_ARCH__ >= 60
19151570/* ==========================================================================
19161571 Assembly Syntax: Vdd32.h=vmpy(Vu32.ub,Vv32.b)
19171572 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpy_VubVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1920,9 +1575,7 @@
19201575 ========================================================================== */
19211576
19221577#define Q6_Wh_vmpy_VubVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpybusv)(Vu,Vv)
1923#endif /* __HEXAGON_ARCH___ >= 60 */
19241578
1925#if __HVX_ARCH__ >= 60
19261579/* ==========================================================================
19271580 Assembly Syntax: Vxx32.h+=vmpy(Vu32.ub,Vv32.b)
19281581 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpyacc_WhVubVb(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1931,9 +1584,7 @@
19311584 ========================================================================== */
19321585
19331586#define Q6_Wh_vmpyacc_WhVubVb(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpybusv_acc)(Vxx,Vu,Vv)
1934#endif /* __HEXAGON_ARCH___ >= 60 */
19351587
1936#if __HVX_ARCH__ >= 60
19371588/* ==========================================================================
19381589 Assembly Syntax: Vdd32.h=vmpy(Vu32.b,Vv32.b)
19391590 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpy_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1942,9 +1593,7 @@
19421593 ========================================================================== */
19431594
19441595#define Q6_Wh_vmpy_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpybv)(Vu,Vv)
1945#endif /* __HEXAGON_ARCH___ >= 60 */
19461596
1947#if __HVX_ARCH__ >= 60
19481597/* ==========================================================================
19491598 Assembly Syntax: Vxx32.h+=vmpy(Vu32.b,Vv32.b)
19501599 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vmpyacc_WhVbVb(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -1953,9 +1602,7 @@
19531602 ========================================================================== */
19541603
19551604#define Q6_Wh_vmpyacc_WhVbVb(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpybv_acc)(Vxx,Vu,Vv)
1956#endif /* __HEXAGON_ARCH___ >= 60 */
19571605
1958#if __HVX_ARCH__ >= 60
19591606/* ==========================================================================
19601607 Assembly Syntax: Vd32.w=vmpye(Vu32.w,Vv32.uh)
19611608 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpye_VwVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -1964,9 +1611,7 @@
19641611 ========================================================================== */
19651612
19661613#define Q6_Vw_vmpye_VwVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyewuh)(Vu,Vv)
1967#endif /* __HEXAGON_ARCH___ >= 60 */
19681614
1969#if __HVX_ARCH__ >= 60
19701615/* ==========================================================================
19711616 Assembly Syntax: Vdd32.w=vmpy(Vu32.h,Rt32.h)
19721617 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpy_VhRh(HVX_Vector Vu, Word32 Rt)
......@@ -1975,9 +1620,7 @@
19751620 ========================================================================== */
19761621
19771622#define Q6_Ww_vmpy_VhRh(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyh)(Vu,Rt)
1978#endif /* __HEXAGON_ARCH___ >= 60 */
19791623
1980#if __HVX_ARCH__ >= 60
19811624/* ==========================================================================
19821625 Assembly Syntax: Vxx32.w+=vmpy(Vu32.h,Rt32.h):sat
19831626 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpyacc_WwVhRh_sat(HVX_VectorPair Vxx, HVX_Vector Vu, Word32 Rt)
......@@ -1986,9 +1629,7 @@
19861629 ========================================================================== */
19871630
19881631#define Q6_Ww_vmpyacc_WwVhRh_sat(Vxx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhsat_acc)(Vxx,Vu,Rt)
1989#endif /* __HEXAGON_ARCH___ >= 60 */
19901632
1991#if __HVX_ARCH__ >= 60
19921633/* ==========================================================================
19931634 Assembly Syntax: Vd32.h=vmpy(Vu32.h,Rt32.h):<<1:rnd:sat
19941635 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpy_VhRh_s1_rnd_sat(HVX_Vector Vu, Word32 Rt)
......@@ -1997,9 +1638,7 @@
19971638 ========================================================================== */
19981639
19991640#define Q6_Vh_vmpy_VhRh_s1_rnd_sat(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhsrs)(Vu,Rt)
2000#endif /* __HEXAGON_ARCH___ >= 60 */
20011641
2002#if __HVX_ARCH__ >= 60
20031642/* ==========================================================================
20041643 Assembly Syntax: Vd32.h=vmpy(Vu32.h,Rt32.h):<<1:sat
20051644 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpy_VhRh_s1_sat(HVX_Vector Vu, Word32 Rt)
......@@ -2008,9 +1647,7 @@
20081647 ========================================================================== */
20091648
20101649#define Q6_Vh_vmpy_VhRh_s1_sat(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhss)(Vu,Rt)
2011#endif /* __HEXAGON_ARCH___ >= 60 */
20121650
2013#if __HVX_ARCH__ >= 60
20141651/* ==========================================================================
20151652 Assembly Syntax: Vdd32.w=vmpy(Vu32.h,Vv32.uh)
20161653 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpy_VhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2019,9 +1656,7 @@
20191656 ========================================================================== */
20201657
20211658#define Q6_Ww_vmpy_VhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhus)(Vu,Vv)
2022#endif /* __HEXAGON_ARCH___ >= 60 */
20231659
2024#if __HVX_ARCH__ >= 60
20251660/* ==========================================================================
20261661 Assembly Syntax: Vxx32.w+=vmpy(Vu32.h,Vv32.uh)
20271662 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpyacc_WwVhVuh(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2030,9 +1665,7 @@
20301665 ========================================================================== */
20311666
20321667#define Q6_Ww_vmpyacc_WwVhVuh(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhus_acc)(Vxx,Vu,Vv)
2033#endif /* __HEXAGON_ARCH___ >= 60 */
20341668
2035#if __HVX_ARCH__ >= 60
20361669/* ==========================================================================
20371670 Assembly Syntax: Vdd32.w=vmpy(Vu32.h,Vv32.h)
20381671 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpy_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2041,9 +1674,7 @@
20411674 ========================================================================== */
20421675
20431676#define Q6_Ww_vmpy_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhv)(Vu,Vv)
2044#endif /* __HEXAGON_ARCH___ >= 60 */
20451677
2046#if __HVX_ARCH__ >= 60
20471678/* ==========================================================================
20481679 Assembly Syntax: Vxx32.w+=vmpy(Vu32.h,Vv32.h)
20491680 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vmpyacc_WwVhVh(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2052,9 +1683,7 @@
20521683 ========================================================================== */
20531684
20541685#define Q6_Ww_vmpyacc_WwVhVh(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhv_acc)(Vxx,Vu,Vv)
2055#endif /* __HEXAGON_ARCH___ >= 60 */
20561686
2057#if __HVX_ARCH__ >= 60
20581687/* ==========================================================================
20591688 Assembly Syntax: Vd32.h=vmpy(Vu32.h,Vv32.h):<<1:rnd:sat
20601689 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpy_VhVh_s1_rnd_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2063,9 +1692,7 @@
20631692 ========================================================================== */
20641693
20651694#define Q6_Vh_vmpy_VhVh_s1_rnd_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyhvsrs)(Vu,Vv)
2066#endif /* __HEXAGON_ARCH___ >= 60 */
20671695
2068#if __HVX_ARCH__ >= 60
20691696/* ==========================================================================
20701697 Assembly Syntax: Vd32.w=vmpyieo(Vu32.h,Vv32.h)
20711698 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyieo_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2074,9 +1701,7 @@
20741701 ========================================================================== */
20751702
20761703#define Q6_Vw_vmpyieo_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyieoh)(Vu,Vv)
2077#endif /* __HEXAGON_ARCH___ >= 60 */
20781704
2079#if __HVX_ARCH__ >= 60
20801705/* ==========================================================================
20811706 Assembly Syntax: Vx32.w+=vmpyie(Vu32.w,Vv32.h)
20821707 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyieacc_VwVwVh(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2085,9 +1710,7 @@
20851710 ========================================================================== */
20861711
20871712#define Q6_Vw_vmpyieacc_VwVwVh(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiewh_acc)(Vx,Vu,Vv)
2088#endif /* __HEXAGON_ARCH___ >= 60 */
20891713
2090#if __HVX_ARCH__ >= 60
20911714/* ==========================================================================
20921715 Assembly Syntax: Vd32.w=vmpyie(Vu32.w,Vv32.uh)
20931716 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyie_VwVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2096,9 +1719,7 @@
20961719 ========================================================================== */
20971720
20981721#define Q6_Vw_vmpyie_VwVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiewuh)(Vu,Vv)
2099#endif /* __HEXAGON_ARCH___ >= 60 */
21001722
2101#if __HVX_ARCH__ >= 60
21021723/* ==========================================================================
21031724 Assembly Syntax: Vx32.w+=vmpyie(Vu32.w,Vv32.uh)
21041725 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyieacc_VwVwVuh(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2107,9 +1728,7 @@
21071728 ========================================================================== */
21081729
21091730#define Q6_Vw_vmpyieacc_VwVwVuh(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiewuh_acc)(Vx,Vu,Vv)
2110#endif /* __HEXAGON_ARCH___ >= 60 */
21111731
2112#if __HVX_ARCH__ >= 60
21131732/* ==========================================================================
21141733 Assembly Syntax: Vd32.h=vmpyi(Vu32.h,Vv32.h)
21151734 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpyi_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2118,9 +1737,7 @@
21181737 ========================================================================== */
21191738
21201739#define Q6_Vh_vmpyi_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyih)(Vu,Vv)
2121#endif /* __HEXAGON_ARCH___ >= 60 */
21221740
2123#if __HVX_ARCH__ >= 60
21241741/* ==========================================================================
21251742 Assembly Syntax: Vx32.h+=vmpyi(Vu32.h,Vv32.h)
21261743 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpyiacc_VhVhVh(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2129,9 +1746,7 @@
21291746 ========================================================================== */
21301747
21311748#define Q6_Vh_vmpyiacc_VhVhVh(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyih_acc)(Vx,Vu,Vv)
2132#endif /* __HEXAGON_ARCH___ >= 60 */
21331749
2134#if __HVX_ARCH__ >= 60
21351750/* ==========================================================================
21361751 Assembly Syntax: Vd32.h=vmpyi(Vu32.h,Rt32.b)
21371752 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpyi_VhRb(HVX_Vector Vu, Word32 Rt)
......@@ -2140,9 +1755,7 @@
21401755 ========================================================================== */
21411756
21421757#define Q6_Vh_vmpyi_VhRb(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyihb)(Vu,Rt)
2143#endif /* __HEXAGON_ARCH___ >= 60 */
21441758
2145#if __HVX_ARCH__ >= 60
21461759/* ==========================================================================
21471760 Assembly Syntax: Vx32.h+=vmpyi(Vu32.h,Rt32.b)
21481761 C Intrinsic Prototype: HVX_Vector Q6_Vh_vmpyiacc_VhVhRb(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -2151,9 +1764,7 @@
21511764 ========================================================================== */
21521765
21531766#define Q6_Vh_vmpyiacc_VhVhRb(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyihb_acc)(Vx,Vu,Rt)
2154#endif /* __HEXAGON_ARCH___ >= 60 */
21551767
2156#if __HVX_ARCH__ >= 60
21571768/* ==========================================================================
21581769 Assembly Syntax: Vd32.w=vmpyio(Vu32.w,Vv32.h)
21591770 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyio_VwVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2162,9 +1773,7 @@
21621773 ========================================================================== */
21631774
21641775#define Q6_Vw_vmpyio_VwVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiowh)(Vu,Vv)
2165#endif /* __HEXAGON_ARCH___ >= 60 */
21661776
2167#if __HVX_ARCH__ >= 60
21681777/* ==========================================================================
21691778 Assembly Syntax: Vd32.w=vmpyi(Vu32.w,Rt32.b)
21701779 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyi_VwRb(HVX_Vector Vu, Word32 Rt)
......@@ -2173,9 +1782,7 @@
21731782 ========================================================================== */
21741783
21751784#define Q6_Vw_vmpyi_VwRb(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiwb)(Vu,Rt)
2176#endif /* __HEXAGON_ARCH___ >= 60 */
21771785
2178#if __HVX_ARCH__ >= 60
21791786/* ==========================================================================
21801787 Assembly Syntax: Vx32.w+=vmpyi(Vu32.w,Rt32.b)
21811788 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyiacc_VwVwRb(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -2184,9 +1791,7 @@
21841791 ========================================================================== */
21851792
21861793#define Q6_Vw_vmpyiacc_VwVwRb(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiwb_acc)(Vx,Vu,Rt)
2187#endif /* __HEXAGON_ARCH___ >= 60 */
21881794
2189#if __HVX_ARCH__ >= 60
21901795/* ==========================================================================
21911796 Assembly Syntax: Vd32.w=vmpyi(Vu32.w,Rt32.h)
21921797 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyi_VwRh(HVX_Vector Vu, Word32 Rt)
......@@ -2195,9 +1800,7 @@
21951800 ========================================================================== */
21961801
21971802#define Q6_Vw_vmpyi_VwRh(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiwh)(Vu,Rt)
2198#endif /* __HEXAGON_ARCH___ >= 60 */
21991803
2200#if __HVX_ARCH__ >= 60
22011804/* ==========================================================================
22021805 Assembly Syntax: Vx32.w+=vmpyi(Vu32.w,Rt32.h)
22031806 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyiacc_VwVwRh(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -2206,9 +1809,7 @@
22061809 ========================================================================== */
22071810
22081811#define Q6_Vw_vmpyiacc_VwVwRh(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiwh_acc)(Vx,Vu,Rt)
2209#endif /* __HEXAGON_ARCH___ >= 60 */
22101812
2211#if __HVX_ARCH__ >= 60
22121813/* ==========================================================================
22131814 Assembly Syntax: Vd32.w=vmpyo(Vu32.w,Vv32.h):<<1:sat
22141815 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyo_VwVh_s1_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2217,9 +1818,7 @@
22171818 ========================================================================== */
22181819
22191820#define Q6_Vw_vmpyo_VwVh_s1_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyowh)(Vu,Vv)
2220#endif /* __HEXAGON_ARCH___ >= 60 */
22211821
2222#if __HVX_ARCH__ >= 60
22231822/* ==========================================================================
22241823 Assembly Syntax: Vd32.w=vmpyo(Vu32.w,Vv32.h):<<1:rnd:sat
22251824 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyo_VwVh_s1_rnd_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2228,9 +1827,7 @@
22281827 ========================================================================== */
22291828
22301829#define Q6_Vw_vmpyo_VwVh_s1_rnd_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyowh_rnd)(Vu,Vv)
2231#endif /* __HEXAGON_ARCH___ >= 60 */
22321830
2233#if __HVX_ARCH__ >= 60
22341831/* ==========================================================================
22351832 Assembly Syntax: Vx32.w+=vmpyo(Vu32.w,Vv32.h):<<1:rnd:sat:shift
22361833 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyoacc_VwVwVh_s1_rnd_sat_shift(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2239,9 +1836,7 @@
22391836 ========================================================================== */
22401837
22411838#define Q6_Vw_vmpyoacc_VwVwVh_s1_rnd_sat_shift(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyowh_rnd_sacc)(Vx,Vu,Vv)
2242#endif /* __HEXAGON_ARCH___ >= 60 */
22431839
2244#if __HVX_ARCH__ >= 60
22451840/* ==========================================================================
22461841 Assembly Syntax: Vx32.w+=vmpyo(Vu32.w,Vv32.h):<<1:sat:shift
22471842 C Intrinsic Prototype: HVX_Vector Q6_Vw_vmpyoacc_VwVwVh_s1_sat_shift(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2250,9 +1845,7 @@
22501845 ========================================================================== */
22511846
22521847#define Q6_Vw_vmpyoacc_VwVwVh_s1_sat_shift(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyowh_sacc)(Vx,Vu,Vv)
2253#endif /* __HEXAGON_ARCH___ >= 60 */
22541848
2255#if __HVX_ARCH__ >= 60
22561849/* ==========================================================================
22571850 Assembly Syntax: Vdd32.uh=vmpy(Vu32.ub,Rt32.ub)
22581851 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vmpy_VubRub(HVX_Vector Vu, Word32 Rt)
......@@ -2261,9 +1854,7 @@
22611854 ========================================================================== */
22621855
22631856#define Q6_Wuh_vmpy_VubRub(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyub)(Vu,Rt)
2264#endif /* __HEXAGON_ARCH___ >= 60 */
22651857
2266#if __HVX_ARCH__ >= 60
22671858/* ==========================================================================
22681859 Assembly Syntax: Vxx32.uh+=vmpy(Vu32.ub,Rt32.ub)
22691860 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vmpyacc_WuhVubRub(HVX_VectorPair Vxx, HVX_Vector Vu, Word32 Rt)
......@@ -2272,9 +1863,7 @@
22721863 ========================================================================== */
22731864
22741865#define Q6_Wuh_vmpyacc_WuhVubRub(Vxx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyub_acc)(Vxx,Vu,Rt)
2275#endif /* __HEXAGON_ARCH___ >= 60 */
22761866
2277#if __HVX_ARCH__ >= 60
22781867/* ==========================================================================
22791868 Assembly Syntax: Vdd32.uh=vmpy(Vu32.ub,Vv32.ub)
22801869 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vmpy_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2283,9 +1872,7 @@
22831872 ========================================================================== */
22841873
22851874#define Q6_Wuh_vmpy_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyubv)(Vu,Vv)
2286#endif /* __HEXAGON_ARCH___ >= 60 */
22871875
2288#if __HVX_ARCH__ >= 60
22891876/* ==========================================================================
22901877 Assembly Syntax: Vxx32.uh+=vmpy(Vu32.ub,Vv32.ub)
22911878 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vmpyacc_WuhVubVub(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2294,9 +1881,7 @@
22941881 ========================================================================== */
22951882
22961883#define Q6_Wuh_vmpyacc_WuhVubVub(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyubv_acc)(Vxx,Vu,Vv)
2297#endif /* __HEXAGON_ARCH___ >= 60 */
22981884
2299#if __HVX_ARCH__ >= 60
23001885/* ==========================================================================
23011886 Assembly Syntax: Vdd32.uw=vmpy(Vu32.uh,Rt32.uh)
23021887 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vmpy_VuhRuh(HVX_Vector Vu, Word32 Rt)
......@@ -2305,9 +1890,7 @@
23051890 ========================================================================== */
23061891
23071892#define Q6_Wuw_vmpy_VuhRuh(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuh)(Vu,Rt)
2308#endif /* __HEXAGON_ARCH___ >= 60 */
23091893
2310#if __HVX_ARCH__ >= 60
23111894/* ==========================================================================
23121895 Assembly Syntax: Vxx32.uw+=vmpy(Vu32.uh,Rt32.uh)
23131896 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vmpyacc_WuwVuhRuh(HVX_VectorPair Vxx, HVX_Vector Vu, Word32 Rt)
......@@ -2316,9 +1899,7 @@
23161899 ========================================================================== */
23171900
23181901#define Q6_Wuw_vmpyacc_WuwVuhRuh(Vxx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuh_acc)(Vxx,Vu,Rt)
2319#endif /* __HEXAGON_ARCH___ >= 60 */
23201902
2321#if __HVX_ARCH__ >= 60
23221903/* ==========================================================================
23231904 Assembly Syntax: Vdd32.uw=vmpy(Vu32.uh,Vv32.uh)
23241905 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vmpy_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2327,9 +1908,7 @@
23271908 ========================================================================== */
23281909
23291910#define Q6_Wuw_vmpy_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuhv)(Vu,Vv)
2330#endif /* __HEXAGON_ARCH___ >= 60 */
23311911
2332#if __HVX_ARCH__ >= 60
23331912/* ==========================================================================
23341913 Assembly Syntax: Vxx32.uw+=vmpy(Vu32.uh,Vv32.uh)
23351914 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vmpyacc_WuwVuhVuh(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2338,9 +1917,7 @@
23381917 ========================================================================== */
23391918
23401919#define Q6_Wuw_vmpyacc_WuwVuhVuh(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuhv_acc)(Vxx,Vu,Vv)
2341#endif /* __HEXAGON_ARCH___ >= 60 */
23421920
2343#if __HVX_ARCH__ >= 60
23441921/* ==========================================================================
23451922 Assembly Syntax: Vd32=vmux(Qt4,Vu32,Vv32)
23461923 C Intrinsic Prototype: HVX_Vector Q6_V_vmux_QVV(HVX_VectorPred Qt, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2349,9 +1926,7 @@
23491926 ========================================================================== */
23501927
23511928#define Q6_V_vmux_QVV(Qt,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmux)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1),Vu,Vv)
2352#endif /* __HEXAGON_ARCH___ >= 60 */
23531929
2354#if __HVX_ARCH__ >= 60
23551930/* ==========================================================================
23561931 Assembly Syntax: Vd32.h=vnavg(Vu32.h,Vv32.h)
23571932 C Intrinsic Prototype: HVX_Vector Q6_Vh_vnavg_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2360,9 +1935,7 @@
23601935 ========================================================================== */
23611936
23621937#define Q6_Vh_vnavg_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnavgh)(Vu,Vv)
2363#endif /* __HEXAGON_ARCH___ >= 60 */
23641938
2365#if __HVX_ARCH__ >= 60
23661939/* ==========================================================================
23671940 Assembly Syntax: Vd32.b=vnavg(Vu32.ub,Vv32.ub)
23681941 C Intrinsic Prototype: HVX_Vector Q6_Vb_vnavg_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2371,9 +1944,7 @@
23711944 ========================================================================== */
23721945
23731946#define Q6_Vb_vnavg_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnavgub)(Vu,Vv)
2374#endif /* __HEXAGON_ARCH___ >= 60 */
23751947
2376#if __HVX_ARCH__ >= 60
23771948/* ==========================================================================
23781949 Assembly Syntax: Vd32.w=vnavg(Vu32.w,Vv32.w)
23791950 C Intrinsic Prototype: HVX_Vector Q6_Vw_vnavg_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2382,9 +1953,7 @@
23821953 ========================================================================== */
23831954
23841955#define Q6_Vw_vnavg_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnavgw)(Vu,Vv)
2385#endif /* __HEXAGON_ARCH___ >= 60 */
23861956
2387#if __HVX_ARCH__ >= 60
23881957/* ==========================================================================
23891958 Assembly Syntax: Vd32.h=vnormamt(Vu32.h)
23901959 C Intrinsic Prototype: HVX_Vector Q6_Vh_vnormamt_Vh(HVX_Vector Vu)
......@@ -2393,9 +1962,7 @@
23931962 ========================================================================== */
23941963
23951964#define Q6_Vh_vnormamt_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnormamth)(Vu)
2396#endif /* __HEXAGON_ARCH___ >= 60 */
23971965
2398#if __HVX_ARCH__ >= 60
23991966/* ==========================================================================
24001967 Assembly Syntax: Vd32.w=vnormamt(Vu32.w)
24011968 C Intrinsic Prototype: HVX_Vector Q6_Vw_vnormamt_Vw(HVX_Vector Vu)
......@@ -2404,9 +1971,7 @@
24041971 ========================================================================== */
24051972
24061973#define Q6_Vw_vnormamt_Vw(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnormamtw)(Vu)
2407#endif /* __HEXAGON_ARCH___ >= 60 */
24081974
2409#if __HVX_ARCH__ >= 60
24101975/* ==========================================================================
24111976 Assembly Syntax: Vd32=vnot(Vu32)
24121977 C Intrinsic Prototype: HVX_Vector Q6_V_vnot_V(HVX_Vector Vu)
......@@ -2415,9 +1980,7 @@
24151980 ========================================================================== */
24161981
24171982#define Q6_V_vnot_V(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnot)(Vu)
2418#endif /* __HEXAGON_ARCH___ >= 60 */
24191983
2420#if __HVX_ARCH__ >= 60
24211984/* ==========================================================================
24221985 Assembly Syntax: Vd32=vor(Vu32,Vv32)
24231986 C Intrinsic Prototype: HVX_Vector Q6_V_vor_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2426,9 +1989,7 @@
24261989 ========================================================================== */
24271990
24281991#define Q6_V_vor_VV(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vor)(Vu,Vv)
2429#endif /* __HEXAGON_ARCH___ >= 60 */
24301992
2431#if __HVX_ARCH__ >= 60
24321993/* ==========================================================================
24331994 Assembly Syntax: Vd32.b=vpacke(Vu32.h,Vv32.h)
24341995 C Intrinsic Prototype: HVX_Vector Q6_Vb_vpacke_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2437,9 +1998,7 @@
24371998 ========================================================================== */
24381999
24392000#define Q6_Vb_vpacke_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackeb)(Vu,Vv)
2440#endif /* __HEXAGON_ARCH___ >= 60 */
24412001
2442#if __HVX_ARCH__ >= 60
24432002/* ==========================================================================
24442003 Assembly Syntax: Vd32.h=vpacke(Vu32.w,Vv32.w)
24452004 C Intrinsic Prototype: HVX_Vector Q6_Vh_vpacke_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2448,9 +2007,7 @@
24482007 ========================================================================== */
24492008
24502009#define Q6_Vh_vpacke_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackeh)(Vu,Vv)
2451#endif /* __HEXAGON_ARCH___ >= 60 */
24522010
2453#if __HVX_ARCH__ >= 60
24542011/* ==========================================================================
24552012 Assembly Syntax: Vd32.b=vpack(Vu32.h,Vv32.h):sat
24562013 C Intrinsic Prototype: HVX_Vector Q6_Vb_vpack_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2459,9 +2016,7 @@
24592016 ========================================================================== */
24602017
24612018#define Q6_Vb_vpack_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackhb_sat)(Vu,Vv)
2462#endif /* __HEXAGON_ARCH___ >= 60 */
24632019
2464#if __HVX_ARCH__ >= 60
24652020/* ==========================================================================
24662021 Assembly Syntax: Vd32.ub=vpack(Vu32.h,Vv32.h):sat
24672022 C Intrinsic Prototype: HVX_Vector Q6_Vub_vpack_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2470,9 +2025,7 @@
24702025 ========================================================================== */
24712026
24722027#define Q6_Vub_vpack_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackhub_sat)(Vu,Vv)
2473#endif /* __HEXAGON_ARCH___ >= 60 */
24742028
2475#if __HVX_ARCH__ >= 60
24762029/* ==========================================================================
24772030 Assembly Syntax: Vd32.b=vpacko(Vu32.h,Vv32.h)
24782031 C Intrinsic Prototype: HVX_Vector Q6_Vb_vpacko_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2481,9 +2034,7 @@
24812034 ========================================================================== */
24822035
24832036#define Q6_Vb_vpacko_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackob)(Vu,Vv)
2484#endif /* __HEXAGON_ARCH___ >= 60 */
24852037
2486#if __HVX_ARCH__ >= 60
24872038/* ==========================================================================
24882039 Assembly Syntax: Vd32.h=vpacko(Vu32.w,Vv32.w)
24892040 C Intrinsic Prototype: HVX_Vector Q6_Vh_vpacko_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2492,9 +2043,7 @@
24922043 ========================================================================== */
24932044
24942045#define Q6_Vh_vpacko_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackoh)(Vu,Vv)
2495#endif /* __HEXAGON_ARCH___ >= 60 */
24962046
2497#if __HVX_ARCH__ >= 60
24982047/* ==========================================================================
24992048 Assembly Syntax: Vd32.h=vpack(Vu32.w,Vv32.w):sat
25002049 C Intrinsic Prototype: HVX_Vector Q6_Vh_vpack_VwVw_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2503,9 +2052,7 @@
25032052 ========================================================================== */
25042053
25052054#define Q6_Vh_vpack_VwVw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackwh_sat)(Vu,Vv)
2506#endif /* __HEXAGON_ARCH___ >= 60 */
25072055
2508#if __HVX_ARCH__ >= 60
25092056/* ==========================================================================
25102057 Assembly Syntax: Vd32.uh=vpack(Vu32.w,Vv32.w):sat
25112058 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vpack_VwVw_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2514,9 +2061,7 @@
25142061 ========================================================================== */
25152062
25162063#define Q6_Vuh_vpack_VwVw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpackwuh_sat)(Vu,Vv)
2517#endif /* __HEXAGON_ARCH___ >= 60 */
25182064
2519#if __HVX_ARCH__ >= 60
25202065/* ==========================================================================
25212066 Assembly Syntax: Vd32.h=vpopcount(Vu32.h)
25222067 C Intrinsic Prototype: HVX_Vector Q6_Vh_vpopcount_Vh(HVX_Vector Vu)
......@@ -2525,9 +2070,7 @@
25252070 ========================================================================== */
25262071
25272072#define Q6_Vh_vpopcount_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vpopcounth)(Vu)
2528#endif /* __HEXAGON_ARCH___ >= 60 */
25292073
2530#if __HVX_ARCH__ >= 60
25312074/* ==========================================================================
25322075 Assembly Syntax: Vd32=vrdelta(Vu32,Vv32)
25332076 C Intrinsic Prototype: HVX_Vector Q6_V_vrdelta_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2536,9 +2079,7 @@
25362079 ========================================================================== */
25372080
25382081#define Q6_V_vrdelta_VV(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrdelta)(Vu,Vv)
2539#endif /* __HEXAGON_ARCH___ >= 60 */
25402082
2541#if __HVX_ARCH__ >= 60
25422083/* ==========================================================================
25432084 Assembly Syntax: Vd32.w=vrmpy(Vu32.ub,Rt32.b)
25442085 C Intrinsic Prototype: HVX_Vector Q6_Vw_vrmpy_VubRb(HVX_Vector Vu, Word32 Rt)
......@@ -2547,9 +2088,7 @@
25472088 ========================================================================== */
25482089
25492090#define Q6_Vw_vrmpy_VubRb(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybus)(Vu,Rt)
2550#endif /* __HEXAGON_ARCH___ >= 60 */
25512091
2552#if __HVX_ARCH__ >= 60
25532092/* ==========================================================================
25542093 Assembly Syntax: Vx32.w+=vrmpy(Vu32.ub,Rt32.b)
25552094 C Intrinsic Prototype: HVX_Vector Q6_Vw_vrmpyacc_VwVubRb(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -2558,9 +2097,7 @@
25582097 ========================================================================== */
25592098
25602099#define Q6_Vw_vrmpyacc_VwVubRb(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybus_acc)(Vx,Vu,Rt)
2561#endif /* __HEXAGON_ARCH___ >= 60 */
25622100
2563#if __HVX_ARCH__ >= 60
25642101/* ==========================================================================
25652102 Assembly Syntax: Vdd32.w=vrmpy(Vuu32.ub,Rt32.b,#u1)
25662103 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vrmpy_WubRbI(HVX_VectorPair Vuu, Word32 Rt, Word32 Iu1)
......@@ -2569,9 +2106,7 @@
25692106 ========================================================================== */
25702107
25712108#define Q6_Ww_vrmpy_WubRbI(Vuu,Rt,Iu1) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybusi)(Vuu,Rt,Iu1)
2572#endif /* __HEXAGON_ARCH___ >= 60 */
25732109
2574#if __HVX_ARCH__ >= 60
25752110/* ==========================================================================
25762111 Assembly Syntax: Vxx32.w+=vrmpy(Vuu32.ub,Rt32.b,#u1)
25772112 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vrmpyacc_WwWubRbI(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt, Word32 Iu1)
......@@ -2580,9 +2115,7 @@
25802115 ========================================================================== */
25812116
25822117#define Q6_Ww_vrmpyacc_WwWubRbI(Vxx,Vuu,Rt,Iu1) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybusi_acc)(Vxx,Vuu,Rt,Iu1)
2583#endif /* __HEXAGON_ARCH___ >= 60 */
25842118
2585#if __HVX_ARCH__ >= 60
25862119/* ==========================================================================
25872120 Assembly Syntax: Vd32.w=vrmpy(Vu32.ub,Vv32.b)
25882121 C Intrinsic Prototype: HVX_Vector Q6_Vw_vrmpy_VubVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2591,9 +2124,7 @@
25912124 ========================================================================== */
25922125
25932126#define Q6_Vw_vrmpy_VubVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybusv)(Vu,Vv)
2594#endif /* __HEXAGON_ARCH___ >= 60 */
25952127
2596#if __HVX_ARCH__ >= 60
25972128/* ==========================================================================
25982129 Assembly Syntax: Vx32.w+=vrmpy(Vu32.ub,Vv32.b)
25992130 C Intrinsic Prototype: HVX_Vector Q6_Vw_vrmpyacc_VwVubVb(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2602,9 +2133,7 @@
26022133 ========================================================================== */
26032134
26042135#define Q6_Vw_vrmpyacc_VwVubVb(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybusv_acc)(Vx,Vu,Vv)
2605#endif /* __HEXAGON_ARCH___ >= 60 */
26062136
2607#if __HVX_ARCH__ >= 60
26082137/* ==========================================================================
26092138 Assembly Syntax: Vd32.w=vrmpy(Vu32.b,Vv32.b)
26102139 C Intrinsic Prototype: HVX_Vector Q6_Vw_vrmpy_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2613,9 +2142,7 @@
26132142 ========================================================================== */
26142143
26152144#define Q6_Vw_vrmpy_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybv)(Vu,Vv)
2616#endif /* __HEXAGON_ARCH___ >= 60 */
26172145
2618#if __HVX_ARCH__ >= 60
26192146/* ==========================================================================
26202147 Assembly Syntax: Vx32.w+=vrmpy(Vu32.b,Vv32.b)
26212148 C Intrinsic Prototype: HVX_Vector Q6_Vw_vrmpyacc_VwVbVb(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2624,9 +2151,7 @@
26242151 ========================================================================== */
26252152
26262153#define Q6_Vw_vrmpyacc_VwVbVb(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpybv_acc)(Vx,Vu,Vv)
2627#endif /* __HEXAGON_ARCH___ >= 60 */
26282154
2629#if __HVX_ARCH__ >= 60
26302155/* ==========================================================================
26312156 Assembly Syntax: Vd32.uw=vrmpy(Vu32.ub,Rt32.ub)
26322157 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vrmpy_VubRub(HVX_Vector Vu, Word32 Rt)
......@@ -2635,9 +2160,7 @@
26352160 ========================================================================== */
26362161
26372162#define Q6_Vuw_vrmpy_VubRub(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpyub)(Vu,Rt)
2638#endif /* __HEXAGON_ARCH___ >= 60 */
26392163
2640#if __HVX_ARCH__ >= 60
26412164/* ==========================================================================
26422165 Assembly Syntax: Vx32.uw+=vrmpy(Vu32.ub,Rt32.ub)
26432166 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vrmpyacc_VuwVubRub(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
......@@ -2646,9 +2169,7 @@
26462169 ========================================================================== */
26472170
26482171#define Q6_Vuw_vrmpyacc_VuwVubRub(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpyub_acc)(Vx,Vu,Rt)
2649#endif /* __HEXAGON_ARCH___ >= 60 */
26502172
2651#if __HVX_ARCH__ >= 60
26522173/* ==========================================================================
26532174 Assembly Syntax: Vdd32.uw=vrmpy(Vuu32.ub,Rt32.ub,#u1)
26542175 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vrmpy_WubRubI(HVX_VectorPair Vuu, Word32 Rt, Word32 Iu1)
......@@ -2657,9 +2178,7 @@
26572178 ========================================================================== */
26582179
26592180#define Q6_Wuw_vrmpy_WubRubI(Vuu,Rt,Iu1) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpyubi)(Vuu,Rt,Iu1)
2660#endif /* __HEXAGON_ARCH___ >= 60 */
26612181
2662#if __HVX_ARCH__ >= 60
26632182/* ==========================================================================
26642183 Assembly Syntax: Vxx32.uw+=vrmpy(Vuu32.ub,Rt32.ub,#u1)
26652184 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vrmpyacc_WuwWubRubI(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt, Word32 Iu1)
......@@ -2668,9 +2187,7 @@
26682187 ========================================================================== */
26692188
26702189#define Q6_Wuw_vrmpyacc_WuwWubRubI(Vxx,Vuu,Rt,Iu1) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpyubi_acc)(Vxx,Vuu,Rt,Iu1)
2671#endif /* __HEXAGON_ARCH___ >= 60 */
26722190
2673#if __HVX_ARCH__ >= 60
26742191/* ==========================================================================
26752192 Assembly Syntax: Vd32.uw=vrmpy(Vu32.ub,Vv32.ub)
26762193 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vrmpy_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2679,9 +2196,7 @@
26792196 ========================================================================== */
26802197
26812198#define Q6_Vuw_vrmpy_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpyubv)(Vu,Vv)
2682#endif /* __HEXAGON_ARCH___ >= 60 */
26832199
2684#if __HVX_ARCH__ >= 60
26852200/* ==========================================================================
26862201 Assembly Syntax: Vx32.uw+=vrmpy(Vu32.ub,Vv32.ub)
26872202 C Intrinsic Prototype: HVX_Vector Q6_Vuw_vrmpyacc_VuwVubVub(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -2690,9 +2205,7 @@
26902205 ========================================================================== */
26912206
26922207#define Q6_Vuw_vrmpyacc_VuwVubVub(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrmpyubv_acc)(Vx,Vu,Vv)
2693#endif /* __HEXAGON_ARCH___ >= 60 */
26942208
2695#if __HVX_ARCH__ >= 60
26962209/* ==========================================================================
26972210 Assembly Syntax: Vd32=vror(Vu32,Rt32)
26982211 C Intrinsic Prototype: HVX_Vector Q6_V_vror_VR(HVX_Vector Vu, Word32 Rt)
......@@ -2701,9 +2214,7 @@
27012214 ========================================================================== */
27022215
27032216#define Q6_V_vror_VR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vror)(Vu,Rt)
2704#endif /* __HEXAGON_ARCH___ >= 60 */
27052217
2706#if __HVX_ARCH__ >= 60
27072218/* ==========================================================================
27082219 Assembly Syntax: Vd32.b=vround(Vu32.h,Vv32.h):sat
27092220 C Intrinsic Prototype: HVX_Vector Q6_Vb_vround_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2712,9 +2223,7 @@
27122223 ========================================================================== */
27132224
27142225#define Q6_Vb_vround_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vroundhb)(Vu,Vv)
2715#endif /* __HEXAGON_ARCH___ >= 60 */
27162226
2717#if __HVX_ARCH__ >= 60
27182227/* ==========================================================================
27192228 Assembly Syntax: Vd32.ub=vround(Vu32.h,Vv32.h):sat
27202229 C Intrinsic Prototype: HVX_Vector Q6_Vub_vround_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2723,9 +2232,7 @@
27232232 ========================================================================== */
27242233
27252234#define Q6_Vub_vround_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vroundhub)(Vu,Vv)
2726#endif /* __HEXAGON_ARCH___ >= 60 */
27272235
2728#if __HVX_ARCH__ >= 60
27292236/* ==========================================================================
27302237 Assembly Syntax: Vd32.h=vround(Vu32.w,Vv32.w):sat
27312238 C Intrinsic Prototype: HVX_Vector Q6_Vh_vround_VwVw_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2734,9 +2241,7 @@
27342241 ========================================================================== */
27352242
27362243#define Q6_Vh_vround_VwVw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vroundwh)(Vu,Vv)
2737#endif /* __HEXAGON_ARCH___ >= 60 */
27382244
2739#if __HVX_ARCH__ >= 60
27402245/* ==========================================================================
27412246 Assembly Syntax: Vd32.uh=vround(Vu32.w,Vv32.w):sat
27422247 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vround_VwVw_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2745,9 +2250,7 @@
27452250 ========================================================================== */
27462251
27472252#define Q6_Vuh_vround_VwVw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vroundwuh)(Vu,Vv)
2748#endif /* __HEXAGON_ARCH___ >= 60 */
27492253
2750#if __HVX_ARCH__ >= 60
27512254/* ==========================================================================
27522255 Assembly Syntax: Vdd32.uw=vrsad(Vuu32.ub,Rt32.ub,#u1)
27532256 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vrsad_WubRubI(HVX_VectorPair Vuu, Word32 Rt, Word32 Iu1)
......@@ -2756,9 +2259,7 @@
27562259 ========================================================================== */
27572260
27582261#define Q6_Wuw_vrsad_WubRubI(Vuu,Rt,Iu1) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrsadubi)(Vuu,Rt,Iu1)
2759#endif /* __HEXAGON_ARCH___ >= 60 */
27602262
2761#if __HVX_ARCH__ >= 60
27622263/* ==========================================================================
27632264 Assembly Syntax: Vxx32.uw+=vrsad(Vuu32.ub,Rt32.ub,#u1)
27642265 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vrsadacc_WuwWubRubI(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt, Word32 Iu1)
......@@ -2767,9 +2268,7 @@
27672268 ========================================================================== */
27682269
27692270#define Q6_Wuw_vrsadacc_WuwWubRubI(Vxx,Vuu,Rt,Iu1) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrsadubi_acc)(Vxx,Vuu,Rt,Iu1)
2770#endif /* __HEXAGON_ARCH___ >= 60 */
27712271
2772#if __HVX_ARCH__ >= 60
27732272/* ==========================================================================
27742273 Assembly Syntax: Vd32.ub=vsat(Vu32.h,Vv32.h)
27752274 C Intrinsic Prototype: HVX_Vector Q6_Vub_vsat_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2778,9 +2277,7 @@
27782277 ========================================================================== */
27792278
27802279#define Q6_Vub_vsat_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsathub)(Vu,Vv)
2781#endif /* __HEXAGON_ARCH___ >= 60 */
27822280
2783#if __HVX_ARCH__ >= 60
27842281/* ==========================================================================
27852282 Assembly Syntax: Vd32.h=vsat(Vu32.w,Vv32.w)
27862283 C Intrinsic Prototype: HVX_Vector Q6_Vh_vsat_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2789,9 +2286,7 @@
27892286 ========================================================================== */
27902287
27912288#define Q6_Vh_vsat_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsatwh)(Vu,Vv)
2792#endif /* __HEXAGON_ARCH___ >= 60 */
27932289
2794#if __HVX_ARCH__ >= 60
27952290/* ==========================================================================
27962291 Assembly Syntax: Vdd32.h=vsxt(Vu32.b)
27972292 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vsxt_Vb(HVX_Vector Vu)
......@@ -2800,9 +2295,7 @@
28002295 ========================================================================== */
28012296
28022297#define Q6_Wh_vsxt_Vb(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsb)(Vu)
2803#endif /* __HEXAGON_ARCH___ >= 60 */
28042298
2805#if __HVX_ARCH__ >= 60
28062299/* ==========================================================================
28072300 Assembly Syntax: Vdd32.w=vsxt(Vu32.h)
28082301 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vsxt_Vh(HVX_Vector Vu)
......@@ -2811,9 +2304,7 @@
28112304 ========================================================================== */
28122305
28132306#define Q6_Ww_vsxt_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsh)(Vu)
2814#endif /* __HEXAGON_ARCH___ >= 60 */
28152307
2816#if __HVX_ARCH__ >= 60
28172308/* ==========================================================================
28182309 Assembly Syntax: Vd32.h=vshuffe(Vu32.h,Vv32.h)
28192310 C Intrinsic Prototype: HVX_Vector Q6_Vh_vshuffe_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2822,9 +2313,7 @@
28222313 ========================================================================== */
28232314
28242315#define Q6_Vh_vshuffe_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshufeh)(Vu,Vv)
2825#endif /* __HEXAGON_ARCH___ >= 60 */
28262316
2827#if __HVX_ARCH__ >= 60
28282317/* ==========================================================================
28292318 Assembly Syntax: Vd32.b=vshuff(Vu32.b)
28302319 C Intrinsic Prototype: HVX_Vector Q6_Vb_vshuff_Vb(HVX_Vector Vu)
......@@ -2833,9 +2322,7 @@
28332322 ========================================================================== */
28342323
28352324#define Q6_Vb_vshuff_Vb(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshuffb)(Vu)
2836#endif /* __HEXAGON_ARCH___ >= 60 */
28372325
2838#if __HVX_ARCH__ >= 60
28392326/* ==========================================================================
28402327 Assembly Syntax: Vd32.b=vshuffe(Vu32.b,Vv32.b)
28412328 C Intrinsic Prototype: HVX_Vector Q6_Vb_vshuffe_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2844,9 +2331,7 @@
28442331 ========================================================================== */
28452332
28462333#define Q6_Vb_vshuffe_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshuffeb)(Vu,Vv)
2847#endif /* __HEXAGON_ARCH___ >= 60 */
28482334
2849#if __HVX_ARCH__ >= 60
28502335/* ==========================================================================
28512336 Assembly Syntax: Vd32.h=vshuff(Vu32.h)
28522337 C Intrinsic Prototype: HVX_Vector Q6_Vh_vshuff_Vh(HVX_Vector Vu)
......@@ -2855,9 +2340,7 @@
28552340 ========================================================================== */
28562341
28572342#define Q6_Vh_vshuff_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshuffh)(Vu)
2858#endif /* __HEXAGON_ARCH___ >= 60 */
28592343
2860#if __HVX_ARCH__ >= 60
28612344/* ==========================================================================
28622345 Assembly Syntax: Vd32.b=vshuffo(Vu32.b,Vv32.b)
28632346 C Intrinsic Prototype: HVX_Vector Q6_Vb_vshuffo_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2866,9 +2349,7 @@
28662349 ========================================================================== */
28672350
28682351#define Q6_Vb_vshuffo_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshuffob)(Vu,Vv)
2869#endif /* __HEXAGON_ARCH___ >= 60 */
28702352
2871#if __HVX_ARCH__ >= 60
28722353/* ==========================================================================
28732354 Assembly Syntax: Vdd32=vshuff(Vu32,Vv32,Rt8)
28742355 C Intrinsic Prototype: HVX_VectorPair Q6_W_vshuff_VVR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
......@@ -2877,9 +2358,7 @@
28772358 ========================================================================== */
28782359
28792360#define Q6_W_vshuff_VVR(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshuffvdd)(Vu,Vv,Rt)
2880#endif /* __HEXAGON_ARCH___ >= 60 */
28812361
2882#if __HVX_ARCH__ >= 60
28832362/* ==========================================================================
28842363 Assembly Syntax: Vdd32.b=vshuffoe(Vu32.b,Vv32.b)
28852364 C Intrinsic Prototype: HVX_VectorPair Q6_Wb_vshuffoe_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2888,9 +2367,7 @@
28882367 ========================================================================== */
28892368
28902369#define Q6_Wb_vshuffoe_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshufoeb)(Vu,Vv)
2891#endif /* __HEXAGON_ARCH___ >= 60 */
28922370
2893#if __HVX_ARCH__ >= 60
28942371/* ==========================================================================
28952372 Assembly Syntax: Vdd32.h=vshuffoe(Vu32.h,Vv32.h)
28962373 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vshuffoe_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2899,9 +2376,7 @@
28992376 ========================================================================== */
29002377
29012378#define Q6_Wh_vshuffoe_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshufoeh)(Vu,Vv)
2902#endif /* __HEXAGON_ARCH___ >= 60 */
29032379
2904#if __HVX_ARCH__ >= 60
29052380/* ==========================================================================
29062381 Assembly Syntax: Vd32.h=vshuffo(Vu32.h,Vv32.h)
29072382 C Intrinsic Prototype: HVX_Vector Q6_Vh_vshuffo_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2910,9 +2385,7 @@
29102385 ========================================================================== */
29112386
29122387#define Q6_Vh_vshuffo_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vshufoh)(Vu,Vv)
2913#endif /* __HEXAGON_ARCH___ >= 60 */
29142388
2915#if __HVX_ARCH__ >= 60
29162389/* ==========================================================================
29172390 Assembly Syntax: Vd32.b=vsub(Vu32.b,Vv32.b)
29182391 C Intrinsic Prototype: HVX_Vector Q6_Vb_vsub_VbVb(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2921,9 +2394,7 @@
29212394 ========================================================================== */
29222395
29232396#define Q6_Vb_vsub_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubb)(Vu,Vv)
2924#endif /* __HEXAGON_ARCH___ >= 60 */
29252397
2926#if __HVX_ARCH__ >= 60
29272398/* ==========================================================================
29282399 Assembly Syntax: Vdd32.b=vsub(Vuu32.b,Vvv32.b)
29292400 C Intrinsic Prototype: HVX_VectorPair Q6_Wb_vsub_WbWb(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -2932,9 +2403,7 @@
29322403 ========================================================================== */
29332404
29342405#define Q6_Wb_vsub_WbWb(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubb_dv)(Vuu,Vvv)
2935#endif /* __HEXAGON_ARCH___ >= 60 */
29362406
2937#if __HVX_ARCH__ >= 60
29382407/* ==========================================================================
29392408 Assembly Syntax: if (!Qv4) Vx32.b-=Vu32.b
29402409 C Intrinsic Prototype: HVX_Vector Q6_Vb_condnac_QnVbVb(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -2943,9 +2412,7 @@
29432412 ========================================================================== */
29442413
29452414#define Q6_Vb_condnac_QnVbVb(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubbnq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
2946#endif /* __HEXAGON_ARCH___ >= 60 */
29472415
2948#if __HVX_ARCH__ >= 60
29492416/* ==========================================================================
29502417 Assembly Syntax: if (Qv4) Vx32.b-=Vu32.b
29512418 C Intrinsic Prototype: HVX_Vector Q6_Vb_condnac_QVbVb(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -2954,9 +2421,7 @@
29542421 ========================================================================== */
29552422
29562423#define Q6_Vb_condnac_QVbVb(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubbq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
2957#endif /* __HEXAGON_ARCH___ >= 60 */
29582424
2959#if __HVX_ARCH__ >= 60
29602425/* ==========================================================================
29612426 Assembly Syntax: Vd32.h=vsub(Vu32.h,Vv32.h)
29622427 C Intrinsic Prototype: HVX_Vector Q6_Vh_vsub_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -2965,9 +2430,7 @@
29652430 ========================================================================== */
29662431
29672432#define Q6_Vh_vsub_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubh)(Vu,Vv)
2968#endif /* __HEXAGON_ARCH___ >= 60 */
29692433
2970#if __HVX_ARCH__ >= 60
29712434/* ==========================================================================
29722435 Assembly Syntax: Vdd32.h=vsub(Vuu32.h,Vvv32.h)
29732436 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vsub_WhWh(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -2976,9 +2439,7 @@
29762439 ========================================================================== */
29772440
29782441#define Q6_Wh_vsub_WhWh(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubh_dv)(Vuu,Vvv)
2979#endif /* __HEXAGON_ARCH___ >= 60 */
29802442
2981#if __HVX_ARCH__ >= 60
29822443/* ==========================================================================
29832444 Assembly Syntax: if (!Qv4) Vx32.h-=Vu32.h
29842445 C Intrinsic Prototype: HVX_Vector Q6_Vh_condnac_QnVhVh(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -2987,9 +2448,7 @@
29872448 ========================================================================== */
29882449
29892450#define Q6_Vh_condnac_QnVhVh(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubhnq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
2990#endif /* __HEXAGON_ARCH___ >= 60 */
29912451
2992#if __HVX_ARCH__ >= 60
29932452/* ==========================================================================
29942453 Assembly Syntax: if (Qv4) Vx32.h-=Vu32.h
29952454 C Intrinsic Prototype: HVX_Vector Q6_Vh_condnac_QVhVh(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -2998,9 +2457,7 @@
29982457 ========================================================================== */
29992458
30002459#define Q6_Vh_condnac_QVhVh(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubhq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
3001#endif /* __HEXAGON_ARCH___ >= 60 */
30022460
3003#if __HVX_ARCH__ >= 60
30042461/* ==========================================================================
30052462 Assembly Syntax: Vd32.h=vsub(Vu32.h,Vv32.h):sat
30062463 C Intrinsic Prototype: HVX_Vector Q6_Vh_vsub_VhVh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3009,9 +2466,7 @@
30092466 ========================================================================== */
30102467
30112468#define Q6_Vh_vsub_VhVh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubhsat)(Vu,Vv)
3012#endif /* __HEXAGON_ARCH___ >= 60 */
30132469
3014#if __HVX_ARCH__ >= 60
30152470/* ==========================================================================
30162471 Assembly Syntax: Vdd32.h=vsub(Vuu32.h,Vvv32.h):sat
30172472 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vsub_WhWh_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -3020,9 +2475,7 @@
30202475 ========================================================================== */
30212476
30222477#define Q6_Wh_vsub_WhWh_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubhsat_dv)(Vuu,Vvv)
3023#endif /* __HEXAGON_ARCH___ >= 60 */
30242478
3025#if __HVX_ARCH__ >= 60
30262479/* ==========================================================================
30272480 Assembly Syntax: Vdd32.w=vsub(Vu32.h,Vv32.h)
30282481 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vsub_VhVh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3031,9 +2484,7 @@
30312484 ========================================================================== */
30322485
30332486#define Q6_Ww_vsub_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubhw)(Vu,Vv)
3034#endif /* __HEXAGON_ARCH___ >= 60 */
30352487
3036#if __HVX_ARCH__ >= 60
30372488/* ==========================================================================
30382489 Assembly Syntax: Vdd32.h=vsub(Vu32.ub,Vv32.ub)
30392490 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vsub_VubVub(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3042,9 +2493,7 @@
30422493 ========================================================================== */
30432494
30442495#define Q6_Wh_vsub_VubVub(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsububh)(Vu,Vv)
3045#endif /* __HEXAGON_ARCH___ >= 60 */
30462496
3047#if __HVX_ARCH__ >= 60
30482497/* ==========================================================================
30492498 Assembly Syntax: Vd32.ub=vsub(Vu32.ub,Vv32.ub):sat
30502499 C Intrinsic Prototype: HVX_Vector Q6_Vub_vsub_VubVub_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3053,9 +2502,7 @@
30532502 ========================================================================== */
30542503
30552504#define Q6_Vub_vsub_VubVub_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsububsat)(Vu,Vv)
3056#endif /* __HEXAGON_ARCH___ >= 60 */
30572505
3058#if __HVX_ARCH__ >= 60
30592506/* ==========================================================================
30602507 Assembly Syntax: Vdd32.ub=vsub(Vuu32.ub,Vvv32.ub):sat
30612508 C Intrinsic Prototype: HVX_VectorPair Q6_Wub_vsub_WubWub_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -3064,9 +2511,7 @@
30642511 ========================================================================== */
30652512
30662513#define Q6_Wub_vsub_WubWub_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsububsat_dv)(Vuu,Vvv)
3067#endif /* __HEXAGON_ARCH___ >= 60 */
30682514
3069#if __HVX_ARCH__ >= 60
30702515/* ==========================================================================
30712516 Assembly Syntax: Vd32.uh=vsub(Vu32.uh,Vv32.uh):sat
30722517 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vsub_VuhVuh_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3075,9 +2520,7 @@
30752520 ========================================================================== */
30762521
30772522#define Q6_Vuh_vsub_VuhVuh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubuhsat)(Vu,Vv)
3078#endif /* __HEXAGON_ARCH___ >= 60 */
30792523
3080#if __HVX_ARCH__ >= 60
30812524/* ==========================================================================
30822525 Assembly Syntax: Vdd32.uh=vsub(Vuu32.uh,Vvv32.uh):sat
30832526 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vsub_WuhWuh_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -3086,9 +2529,7 @@
30862529 ========================================================================== */
30872530
30882531#define Q6_Wuh_vsub_WuhWuh_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubuhsat_dv)(Vuu,Vvv)
3089#endif /* __HEXAGON_ARCH___ >= 60 */
30902532
3091#if __HVX_ARCH__ >= 60
30922533/* ==========================================================================
30932534 Assembly Syntax: Vdd32.w=vsub(Vu32.uh,Vv32.uh)
30942535 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vsub_VuhVuh(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3097,9 +2538,7 @@
30972538 ========================================================================== */
30982539
30992540#define Q6_Ww_vsub_VuhVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubuhw)(Vu,Vv)
3100#endif /* __HEXAGON_ARCH___ >= 60 */
31012541
3102#if __HVX_ARCH__ >= 60
31032542/* ==========================================================================
31042543 Assembly Syntax: Vd32.w=vsub(Vu32.w,Vv32.w)
31052544 C Intrinsic Prototype: HVX_Vector Q6_Vw_vsub_VwVw(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3108,9 +2547,7 @@
31082547 ========================================================================== */
31092548
31102549#define Q6_Vw_vsub_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubw)(Vu,Vv)
3111#endif /* __HEXAGON_ARCH___ >= 60 */
31122550
3113#if __HVX_ARCH__ >= 60
31142551/* ==========================================================================
31152552 Assembly Syntax: Vdd32.w=vsub(Vuu32.w,Vvv32.w)
31162553 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vsub_WwWw(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -3119,9 +2556,7 @@
31192556 ========================================================================== */
31202557
31212558#define Q6_Ww_vsub_WwWw(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubw_dv)(Vuu,Vvv)
3122#endif /* __HEXAGON_ARCH___ >= 60 */
31232559
3124#if __HVX_ARCH__ >= 60
31252560/* ==========================================================================
31262561 Assembly Syntax: if (!Qv4) Vx32.w-=Vu32.w
31272562 C Intrinsic Prototype: HVX_Vector Q6_Vw_condnac_QnVwVw(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -3130,9 +2565,7 @@
31302565 ========================================================================== */
31312566
31322567#define Q6_Vw_condnac_QnVwVw(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubwnq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
3133#endif /* __HEXAGON_ARCH___ >= 60 */
31342568
3135#if __HVX_ARCH__ >= 60
31362569/* ==========================================================================
31372570 Assembly Syntax: if (Qv4) Vx32.w-=Vu32.w
31382571 C Intrinsic Prototype: HVX_Vector Q6_Vw_condnac_QVwVw(HVX_VectorPred Qv, HVX_Vector Vx, HVX_Vector Vu)
......@@ -3141,9 +2574,7 @@
31412574 ========================================================================== */
31422575
31432576#define Q6_Vw_condnac_QVwVw(Qv,Vx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubwq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vx,Vu)
3144#endif /* __HEXAGON_ARCH___ >= 60 */
31452577
3146#if __HVX_ARCH__ >= 60
31472578/* ==========================================================================
31482579 Assembly Syntax: Vd32.w=vsub(Vu32.w,Vv32.w):sat
31492580 C Intrinsic Prototype: HVX_Vector Q6_Vw_vsub_VwVw_sat(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3152,9 +2583,7 @@
31522583 ========================================================================== */
31532584
31542585#define Q6_Vw_vsub_VwVw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubwsat)(Vu,Vv)
3155#endif /* __HEXAGON_ARCH___ >= 60 */
31562586
3157#if __HVX_ARCH__ >= 60
31582587/* ==========================================================================
31592588 Assembly Syntax: Vdd32.w=vsub(Vuu32.w,Vvv32.w):sat
31602589 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vsub_WwWw_sat(HVX_VectorPair Vuu, HVX_VectorPair Vvv)
......@@ -3163,9 +2592,7 @@
31632592 ========================================================================== */
31642593
31652594#define Q6_Ww_vsub_WwWw_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubwsat_dv)(Vuu,Vvv)
3166#endif /* __HEXAGON_ARCH___ >= 60 */
31672595
3168#if __HVX_ARCH__ >= 60
31692596/* ==========================================================================
31702597 Assembly Syntax: Vdd32=vswap(Qt4,Vu32,Vv32)
31712598 C Intrinsic Prototype: HVX_VectorPair Q6_W_vswap_QVV(HVX_VectorPred Qt, HVX_Vector Vu, HVX_Vector Vv)
......@@ -3174,9 +2601,7 @@
31742601 ========================================================================== */
31752602
31762603#define Q6_W_vswap_QVV(Qt,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vswap)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1),Vu,Vv)
3177#endif /* __HEXAGON_ARCH___ >= 60 */
31782604
3179#if __HVX_ARCH__ >= 60
31802605/* ==========================================================================
31812606 Assembly Syntax: Vdd32.h=vtmpy(Vuu32.b,Rt32.b)
31822607 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vtmpy_WbRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -3185,9 +2610,7 @@
31852610 ========================================================================== */
31862611
31872612#define Q6_Wh_vtmpy_WbRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vtmpyb)(Vuu,Rt)
3188#endif /* __HEXAGON_ARCH___ >= 60 */
31892613
3190#if __HVX_ARCH__ >= 60
31912614/* ==========================================================================
31922615 Assembly Syntax: Vxx32.h+=vtmpy(Vuu32.b,Rt32.b)
31932616 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vtmpyacc_WhWbRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -3196,9 +2619,7 @@
31962619 ========================================================================== */
31972620
31982621#define Q6_Wh_vtmpyacc_WhWbRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vtmpyb_acc)(Vxx,Vuu,Rt)
3199#endif /* __HEXAGON_ARCH___ >= 60 */
32002622
3201#if __HVX_ARCH__ >= 60
32022623/* ==========================================================================
32032624 Assembly Syntax: Vdd32.h=vtmpy(Vuu32.ub,Rt32.b)
32042625 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vtmpy_WubRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -3207,9 +2628,7 @@
32072628 ========================================================================== */
32082629
32092630#define Q6_Wh_vtmpy_WubRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vtmpybus)(Vuu,Rt)
3210#endif /* __HEXAGON_ARCH___ >= 60 */
32112631
3212#if __HVX_ARCH__ >= 60
32132632/* ==========================================================================
32142633 Assembly Syntax: Vxx32.h+=vtmpy(Vuu32.ub,Rt32.b)
32152634 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vtmpyacc_WhWubRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -3218,9 +2637,7 @@
32182637 ========================================================================== */
32192638
32202639#define Q6_Wh_vtmpyacc_WhWubRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vtmpybus_acc)(Vxx,Vuu,Rt)
3221#endif /* __HEXAGON_ARCH___ >= 60 */
32222640
3223#if __HVX_ARCH__ >= 60
32242641/* ==========================================================================
32252642 Assembly Syntax: Vdd32.w=vtmpy(Vuu32.h,Rt32.b)
32262643 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vtmpy_WhRb(HVX_VectorPair Vuu, Word32 Rt)
......@@ -3229,9 +2646,7 @@
32292646 ========================================================================== */
32302647
32312648#define Q6_Ww_vtmpy_WhRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vtmpyhb)(Vuu,Rt)
3232#endif /* __HEXAGON_ARCH___ >= 60 */
32332649
3234#if __HVX_ARCH__ >= 60
32352650/* ==========================================================================
32362651 Assembly Syntax: Vxx32.w+=vtmpy(Vuu32.h,Rt32.b)
32372652 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vtmpyacc_WwWhRb(HVX_VectorPair Vxx, HVX_VectorPair Vuu, Word32 Rt)
......@@ -3240,9 +2655,7 @@
32402655 ========================================================================== */
32412656
32422657#define Q6_Ww_vtmpyacc_WwWhRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vtmpyhb_acc)(Vxx,Vuu,Rt)
3243#endif /* __HEXAGON_ARCH___ >= 60 */
32442658
3245#if __HVX_ARCH__ >= 60
32462659/* ==========================================================================
32472660 Assembly Syntax: Vdd32.h=vunpack(Vu32.b)
32482661 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vunpack_Vb(HVX_Vector Vu)
......@@ -3251,9 +2664,7 @@
32512664 ========================================================================== */
32522665
32532666#define Q6_Wh_vunpack_Vb(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vunpackb)(Vu)
3254#endif /* __HEXAGON_ARCH___ >= 60 */
32552667
3256#if __HVX_ARCH__ >= 60
32572668/* ==========================================================================
32582669 Assembly Syntax: Vdd32.w=vunpack(Vu32.h)
32592670 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vunpack_Vh(HVX_Vector Vu)
......@@ -3262,9 +2673,7 @@
32622673 ========================================================================== */
32632674
32642675#define Q6_Ww_vunpack_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vunpackh)(Vu)
3265#endif /* __HEXAGON_ARCH___ >= 60 */
32662676
3267#if __HVX_ARCH__ >= 60
32682677/* ==========================================================================
32692678 Assembly Syntax: Vxx32.h|=vunpacko(Vu32.b)
32702679 C Intrinsic Prototype: HVX_VectorPair Q6_Wh_vunpackoor_WhVb(HVX_VectorPair Vxx, HVX_Vector Vu)
......@@ -3273,9 +2682,7 @@
32732682 ========================================================================== */
32742683
32752684#define Q6_Wh_vunpackoor_WhVb(Vxx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vunpackob)(Vxx,Vu)
3276#endif /* __HEXAGON_ARCH___ >= 60 */
32772685
3278#if __HVX_ARCH__ >= 60
32792686/* ==========================================================================
32802687 Assembly Syntax: Vxx32.w|=vunpacko(Vu32.h)
32812688 C Intrinsic Prototype: HVX_VectorPair Q6_Ww_vunpackoor_WwVh(HVX_VectorPair Vxx, HVX_Vector Vu)
......@@ -3284,9 +2691,7 @@
32842691 ========================================================================== */
32852692
32862693#define Q6_Ww_vunpackoor_WwVh(Vxx,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vunpackoh)(Vxx,Vu)
3287#endif /* __HEXAGON_ARCH___ >= 60 */
32882694
3289#if __HVX_ARCH__ >= 60
32902695/* ==========================================================================
32912696 Assembly Syntax: Vdd32.uh=vunpack(Vu32.ub)
32922697 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vunpack_Vub(HVX_Vector Vu)
......@@ -3295,9 +2700,7 @@
32952700 ========================================================================== */
32962701
32972702#define Q6_Wuh_vunpack_Vub(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vunpackub)(Vu)
3298#endif /* __HEXAGON_ARCH___ >= 60 */
32992703
3300#if __HVX_ARCH__ >= 60
33012704/* ==========================================================================
33022705 Assembly Syntax: Vdd32.uw=vunpack(Vu32.uh)
33032706 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vunpack_Vuh(HVX_Vector Vu)
......@@ -3306,9 +2709,7 @@
33062709 ========================================================================== */
33072710
33082711#define Q6_Wuw_vunpack_Vuh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vunpackuh)(Vu)
3309#endif /* __HEXAGON_ARCH___ >= 60 */
33102712
3311#if __HVX_ARCH__ >= 60
33122713/* ==========================================================================
33132714 Assembly Syntax: Vd32=vxor(Vu32,Vv32)
33142715 C Intrinsic Prototype: HVX_Vector Q6_V_vxor_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -3317,9 +2718,7 @@
33172718 ========================================================================== */
33182719
33192720#define Q6_V_vxor_VV(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vxor)(Vu,Vv)
3320#endif /* __HEXAGON_ARCH___ >= 60 */
33212721
3322#if __HVX_ARCH__ >= 60
33232722/* ==========================================================================
33242723 Assembly Syntax: Vdd32.uh=vzxt(Vu32.ub)
33252724 C Intrinsic Prototype: HVX_VectorPair Q6_Wuh_vzxt_Vub(HVX_Vector Vu)
......@@ -3328,9 +2727,7 @@
33282727 ========================================================================== */
33292728
33302729#define Q6_Wuh_vzxt_Vub(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vzb)(Vu)
3331#endif /* __HEXAGON_ARCH___ >= 60 */
33322730
3333#if __HVX_ARCH__ >= 60
33342731/* ==========================================================================
33352732 Assembly Syntax: Vdd32.uw=vzxt(Vu32.uh)
33362733 C Intrinsic Prototype: HVX_VectorPair Q6_Wuw_vzxt_Vuh(HVX_Vector Vu)
......@@ -3339,7 +2736,6 @@
33392736 ========================================================================== */
33402737
33412738#define Q6_Wuw_vzxt_Vuh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vzh)(Vu)
3342#endif /* __HEXAGON_ARCH___ >= 60 */
33432739
33442740#if __HVX_ARCH__ >= 62
33452741/* ==========================================================================
......@@ -3350,7 +2746,7 @@
33502746 ========================================================================== */
33512747
33522748#define Q6_Vb_vsplat_R(Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_lvsplatb)(Rt)
3353#endif /* __HEXAGON_ARCH___ >= 62 */
2749#endif
33542750
33552751#if __HVX_ARCH__ >= 62
33562752/* ==========================================================================
......@@ -3361,7 +2757,7 @@
33612757 ========================================================================== */
33622758
33632759#define Q6_Vh_vsplat_R(Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_lvsplath)(Rt)
3364#endif /* __HEXAGON_ARCH___ >= 62 */
2760#endif
33652761
33662762#if __HVX_ARCH__ >= 62
33672763/* ==========================================================================
......@@ -3372,7 +2768,7 @@
33722768 ========================================================================== */
33732769
33742770#define Q6_Q_vsetq2_R(Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_pred_scalar2v2)(Rt)),-1)
3375#endif /* __HEXAGON_ARCH___ >= 62 */
2771#endif
33762772
33772773#if __HVX_ARCH__ >= 62
33782774/* ==========================================================================
......@@ -3383,7 +2779,7 @@
33832779 ========================================================================== */
33842780
33852781#define Q6_Qb_vshuffe_QhQh(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_shuffeqh)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
3386#endif /* __HEXAGON_ARCH___ >= 62 */
2782#endif
33872783
33882784#if __HVX_ARCH__ >= 62
33892785/* ==========================================================================
......@@ -3394,7 +2790,7 @@
33942790 ========================================================================== */
33952791
33962792#define Q6_Qh_vshuffe_QwQw(Qs,Qt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_shuffeqw)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qt),-1))),-1)
3397#endif /* __HEXAGON_ARCH___ >= 62 */
2793#endif
33982794
33992795#if __HVX_ARCH__ >= 62
34002796/* ==========================================================================
......@@ -3405,7 +2801,7 @@
34052801 ========================================================================== */
34062802
34072803#define Q6_Vb_vadd_VbVb_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddbsat)(Vu,Vv)
3408#endif /* __HEXAGON_ARCH___ >= 62 */
2804#endif
34092805
34102806#if __HVX_ARCH__ >= 62
34112807/* ==========================================================================
......@@ -3416,7 +2812,7 @@
34162812 ========================================================================== */
34172813
34182814#define Q6_Wb_vadd_WbWb_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddbsat_dv)(Vuu,Vvv)
3419#endif /* __HEXAGON_ARCH___ >= 62 */
2815#endif
34202816
34212817#if __HVX_ARCH__ >= 62
34222818/* ==========================================================================
......@@ -3427,7 +2823,7 @@
34272823 ========================================================================== */
34282824
34292825#define Q6_Vw_vadd_VwVwQ_carry(Vu,Vv,Qx) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddcarry)(Vu,Vv,Qx)
3430#endif /* __HEXAGON_ARCH___ >= 62 */
2826#endif
34312827
34322828#if __HVX_ARCH__ >= 62
34332829/* ==========================================================================
......@@ -3438,7 +2834,7 @@
34382834 ========================================================================== */
34392835
34402836#define Q6_Vh_vadd_vclb_VhVh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddclbh)(Vu,Vv)
3441#endif /* __HEXAGON_ARCH___ >= 62 */
2837#endif
34422838
34432839#if __HVX_ARCH__ >= 62
34442840/* ==========================================================================
......@@ -3449,7 +2845,7 @@
34492845 ========================================================================== */
34502846
34512847#define Q6_Vw_vadd_vclb_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddclbw)(Vu,Vv)
3452#endif /* __HEXAGON_ARCH___ >= 62 */
2848#endif
34532849
34542850#if __HVX_ARCH__ >= 62
34552851/* ==========================================================================
......@@ -3460,7 +2856,7 @@
34602856 ========================================================================== */
34612857
34622858#define Q6_Ww_vaddacc_WwVhVh(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddhw_acc)(Vxx,Vu,Vv)
3463#endif /* __HEXAGON_ARCH___ >= 62 */
2859#endif
34642860
34652861#if __HVX_ARCH__ >= 62
34662862/* ==========================================================================
......@@ -3471,7 +2867,7 @@
34712867 ========================================================================== */
34722868
34732869#define Q6_Wh_vaddacc_WhVubVub(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddubh_acc)(Vxx,Vu,Vv)
3474#endif /* __HEXAGON_ARCH___ >= 62 */
2870#endif
34752871
34762872#if __HVX_ARCH__ >= 62
34772873/* ==========================================================================
......@@ -3482,7 +2878,7 @@
34822878 ========================================================================== */
34832879
34842880#define Q6_Vub_vadd_VubVb_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddububb_sat)(Vu,Vv)
3485#endif /* __HEXAGON_ARCH___ >= 62 */
2881#endif
34862882
34872883#if __HVX_ARCH__ >= 62
34882884/* ==========================================================================
......@@ -3493,7 +2889,7 @@
34932889 ========================================================================== */
34942890
34952891#define Q6_Ww_vaddacc_WwVuhVuh(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadduhw_acc)(Vxx,Vu,Vv)
3496#endif /* __HEXAGON_ARCH___ >= 62 */
2892#endif
34972893
34982894#if __HVX_ARCH__ >= 62
34992895/* ==========================================================================
......@@ -3504,7 +2900,7 @@
35042900 ========================================================================== */
35052901
35062902#define Q6_Vuw_vadd_VuwVuw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadduwsat)(Vu,Vv)
3507#endif /* __HEXAGON_ARCH___ >= 62 */
2903#endif
35082904
35092905#if __HVX_ARCH__ >= 62
35102906/* ==========================================================================
......@@ -3515,7 +2911,7 @@
35152911 ========================================================================== */
35162912
35172913#define Q6_Wuw_vadd_WuwWuw_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadduwsat_dv)(Vuu,Vvv)
3518#endif /* __HEXAGON_ARCH___ >= 62 */
2914#endif
35192915
35202916#if __HVX_ARCH__ >= 62
35212917/* ==========================================================================
......@@ -3526,7 +2922,7 @@
35262922 ========================================================================== */
35272923
35282924#define Q6_V_vand_QnR(Qu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandnqrt)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qu),-1),Rt)
3529#endif /* __HEXAGON_ARCH___ >= 62 */
2925#endif
35302926
35312927#if __HVX_ARCH__ >= 62
35322928/* ==========================================================================
......@@ -3537,7 +2933,7 @@
35372933 ========================================================================== */
35382934
35392935#define Q6_V_vandor_VQnR(Vx,Qu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandnqrt_acc)(Vx,__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qu),-1),Rt)
3540#endif /* __HEXAGON_ARCH___ >= 62 */
2936#endif
35412937
35422938#if __HVX_ARCH__ >= 62
35432939/* ==========================================================================
......@@ -3548,7 +2944,7 @@
35482944 ========================================================================== */
35492945
35502946#define Q6_V_vand_QnV(Qv,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvnqv)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vu)
3551#endif /* __HEXAGON_ARCH___ >= 62 */
2947#endif
35522948
35532949#if __HVX_ARCH__ >= 62
35542950/* ==========================================================================
......@@ -3559,7 +2955,7 @@
35592955 ========================================================================== */
35602956
35612957#define Q6_V_vand_QV(Qv,Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvqv)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1),Vu)
3562#endif /* __HEXAGON_ARCH___ >= 62 */
2958#endif
35632959
35642960#if __HVX_ARCH__ >= 62
35652961/* ==========================================================================
......@@ -3570,7 +2966,7 @@
35702966 ========================================================================== */
35712967
35722968#define Q6_Vb_vasr_VhVhR_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrhbsat)(Vu,Vv,Rt)
3573#endif /* __HEXAGON_ARCH___ >= 62 */
2969#endif
35742970
35752971#if __HVX_ARCH__ >= 62
35762972/* ==========================================================================
......@@ -3581,7 +2977,7 @@
35812977 ========================================================================== */
35822978
35832979#define Q6_Vuh_vasr_VuwVuwR_rnd_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasruwuhrndsat)(Vu,Vv,Rt)
3584#endif /* __HEXAGON_ARCH___ >= 62 */
2980#endif
35852981
35862982#if __HVX_ARCH__ >= 62
35872983/* ==========================================================================
......@@ -3592,7 +2988,7 @@
35922988 ========================================================================== */
35932989
35942990#define Q6_Vuh_vasr_VwVwR_rnd_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrwuhrndsat)(Vu,Vv,Rt)
3595#endif /* __HEXAGON_ARCH___ >= 62 */
2991#endif
35962992
35972993#if __HVX_ARCH__ >= 62
35982994/* ==========================================================================
......@@ -3603,7 +2999,7 @@
36032999 ========================================================================== */
36043000
36053001#define Q6_Vub_vlsr_VubR(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlsrb)(Vu,Rt)
3606#endif /* __HEXAGON_ARCH___ >= 62 */
3002#endif
36073003
36083004#if __HVX_ARCH__ >= 62
36093005/* ==========================================================================
......@@ -3614,7 +3010,7 @@
36143010 ========================================================================== */
36153011
36163012#define Q6_Vb_vlut32_VbVbR_nomatch(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvvb_nm)(Vu,Vv,Rt)
3617#endif /* __HEXAGON_ARCH___ >= 62 */
3013#endif
36183014
36193015#if __HVX_ARCH__ >= 62
36203016/* ==========================================================================
......@@ -3625,7 +3021,7 @@
36253021 ========================================================================== */
36263022
36273023#define Q6_Vb_vlut32or_VbVbVbI(Vx,Vu,Vv,Iu3) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvvb_oracci)(Vx,Vu,Vv,Iu3)
3628#endif /* __HEXAGON_ARCH___ >= 62 */
3024#endif
36293025
36303026#if __HVX_ARCH__ >= 62
36313027/* ==========================================================================
......@@ -3636,7 +3032,7 @@
36363032 ========================================================================== */
36373033
36383034#define Q6_Vb_vlut32_VbVbI(Vu,Vv,Iu3) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvvbi)(Vu,Vv,Iu3)
3639#endif /* __HEXAGON_ARCH___ >= 62 */
3035#endif
36403036
36413037#if __HVX_ARCH__ >= 62
36423038/* ==========================================================================
......@@ -3647,7 +3043,7 @@
36473043 ========================================================================== */
36483044
36493045#define Q6_Wh_vlut16_VbVhR_nomatch(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvwh_nm)(Vu,Vv,Rt)
3650#endif /* __HEXAGON_ARCH___ >= 62 */
3046#endif
36513047
36523048#if __HVX_ARCH__ >= 62
36533049/* ==========================================================================
......@@ -3658,7 +3054,7 @@
36583054 ========================================================================== */
36593055
36603056#define Q6_Wh_vlut16or_WhVbVhI(Vxx,Vu,Vv,Iu3) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvwh_oracci)(Vxx,Vu,Vv,Iu3)
3661#endif /* __HEXAGON_ARCH___ >= 62 */
3057#endif
36623058
36633059#if __HVX_ARCH__ >= 62
36643060/* ==========================================================================
......@@ -3669,7 +3065,7 @@
36693065 ========================================================================== */
36703066
36713067#define Q6_Wh_vlut16_VbVhI(Vu,Vv,Iu3) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlutvwhi)(Vu,Vv,Iu3)
3672#endif /* __HEXAGON_ARCH___ >= 62 */
3068#endif
36733069
36743070#if __HVX_ARCH__ >= 62
36753071/* ==========================================================================
......@@ -3680,7 +3076,7 @@
36803076 ========================================================================== */
36813077
36823078#define Q6_Vb_vmax_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmaxb)(Vu,Vv)
3683#endif /* __HEXAGON_ARCH___ >= 62 */
3079#endif
36843080
36853081#if __HVX_ARCH__ >= 62
36863082/* ==========================================================================
......@@ -3691,7 +3087,7 @@
36913087 ========================================================================== */
36923088
36933089#define Q6_Vb_vmin_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vminb)(Vu,Vv)
3694#endif /* __HEXAGON_ARCH___ >= 62 */
3090#endif
36953091
36963092#if __HVX_ARCH__ >= 62
36973093/* ==========================================================================
......@@ -3702,7 +3098,7 @@
37023098 ========================================================================== */
37033099
37043100#define Q6_Ww_vmpa_WuhRb(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpauhb)(Vuu,Rt)
3705#endif /* __HEXAGON_ARCH___ >= 62 */
3101#endif
37063102
37073103#if __HVX_ARCH__ >= 62
37083104/* ==========================================================================
......@@ -3713,7 +3109,7 @@
37133109 ========================================================================== */
37143110
37153111#define Q6_Ww_vmpaacc_WwWuhRb(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpauhb_acc)(Vxx,Vuu,Rt)
3716#endif /* __HEXAGON_ARCH___ >= 62 */
3112#endif
37173113
37183114#if __HVX_ARCH__ >= 62
37193115/* ==========================================================================
......@@ -3724,7 +3120,7 @@
37243120 ========================================================================== */
37253121
37263122#define Q6_W_vmpye_VwVuh(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyewuh_64)(Vu,Vv)
3727#endif /* __HEXAGON_ARCH___ >= 62 */
3123#endif
37283124
37293125#if __HVX_ARCH__ >= 62
37303126/* ==========================================================================
......@@ -3735,7 +3131,7 @@
37353131 ========================================================================== */
37363132
37373133#define Q6_Vw_vmpyi_VwRub(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiwub)(Vu,Rt)
3738#endif /* __HEXAGON_ARCH___ >= 62 */
3134#endif
37393135
37403136#if __HVX_ARCH__ >= 62
37413137/* ==========================================================================
......@@ -3746,7 +3142,7 @@
37463142 ========================================================================== */
37473143
37483144#define Q6_Vw_vmpyiacc_VwVwRub(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyiwub_acc)(Vx,Vu,Rt)
3749#endif /* __HEXAGON_ARCH___ >= 62 */
3145#endif
37503146
37513147#if __HVX_ARCH__ >= 62
37523148/* ==========================================================================
......@@ -3757,7 +3153,7 @@
37573153 ========================================================================== */
37583154
37593155#define Q6_W_vmpyoacc_WVwVh(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyowh_64_acc)(Vxx,Vu,Vv)
3760#endif /* __HEXAGON_ARCH___ >= 62 */
3156#endif
37613157
37623158#if __HVX_ARCH__ >= 62
37633159/* ==========================================================================
......@@ -3768,7 +3164,7 @@
37683164 ========================================================================== */
37693165
37703166#define Q6_Vub_vround_VuhVuh_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrounduhub)(Vu,Vv)
3771#endif /* __HEXAGON_ARCH___ >= 62 */
3167#endif
37723168
37733169#if __HVX_ARCH__ >= 62
37743170/* ==========================================================================
......@@ -3779,7 +3175,7 @@
37793175 ========================================================================== */
37803176
37813177#define Q6_Vuh_vround_VuwVuw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrounduwuh)(Vu,Vv)
3782#endif /* __HEXAGON_ARCH___ >= 62 */
3178#endif
37833179
37843180#if __HVX_ARCH__ >= 62
37853181/* ==========================================================================
......@@ -3790,7 +3186,7 @@
37903186 ========================================================================== */
37913187
37923188#define Q6_Vuh_vsat_VuwVuw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsatuwuh)(Vu,Vv)
3793#endif /* __HEXAGON_ARCH___ >= 62 */
3189#endif
37943190
37953191#if __HVX_ARCH__ >= 62
37963192/* ==========================================================================
......@@ -3801,7 +3197,7 @@
38013197 ========================================================================== */
38023198
38033199#define Q6_Vb_vsub_VbVb_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubbsat)(Vu,Vv)
3804#endif /* __HEXAGON_ARCH___ >= 62 */
3200#endif
38053201
38063202#if __HVX_ARCH__ >= 62
38073203/* ==========================================================================
......@@ -3812,7 +3208,7 @@
38123208 ========================================================================== */
38133209
38143210#define Q6_Wb_vsub_WbWb_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubbsat_dv)(Vuu,Vvv)
3815#endif /* __HEXAGON_ARCH___ >= 62 */
3211#endif
38163212
38173213#if __HVX_ARCH__ >= 62
38183214/* ==========================================================================
......@@ -3823,7 +3219,7 @@
38233219 ========================================================================== */
38243220
38253221#define Q6_Vw_vsub_VwVwQ_carry(Vu,Vv,Qx) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubcarry)(Vu,Vv,Qx)
3826#endif /* __HEXAGON_ARCH___ >= 62 */
3222#endif
38273223
38283224#if __HVX_ARCH__ >= 62
38293225/* ==========================================================================
......@@ -3834,7 +3230,7 @@
38343230 ========================================================================== */
38353231
38363232#define Q6_Vub_vsub_VubVb_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubububb_sat)(Vu,Vv)
3837#endif /* __HEXAGON_ARCH___ >= 62 */
3233#endif
38383234
38393235#if __HVX_ARCH__ >= 62
38403236/* ==========================================================================
......@@ -3845,7 +3241,7 @@
38453241 ========================================================================== */
38463242
38473243#define Q6_Vuw_vsub_VuwVuw_sat(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubuwsat)(Vu,Vv)
3848#endif /* __HEXAGON_ARCH___ >= 62 */
3244#endif
38493245
38503246#if __HVX_ARCH__ >= 62
38513247/* ==========================================================================
......@@ -3856,7 +3252,7 @@
38563252 ========================================================================== */
38573253
38583254#define Q6_Wuw_vsub_WuwWuw_sat(Vuu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsubuwsat_dv)(Vuu,Vvv)
3859#endif /* __HEXAGON_ARCH___ >= 62 */
3255#endif
38603256
38613257#if __HVX_ARCH__ >= 65
38623258/* ==========================================================================
......@@ -3867,7 +3263,7 @@
38673263 ========================================================================== */
38683264
38693265#define Q6_Vb_vabs_Vb(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsb)(Vu)
3870#endif /* __HEXAGON_ARCH___ >= 65 */
3266#endif
38713267
38723268#if __HVX_ARCH__ >= 65
38733269/* ==========================================================================
......@@ -3878,7 +3274,7 @@
38783274 ========================================================================== */
38793275
38803276#define Q6_Vb_vabs_Vb_sat(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabsb_sat)(Vu)
3881#endif /* __HEXAGON_ARCH___ >= 65 */
3277#endif
38823278
38833279#if __HVX_ARCH__ >= 65
38843280/* ==========================================================================
......@@ -3889,7 +3285,7 @@
38893285 ========================================================================== */
38903286
38913287#define Q6_Vh_vaslacc_VhVhR(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaslh_acc)(Vx,Vu,Rt)
3892#endif /* __HEXAGON_ARCH___ >= 65 */
3288#endif
38933289
38943290#if __HVX_ARCH__ >= 65
38953291/* ==========================================================================
......@@ -3900,7 +3296,7 @@
39003296 ========================================================================== */
39013297
39023298#define Q6_Vh_vasracc_VhVhR(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrh_acc)(Vx,Vu,Rt)
3903#endif /* __HEXAGON_ARCH___ >= 65 */
3299#endif
39043300
39053301#if __HVX_ARCH__ >= 65
39063302/* ==========================================================================
......@@ -3911,7 +3307,7 @@
39113307 ========================================================================== */
39123308
39133309#define Q6_Vub_vasr_VuhVuhR_rnd_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasruhubrndsat)(Vu,Vv,Rt)
3914#endif /* __HEXAGON_ARCH___ >= 65 */
3310#endif
39153311
39163312#if __HVX_ARCH__ >= 65
39173313/* ==========================================================================
......@@ -3922,7 +3318,7 @@
39223318 ========================================================================== */
39233319
39243320#define Q6_Vub_vasr_VuhVuhR_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasruhubsat)(Vu,Vv,Rt)
3925#endif /* __HEXAGON_ARCH___ >= 65 */
3321#endif
39263322
39273323#if __HVX_ARCH__ >= 65
39283324/* ==========================================================================
......@@ -3933,7 +3329,7 @@
39333329 ========================================================================== */
39343330
39353331#define Q6_Vuh_vasr_VuwVuwR_sat(Vu,Vv,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasruwuhsat)(Vu,Vv,Rt)
3936#endif /* __HEXAGON_ARCH___ >= 65 */
3332#endif
39373333
39383334#if __HVX_ARCH__ >= 65
39393335/* ==========================================================================
......@@ -3944,7 +3340,7 @@
39443340 ========================================================================== */
39453341
39463342#define Q6_Vb_vavg_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgb)(Vu,Vv)
3947#endif /* __HEXAGON_ARCH___ >= 65 */
3343#endif
39483344
39493345#if __HVX_ARCH__ >= 65
39503346/* ==========================================================================
......@@ -3955,7 +3351,7 @@
39553351 ========================================================================== */
39563352
39573353#define Q6_Vb_vavg_VbVb_rnd(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavgbrnd)(Vu,Vv)
3958#endif /* __HEXAGON_ARCH___ >= 65 */
3354#endif
39593355
39603356#if __HVX_ARCH__ >= 65
39613357/* ==========================================================================
......@@ -3966,7 +3362,7 @@
39663362 ========================================================================== */
39673363
39683364#define Q6_Vuw_vavg_VuwVuw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavguw)(Vu,Vv)
3969#endif /* __HEXAGON_ARCH___ >= 65 */
3365#endif
39703366
39713367#if __HVX_ARCH__ >= 65
39723368/* ==========================================================================
......@@ -3977,7 +3373,7 @@
39773373 ========================================================================== */
39783374
39793375#define Q6_Vuw_vavg_VuwVuw_rnd(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vavguwrnd)(Vu,Vv)
3980#endif /* __HEXAGON_ARCH___ >= 65 */
3376#endif
39813377
39823378#if __HVX_ARCH__ >= 65
39833379/* ==========================================================================
......@@ -3988,7 +3384,7 @@
39883384 ========================================================================== */
39893385
39903386#define Q6_W_vzero() __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdd0)()
3991#endif /* __HEXAGON_ARCH___ >= 65 */
3387#endif
39923388
39933389#if __HVX_ARCH__ >= 65
39943390/* ==========================================================================
......@@ -3999,7 +3395,7 @@
39993395 ========================================================================== */
40003396
40013397#define Q6_vgather_ARMVh(Rs,Rt,Mu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgathermh)(Rs,Rt,Mu,Vv)
4002#endif /* __HEXAGON_ARCH___ >= 65 */
3398#endif
40033399
40043400#if __HVX_ARCH__ >= 65
40053401/* ==========================================================================
......@@ -4010,7 +3406,7 @@
40103406 ========================================================================== */
40113407
40123408#define Q6_vgather_AQRMVh(Rs,Qs,Rt,Mu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgathermhq)(Rs,__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),Rt,Mu,Vv)
4013#endif /* __HEXAGON_ARCH___ >= 65 */
3409#endif
40143410
40153411#if __HVX_ARCH__ >= 65
40163412/* ==========================================================================
......@@ -4021,7 +3417,7 @@
40213417 ========================================================================== */
40223418
40233419#define Q6_vgather_ARMWw(Rs,Rt,Mu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgathermhw)(Rs,Rt,Mu,Vvv)
4024#endif /* __HEXAGON_ARCH___ >= 65 */
3420#endif
40253421
40263422#if __HVX_ARCH__ >= 65
40273423/* ==========================================================================
......@@ -4032,7 +3428,7 @@
40323428 ========================================================================== */
40333429
40343430#define Q6_vgather_AQRMWw(Rs,Qs,Rt,Mu,Vvv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgathermhwq)(Rs,__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),Rt,Mu,Vvv)
4035#endif /* __HEXAGON_ARCH___ >= 65 */
3431#endif
40363432
40373433#if __HVX_ARCH__ >= 65
40383434/* ==========================================================================
......@@ -4043,7 +3439,7 @@
40433439 ========================================================================== */
40443440
40453441#define Q6_vgather_ARMVw(Rs,Rt,Mu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgathermw)(Rs,Rt,Mu,Vv)
4046#endif /* __HEXAGON_ARCH___ >= 65 */
3442#endif
40473443
40483444#if __HVX_ARCH__ >= 65
40493445/* ==========================================================================
......@@ -4054,7 +3450,7 @@
40543450 ========================================================================== */
40553451
40563452#define Q6_vgather_AQRMVw(Rs,Qs,Rt,Mu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgathermwq)(Rs,__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),Rt,Mu,Vv)
4057#endif /* __HEXAGON_ARCH___ >= 65 */
3453#endif
40583454
40593455#if __HVX_ARCH__ >= 65
40603456/* ==========================================================================
......@@ -4065,7 +3461,7 @@
40653461 ========================================================================== */
40663462
40673463#define Q6_Vh_vlut4_VuhPh(Vu,Rtt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vlut4)(Vu,Rtt)
4068#endif /* __HEXAGON_ARCH___ >= 65 */
3464#endif
40693465
40703466#if __HVX_ARCH__ >= 65
40713467/* ==========================================================================
......@@ -4076,7 +3472,7 @@
40763472 ========================================================================== */
40773473
40783474#define Q6_Wh_vmpa_WubRub(Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpabuu)(Vuu,Rt)
4079#endif /* __HEXAGON_ARCH___ >= 65 */
3475#endif
40803476
40813477#if __HVX_ARCH__ >= 65
40823478/* ==========================================================================
......@@ -4087,7 +3483,7 @@
40873483 ========================================================================== */
40883484
40893485#define Q6_Wh_vmpaacc_WhWubRub(Vxx,Vuu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpabuu_acc)(Vxx,Vuu,Rt)
4090#endif /* __HEXAGON_ARCH___ >= 65 */
3486#endif
40913487
40923488#if __HVX_ARCH__ >= 65
40933489/* ==========================================================================
......@@ -4098,7 +3494,7 @@
40983494 ========================================================================== */
40993495
41003496#define Q6_Vh_vmpa_VhVhVhPh_sat(Vx,Vu,Rtt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpahhsat)(Vx,Vu,Rtt)
4101#endif /* __HEXAGON_ARCH___ >= 65 */
3497#endif
41023498
41033499#if __HVX_ARCH__ >= 65
41043500/* ==========================================================================
......@@ -4109,7 +3505,7 @@
41093505 ========================================================================== */
41103506
41113507#define Q6_Vh_vmpa_VhVhVuhPuh_sat(Vx,Vu,Rtt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpauhuhsat)(Vx,Vu,Rtt)
4112#endif /* __HEXAGON_ARCH___ >= 65 */
3508#endif
41133509
41143510#if __HVX_ARCH__ >= 65
41153511/* ==========================================================================
......@@ -4120,7 +3516,7 @@
41203516 ========================================================================== */
41213517
41223518#define Q6_Vh_vmps_VhVhVuhPuh_sat(Vx,Vu,Rtt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpsuhuhsat)(Vx,Vu,Rtt)
4123#endif /* __HEXAGON_ARCH___ >= 65 */
3519#endif
41243520
41253521#if __HVX_ARCH__ >= 65
41263522/* ==========================================================================
......@@ -4131,7 +3527,7 @@
41313527 ========================================================================== */
41323528
41333529#define Q6_Ww_vmpyacc_WwVhRh(Vxx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyh_acc)(Vxx,Vu,Rt)
4134#endif /* __HEXAGON_ARCH___ >= 65 */
3530#endif
41353531
41363532#if __HVX_ARCH__ >= 65
41373533/* ==========================================================================
......@@ -4142,7 +3538,7 @@
41423538 ========================================================================== */
41433539
41443540#define Q6_Vuw_vmpye_VuhRuh(Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuhe)(Vu,Rt)
4145#endif /* __HEXAGON_ARCH___ >= 65 */
3541#endif
41463542
41473543#if __HVX_ARCH__ >= 65
41483544/* ==========================================================================
......@@ -4153,7 +3549,7 @@
41533549 ========================================================================== */
41543550
41553551#define Q6_Vuw_vmpyeacc_VuwVuhRuh(Vx,Vu,Rt) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuhe_acc)(Vx,Vu,Rt)
4156#endif /* __HEXAGON_ARCH___ >= 65 */
3552#endif
41573553
41583554#if __HVX_ARCH__ >= 65
41593555/* ==========================================================================
......@@ -4164,7 +3560,7 @@
41643560 ========================================================================== */
41653561
41663562#define Q6_Vb_vnavg_VbVb(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vnavgb)(Vu,Vv)
4167#endif /* __HEXAGON_ARCH___ >= 65 */
3563#endif
41683564
41693565#if __HVX_ARCH__ >= 65
41703566/* ==========================================================================
......@@ -4175,7 +3571,7 @@
41753571 ========================================================================== */
41763572
41773573#define Q6_Vb_prefixsum_Q(Qv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vprefixqb)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1))
4178#endif /* __HEXAGON_ARCH___ >= 65 */
3574#endif
41793575
41803576#if __HVX_ARCH__ >= 65
41813577/* ==========================================================================
......@@ -4186,7 +3582,7 @@
41863582 ========================================================================== */
41873583
41883584#define Q6_Vh_prefixsum_Q(Qv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vprefixqh)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1))
4189#endif /* __HEXAGON_ARCH___ >= 65 */
3585#endif
41903586
41913587#if __HVX_ARCH__ >= 65
41923588/* ==========================================================================
......@@ -4197,7 +3593,7 @@
41973593 ========================================================================== */
41983594
41993595#define Q6_Vw_prefixsum_Q(Qv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vprefixqw)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qv),-1))
4200#endif /* __HEXAGON_ARCH___ >= 65 */
3596#endif
42013597
42023598#if __HVX_ARCH__ >= 65
42033599/* ==========================================================================
......@@ -4208,7 +3604,7 @@
42083604 ========================================================================== */
42093605
42103606#define Q6_vscatter_RMVhV(Rt,Mu,Vv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermh)(Rt,Mu,Vv,Vw)
4211#endif /* __HEXAGON_ARCH___ >= 65 */
3607#endif
42123608
42133609#if __HVX_ARCH__ >= 65
42143610/* ==========================================================================
......@@ -4219,7 +3615,7 @@
42193615 ========================================================================== */
42203616
42213617#define Q6_vscatteracc_RMVhV(Rt,Mu,Vv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermh_add)(Rt,Mu,Vv,Vw)
4222#endif /* __HEXAGON_ARCH___ >= 65 */
3618#endif
42233619
42243620#if __HVX_ARCH__ >= 65
42253621/* ==========================================================================
......@@ -4230,7 +3626,7 @@
42303626 ========================================================================== */
42313627
42323628#define Q6_vscatter_QRMVhV(Qs,Rt,Mu,Vv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermhq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),Rt,Mu,Vv,Vw)
4233#endif /* __HEXAGON_ARCH___ >= 65 */
3629#endif
42343630
42353631#if __HVX_ARCH__ >= 65
42363632/* ==========================================================================
......@@ -4241,7 +3637,7 @@
42413637 ========================================================================== */
42423638
42433639#define Q6_vscatter_RMWwV(Rt,Mu,Vvv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermhw)(Rt,Mu,Vvv,Vw)
4244#endif /* __HEXAGON_ARCH___ >= 65 */
3640#endif
42453641
42463642#if __HVX_ARCH__ >= 65
42473643/* ==========================================================================
......@@ -4252,7 +3648,7 @@
42523648 ========================================================================== */
42533649
42543650#define Q6_vscatteracc_RMWwV(Rt,Mu,Vvv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermhw_add)(Rt,Mu,Vvv,Vw)
4255#endif /* __HEXAGON_ARCH___ >= 65 */
3651#endif
42563652
42573653#if __HVX_ARCH__ >= 65
42583654/* ==========================================================================
......@@ -4263,7 +3659,7 @@
42633659 ========================================================================== */
42643660
42653661#define Q6_vscatter_QRMWwV(Qs,Rt,Mu,Vvv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermhwq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),Rt,Mu,Vvv,Vw)
4266#endif /* __HEXAGON_ARCH___ >= 65 */
3662#endif
42673663
42683664#if __HVX_ARCH__ >= 65
42693665/* ==========================================================================
......@@ -4274,7 +3670,7 @@
42743670 ========================================================================== */
42753671
42763672#define Q6_vscatter_RMVwV(Rt,Mu,Vv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermw)(Rt,Mu,Vv,Vw)
4277#endif /* __HEXAGON_ARCH___ >= 65 */
3673#endif
42783674
42793675#if __HVX_ARCH__ >= 65
42803676/* ==========================================================================
......@@ -4285,7 +3681,7 @@
42853681 ========================================================================== */
42863682
42873683#define Q6_vscatteracc_RMVwV(Rt,Mu,Vv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermw_add)(Rt,Mu,Vv,Vw)
4288#endif /* __HEXAGON_ARCH___ >= 65 */
3684#endif
42893685
42903686#if __HVX_ARCH__ >= 65
42913687/* ==========================================================================
......@@ -4296,7 +3692,7 @@
42963692 ========================================================================== */
42973693
42983694#define Q6_vscatter_QRMVwV(Qs,Rt,Mu,Vv,Vw) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vscattermwq)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1),Rt,Mu,Vv,Vw)
4299#endif /* __HEXAGON_ARCH___ >= 65 */
3695#endif
43003696
43013697#if __HVX_ARCH__ >= 66
43023698/* ==========================================================================
......@@ -4307,7 +3703,7 @@
43073703 ========================================================================== */
43083704
43093705#define Q6_Vw_vadd_VwVwQ_carry_sat(Vu,Vv,Qs) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vaddcarrysat)(Vu,Vv,__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qs),-1))
4310#endif /* __HEXAGON_ARCH___ >= 66 */
3706#endif
43113707
43123708#if __HVX_ARCH__ >= 66
43133709/* ==========================================================================
......@@ -4318,7 +3714,7 @@
43183714 ========================================================================== */
43193715
43203716#define Q6_Ww_vasrinto_WwVwVw(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasr_into)(Vxx,Vu,Vv)
4321#endif /* __HEXAGON_ARCH___ >= 66 */
3717#endif
43223718
43233719#if __HVX_ARCH__ >= 66
43243720/* ==========================================================================
......@@ -4329,7 +3725,7 @@
43293725 ========================================================================== */
43303726
43313727#define Q6_Vuw_vrotr_VuwVuw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vrotr)(Vu,Vv)
4332#endif /* __HEXAGON_ARCH___ >= 66 */
3728#endif
43333729
43343730#if __HVX_ARCH__ >= 66
43353731/* ==========================================================================
......@@ -4340,7 +3736,7 @@
43403736 ========================================================================== */
43413737
43423738#define Q6_Vw_vsatdw_VwVw(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsatdw)(Vu,Vv)
4343#endif /* __HEXAGON_ARCH___ >= 66 */
3739#endif
43443740
43453741#if __HVX_ARCH__ >= 68
43463742/* ==========================================================================
......@@ -4351,7 +3747,7 @@
43513747 ========================================================================== */
43523748
43533749#define Q6_Ww_v6mpy_WubWbI_h(Vuu,Vvv,Iu2) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_v6mpyhubs10)(Vuu,Vvv,Iu2)
4354#endif /* __HEXAGON_ARCH___ >= 68 */
3750#endif
43553751
43563752#if __HVX_ARCH__ >= 68
43573753/* ==========================================================================
......@@ -4362,7 +3758,7 @@
43623758 ========================================================================== */
43633759
43643760#define Q6_Ww_v6mpyacc_WwWubWbI_h(Vxx,Vuu,Vvv,Iu2) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_v6mpyhubs10_vxx)(Vxx,Vuu,Vvv,Iu2)
4365#endif /* __HEXAGON_ARCH___ >= 68 */
3761#endif
43663762
43673763#if __HVX_ARCH__ >= 68
43683764/* ==========================================================================
......@@ -4373,7 +3769,7 @@
43733769 ========================================================================== */
43743770
43753771#define Q6_Ww_v6mpy_WubWbI_v(Vuu,Vvv,Iu2) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_v6mpyvubs10)(Vuu,Vvv,Iu2)
4376#endif /* __HEXAGON_ARCH___ >= 68 */
3772#endif
43773773
43783774#if __HVX_ARCH__ >= 68
43793775/* ==========================================================================
......@@ -4384,9 +3780,9 @@
43843780 ========================================================================== */
43853781
43863782#define Q6_Ww_v6mpyacc_WwWubWbI_v(Vxx,Vuu,Vvv,Iu2) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_v6mpyvubs10_vxx)(Vxx,Vuu,Vvv,Iu2)
4387#endif /* __HEXAGON_ARCH___ >= 68 */
3783#endif
43883784
4389#if __HVX_ARCH__ >= 68
3785#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
43903786/* ==========================================================================
43913787 Assembly Syntax: Vd32.hf=vabs(Vu32.hf)
43923788 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vabs_Vhf(HVX_Vector Vu)
......@@ -4395,9 +3791,9 @@
43953791 ========================================================================== */
43963792
43973793#define Q6_Vhf_vabs_Vhf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_hf)(Vu)
4398#endif /* __HEXAGON_ARCH___ >= 68 */
3794#endif
43993795
4400#if __HVX_ARCH__ >= 68
3796#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
44013797/* ==========================================================================
44023798 Assembly Syntax: Vd32.sf=vabs(Vu32.sf)
44033799 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vabs_Vsf(HVX_Vector Vu)
......@@ -4406,7 +3802,7 @@
44063802 ========================================================================== */
44073803
44083804#define Q6_Vsf_vabs_Vsf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_sf)(Vu)
4409#endif /* __HEXAGON_ARCH___ >= 68 */
3805#endif
44103806
44113807#if __HVX_ARCH__ >= 68
44123808/* ==========================================================================
......@@ -4417,9 +3813,9 @@
44173813 ========================================================================== */
44183814
44193815#define Q6_Vqf16_vadd_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_hf)(Vu,Vv)
4420#endif /* __HEXAGON_ARCH___ >= 68 */
3816#endif
44213817
4422#if __HVX_ARCH__ >= 68
3818#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
44233819/* ==========================================================================
44243820 Assembly Syntax: Vd32.hf=vadd(Vu32.hf,Vv32.hf)
44253821 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vadd_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4428,7 +3824,7 @@
44283824 ========================================================================== */
44293825
44303826#define Q6_Vhf_vadd_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_hf_hf)(Vu,Vv)
4431#endif /* __HEXAGON_ARCH___ >= 68 */
3827#endif
44323828
44333829#if __HVX_ARCH__ >= 68
44343830/* ==========================================================================
......@@ -4439,7 +3835,7 @@
44393835 ========================================================================== */
44403836
44413837#define Q6_Vqf16_vadd_Vqf16Vqf16(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_qf16)(Vu,Vv)
4442#endif /* __HEXAGON_ARCH___ >= 68 */
3838#endif
44433839
44443840#if __HVX_ARCH__ >= 68
44453841/* ==========================================================================
......@@ -4450,7 +3846,7 @@
44503846 ========================================================================== */
44513847
44523848#define Q6_Vqf16_vadd_Vqf16Vhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_qf16_mix)(Vu,Vv)
4453#endif /* __HEXAGON_ARCH___ >= 68 */
3849#endif
44543850
44553851#if __HVX_ARCH__ >= 68
44563852/* ==========================================================================
......@@ -4461,7 +3857,7 @@
44613857 ========================================================================== */
44623858
44633859#define Q6_Vqf32_vadd_Vqf32Vqf32(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_qf32)(Vu,Vv)
4464#endif /* __HEXAGON_ARCH___ >= 68 */
3860#endif
44653861
44663862#if __HVX_ARCH__ >= 68
44673863/* ==========================================================================
......@@ -4472,7 +3868,7 @@
44723868 ========================================================================== */
44733869
44743870#define Q6_Vqf32_vadd_Vqf32Vsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_qf32_mix)(Vu,Vv)
4475#endif /* __HEXAGON_ARCH___ >= 68 */
3871#endif
44763872
44773873#if __HVX_ARCH__ >= 68
44783874/* ==========================================================================
......@@ -4483,9 +3879,9 @@
44833879 ========================================================================== */
44843880
44853881#define Q6_Vqf32_vadd_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_sf)(Vu,Vv)
4486#endif /* __HEXAGON_ARCH___ >= 68 */
3882#endif
44873883
4488#if __HVX_ARCH__ >= 68
3884#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
44893885/* ==========================================================================
44903886 Assembly Syntax: Vdd32.sf=vadd(Vu32.hf,Vv32.hf)
44913887 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vadd_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4494,9 +3890,9 @@
44943890 ========================================================================== */
44953891
44963892#define Q6_Wsf_vadd_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_sf_hf)(Vu,Vv)
4497#endif /* __HEXAGON_ARCH___ >= 68 */
3893#endif
44983894
4499#if __HVX_ARCH__ >= 68
3895#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45003896/* ==========================================================================
45013897 Assembly Syntax: Vd32.sf=vadd(Vu32.sf,Vv32.sf)
45023898 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vadd_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4505,9 +3901,9 @@
45053901 ========================================================================== */
45063902
45073903#define Q6_Vsf_vadd_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_sf_sf)(Vu,Vv)
4508#endif /* __HEXAGON_ARCH___ >= 68 */
3904#endif
45093905
4510#if __HVX_ARCH__ >= 68
3906#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45113907/* ==========================================================================
45123908 Assembly Syntax: Vd32.w=vfmv(Vu32.w)
45133909 C Intrinsic Prototype: HVX_Vector Q6_Vw_vfmv_Vw(HVX_Vector Vu)
......@@ -4516,7 +3912,7 @@
45163912 ========================================================================== */
45173913
45183914#define Q6_Vw_vfmv_Vw(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vassign_fp)(Vu)
4519#endif /* __HEXAGON_ARCH___ >= 68 */
3915#endif
45203916
45213917#if __HVX_ARCH__ >= 68
45223918/* ==========================================================================
......@@ -4527,7 +3923,7 @@
45273923 ========================================================================== */
45283924
45293925#define Q6_Vhf_equals_Vqf16(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_hf_qf16)(Vu)
4530#endif /* __HEXAGON_ARCH___ >= 68 */
3926#endif
45313927
45323928#if __HVX_ARCH__ >= 68
45333929/* ==========================================================================
......@@ -4538,7 +3934,7 @@
45383934 ========================================================================== */
45393935
45403936#define Q6_Vhf_equals_Wqf32(Vuu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_hf_qf32)(Vuu)
4541#endif /* __HEXAGON_ARCH___ >= 68 */
3937#endif
45423938
45433939#if __HVX_ARCH__ >= 68
45443940/* ==========================================================================
......@@ -4549,9 +3945,9 @@
45493945 ========================================================================== */
45503946
45513947#define Q6_Vsf_equals_Vqf32(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_sf_qf32)(Vu)
4552#endif /* __HEXAGON_ARCH___ >= 68 */
3948#endif
45533949
4554#if __HVX_ARCH__ >= 68
3950#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45553951/* ==========================================================================
45563952 Assembly Syntax: Vd32.b=vcvt(Vu32.hf,Vv32.hf)
45573953 C Intrinsic Prototype: HVX_Vector Q6_Vb_vcvt_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4560,9 +3956,9 @@
45603956 ========================================================================== */
45613957
45623958#define Q6_Vb_vcvt_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_b_hf)(Vu,Vv)
4563#endif /* __HEXAGON_ARCH___ >= 68 */
3959#endif
45643960
4565#if __HVX_ARCH__ >= 68
3961#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45663962/* ==========================================================================
45673963 Assembly Syntax: Vd32.h=vcvt(Vu32.hf)
45683964 C Intrinsic Prototype: HVX_Vector Q6_Vh_vcvt_Vhf(HVX_Vector Vu)
......@@ -4571,9 +3967,9 @@
45713967 ========================================================================== */
45723968
45733969#define Q6_Vh_vcvt_Vhf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_h_hf)(Vu)
4574#endif /* __HEXAGON_ARCH___ >= 68 */
3970#endif
45753971
4576#if __HVX_ARCH__ >= 68
3972#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45773973/* ==========================================================================
45783974 Assembly Syntax: Vdd32.hf=vcvt(Vu32.b)
45793975 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vcvt_Vb(HVX_Vector Vu)
......@@ -4582,9 +3978,9 @@
45823978 ========================================================================== */
45833979
45843980#define Q6_Whf_vcvt_Vb(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_hf_b)(Vu)
4585#endif /* __HEXAGON_ARCH___ >= 68 */
3981#endif
45863982
4587#if __HVX_ARCH__ >= 68
3983#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45883984/* ==========================================================================
45893985 Assembly Syntax: Vd32.hf=vcvt(Vu32.h)
45903986 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vcvt_Vh(HVX_Vector Vu)
......@@ -4593,9 +3989,9 @@
45933989 ========================================================================== */
45943990
45953991#define Q6_Vhf_vcvt_Vh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_hf_h)(Vu)
4596#endif /* __HEXAGON_ARCH___ >= 68 */
3992#endif
45973993
4598#if __HVX_ARCH__ >= 68
3994#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
45993995/* ==========================================================================
46003996 Assembly Syntax: Vd32.hf=vcvt(Vu32.sf,Vv32.sf)
46013997 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vcvt_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4604,9 +4000,9 @@
46044000 ========================================================================== */
46054001
46064002#define Q6_Vhf_vcvt_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_hf_sf)(Vu,Vv)
4607#endif /* __HEXAGON_ARCH___ >= 68 */
4003#endif
46084004
4609#if __HVX_ARCH__ >= 68
4005#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46104006/* ==========================================================================
46114007 Assembly Syntax: Vdd32.hf=vcvt(Vu32.ub)
46124008 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vcvt_Vub(HVX_Vector Vu)
......@@ -4615,9 +4011,9 @@
46154011 ========================================================================== */
46164012
46174013#define Q6_Whf_vcvt_Vub(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_hf_ub)(Vu)
4618#endif /* __HEXAGON_ARCH___ >= 68 */
4014#endif
46194015
4620#if __HVX_ARCH__ >= 68
4016#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46214017/* ==========================================================================
46224018 Assembly Syntax: Vd32.hf=vcvt(Vu32.uh)
46234019 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vcvt_Vuh(HVX_Vector Vu)
......@@ -4626,9 +4022,9 @@
46264022 ========================================================================== */
46274023
46284024#define Q6_Vhf_vcvt_Vuh(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_hf_uh)(Vu)
4629#endif /* __HEXAGON_ARCH___ >= 68 */
4025#endif
46304026
4631#if __HVX_ARCH__ >= 68
4027#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46324028/* ==========================================================================
46334029 Assembly Syntax: Vdd32.sf=vcvt(Vu32.hf)
46344030 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vcvt_Vhf(HVX_Vector Vu)
......@@ -4637,9 +4033,9 @@
46374033 ========================================================================== */
46384034
46394035#define Q6_Wsf_vcvt_Vhf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_sf_hf)(Vu)
4640#endif /* __HEXAGON_ARCH___ >= 68 */
4036#endif
46414037
4642#if __HVX_ARCH__ >= 68
4038#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46434039/* ==========================================================================
46444040 Assembly Syntax: Vd32.ub=vcvt(Vu32.hf,Vv32.hf)
46454041 C Intrinsic Prototype: HVX_Vector Q6_Vub_vcvt_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4648,9 +4044,9 @@
46484044 ========================================================================== */
46494045
46504046#define Q6_Vub_vcvt_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_ub_hf)(Vu,Vv)
4651#endif /* __HEXAGON_ARCH___ >= 68 */
4047#endif
46524048
4653#if __HVX_ARCH__ >= 68
4049#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46544050/* ==========================================================================
46554051 Assembly Syntax: Vd32.uh=vcvt(Vu32.hf)
46564052 C Intrinsic Prototype: HVX_Vector Q6_Vuh_vcvt_Vhf(HVX_Vector Vu)
......@@ -4659,9 +4055,9 @@
46594055 ========================================================================== */
46604056
46614057#define Q6_Vuh_vcvt_Vhf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_uh_hf)(Vu)
4662#endif /* __HEXAGON_ARCH___ >= 68 */
4058#endif
46634059
4664#if __HVX_ARCH__ >= 68
4060#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46654061/* ==========================================================================
46664062 Assembly Syntax: Vd32.sf=vdmpy(Vu32.hf,Vv32.hf)
46674063 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vdmpy_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4670,9 +4066,9 @@
46704066 ========================================================================== */
46714067
46724068#define Q6_Vsf_vdmpy_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpy_sf_hf)(Vu,Vv)
4673#endif /* __HEXAGON_ARCH___ >= 68 */
4069#endif
46744070
4675#if __HVX_ARCH__ >= 68
4071#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46764072/* ==========================================================================
46774073 Assembly Syntax: Vx32.sf+=vdmpy(Vu32.hf,Vv32.hf)
46784074 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vdmpyacc_VsfVhfVhf(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -4681,9 +4077,9 @@
46814077 ========================================================================== */
46824078
46834079#define Q6_Vsf_vdmpyacc_VsfVhfVhf(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vdmpy_sf_hf_acc)(Vx,Vu,Vv)
4684#endif /* __HEXAGON_ARCH___ >= 68 */
4080#endif
46854081
4686#if __HVX_ARCH__ >= 68
4082#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46874083/* ==========================================================================
46884084 Assembly Syntax: Vd32.hf=vfmax(Vu32.hf,Vv32.hf)
46894085 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vfmax_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4692,9 +4088,9 @@
46924088 ========================================================================== */
46934089
46944090#define Q6_Vhf_vfmax_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfmax_hf)(Vu,Vv)
4695#endif /* __HEXAGON_ARCH___ >= 68 */
4091#endif
46964092
4697#if __HVX_ARCH__ >= 68
4093#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
46984094/* ==========================================================================
46994095 Assembly Syntax: Vd32.sf=vfmax(Vu32.sf,Vv32.sf)
47004096 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vfmax_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4703,9 +4099,9 @@
47034099 ========================================================================== */
47044100
47054101#define Q6_Vsf_vfmax_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfmax_sf)(Vu,Vv)
4706#endif /* __HEXAGON_ARCH___ >= 68 */
4102#endif
47074103
4708#if __HVX_ARCH__ >= 68
4104#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
47094105/* ==========================================================================
47104106 Assembly Syntax: Vd32.hf=vfmin(Vu32.hf,Vv32.hf)
47114107 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vfmin_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4714,9 +4110,9 @@
47144110 ========================================================================== */
47154111
47164112#define Q6_Vhf_vfmin_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfmin_hf)(Vu,Vv)
4717#endif /* __HEXAGON_ARCH___ >= 68 */
4113#endif
47184114
4719#if __HVX_ARCH__ >= 68
4115#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
47204116/* ==========================================================================
47214117 Assembly Syntax: Vd32.sf=vfmin(Vu32.sf,Vv32.sf)
47224118 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vfmin_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4725,9 +4121,9 @@
47254121 ========================================================================== */
47264122
47274123#define Q6_Vsf_vfmin_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfmin_sf)(Vu,Vv)
4728#endif /* __HEXAGON_ARCH___ >= 68 */
4124#endif
47294125
4730#if __HVX_ARCH__ >= 68
4126#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
47314127/* ==========================================================================
47324128 Assembly Syntax: Vd32.hf=vfneg(Vu32.hf)
47334129 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vfneg_Vhf(HVX_Vector Vu)
......@@ -4736,9 +4132,9 @@
47364132 ========================================================================== */
47374133
47384134#define Q6_Vhf_vfneg_Vhf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfneg_hf)(Vu)
4739#endif /* __HEXAGON_ARCH___ >= 68 */
4135#endif
47404136
4741#if __HVX_ARCH__ >= 68
4137#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
47424138/* ==========================================================================
47434139 Assembly Syntax: Vd32.sf=vfneg(Vu32.sf)
47444140 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vfneg_Vsf(HVX_Vector Vu)
......@@ -4747,7 +4143,7 @@
47474143 ========================================================================== */
47484144
47494145#define Q6_Vsf_vfneg_Vsf(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfneg_sf)(Vu)
4750#endif /* __HEXAGON_ARCH___ >= 68 */
4146#endif
47514147
47524148#if __HVX_ARCH__ >= 68
47534149/* ==========================================================================
......@@ -4758,7 +4154,7 @@
47584154 ========================================================================== */
47594155
47604156#define Q6_Q_vcmp_gt_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgthf)(Vu,Vv)),-1)
4761#endif /* __HEXAGON_ARCH___ >= 68 */
4157#endif
47624158
47634159#if __HVX_ARCH__ >= 68
47644160/* ==========================================================================
......@@ -4769,7 +4165,7 @@
47694165 ========================================================================== */
47704166
47714167#define Q6_Q_vcmp_gtand_QVhfVhf(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgthf_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
4772#endif /* __HEXAGON_ARCH___ >= 68 */
4168#endif
47734169
47744170#if __HVX_ARCH__ >= 68
47754171/* ==========================================================================
......@@ -4780,7 +4176,7 @@
47804176 ========================================================================== */
47814177
47824178#define Q6_Q_vcmp_gtor_QVhfVhf(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgthf_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
4783#endif /* __HEXAGON_ARCH___ >= 68 */
4179#endif
47844180
47854181#if __HVX_ARCH__ >= 68
47864182/* ==========================================================================
......@@ -4791,7 +4187,7 @@
47914187 ========================================================================== */
47924188
47934189#define Q6_Q_vcmp_gtxacc_QVhfVhf(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgthf_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
4794#endif /* __HEXAGON_ARCH___ >= 68 */
4190#endif
47954191
47964192#if __HVX_ARCH__ >= 68
47974193/* ==========================================================================
......@@ -4802,7 +4198,7 @@
48024198 ========================================================================== */
48034199
48044200#define Q6_Q_vcmp_gt_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtsf)(Vu,Vv)),-1)
4805#endif /* __HEXAGON_ARCH___ >= 68 */
4201#endif
48064202
48074203#if __HVX_ARCH__ >= 68
48084204/* ==========================================================================
......@@ -4813,7 +4209,7 @@
48134209 ========================================================================== */
48144210
48154211#define Q6_Q_vcmp_gtand_QVsfVsf(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtsf_and)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
4816#endif /* __HEXAGON_ARCH___ >= 68 */
4212#endif
48174213
48184214#if __HVX_ARCH__ >= 68
48194215/* ==========================================================================
......@@ -4824,7 +4220,7 @@
48244220 ========================================================================== */
48254221
48264222#define Q6_Q_vcmp_gtor_QVsfVsf(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtsf_or)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
4827#endif /* __HEXAGON_ARCH___ >= 68 */
4223#endif
48284224
48294225#if __HVX_ARCH__ >= 68
48304226/* ==========================================================================
......@@ -4835,7 +4231,7 @@
48354231 ========================================================================== */
48364232
48374233#define Q6_Q_vcmp_gtxacc_QVsfVsf(Qx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtsf_xor)(__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx),-1),Vu,Vv)),-1)
4838#endif /* __HEXAGON_ARCH___ >= 68 */
4234#endif
48394235
48404236#if __HVX_ARCH__ >= 68
48414237/* ==========================================================================
......@@ -4846,7 +4242,7 @@
48464242 ========================================================================== */
48474243
48484244#define Q6_Vhf_vmax_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmax_hf)(Vu,Vv)
4849#endif /* __HEXAGON_ARCH___ >= 68 */
4245#endif
48504246
48514247#if __HVX_ARCH__ >= 68
48524248/* ==========================================================================
......@@ -4857,7 +4253,7 @@
48574253 ========================================================================== */
48584254
48594255#define Q6_Vsf_vmax_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmax_sf)(Vu,Vv)
4860#endif /* __HEXAGON_ARCH___ >= 68 */
4256#endif
48614257
48624258#if __HVX_ARCH__ >= 68
48634259/* ==========================================================================
......@@ -4868,7 +4264,7 @@
48684264 ========================================================================== */
48694265
48704266#define Q6_Vhf_vmin_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmin_hf)(Vu,Vv)
4871#endif /* __HEXAGON_ARCH___ >= 68 */
4267#endif
48724268
48734269#if __HVX_ARCH__ >= 68
48744270/* ==========================================================================
......@@ -4879,9 +4275,9 @@
48794275 ========================================================================== */
48804276
48814277#define Q6_Vsf_vmin_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmin_sf)(Vu,Vv)
4882#endif /* __HEXAGON_ARCH___ >= 68 */
4278#endif
48834279
4884#if __HVX_ARCH__ >= 68
4280#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
48854281/* ==========================================================================
48864282 Assembly Syntax: Vd32.hf=vmpy(Vu32.hf,Vv32.hf)
48874283 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vmpy_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -4890,9 +4286,9 @@
48904286 ========================================================================== */
48914287
48924288#define Q6_Vhf_vmpy_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_hf_hf)(Vu,Vv)
4893#endif /* __HEXAGON_ARCH___ >= 68 */
4289#endif
48944290
4895#if __HVX_ARCH__ >= 68
4291#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
48964292/* ==========================================================================
48974293 Assembly Syntax: Vx32.hf+=vmpy(Vu32.hf,Vv32.hf)
48984294 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vmpyacc_VhfVhfVhf(HVX_Vector Vx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -4901,7 +4297,7 @@
49014297 ========================================================================== */
49024298
49034299#define Q6_Vhf_vmpyacc_VhfVhfVhf(Vx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_hf_hf_acc)(Vx,Vu,Vv)
4904#endif /* __HEXAGON_ARCH___ >= 68 */
4300#endif
49054301
49064302#if __HVX_ARCH__ >= 68
49074303/* ==========================================================================
......@@ -4912,7 +4308,7 @@
49124308 ========================================================================== */
49134309
49144310#define Q6_Vqf16_vmpy_Vqf16Vqf16(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf16)(Vu,Vv)
4915#endif /* __HEXAGON_ARCH___ >= 68 */
4311#endif
49164312
49174313#if __HVX_ARCH__ >= 68
49184314/* ==========================================================================
......@@ -4923,7 +4319,7 @@
49234319 ========================================================================== */
49244320
49254321#define Q6_Vqf16_vmpy_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf16_hf)(Vu,Vv)
4926#endif /* __HEXAGON_ARCH___ >= 68 */
4322#endif
49274323
49284324#if __HVX_ARCH__ >= 68
49294325/* ==========================================================================
......@@ -4934,7 +4330,7 @@
49344330 ========================================================================== */
49354331
49364332#define Q6_Vqf16_vmpy_Vqf16Vhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf16_mix_hf)(Vu,Vv)
4937#endif /* __HEXAGON_ARCH___ >= 68 */
4333#endif
49384334
49394335#if __HVX_ARCH__ >= 68
49404336/* ==========================================================================
......@@ -4945,7 +4341,7 @@
49454341 ========================================================================== */
49464342
49474343#define Q6_Vqf32_vmpy_Vqf32Vqf32(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf32)(Vu,Vv)
4948#endif /* __HEXAGON_ARCH___ >= 68 */
4344#endif
49494345
49504346#if __HVX_ARCH__ >= 68
49514347/* ==========================================================================
......@@ -4956,7 +4352,7 @@
49564352 ========================================================================== */
49574353
49584354#define Q6_Wqf32_vmpy_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf32_hf)(Vu,Vv)
4959#endif /* __HEXAGON_ARCH___ >= 68 */
4355#endif
49604356
49614357#if __HVX_ARCH__ >= 68
49624358/* ==========================================================================
......@@ -4967,7 +4363,7 @@
49674363 ========================================================================== */
49684364
49694365#define Q6_Wqf32_vmpy_Vqf16Vhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf32_mix_hf)(Vu,Vv)
4970#endif /* __HEXAGON_ARCH___ >= 68 */
4366#endif
49714367
49724368#if __HVX_ARCH__ >= 68
49734369/* ==========================================================================
......@@ -4978,7 +4374,7 @@
49784374 ========================================================================== */
49794375
49804376#define Q6_Wqf32_vmpy_Vqf16Vqf16(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf32_qf16)(Vu,Vv)
4981#endif /* __HEXAGON_ARCH___ >= 68 */
4377#endif
49824378
49834379#if __HVX_ARCH__ >= 68
49844380/* ==========================================================================
......@@ -4989,9 +4385,9 @@
49894385 ========================================================================== */
49904386
49914387#define Q6_Vqf32_vmpy_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_qf32_sf)(Vu,Vv)
4992#endif /* __HEXAGON_ARCH___ >= 68 */
4388#endif
49934389
4994#if __HVX_ARCH__ >= 68
4390#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
49954391/* ==========================================================================
49964392 Assembly Syntax: Vdd32.sf=vmpy(Vu32.hf,Vv32.hf)
49974393 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpy_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5000,9 +4396,9 @@
50004396 ========================================================================== */
50014397
50024398#define Q6_Wsf_vmpy_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_sf_hf)(Vu,Vv)
5003#endif /* __HEXAGON_ARCH___ >= 68 */
4399#endif
50044400
5005#if __HVX_ARCH__ >= 68
4401#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
50064402/* ==========================================================================
50074403 Assembly Syntax: Vxx32.sf+=vmpy(Vu32.hf,Vv32.hf)
50084404 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpyacc_WsfVhfVhf(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
......@@ -5011,9 +4407,9 @@
50114407 ========================================================================== */
50124408
50134409#define Q6_Wsf_vmpyacc_WsfVhfVhf(Vxx,Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_sf_hf_acc)(Vxx,Vu,Vv)
5014#endif /* __HEXAGON_ARCH___ >= 68 */
4410#endif
50154411
5016#if __HVX_ARCH__ >= 68
4412#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
50174413/* ==========================================================================
50184414 Assembly Syntax: Vd32.sf=vmpy(Vu32.sf,Vv32.sf)
50194415 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vmpy_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5022,7 +4418,7 @@
50224418 ========================================================================== */
50234419
50244420#define Q6_Vsf_vmpy_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_sf_sf)(Vu,Vv)
5025#endif /* __HEXAGON_ARCH___ >= 68 */
4421#endif
50264422
50274423#if __HVX_ARCH__ >= 68
50284424/* ==========================================================================
......@@ -5033,9 +4429,9 @@
50334429 ========================================================================== */
50344430
50354431#define Q6_Vqf16_vsub_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_hf)(Vu,Vv)
5036#endif /* __HEXAGON_ARCH___ >= 68 */
4432#endif
50374433
5038#if __HVX_ARCH__ >= 68
4434#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
50394435/* ==========================================================================
50404436 Assembly Syntax: Vd32.hf=vsub(Vu32.hf,Vv32.hf)
50414437 C Intrinsic Prototype: HVX_Vector Q6_Vhf_vsub_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5044,7 +4440,7 @@
50444440 ========================================================================== */
50454441
50464442#define Q6_Vhf_vsub_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_hf_hf)(Vu,Vv)
5047#endif /* __HEXAGON_ARCH___ >= 68 */
4443#endif
50484444
50494445#if __HVX_ARCH__ >= 68
50504446/* ==========================================================================
......@@ -5055,7 +4451,7 @@
50554451 ========================================================================== */
50564452
50574453#define Q6_Vqf16_vsub_Vqf16Vqf16(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_qf16)(Vu,Vv)
5058#endif /* __HEXAGON_ARCH___ >= 68 */
4454#endif
50594455
50604456#if __HVX_ARCH__ >= 68
50614457/* ==========================================================================
......@@ -5066,7 +4462,7 @@
50664462 ========================================================================== */
50674463
50684464#define Q6_Vqf16_vsub_Vqf16Vhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_qf16_mix)(Vu,Vv)
5069#endif /* __HEXAGON_ARCH___ >= 68 */
4465#endif
50704466
50714467#if __HVX_ARCH__ >= 68
50724468/* ==========================================================================
......@@ -5077,7 +4473,7 @@
50774473 ========================================================================== */
50784474
50794475#define Q6_Vqf32_vsub_Vqf32Vqf32(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_qf32)(Vu,Vv)
5080#endif /* __HEXAGON_ARCH___ >= 68 */
4476#endif
50814477
50824478#if __HVX_ARCH__ >= 68
50834479/* ==========================================================================
......@@ -5088,7 +4484,7 @@
50884484 ========================================================================== */
50894485
50904486#define Q6_Vqf32_vsub_Vqf32Vsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_qf32_mix)(Vu,Vv)
5091#endif /* __HEXAGON_ARCH___ >= 68 */
4487#endif
50924488
50934489#if __HVX_ARCH__ >= 68
50944490/* ==========================================================================
......@@ -5099,9 +4495,9 @@
50994495 ========================================================================== */
51004496
51014497#define Q6_Vqf32_vsub_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_sf)(Vu,Vv)
5102#endif /* __HEXAGON_ARCH___ >= 68 */
4498#endif
51034499
5104#if __HVX_ARCH__ >= 68
4500#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
51054501/* ==========================================================================
51064502 Assembly Syntax: Vdd32.sf=vsub(Vu32.hf,Vv32.hf)
51074503 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vsub_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5110,9 +4506,9 @@
51104506 ========================================================================== */
51114507
51124508#define Q6_Wsf_vsub_VhfVhf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_sf_hf)(Vu,Vv)
5113#endif /* __HEXAGON_ARCH___ >= 68 */
4509#endif
51144510
5115#if __HVX_ARCH__ >= 68
4511#if __HVX_ARCH__ >= 68 && defined __HVX_IEEE_FP__
51164512/* ==========================================================================
51174513 Assembly Syntax: Vd32.sf=vsub(Vu32.sf,Vv32.sf)
51184514 C Intrinsic Prototype: HVX_Vector Q6_Vsf_vsub_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5121,7 +4517,7 @@
51214517 ========================================================================== */
51224518
51234519#define Q6_Vsf_vsub_VsfVsf(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_sf_sf)(Vu,Vv)
5124#endif /* __HEXAGON_ARCH___ >= 68 */
4520#endif
51254521
51264522#if __HVX_ARCH__ >= 69
51274523/* ==========================================================================
......@@ -5132,7 +4528,7 @@
51324528 ========================================================================== */
51334529
51344530#define Q6_Vub_vasr_WuhVub_rnd_sat(Vuu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrvuhubrndsat)(Vuu,Vv)
5135#endif /* __HEXAGON_ARCH___ >= 69 */
4531#endif
51364532
51374533#if __HVX_ARCH__ >= 69
51384534/* ==========================================================================
......@@ -5143,7 +4539,7 @@
51434539 ========================================================================== */
51444540
51454541#define Q6_Vub_vasr_WuhVub_sat(Vuu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrvuhubsat)(Vuu,Vv)
5146#endif /* __HEXAGON_ARCH___ >= 69 */
4542#endif
51474543
51484544#if __HVX_ARCH__ >= 69
51494545/* ==========================================================================
......@@ -5154,7 +4550,7 @@
51544550 ========================================================================== */
51554551
51564552#define Q6_Vuh_vasr_WwVuh_rnd_sat(Vuu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrvwuhrndsat)(Vuu,Vv)
5157#endif /* __HEXAGON_ARCH___ >= 69 */
4553#endif
51584554
51594555#if __HVX_ARCH__ >= 69
51604556/* ==========================================================================
......@@ -5165,7 +4561,7 @@
51654561 ========================================================================== */
51664562
51674563#define Q6_Vuh_vasr_WwVuh_sat(Vuu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vasrvwuhsat)(Vuu,Vv)
5168#endif /* __HEXAGON_ARCH___ >= 69 */
4564#endif
51694565
51704566#if __HVX_ARCH__ >= 69
51714567/* ==========================================================================
......@@ -5176,9 +4572,9 @@
51764572 ========================================================================== */
51774573
51784574#define Q6_Vuh_vmpy_VuhVuh_rs16(Vu,Vv) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpyuhvs)(Vu,Vv)
5179#endif /* __HEXAGON_ARCH___ >= 69 */
4575#endif
51804576
5181#if __HVX_ARCH__ >= 73
4577#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
51824578/* ==========================================================================
51834579 Assembly Syntax: Vdd32.sf=vadd(Vu32.bf,Vv32.bf)
51844580 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vadd_VbfVbf(HVX_Vector Vu,
......@@ -5187,7 +4583,7 @@
51874583
51884584#define Q6_Wsf_vadd_VbfVbf(Vu, Vv) \
51894585 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_sf_bf)(Vu, Vv)
5190#endif /* __HEXAGON_ARCH___ >= 73 */
4586#endif
51914587
51924588#if __HVX_ARCH__ >= 73
51934589/* ==========================================================================
......@@ -5199,7 +4595,7 @@
51994595
52004596#define Q6_Vh_equals_Vhf(Vu) \
52014597 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_h_hf)(Vu)
5202#endif /* __HEXAGON_ARCH___ >= 73 */
4598#endif
52034599
52044600#if __HVX_ARCH__ >= 73
52054601/* ==========================================================================
......@@ -5211,7 +4607,7 @@
52114607
52124608#define Q6_Vhf_equals_Vh(Vu) \
52134609 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_hf_h)(Vu)
5214#endif /* __HEXAGON_ARCH___ >= 73 */
4610#endif
52154611
52164612#if __HVX_ARCH__ >= 73
52174613/* ==========================================================================
......@@ -5223,7 +4619,7 @@
52234619
52244620#define Q6_Vsf_equals_Vw(Vu) \
52254621 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_sf_w)(Vu)
5226#endif /* __HEXAGON_ARCH___ >= 73 */
4622#endif
52274623
52284624#if __HVX_ARCH__ >= 73
52294625/* ==========================================================================
......@@ -5235,9 +4631,9 @@
52354631
52364632#define Q6_Vw_equals_Vsf(Vu) \
52374633 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_w_sf)(Vu)
5238#endif /* __HEXAGON_ARCH___ >= 73 */
4634#endif
52394635
5240#if __HVX_ARCH__ >= 73
4636#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
52414637/* ==========================================================================
52424638 Assembly Syntax: Vd32.bf=vcvt(Vu32.sf,Vv32.sf)
52434639 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vcvt_VsfVsf(HVX_Vector Vu,
......@@ -5246,7 +4642,7 @@
52464642
52474643#define Q6_Vbf_vcvt_VsfVsf(Vu, Vv) \
52484644 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_bf_sf)(Vu, Vv)
5249#endif /* __HEXAGON_ARCH___ >= 73 */
4645#endif
52504646
52514647#if __HVX_ARCH__ >= 73
52524648/* ==========================================================================
......@@ -5258,7 +4654,7 @@
52584654#define Q6_Q_vcmp_gt_VbfVbf(Vu, Vv) \
52594655 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt) \
52604656 ((__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vgtbf)(Vu, Vv)), -1)
5261#endif /* __HEXAGON_ARCH___ >= 73 */
4657#endif
52624658
52634659#if __HVX_ARCH__ >= 73
52644660/* ==========================================================================
......@@ -5274,7 +4670,7 @@
52744670 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
52754671 Vv)), \
52764672 -1)
5277#endif /* __HEXAGON_ARCH___ >= 73 */
4673#endif
52784674
52794675#if __HVX_ARCH__ >= 73
52804676/* ==========================================================================
......@@ -5290,7 +4686,7 @@
52904686 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
52914687 Vv)), \
52924688 -1)
5293#endif /* __HEXAGON_ARCH___ >= 73 */
4689#endif
52944690
52954691#if __HVX_ARCH__ >= 73
52964692/* ==========================================================================
......@@ -5306,9 +4702,9 @@
53064702 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
53074703 Vv)), \
53084704 -1)
5309#endif /* __HEXAGON_ARCH___ >= 73 */
4705#endif
53104706
5311#if __HVX_ARCH__ >= 73
4707#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
53124708/* ==========================================================================
53134709 Assembly Syntax: Vd32.bf=vmax(Vu32.bf,Vv32.bf)
53144710 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vmax_VbfVbf(HVX_Vector Vu,
......@@ -5317,9 +4713,9 @@
53174713
53184714#define Q6_Vbf_vmax_VbfVbf(Vu, Vv) \
53194715 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmax_bf)(Vu, Vv)
5320#endif /* __HEXAGON_ARCH___ >= 73 */
4716#endif
53214717
5322#if __HVX_ARCH__ >= 73
4718#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
53234719/* ==========================================================================
53244720 Assembly Syntax: Vd32.bf=vmin(Vu32.bf,Vv32.bf)
53254721 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vmin_VbfVbf(HVX_Vector Vu,
......@@ -5328,9 +4724,9 @@
53284724
53294725#define Q6_Vbf_vmin_VbfVbf(Vu, Vv) \
53304726 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmin_bf)(Vu, Vv)
5331#endif /* __HEXAGON_ARCH___ >= 73 */
4727#endif
53324728
5333#if __HVX_ARCH__ >= 73
4729#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
53344730/* ==========================================================================
53354731 Assembly Syntax: Vdd32.sf=vmpy(Vu32.bf,Vv32.bf)
53364732 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpy_VbfVbf(HVX_Vector Vu,
......@@ -5339,9 +4735,9 @@
53394735
53404736#define Q6_Wsf_vmpy_VbfVbf(Vu, Vv) \
53414737 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_sf_bf)(Vu, Vv)
5342#endif /* __HEXAGON_ARCH___ >= 73 */
4738#endif
53434739
5344#if __HVX_ARCH__ >= 73
4740#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
53454741/* ==========================================================================
53464742 Assembly Syntax: Vxx32.sf+=vmpy(Vu32.bf,Vv32.bf)
53474743 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpyacc_WsfVbfVbf(HVX_VectorPair
......@@ -5351,9 +4747,9 @@
53514747
53524748#define Q6_Wsf_vmpyacc_WsfVbfVbf(Vxx, Vu, Vv) \
53534749 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_sf_bf_acc)(Vxx, Vu, Vv)
5354#endif /* __HEXAGON_ARCH___ >= 73 */
4750#endif
53554751
5356#if __HVX_ARCH__ >= 73
4752#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
53574753/* ==========================================================================
53584754 Assembly Syntax: Vdd32.sf=vsub(Vu32.bf,Vv32.bf)
53594755 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vsub_VbfVbf(HVX_Vector Vu,
......@@ -5362,7 +4758,7 @@
53624758
53634759#define Q6_Wsf_vsub_VbfVbf(Vu, Vv) \
53644760 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_sf_bf)(Vu, Vv)
5365#endif /* __HEXAGON_ARCH___ >= 73 */
4761#endif
53664762
53674763#if __HVX_ARCH__ >= 79
53684764/* ==========================================================================
......@@ -5374,7 +4770,7 @@
53744770
53754771#define Q6_V_vgetqfext_VR(Vu, Rt) \
53764772 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_get_qfext)(Vu, Rt)
5377#endif /* __HEXAGON_ARCH___ >= 79 */
4773#endif
53784774
53794775#if __HVX_ARCH__ >= 79
53804776/* ==========================================================================
......@@ -5386,7 +4782,7 @@
53864782
53874783#define Q6_V_vgetqfextor_VVR(Vx, Vu, Rt) \
53884784 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_get_qfext_oracc)(Vx, Vu, Rt)
5389#endif /* __HEXAGON_ARCH___ >= 79 */
4785#endif
53904786
53914787#if __HVX_ARCH__ >= 79
53924788/* ==========================================================================
......@@ -5398,9 +4794,9 @@
53984794
53994795#define Q6_V_vsetqfext_VR(Vu, Rt) \
54004796 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_set_qfext)(Vu, Rt)
5401#endif /* __HEXAGON_ARCH___ >= 79 */
4797#endif
54024798
5403#if __HVX_ARCH__ >= 79
4799#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54044800/* ==========================================================================
54054801 Assembly Syntax: Vd32.f8=vabs(Vu32.f8)
54064802 C Intrinsic Prototype: HVX_Vector Q6_V_vabs_V(HVX_Vector Vu)
......@@ -5409,9 +4805,9 @@
54094805 ========================================================================== */
54104806
54114807#define Q6_V_vabs_V(Vu) __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_f8)(Vu)
5412#endif /* __HEXAGON_ARCH___ >= 79 */
4808#endif
54134809
5414#if __HVX_ARCH__ >= 79
4810#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54154811/* ==========================================================================
54164812 Assembly Syntax: Vdd32.hf=vadd(Vu32.f8,Vv32.f8)
54174813 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vadd_VV(HVX_Vector Vu,
......@@ -5420,9 +4816,9 @@
54204816
54214817#define Q6_Whf_vadd_VV(Vu, Vv) \
54224818 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vadd_hf_f8)(Vu, Vv)
5423#endif /* __HEXAGON_ARCH___ >= 79 */
4819#endif
54244820
5425#if __HVX_ARCH__ >= 79
4821#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54264822/* ==========================================================================
54274823 Assembly Syntax: Vd32.b=vcvt2(Vu32.hf,Vv32.hf)
54284824 C Intrinsic Prototype: HVX_Vector Q6_Vb_vcvt2_VhfVhf(HVX_Vector Vu,
......@@ -5431,9 +4827,9 @@
54314827
54324828#define Q6_Vb_vcvt2_VhfVhf(Vu, Vv) \
54334829 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt2_b_hf)(Vu, Vv)
5434#endif /* __HEXAGON_ARCH___ >= 79 */
4830#endif
54354831
5436#if __HVX_ARCH__ >= 79
4832#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54374833/* ==========================================================================
54384834 Assembly Syntax: Vdd32.hf=vcvt2(Vu32.b)
54394835 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vcvt2_Vb(HVX_Vector Vu)
......@@ -5443,9 +4839,9 @@
54434839
54444840#define Q6_Whf_vcvt2_Vb(Vu) \
54454841 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt2_hf_b)(Vu)
5446#endif /* __HEXAGON_ARCH___ >= 79 */
4842#endif
54474843
5448#if __HVX_ARCH__ >= 79
4844#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54494845/* ==========================================================================
54504846 Assembly Syntax: Vdd32.hf=vcvt2(Vu32.ub)
54514847 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vcvt2_Vub(HVX_Vector Vu)
......@@ -5455,9 +4851,9 @@
54554851
54564852#define Q6_Whf_vcvt2_Vub(Vu) \
54574853 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt2_hf_ub)(Vu)
5458#endif /* __HEXAGON_ARCH___ >= 79 */
4854#endif
54594855
5460#if __HVX_ARCH__ >= 79
4856#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54614857/* ==========================================================================
54624858 Assembly Syntax: Vd32.ub=vcvt2(Vu32.hf,Vv32.hf)
54634859 C Intrinsic Prototype: HVX_Vector Q6_Vub_vcvt2_VhfVhf(HVX_Vector Vu,
......@@ -5466,9 +4862,9 @@
54664862
54674863#define Q6_Vub_vcvt2_VhfVhf(Vu, Vv) \
54684864 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt2_ub_hf)(Vu, Vv)
5469#endif /* __HEXAGON_ARCH___ >= 79 */
4865#endif
54704866
5471#if __HVX_ARCH__ >= 79
4867#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54724868/* ==========================================================================
54734869 Assembly Syntax: Vd32.f8=vcvt(Vu32.hf,Vv32.hf)
54744870 C Intrinsic Prototype: HVX_Vector Q6_V_vcvt_VhfVhf(HVX_Vector Vu, HVX_Vector
......@@ -5477,9 +4873,9 @@
54774873
54784874#define Q6_V_vcvt_VhfVhf(Vu, Vv) \
54794875 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_f8_hf)(Vu, Vv)
5480#endif /* __HEXAGON_ARCH___ >= 79 */
4876#endif
54814877
5482#if __HVX_ARCH__ >= 79
4878#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54834879/* ==========================================================================
54844880 Assembly Syntax: Vdd32.hf=vcvt(Vu32.f8)
54854881 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vcvt_V(HVX_Vector Vu)
......@@ -5489,9 +4885,9 @@
54894885
54904886#define Q6_Whf_vcvt_V(Vu) \
54914887 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vcvt_hf_f8)(Vu)
5492#endif /* __HEXAGON_ARCH___ >= 79 */
4888#endif
54934889
5494#if __HVX_ARCH__ >= 79
4890#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
54954891/* ==========================================================================
54964892 Assembly Syntax: Vd32.f8=vfmax(Vu32.f8,Vv32.f8)
54974893 C Intrinsic Prototype: HVX_Vector Q6_V_vfmax_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5501,9 +4897,9 @@
55014897
55024898#define Q6_V_vfmax_VV(Vu, Vv) \
55034899 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfmax_f8)(Vu, Vv)
5504#endif /* __HEXAGON_ARCH___ >= 79 */
4900#endif
55054901
5506#if __HVX_ARCH__ >= 79
4902#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
55074903/* ==========================================================================
55084904 Assembly Syntax: Vd32.f8=vfmin(Vu32.f8,Vv32.f8)
55094905 C Intrinsic Prototype: HVX_Vector Q6_V_vfmin_VV(HVX_Vector Vu, HVX_Vector Vv)
......@@ -5513,9 +4909,9 @@
55134909
55144910#define Q6_V_vfmin_VV(Vu, Vv) \
55154911 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfmin_f8)(Vu, Vv)
5516#endif /* __HEXAGON_ARCH___ >= 79 */
4912#endif
55174913
5518#if __HVX_ARCH__ >= 79
4914#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
55194915/* ==========================================================================
55204916 Assembly Syntax: Vd32.f8=vfneg(Vu32.f8)
55214917 C Intrinsic Prototype: HVX_Vector Q6_V_vfneg_V(HVX_Vector Vu)
......@@ -5525,7 +4921,7 @@
55254921
55264922#define Q6_V_vfneg_V(Vu) \
55274923 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vfneg_f8)(Vu)
5528#endif /* __HEXAGON_ARCH___ >= 79 */
4924#endif
55294925
55304926#if __HVX_ARCH__ >= 79
55314927/* ==========================================================================
......@@ -5536,9 +4932,9 @@
55364932
55374933#define Q6_V_vmerge_VVw(Vu, Vv) \
55384934 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmerge_qf)(Vu, Vv)
5539#endif /* __HEXAGON_ARCH___ >= 79 */
4935#endif
55404936
5541#if __HVX_ARCH__ >= 79
4937#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
55424938/* ==========================================================================
55434939 Assembly Syntax: Vdd32.hf=vmpy(Vu32.f8,Vv32.f8)
55444940 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vmpy_VV(HVX_Vector Vu,
......@@ -5547,9 +4943,9 @@
55474943
55484944#define Q6_Whf_vmpy_VV(Vu, Vv) \
55494945 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_hf_f8)(Vu, Vv)
5550#endif /* __HEXAGON_ARCH___ >= 79 */
4946#endif
55514947
5552#if __HVX_ARCH__ >= 79
4948#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
55534949/* ==========================================================================
55544950 Assembly Syntax: Vxx32.hf+=vmpy(Vu32.f8,Vv32.f8)
55554951 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vmpyacc_WhfVV(HVX_VectorPair
......@@ -5559,7 +4955,7 @@
55594955
55604956#define Q6_Whf_vmpyacc_WhfVV(Vxx, Vu, Vv) \
55614957 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_hf_f8_acc)(Vxx, Vu, Vv)
5562#endif /* __HEXAGON_ARCH___ >= 79 */
4958#endif
55634959
55644960#if __HVX_ARCH__ >= 79
55654961/* ==========================================================================
......@@ -5570,7 +4966,7 @@
55704966
55714967#define Q6_Vqf16_vmpy_VhfRhf(Vu, Rt) \
55724968 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_rt_hf)(Vu, Rt)
5573#endif /* __HEXAGON_ARCH___ >= 79 */
4969#endif
55744970
55754971#if __HVX_ARCH__ >= 79
55764972/* ==========================================================================
......@@ -5581,7 +4977,7 @@
55814977
55824978#define Q6_Vqf16_vmpy_Vqf16Rhf(Vu, Rt) \
55834979 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_rt_qf16)(Vu, Rt)
5584#endif /* __HEXAGON_ARCH___ >= 79 */
4980#endif
55854981
55864982#if __HVX_ARCH__ >= 79
55874983/* ==========================================================================
......@@ -5592,9 +4988,9 @@
55924988
55934989#define Q6_Vqf32_vmpy_VsfRsf(Vu, Rt) \
55944990 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vmpy_rt_sf)(Vu, Rt)
5595#endif /* __HEXAGON_ARCH___ >= 79 */
4991#endif
55964992
5597#if __HVX_ARCH__ >= 79
4993#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
55984994/* ==========================================================================
55994995 Assembly Syntax: Vdd32.hf=vsub(Vu32.f8,Vv32.f8)
56004996 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vsub_VV(HVX_Vector Vu,
......@@ -5603,7 +4999,400 @@
56034999
56045000#define Q6_Whf_vsub_VV(Vu, Vv) \
56055001 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_hf_f8)(Vu, Vv)
5606#endif /* __HEXAGON_ARCH___ >= 79 */
5002#endif
5003
5004#if __HVX_ARCH__ >= 81
5005/* ==========================================================================
5006 Assembly Syntax: Vd32.qf16=vabs(Vu32.hf)
5007 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vabs_Vhf(HVX_Vector Vu)
5008 Instruction Type: CVI_VS
5009 Execution Slots: SLOT0123
5010 ========================================================================== */
5011
5012#define Q6_Vqf16_vabs_Vhf(Vu) \
5013 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_qf16_hf)(Vu)
5014#endif
5015
5016#if __HVX_ARCH__ >= 81
5017/* ==========================================================================
5018 Assembly Syntax: Vd32.qf16=vabs(Vu32.qf16)
5019 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vabs_Vqf16(HVX_Vector Vu)
5020 Instruction Type: CVI_VS
5021 Execution Slots: SLOT0123
5022 ========================================================================== */
5023
5024#define Q6_Vqf16_vabs_Vqf16(Vu) \
5025 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_qf16_qf16)(Vu)
5026#endif
5027
5028#if __HVX_ARCH__ >= 81
5029/* ==========================================================================
5030 Assembly Syntax: Vd32.qf32=vabs(Vu32.qf32)
5031 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vabs_Vqf32(HVX_Vector Vu)
5032 Instruction Type: CVI_VS
5033 Execution Slots: SLOT0123
5034 ========================================================================== */
5035
5036#define Q6_Vqf32_vabs_Vqf32(Vu) \
5037 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_qf32_qf32)(Vu)
5038#endif
5039
5040#if __HVX_ARCH__ >= 81
5041/* ==========================================================================
5042 Assembly Syntax: Vd32.qf32=vabs(Vu32.sf)
5043 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vabs_Vsf(HVX_Vector Vu)
5044 Instruction Type: CVI_VS
5045 Execution Slots: SLOT0123
5046 ========================================================================== */
5047
5048#define Q6_Vqf32_vabs_Vsf(Vu) \
5049 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vabs_qf32_sf)(Vu)
5050#endif
5051
5052#if __HVX_ARCH__ >= 81
5053/* ==========================================================================
5054 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
5057 ========================================================================== */
5058
5059#define Q6_V_valign4_VVR(Vu, Vv, Rt) \
5060 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_valign4)(Vu, Vv, Rt)
5061#endif
5062
5063#if __HVX_ARCH__ >= 81
5064/* ==========================================================================
5065 Assembly Syntax: Vd32.bf=Vuu32.qf32
5066 C Intrinsic Prototype: HVX_Vector Q6_Vbf_equals_Wqf32(HVX_VectorPair Vuu)
5067 Instruction Type: CVI_VS
5068 Execution Slots: SLOT0123
5069 ========================================================================== */
5070
5071#define Q6_Vbf_equals_Wqf32(Vuu) \
5072 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_bf_qf32)(Vuu)
5073#endif
5074
5075#if __HVX_ARCH__ >= 81
5076/* ==========================================================================
5077 Assembly Syntax: Vd32.f8=Vu32.qf16
5078 C Intrinsic Prototype: HVX_Vector Q6_V_equals_Vqf16(HVX_Vector Vu)
5079 Instruction Type: CVI_VS
5080 Execution Slots: SLOT0123
5081 ========================================================================== */
5082
5083#define Q6_V_equals_Vqf16(Vu) \
5084 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_f8_qf16)(Vu)
5085#endif
5086
5087#if __HVX_ARCH__ >= 81
5088/* ==========================================================================
5089 Assembly Syntax: Vd32.h=Vu32.hf:rnd
5090 C Intrinsic Prototype: HVX_Vector Q6_Vh_equals_Vhf_rnd(HVX_Vector Vu)
5091 Instruction Type: CVI_VS
5092 Execution Slots: SLOT0123
5093 ========================================================================== */
5094
5095#define Q6_Vh_equals_Vhf_rnd(Vu) \
5096 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_h_hf_rnd)(Vu)
5097#endif
5098
5099#if __HVX_ARCH__ >= 81
5100/* ==========================================================================
5101 Assembly Syntax: Vdd32.qf16=Vu32.f8
5102 C Intrinsic Prototype: HVX_VectorPair Q6_Wqf16_equals_V(HVX_Vector Vu)
5103 Instruction Type: CVI_VP_VS
5104 Execution Slots: SLOT0123
5105 ========================================================================== */
5106
5107#define Q6_Wqf16_equals_V(Vu) \
5108 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_qf16_f8)(Vu)
5109#endif
5110
5111#if __HVX_ARCH__ >= 81
5112/* ==========================================================================
5113 Assembly Syntax: Vd32.qf16=Vu32.hf
5114 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_equals_Vhf(HVX_Vector Vu)
5115 Instruction Type: CVI_VS
5116 Execution Slots: SLOT0123
5117 ========================================================================== */
5118
5119#define Q6_Vqf16_equals_Vhf(Vu) \
5120 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_qf16_hf)(Vu)
5121#endif
5122
5123#if __HVX_ARCH__ >= 81
5124/* ==========================================================================
5125 Assembly Syntax: Vd32.qf16=Vu32.qf16
5126 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_equals_Vqf16(HVX_Vector Vu)
5127 Instruction Type: CVI_VS
5128 Execution Slots: SLOT0123
5129 ========================================================================== */
5130
5131#define Q6_Vqf16_equals_Vqf16(Vu) \
5132 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_qf16_qf16)(Vu)
5133#endif
5134
5135#if __HVX_ARCH__ >= 81
5136/* ==========================================================================
5137 Assembly Syntax: Vd32.qf32=Vu32.qf32
5138 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_equals_Vqf32(HVX_Vector Vu)
5139 Instruction Type: CVI_VS
5140 Execution Slots: SLOT0123
5141 ========================================================================== */
5142
5143#define Q6_Vqf32_equals_Vqf32(Vu) \
5144 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_qf32_qf32)(Vu)
5145#endif
5146
5147#if __HVX_ARCH__ >= 81
5148/* ==========================================================================
5149 Assembly Syntax: Vd32.qf32=Vu32.sf
5150 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_equals_Vsf(HVX_Vector Vu)
5151 Instruction Type: CVI_VS
5152 Execution Slots: SLOT0123
5153 ========================================================================== */
5154
5155#define Q6_Vqf32_equals_Vsf(Vu) \
5156 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vconv_qf32_sf)(Vu)
5157#endif
5158
5159#if __HVX_ARCH__ >= 81
5160/* ==========================================================================
5161 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
5164 ========================================================================== */
5165
5166#define Q6_Q_vcmp_eq_VhfVhf(Vu, Vv) \
5167 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5168 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqhf)(Vu, Vv)), -1)
5169#endif
5170
5171#if __HVX_ARCH__ >= 81
5172/* ==========================================================================
5173 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
5177 ========================================================================== */
5178
5179#define Q6_Q_vcmp_eqand_QVhfVhf(Qx, Vu, Vv) \
5180 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5181 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqhf_and)( \
5182 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
5183 Vv)), \
5184 -1)
5185#endif
5186
5187#if __HVX_ARCH__ >= 81
5188/* ==========================================================================
5189 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
5193 ========================================================================== */
5194
5195#define Q6_Q_vcmp_eqor_QVhfVhf(Qx, Vu, Vv) \
5196 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5197 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqhf_or)( \
5198 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
5199 Vv)), \
5200 -1)
5201#endif
5202
5203#if __HVX_ARCH__ >= 81
5204/* ==========================================================================
5205 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
5209 ========================================================================== */
5210
5211#define Q6_Q_vcmp_eqxacc_QVhfVhf(Qx, Vu, Vv) \
5212 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5213 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqhf_xor)( \
5214 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
5215 Vv)), \
5216 -1)
5217#endif
5218
5219#if __HVX_ARCH__ >= 81
5220/* ==========================================================================
5221 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
5224 ========================================================================== */
5225
5226#define Q6_Q_vcmp_eq_VsfVsf(Vu, Vv) \
5227 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5228 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqsf)(Vu, Vv)), -1)
5229#endif
5230
5231#if __HVX_ARCH__ >= 81
5232/* ==========================================================================
5233 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
5237 ========================================================================== */
5238
5239#define Q6_Q_vcmp_eqand_QVsfVsf(Qx, Vu, Vv) \
5240 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5241 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqsf_and)( \
5242 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
5243 Vv)), \
5244 -1)
5245#endif
5246
5247#if __HVX_ARCH__ >= 81
5248/* ==========================================================================
5249 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
5253 ========================================================================== */
5254
5255#define Q6_Q_vcmp_eqor_QVsfVsf(Qx, Vu, Vv) \
5256 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5257 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqsf_or)( \
5258 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
5259 Vv)), \
5260 -1)
5261#endif
5262
5263#if __HVX_ARCH__ >= 81
5264/* ==========================================================================
5265 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
5269 ========================================================================== */
5270
5271#define Q6_Q_vcmp_eqxacc_QVsfVsf(Qx, Vu, Vv) \
5272 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandqrt)( \
5273 (__BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_veqsf_xor)( \
5274 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vandvrt)((Qx), -1), Vu, \
5275 Vv)), \
5276 -1)
5277#endif
5278
5279#if __HVX_ARCH__ >= 81
5280/* ==========================================================================
5281 Assembly Syntax: Vd32.w=vilog2(Vu32.hf)
5282 C Intrinsic Prototype: HVX_Vector Q6_Vw_vilog2_Vhf(HVX_Vector Vu)
5283 Instruction Type: CVI_VS
5284 Execution Slots: SLOT0123
5285 ========================================================================== */
5286
5287#define Q6_Vw_vilog2_Vhf(Vu) \
5288 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vilog2_hf)(Vu)
5289#endif
5290
5291#if __HVX_ARCH__ >= 81
5292/* ==========================================================================
5293 Assembly Syntax: Vd32.w=vilog2(Vu32.qf16)
5294 C Intrinsic Prototype: HVX_Vector Q6_Vw_vilog2_Vqf16(HVX_Vector Vu)
5295 Instruction Type: CVI_VS
5296 Execution Slots: SLOT0123
5297 ========================================================================== */
5298
5299#define Q6_Vw_vilog2_Vqf16(Vu) \
5300 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vilog2_qf16)(Vu)
5301#endif
5302
5303#if __HVX_ARCH__ >= 81
5304/* ==========================================================================
5305 Assembly Syntax: Vd32.w=vilog2(Vu32.qf32)
5306 C Intrinsic Prototype: HVX_Vector Q6_Vw_vilog2_Vqf32(HVX_Vector Vu)
5307 Instruction Type: CVI_VS
5308 Execution Slots: SLOT0123
5309 ========================================================================== */
5310
5311#define Q6_Vw_vilog2_Vqf32(Vu) \
5312 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vilog2_qf32)(Vu)
5313#endif
5314
5315#if __HVX_ARCH__ >= 81
5316/* ==========================================================================
5317 Assembly Syntax: Vd32.w=vilog2(Vu32.sf)
5318 C Intrinsic Prototype: HVX_Vector Q6_Vw_vilog2_Vsf(HVX_Vector Vu)
5319 Instruction Type: CVI_VS
5320 Execution Slots: SLOT0123
5321 ========================================================================== */
5322
5323#define Q6_Vw_vilog2_Vsf(Vu) \
5324 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vilog2_sf)(Vu)
5325#endif
5326
5327#if __HVX_ARCH__ >= 81
5328/* ==========================================================================
5329 Assembly Syntax: Vd32.qf16=vneg(Vu32.hf)
5330 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vneg_Vhf(HVX_Vector Vu)
5331 Instruction Type: CVI_VS
5332 Execution Slots: SLOT0123
5333 ========================================================================== */
5334
5335#define Q6_Vqf16_vneg_Vhf(Vu) \
5336 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vneg_qf16_hf)(Vu)
5337#endif
5338
5339#if __HVX_ARCH__ >= 81
5340/* ==========================================================================
5341 Assembly Syntax: Vd32.qf16=vneg(Vu32.qf16)
5342 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vneg_Vqf16(HVX_Vector Vu)
5343 Instruction Type: CVI_VS
5344 Execution Slots: SLOT0123
5345 ========================================================================== */
5346
5347#define Q6_Vqf16_vneg_Vqf16(Vu) \
5348 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vneg_qf16_qf16)(Vu)
5349#endif
5350
5351#if __HVX_ARCH__ >= 81
5352/* ==========================================================================
5353 Assembly Syntax: Vd32.qf32=vneg(Vu32.qf32)
5354 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vneg_Vqf32(HVX_Vector Vu)
5355 Instruction Type: CVI_VS
5356 Execution Slots: SLOT0123
5357 ========================================================================== */
5358
5359#define Q6_Vqf32_vneg_Vqf32(Vu) \
5360 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vneg_qf32_qf32)(Vu)
5361#endif
5362
5363#if __HVX_ARCH__ >= 81
5364/* ==========================================================================
5365 Assembly Syntax: Vd32.qf32=vneg(Vu32.sf)
5366 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vneg_Vsf(HVX_Vector Vu)
5367 Instruction Type: CVI_VS
5368 Execution Slots: SLOT0123
5369 ========================================================================== */
5370
5371#define Q6_Vqf32_vneg_Vsf(Vu) \
5372 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vneg_qf32_sf)(Vu)
5373#endif
5374
5375#if __HVX_ARCH__ >= 81
5376/* ==========================================================================
5377 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
5380 ========================================================================== */
5381
5382#define Q6_Vqf16_vsub_VhfVqf16(Vu, Vv) \
5383 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_hf_mix)(Vu, Vv)
5384#endif
5385
5386#if __HVX_ARCH__ >= 81
5387/* ==========================================================================
5388 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
5391 ========================================================================== */
5392
5393#define Q6_Vqf32_vsub_VsfVqf32(Vu, Vv) \
5394 __BUILTIN_VECTOR_WRAP(__builtin_HEXAGON_V6_vsub_sf_mix)(Vu, Vv)
5395#endif
56075396
56085397#endif /* __HVX__ */
56095398
lib/include/immintrin.h-12
......@@ -475,24 +475,12 @@ _storebe_i64(void * __P, long long __D) {
475475
476476#include <amxfp8intrin.h>
477477
478#include <amxtransposeintrin.h>
479
480478#include <amxmovrsintrin.h>
481479
482#include <amxmovrstransposeintrin.h>
483
484480#include <amxavx512intrin.h>
485481
486482#include <amxtf32intrin.h>
487483
488#include <amxtf32transposeintrin.h>
489
490#include <amxbf16transposeintrin.h>
491
492#include <amxfp16transposeintrin.h>
493
494#include <amxcomplextransposeintrin.h>
495
496484#include <avx512vp2intersectintrin.h>
497485
498486#include <avx512vlvp2intersectintrin.h>
lib/include/intrin.h+4
......@@ -30,6 +30,10 @@
3030#include <arm64intr.h>
3131#endif
3232
33#if defined(__ARM_ACLE)
34#include <arm_acle.h>
35#endif
36
3337/* For the definition of jmp_buf. */
3438#if __STDC_HOSTED__
3539#include <setjmp.h>
lib/include/lasxintrin.h+113
......@@ -10,6 +10,8 @@
1010#ifndef _LOONGSON_ASXINTRIN_H
1111#define _LOONGSON_ASXINTRIN_H 1
1212
13#include <lsxintrin.h>
14
1315#if defined(__loongarch_asx)
1416
1517typedef signed char v32i8 __attribute__((vector_size(32), aligned(32)));
......@@ -3882,5 +3884,116 @@ extern __inline
38823884
38833885#define __lasx_xvrepli_w(/*si10*/ _1) ((__m256i)__builtin_lasx_xvrepli_w((_1)))
38843886
3887#if defined(__loongarch_asx_sx_conv)
3888
3889extern __inline
3890 __attribute__((__gnu_inline__, __always_inline__,
3891 __artificial__)) __m256 __lasx_cast_128_s(__m128 _1) {
3892 return (__m256)__builtin_lasx_cast_128_s((v4f32)_1);
3893}
3894
3895extern __inline
3896 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256d
3897 __lasx_cast_128_d(__m128d _1) {
3898 return (__m256d)__builtin_lasx_cast_128_d((v2f64)_1);
3899}
3900
3901extern __inline
3902 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256i
3903 __lasx_cast_128(__m128i _1) {
3904 return (__m256i)__builtin_lasx_cast_128((v2i64)_1);
3905}
3906
3907extern __inline
3908 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256
3909 __lasx_concat_128_s(__m128 _1, __m128 _2) {
3910 return (__m256)__builtin_lasx_concat_128_s((v4f32)_1, (v4f32)_2);
3911}
3912
3913extern __inline
3914 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256d
3915 __lasx_concat_128_d(__m128d _1, __m128d _2) {
3916 return (__m256d)__builtin_lasx_concat_128_d((v2f64)_1, (v2f64)_2);
3917}
3918
3919extern __inline
3920 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256i
3921 __lasx_concat_128(__m128i _1, __m128i _2) {
3922 return (__m256i)__builtin_lasx_concat_128((v2i64)_1, (v2i64)_2);
3923}
3924
3925extern __inline
3926 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128
3927 __lasx_extract_128_lo_s(__m256 _1) {
3928 return (__m128)__builtin_lasx_extract_128_lo_s((v8f32)_1);
3929}
3930
3931extern __inline
3932 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128d
3933 __lasx_extract_128_lo_d(__m256d _1) {
3934 return (__m128d)__builtin_lasx_extract_128_lo_d((v4f64)_1);
3935}
3936
3937extern __inline
3938 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128i
3939 __lasx_extract_128_lo(__m256i _1) {
3940 return (__m128i)__builtin_lasx_extract_128_lo((v4i64)_1);
3941}
3942
3943extern __inline
3944 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128
3945 __lasx_extract_128_hi_s(__m256 _1) {
3946 return (__m128)__builtin_lasx_extract_128_hi_s((v8f32)_1);
3947}
3948
3949extern __inline
3950 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128d
3951 __lasx_extract_128_hi_d(__m256d _1) {
3952 return (__m128d)__builtin_lasx_extract_128_hi_d((v4f64)_1);
3953}
3954
3955extern __inline
3956 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128i
3957 __lasx_extract_128_hi(__m256i _1) {
3958 return (__m128i)__builtin_lasx_extract_128_hi((v4i64)_1);
3959}
3960
3961extern __inline
3962 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256
3963 __lasx_insert_128_lo_s(__m256 _1, __m128 _2) {
3964 return (__m256)__builtin_lasx_insert_128_lo_s((v8f32)_1, (v4f32)_2);
3965}
3966
3967extern __inline
3968 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256d
3969 __lasx_insert_128_lo_d(__m256d _1, __m128d _2) {
3970 return (__m256d)__builtin_lasx_insert_128_lo_d((v4f64)_1, (v2f64)_2);
3971}
3972
3973extern __inline
3974 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256i
3975 __lasx_insert_128_lo(__m256i _1, __m128i _2) {
3976 return (__m256i)__builtin_lasx_insert_128_lo((v4i64)_1, (v2i64)_2);
3977}
3978
3979extern __inline
3980 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256
3981 __lasx_insert_128_hi_s(__m256 _1, __m128 _2) {
3982 return (__m256)__builtin_lasx_insert_128_hi_s((v8f32)_1, (v4f32)_2);
3983}
3984
3985extern __inline
3986 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256d
3987 __lasx_insert_128_hi_d(__m256d _1, __m128d _2) {
3988 return (__m256d)__builtin_lasx_insert_128_hi_d((v4f64)_1, (v2f64)_2);
3989}
3990
3991extern __inline
3992 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256i
3993 __lasx_insert_128_hi(__m256i _1, __m128i _2) {
3994 return (__m256i)__builtin_lasx_insert_128_hi((v4i64)_1, (v2i64)_2);
3995}
3996
3997#endif /* defined(__loongarch_asx_sx_conv). */
38853998#endif /* defined(__loongarch_asx). */
38863999#endif /* _LOONGSON_ASXINTRIN_H. */
lib/include/llvm_libc_wrappers/assert.h+3-5
......@@ -19,13 +19,11 @@
1919
2020#if defined(__HIP__) || defined(__CUDA__)
2121#define __LIBC_ATTRS __attribute__((device))
22#else
23#define __LIBC_ATTRS
2224#endif
2325
24#pragma omp begin declare target
25
26#include <llvm-libc-decls/assert.h>
27
28#pragma omp end declare target
26// TODO: Define these for CUDA / HIP.
2927
3028#undef __LIBC_ATTRS
3129
lib/include/llvm_libc_wrappers/ctype.h+3-115
......@@ -13,128 +13,16 @@
1313#error "This file is for GPU offloading compilation only"
1414#endif
1515
16// The GNU headers like to define 'toupper' and 'tolower' redundantly. This is
17// necessary to prevent it from doing that and remapping our implementation.
18#if (defined(__NVPTX__) || defined(__AMDGPU__)) && defined(__GLIBC__)
19#pragma push_macro("__USE_EXTERN_INLINES")
20#undef __USE_EXTERN_INLINES
21#endif
22
2316#include_next <ctype.h>
2417
25#if (defined(__NVPTX__) || defined(__AMDGPU__)) && defined(__GLIBC__)
26#pragma pop_macro("__USE_EXTERN_INLINES")
27#endif
28
29#if __has_include(<llvm-libc-decls/ctype.h>)
30
3118#if defined(__HIP__) || defined(__CUDA__)
3219#define __LIBC_ATTRS __attribute__((device))
20#else
21#define __LIBC_ATTRS
3322#endif
3423
35// The GNU headers like to provide these as macros, we need to undefine them so
36// they do not conflict with the following definitions for the GPU.
37
38#pragma push_macro("isalnum")
39#pragma push_macro("isalpha")
40#pragma push_macro("isascii")
41#pragma push_macro("isblank")
42#pragma push_macro("iscntrl")
43#pragma push_macro("isdigit")
44#pragma push_macro("isgraph")
45#pragma push_macro("islower")
46#pragma push_macro("isprint")
47#pragma push_macro("ispunct")
48#pragma push_macro("isspace")
49#pragma push_macro("isupper")
50#pragma push_macro("isxdigit")
51#pragma push_macro("toascii")
52#pragma push_macro("tolower")
53#pragma push_macro("toupper")
54#pragma push_macro("isalnum_l")
55#pragma push_macro("isalpha_l")
56#pragma push_macro("isascii_l")
57#pragma push_macro("isblank_l")
58#pragma push_macro("iscntrl_l")
59#pragma push_macro("isdigit_l")
60#pragma push_macro("isgraph_l")
61#pragma push_macro("islower_l")
62#pragma push_macro("isprint_l")
63#pragma push_macro("ispunct_l")
64#pragma push_macro("isspace_l")
65#pragma push_macro("isupper_l")
66#pragma push_macro("isxdigit_l")
67
68#undef isalnum
69#undef isalpha
70#undef isascii
71#undef iscntrl
72#undef isdigit
73#undef islower
74#undef isgraph
75#undef isprint
76#undef ispunct
77#undef isspace
78#undef isupper
79#undef isblank
80#undef isxdigit
81#undef toascii
82#undef tolower
83#undef toupper
84#undef isalnum_l
85#undef isalpha_l
86#undef iscntrl_l
87#undef isdigit_l
88#undef islower_l
89#undef isgraph_l
90#undef isprint_l
91#undef ispunct_l
92#undef isspace_l
93#undef isupper_l
94#undef isblank_l
95#undef isxdigit_l
96
97#pragma omp begin declare target
98
99#include <llvm-libc-decls/ctype.h>
100
101#pragma omp end declare target
102
103// Restore the original macros when compiling on the host.
104#if !defined(__NVPTX__) && !defined(__AMDGPU__)
105#pragma pop_macro("isalnum")
106#pragma pop_macro("isalpha")
107#pragma pop_macro("isascii")
108#pragma pop_macro("isblank")
109#pragma pop_macro("iscntrl")
110#pragma pop_macro("isdigit")
111#pragma pop_macro("isgraph")
112#pragma pop_macro("islower")
113#pragma pop_macro("isprint")
114#pragma pop_macro("ispunct")
115#pragma pop_macro("isspace")
116#pragma pop_macro("isupper")
117#pragma pop_macro("isxdigit")
118#pragma pop_macro("toascii")
119#pragma pop_macro("tolower")
120#pragma pop_macro("toupper")
121#pragma pop_macro("isalnum_l")
122#pragma pop_macro("isalpha_l")
123#pragma pop_macro("isascii_l")
124#pragma pop_macro("isblank_l")
125#pragma pop_macro("iscntrl_l")
126#pragma pop_macro("isdigit_l")
127#pragma pop_macro("isgraph_l")
128#pragma pop_macro("islower_l")
129#pragma pop_macro("isprint_l")
130#pragma pop_macro("ispunct_l")
131#pragma pop_macro("isspace_l")
132#pragma pop_macro("isupper_l")
133#pragma pop_macro("isxdigit_l")
134#endif
24// TODO: Define these for CUDA / HIP.
13525
13626#undef __LIBC_ATTRS
13727
138#endif
139
14028#endif // __CLANG_LLVM_LIBC_WRAPPERS_CTYPE_H__
lib/include/llvm_libc_wrappers/inttypes.h+3-5
......@@ -19,13 +19,11 @@
1919
2020#if defined(__HIP__) || defined(__CUDA__)
2121#define __LIBC_ATTRS __attribute__((device))
22#else
23#define __LIBC_ATTRS
2224#endif
2325
24#pragma omp begin declare target
25
26#include <llvm-libc-decls/inttypes.h>
27
28#pragma omp end declare target
26// TODO: Define these for CUDA / HIP.
2927
3028#undef __LIBC_ATTRS
3129
lib/include/llvm_libc_wrappers/stdio.h+10-38
......@@ -6,45 +6,19 @@
66//
77//===----------------------------------------------------------------------===//
88
9#ifndef __CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__
10#define __CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__
11
912#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
1013#error "This file is for GPU offloading compilation only"
1114#endif
1215
1316#include_next <stdio.h>
1417
15// In some old versions of glibc, other standard headers sometimes define
16// special macros (e.g., __need_FILE) before including stdio.h to cause stdio.h
17// to produce special definitions. Future includes of stdio.h when those
18// special macros are undefined are expected to produce the normal definitions
19// from stdio.h.
20//
21// We do not apply our include guard (__CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__)
22// unconditionally to the above include_next. Otherwise, after an occurrence of
23// the first glibc stdio.h use case described above, the include_next would be
24// skipped for remaining includes of stdio.h, leaving required symbols
25// undefined.
26//
27// We make the following assumptions to handle all use cases:
28//
29// 1. If the above include_next produces special glibc definitions, then (a) it
30// does not produce the normal definitions that we must intercept below, (b)
31// the current file was included from a glibc header that already defined
32// __GLIBC__ (usually by including glibc's <features.h>), and (c) the above
33// include_next does not define _STDIO_H. In that case, we skip the rest of
34// the current file and don't guard against future includes.
35// 2. If the above include_next produces the normal stdio.h definitions, then
36// either (a) __GLIBC__ is not defined because C headers are from some other
37// libc implementation or (b) the above include_next defines _STDIO_H to
38// prevent the above include_next from having any effect in the future.
39#if !defined(__GLIBC__) || defined(_STDIO_H)
40
41#ifndef __CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__
42#define __CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__
43
44#if __has_include(<llvm-libc-decls/stdio.h>)
45
4618#if defined(__HIP__) || defined(__CUDA__)
4719#define __LIBC_ATTRS __attribute__((device))
20#else
21#define __LIBC_ATTRS
4822#endif
4923
5024// Some headers provide these as macros. Temporarily undefine them so they do
......@@ -60,21 +34,19 @@
6034
6135#pragma omp begin declare target
6236
63#include <llvm-libc-decls/stdio.h>
37__LIBC_ATTRS extern FILE *stderr;
38__LIBC_ATTRS extern FILE *stdin;
39__LIBC_ATTRS extern FILE *stdout;
6440
6541#pragma omp end declare target
6642
67#undef __LIBC_ATTRS
68
6943// Restore the original macros when compiling on the host.
7044#if !defined(__NVPTX__) && !defined(__AMDGPU__)
71#pragma pop_macro("stdout")
7245#pragma pop_macro("stderr")
7346#pragma pop_macro("stdin")
47#pragma pop_macro("stdout")
7448#endif
7549
76#endif
50#undef __LIBC_ATTRS
7751
7852#endif // __CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__
79
80#endif
lib/include/llvm_libc_wrappers/stdlib.h+3-24
......@@ -15,39 +15,18 @@
1515
1616#include_next <stdlib.h>
1717
18#if __has_include(<llvm-libc-decls/stdlib.h>)
19
2018#if defined(__HIP__) || defined(__CUDA__)
2119#define __LIBC_ATTRS __attribute__((device))
20#else
21#define __LIBC_ATTRS
2222#endif
2323
2424#pragma omp begin declare target
2525
26// The LLVM C library uses these named types so we forward declare them.
27typedef void (*__atexithandler_t)(void);
28typedef int (*__search_compare_t)(const void *, const void *);
29typedef int (*__qsortcompare_t)(const void *, const void *);
30typedef int (*__qsortrcompare_t)(const void *, const void *, void *);
31
32// Enforce ABI compatibility with the structs used by the LLVM C library.
33_Static_assert(__builtin_offsetof(div_t, quot) == 0, "ABI mismatch!");
34_Static_assert(__builtin_offsetof(ldiv_t, quot) == 0, "ABI mismatch!");
35_Static_assert(__builtin_offsetof(lldiv_t, quot) == 0, "ABI mismatch!");
36
37#if defined(__GLIBC__) && __cplusplus >= 201703L
38#define at_quick_exit atexit
39#endif
40
41#include <llvm-libc-decls/stdlib.h>
42
43#if defined(__GLIBC__) && __cplusplus >= 201703L
44#undef at_quick_exit
45#endif
26// TODO: Define these for CUDA / HIP.
4627
4728#pragma omp end declare target
4829
4930#undef __LIBC_ATTRS
5031
51#endif
52
5332#endif // __CLANG_LLVM_LIBC_WRAPPERS_STDLIB_H__
lib/include/llvm_libc_wrappers/string.h+2-70
......@@ -15,82 +15,14 @@
1515
1616#include_next <string.h>
1717
18#if __has_include(<llvm-libc-decls/string.h>)
19
2018#if defined(__HIP__) || defined(__CUDA__)
2119#define __LIBC_ATTRS __attribute__((device))
22#endif
23
24#pragma omp begin declare target
25
26// The GNU headers provide C++ standard compliant headers when in C++ mode and
27// the LLVM libc does not. We need to manually provide the definitions using the
28// same prototypes.
29#if defined(__cplusplus) && defined(__GLIBC__) && \
30 defined(__CORRECT_ISO_CPP_STRING_H_PROTO)
31
32#ifndef __LIBC_ATTRS
33#define __LIBC_ATTRS
34#endif
35
36extern "C" {
37void *memccpy(void *__restrict, const void *__restrict, int,
38 size_t) __LIBC_ATTRS;
39int memcmp(const void *, const void *, size_t) __LIBC_ATTRS;
40void *memcpy(void *__restrict, const void *__restrict, size_t) __LIBC_ATTRS;
41void *memmem(const void *, size_t, const void *, size_t) __LIBC_ATTRS;
42void *memmove(void *, const void *, size_t) __LIBC_ATTRS;
43void *mempcpy(void *__restrict, const void *__restrict, size_t) __LIBC_ATTRS;
44void *memset(void *, int, size_t) __LIBC_ATTRS;
45char *stpcpy(char *__restrict, const char *__restrict) __LIBC_ATTRS;
46char *stpncpy(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
47char *strcat(char *__restrict, const char *__restrict) __LIBC_ATTRS;
48int strcmp(const char *, const char *) __LIBC_ATTRS;
49int strcoll(const char *, const char *) __LIBC_ATTRS;
50char *strcpy(char *__restrict, const char *__restrict) __LIBC_ATTRS;
51size_t strcspn(const char *, const char *) __LIBC_ATTRS;
52char *strdup(const char *) __LIBC_ATTRS;
53size_t strlen(const char *) __LIBC_ATTRS;
54char *strncat(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
55int strncmp(const char *, const char *, size_t) __LIBC_ATTRS;
56char *strncpy(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
57char *strndup(const char *, size_t) __LIBC_ATTRS;
58size_t strnlen(const char *, size_t) __LIBC_ATTRS;
59size_t strspn(const char *, const char *) __LIBC_ATTRS;
60char *strtok(char *__restrict, const char *__restrict) __LIBC_ATTRS;
61char *strtok_r(char *__restrict, const char *__restrict,
62 char **__restrict) __LIBC_ATTRS;
63size_t strxfrm(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
64}
65
66extern "C++" {
67char *strstr(char *, const char *) noexcept __LIBC_ATTRS;
68const char *strstr(const char *, const char *) noexcept __LIBC_ATTRS;
69char *strpbrk(char *, const char *) noexcept __LIBC_ATTRS;
70const char *strpbrk(const char *, const char *) noexcept __LIBC_ATTRS;
71char *strrchr(char *, int) noexcept __LIBC_ATTRS;
72const char *strrchr(const char *, int) noexcept __LIBC_ATTRS;
73char *strchr(char *, int) noexcept __LIBC_ATTRS;
74const char *strchr(const char *, int) noexcept __LIBC_ATTRS;
75char *strchrnul(char *, int) noexcept __LIBC_ATTRS;
76const char *strchrnul(const char *, int) noexcept __LIBC_ATTRS;
77char *strcasestr(char *, const char *) noexcept __LIBC_ATTRS;
78const char *strcasestr(const char *, const char *) noexcept __LIBC_ATTRS;
79void *memrchr(void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
80const void *memrchr(const void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
81void *memchr(void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
82const void *memchr(const void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
83}
84
8520#else
86#include <llvm-libc-decls/string.h>
87
21#define __LIBC_ATTRS
8822#endif
8923
90#pragma omp end declare target
24// TODO: Define these for CUDA / HIP.
9125
9226#undef __LIBC_ATTRS
9327
94#endif
95
9628#endif // __CLANG_LLVM_LIBC_WRAPPERS_STRING_H__
lib/include/llvm_libc_wrappers/time.h+4-10
......@@ -15,20 +15,14 @@
1515
1616#include_next <time.h>
1717
18#if __has_include(<llvm-libc-decls/time.h>)
19
2018#if defined(__HIP__) || defined(__CUDA__)
2119#define __LIBC_ATTRS __attribute__((device))
20#else
21#define __LIBC_ATTRS
2222#endif
2323
24#pragma omp begin declare target
25
26_Static_assert(sizeof(clock_t) == sizeof(long), "ABI mismatch!");
27
28#include <llvm-libc-decls/time.h>
24// TODO: Define these for CUDA / HIP.
2925
30#pragma omp end declare target
31
32#endif
26#undef __LIBC_ATTRS
3327
3428#endif // __CLANG_LLVM_LIBC_WRAPPERS_TIME_H__
lib/include/mmintrin.h+188-257
......@@ -39,27 +39,21 @@ typedef short __v8hi __attribute__((__vector_size__(16)));
3939typedef char __v16qi __attribute__((__vector_size__(16)));
4040
4141/* Define the default attributes for the functions in this file. */
42#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
42#if defined(__cplusplus) && (__cplusplus >= 201103L)
4343#define __DEFAULT_FN_ATTRS_SSE2 \
44 __attribute__((__always_inline__, __nodebug__, \
45 __target__("sse2,no-evex512"), __min_vector_width__(128)))
44 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), \
45 __min_vector_width__(128))) constexpr
4646#else
4747#define __DEFAULT_FN_ATTRS_SSE2 \
4848 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), \
4949 __min_vector_width__(128)))
5050#endif
5151
52#if defined(__cplusplus) && (__cplusplus >= 201103L)
53#define __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR __DEFAULT_FN_ATTRS_SSE2 constexpr
54#else
55#define __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR __DEFAULT_FN_ATTRS_SSE2
56#endif
57
5852#define __trunc64(x) \
5953 (__m64) __builtin_shufflevector((__v2di)(x), __extension__(__v2di){}, 0)
60#define __anyext128(x) \
54#define __zext128(x) \
6155 (__m128i) __builtin_shufflevector((__v2si)(x), __extension__(__v2si){}, 0, \
62 1, -1, -1)
56 1, 2, 3)
6357
6458/// Clears the MMX state by setting the state of the x87 stack registers
6559/// to empty.
......@@ -68,9 +62,9 @@ typedef char __v16qi __attribute__((__vector_size__(16)));
6862///
6963/// This intrinsic corresponds to the <c> EMMS </c> instruction.
7064///
71static __inline__ void __attribute__((__always_inline__, __nodebug__,
72 __target__("mmx,no-evex512")))
73_mm_empty(void) {
65static __inline__ void
66 __attribute__((__always_inline__, __nodebug__, __target__("mmx")))
67 _mm_empty(void) {
7468 __builtin_ia32_emms();
7569}
7670
......@@ -85,10 +79,8 @@ _mm_empty(void) {
8579/// A 32-bit integer value.
8680/// \returns A 64-bit integer vector. The lower 32 bits contain the value of the
8781/// parameter. The upper 32 bits are set to 0.
88static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
89_mm_cvtsi32_si64(int __i)
90{
91 return __extension__ (__m64)(__v2si){__i, 0};
82static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtsi32_si64(int __i) {
83 return __extension__(__m64)(__v2si){__i, 0};
9284}
9385
9486/// Returns the lower 32 bits of a 64-bit integer vector as a 32-bit
......@@ -102,10 +94,8 @@ _mm_cvtsi32_si64(int __i)
10294/// A 64-bit integer vector.
10395/// \returns A 32-bit signed integer value containing the lower 32 bits of the
10496/// parameter.
105static __inline__ int __DEFAULT_FN_ATTRS_SSE2
106_mm_cvtsi64_si32(__m64 __m)
107{
108 return ((__v2si)__m)[0];
97static __inline__ int __DEFAULT_FN_ATTRS_SSE2 _mm_cvtsi64_si32(__m64 __m) {
98 return ((__v2si)__m)[0];
10999}
110100
111101/// Casts a 64-bit signed integer value into a 64-bit integer vector.
......@@ -118,10 +108,8 @@ _mm_cvtsi64_si32(__m64 __m)
118108/// A 64-bit signed integer.
119109/// \returns A 64-bit integer vector containing the same bitwise pattern as the
120110/// parameter.
121static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
122_mm_cvtsi64_m64(long long __i)
123{
124 return (__m64)__i;
111static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtsi64_m64(long long __i) {
112 return __extension__(__m64)(__v1di){__i};
125113}
126114
127115/// Casts a 64-bit integer vector into a 64-bit signed integer value.
......@@ -134,10 +122,8 @@ _mm_cvtsi64_m64(long long __i)
134122/// A 64-bit integer vector.
135123/// \returns A 64-bit signed integer containing the same bitwise pattern as the
136124/// parameter.
137static __inline__ long long __DEFAULT_FN_ATTRS_SSE2
138_mm_cvtm64_si64(__m64 __m)
139{
140 return (long long)__m;
125static __inline__ long long __DEFAULT_FN_ATTRS_SSE2 _mm_cvtm64_si64(__m64 __m) {
126 return ((__v1di)__m)[0];
141127}
142128
143129/// Converts, with saturation, 16-bit signed integers from both 64-bit integer
......@@ -159,11 +145,10 @@ _mm_cvtm64_si64(__m64 __m)
159145/// written to the upper 32 bits of the result.
160146/// \returns A 64-bit integer vector of [8 x i8] containing the converted
161147/// values.
162static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
163_mm_packs_pi16(__m64 __m1, __m64 __m2)
164{
165 return __trunc64(__builtin_ia32_packsswb128(
166 (__v8hi)__builtin_shufflevector(__m1, __m2, 0, 1), (__v8hi){}));
148static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_packs_pi16(__m64 __m1,
149 __m64 __m2) {
150 return __trunc64(__builtin_ia32_packsswb128(
151 (__v8hi)__builtin_shufflevector(__m1, __m2, 0, 1), (__v8hi){}));
167152}
168153
169154/// Converts, with saturation, 32-bit signed integers from both 64-bit integer
......@@ -185,11 +170,10 @@ _mm_packs_pi16(__m64 __m1, __m64 __m2)
185170/// written to the upper 32 bits of the result.
186171/// \returns A 64-bit integer vector of [4 x i16] containing the converted
187172/// values.
188static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
189_mm_packs_pi32(__m64 __m1, __m64 __m2)
190{
191 return __trunc64(__builtin_ia32_packssdw128(
192 (__v4si)__builtin_shufflevector(__m1, __m2, 0, 1), (__v4si){}));
173static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_packs_pi32(__m64 __m1,
174 __m64 __m2) {
175 return __trunc64(__builtin_ia32_packssdw128(
176 (__v4si)__builtin_shufflevector(__m1, __m2, 0, 1), (__v4si){}));
193177}
194178
195179/// Converts, with saturation, 16-bit signed integers from both 64-bit integer
......@@ -211,11 +195,10 @@ _mm_packs_pi32(__m64 __m1, __m64 __m2)
211195/// written to the upper 32 bits of the result.
212196/// \returns A 64-bit integer vector of [8 x i8] containing the converted
213197/// values.
214static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
215_mm_packs_pu16(__m64 __m1, __m64 __m2)
216{
217 return __trunc64(__builtin_ia32_packuswb128(
218 (__v8hi)__builtin_shufflevector(__m1, __m2, 0, 1), (__v8hi){}));
198static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_packs_pu16(__m64 __m1,
199 __m64 __m2) {
200 return __trunc64(__builtin_ia32_packuswb128(
201 (__v8hi)__builtin_shufflevector(__m1, __m2, 0, 1), (__v8hi){}));
219202}
220203
221204/// Unpacks the upper 32 bits from two 64-bit integer vectors of [8 x i8]
......@@ -239,11 +222,10 @@ _mm_packs_pu16(__m64 __m1, __m64 __m2)
239222/// Bits [63:56] are written to bits [63:56] of the result.
240223/// \returns A 64-bit integer vector of [8 x i8] containing the interleaved
241224/// values.
242static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
243_mm_unpackhi_pi8(__m64 __m1, __m64 __m2)
244{
245 return (__m64)__builtin_shufflevector((__v8qi)__m1, (__v8qi)__m2,
246 4, 12, 5, 13, 6, 14, 7, 15);
225static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_unpackhi_pi8(__m64 __m1,
226 __m64 __m2) {
227 return (__m64)__builtin_shufflevector((__v8qi)__m1, (__v8qi)__m2, 4, 12, 5,
228 13, 6, 14, 7, 15);
247229}
248230
249231/// Unpacks the upper 32 bits from two 64-bit integer vectors of
......@@ -263,11 +245,9 @@ _mm_unpackhi_pi8(__m64 __m1, __m64 __m2)
263245/// Bits [63:48] are written to bits [63:48] of the result.
264246/// \returns A 64-bit integer vector of [4 x i16] containing the interleaved
265247/// values.
266static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
267_mm_unpackhi_pi16(__m64 __m1, __m64 __m2)
268{
269 return (__m64)__builtin_shufflevector((__v4hi)__m1, (__v4hi)__m2,
270 2, 6, 3, 7);
248static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_unpackhi_pi16(__m64 __m1,
249 __m64 __m2) {
250 return (__m64)__builtin_shufflevector((__v4hi)__m1, (__v4hi)__m2, 2, 6, 3, 7);
271251}
272252
273253/// Unpacks the upper 32 bits from two 64-bit integer vectors of
......@@ -285,10 +265,9 @@ _mm_unpackhi_pi16(__m64 __m1, __m64 __m2)
285265/// the upper 32 bits of the result.
286266/// \returns A 64-bit integer vector of [2 x i32] containing the interleaved
287267/// values.
288static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
289_mm_unpackhi_pi32(__m64 __m1, __m64 __m2)
290{
291 return (__m64)__builtin_shufflevector((__v2si)__m1, (__v2si)__m2, 1, 3);
268static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_unpackhi_pi32(__m64 __m1,
269 __m64 __m2) {
270 return (__m64)__builtin_shufflevector((__v2si)__m1, (__v2si)__m2, 1, 3);
292271}
293272
294273/// Unpacks the lower 32 bits from two 64-bit integer vectors of [8 x i8]
......@@ -312,11 +291,10 @@ _mm_unpackhi_pi32(__m64 __m1, __m64 __m2)
312291/// Bits [31:24] are written to bits [63:56] of the result.
313292/// \returns A 64-bit integer vector of [8 x i8] containing the interleaved
314293/// values.
315static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
316_mm_unpacklo_pi8(__m64 __m1, __m64 __m2)
317{
318 return (__m64)__builtin_shufflevector((__v8qi)__m1, (__v8qi)__m2,
319 0, 8, 1, 9, 2, 10, 3, 11);
294static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_unpacklo_pi8(__m64 __m1,
295 __m64 __m2) {
296 return (__m64)__builtin_shufflevector((__v8qi)__m1, (__v8qi)__m2, 0, 8, 1, 9,
297 2, 10, 3, 11);
320298}
321299
322300/// Unpacks the lower 32 bits from two 64-bit integer vectors of
......@@ -336,11 +314,9 @@ _mm_unpacklo_pi8(__m64 __m1, __m64 __m2)
336314/// Bits [31:16] are written to bits [63:48] of the result.
337315/// \returns A 64-bit integer vector of [4 x i16] containing the interleaved
338316/// values.
339static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
340_mm_unpacklo_pi16(__m64 __m1, __m64 __m2)
341{
342 return (__m64)__builtin_shufflevector((__v4hi)__m1, (__v4hi)__m2,
343 0, 4, 1, 5);
317static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_unpacklo_pi16(__m64 __m1,
318 __m64 __m2) {
319 return (__m64)__builtin_shufflevector((__v4hi)__m1, (__v4hi)__m2, 0, 4, 1, 5);
344320}
345321
346322/// Unpacks the lower 32 bits from two 64-bit integer vectors of
......@@ -358,10 +334,9 @@ _mm_unpacklo_pi16(__m64 __m1, __m64 __m2)
358334/// the upper 32 bits of the result.
359335/// \returns A 64-bit integer vector of [2 x i32] containing the interleaved
360336/// values.
361static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
362_mm_unpacklo_pi32(__m64 __m1, __m64 __m2)
363{
364 return (__m64)__builtin_shufflevector((__v2si)__m1, (__v2si)__m2, 0, 2);
337static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_unpacklo_pi32(__m64 __m1,
338 __m64 __m2) {
339 return (__m64)__builtin_shufflevector((__v2si)__m1, (__v2si)__m2, 0, 2);
365340}
366341
367342/// Adds each 8-bit integer element of the first 64-bit integer vector
......@@ -379,10 +354,9 @@ _mm_unpacklo_pi32(__m64 __m1, __m64 __m2)
379354/// A 64-bit integer vector of [8 x i8].
380355/// \returns A 64-bit integer vector of [8 x i8] containing the sums of both
381356/// parameters.
382static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
383_mm_add_pi8(__m64 __m1, __m64 __m2)
384{
385 return (__m64)(((__v8qu)__m1) + ((__v8qu)__m2));
357static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_add_pi8(__m64 __m1,
358 __m64 __m2) {
359 return (__m64)(((__v8qu)__m1) + ((__v8qu)__m2));
386360}
387361
388362/// Adds each 16-bit integer element of the first 64-bit integer vector
......@@ -400,10 +374,9 @@ _mm_add_pi8(__m64 __m1, __m64 __m2)
400374/// A 64-bit integer vector of [4 x i16].
401375/// \returns A 64-bit integer vector of [4 x i16] containing the sums of both
402376/// parameters.
403static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
404_mm_add_pi16(__m64 __m1, __m64 __m2)
405{
406 return (__m64)(((__v4hu)__m1) + ((__v4hu)__m2));
377static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_add_pi16(__m64 __m1,
378 __m64 __m2) {
379 return (__m64)(((__v4hu)__m1) + ((__v4hu)__m2));
407380}
408381
409382/// Adds each 32-bit integer element of the first 64-bit integer vector
......@@ -421,10 +394,9 @@ _mm_add_pi16(__m64 __m1, __m64 __m2)
421394/// A 64-bit integer vector of [2 x i32].
422395/// \returns A 64-bit integer vector of [2 x i32] containing the sums of both
423396/// parameters.
424static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
425_mm_add_pi32(__m64 __m1, __m64 __m2)
426{
427 return (__m64)(((__v2su)__m1) + ((__v2su)__m2));
397static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_add_pi32(__m64 __m1,
398 __m64 __m2) {
399 return (__m64)(((__v2su)__m1) + ((__v2su)__m2));
428400}
429401
430402/// Adds, with saturation, each 8-bit signed integer element of the first
......@@ -445,10 +417,9 @@ _mm_add_pi32(__m64 __m1, __m64 __m2)
445417/// A 64-bit integer vector of [8 x i8].
446418/// \returns A 64-bit integer vector of [8 x i8] containing the saturated sums
447419/// of both parameters.
448static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
449_mm_adds_pi8(__m64 __m1, __m64 __m2)
450{
451 return (__m64)__builtin_elementwise_add_sat((__v8qs)__m1, (__v8qs)__m2);
420static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_adds_pi8(__m64 __m1,
421 __m64 __m2) {
422 return (__m64)__builtin_elementwise_add_sat((__v8qs)__m1, (__v8qs)__m2);
452423}
453424
454425/// Adds, with saturation, each 16-bit signed integer element of the first
......@@ -469,10 +440,9 @@ _mm_adds_pi8(__m64 __m1, __m64 __m2)
469440/// A 64-bit integer vector of [4 x i16].
470441/// \returns A 64-bit integer vector of [4 x i16] containing the saturated sums
471442/// of both parameters.
472static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
473_mm_adds_pi16(__m64 __m1, __m64 __m2)
474{
475 return (__m64)__builtin_elementwise_add_sat((__v4hi)__m1, (__v4hi)__m2);
443static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_adds_pi16(__m64 __m1,
444 __m64 __m2) {
445 return (__m64)__builtin_elementwise_add_sat((__v4hi)__m1, (__v4hi)__m2);
476446}
477447
478448/// Adds, with saturation, each 8-bit unsigned integer element of the first
......@@ -492,10 +462,9 @@ _mm_adds_pi16(__m64 __m1, __m64 __m2)
492462/// A 64-bit integer vector of [8 x i8].
493463/// \returns A 64-bit integer vector of [8 x i8] containing the saturated
494464/// unsigned sums of both parameters.
495static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
496_mm_adds_pu8(__m64 __m1, __m64 __m2)
497{
498 return (__m64)__builtin_elementwise_add_sat((__v8qu)__m1, (__v8qu)__m2);
465static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_adds_pu8(__m64 __m1,
466 __m64 __m2) {
467 return (__m64)__builtin_elementwise_add_sat((__v8qu)__m1, (__v8qu)__m2);
499468}
500469
501470/// Adds, with saturation, each 16-bit unsigned integer element of the first
......@@ -515,10 +484,9 @@ _mm_adds_pu8(__m64 __m1, __m64 __m2)
515484/// A 64-bit integer vector of [4 x i16].
516485/// \returns A 64-bit integer vector of [4 x i16] containing the saturated
517486/// unsigned sums of both parameters.
518static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
519_mm_adds_pu16(__m64 __m1, __m64 __m2)
520{
521 return (__m64)__builtin_elementwise_add_sat((__v4hu)__m1, (__v4hu)__m2);
487static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_adds_pu16(__m64 __m1,
488 __m64 __m2) {
489 return (__m64)__builtin_elementwise_add_sat((__v4hu)__m1, (__v4hu)__m2);
522490}
523491
524492/// Subtracts each 8-bit integer element of the second 64-bit integer
......@@ -536,10 +504,9 @@ _mm_adds_pu16(__m64 __m1, __m64 __m2)
536504/// A 64-bit integer vector of [8 x i8] containing the subtrahends.
537505/// \returns A 64-bit integer vector of [8 x i8] containing the differences of
538506/// both parameters.
539static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
540_mm_sub_pi8(__m64 __m1, __m64 __m2)
541{
542 return (__m64)(((__v8qu)__m1) - ((__v8qu)__m2));
507static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sub_pi8(__m64 __m1,
508 __m64 __m2) {
509 return (__m64)(((__v8qu)__m1) - ((__v8qu)__m2));
543510}
544511
545512/// Subtracts each 16-bit integer element of the second 64-bit integer
......@@ -557,10 +524,9 @@ _mm_sub_pi8(__m64 __m1, __m64 __m2)
557524/// A 64-bit integer vector of [4 x i16] containing the subtrahends.
558525/// \returns A 64-bit integer vector of [4 x i16] containing the differences of
559526/// both parameters.
560static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
561_mm_sub_pi16(__m64 __m1, __m64 __m2)
562{
563 return (__m64)(((__v4hu)__m1) - ((__v4hu)__m2));
527static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sub_pi16(__m64 __m1,
528 __m64 __m2) {
529 return (__m64)(((__v4hu)__m1) - ((__v4hu)__m2));
564530}
565531
566532/// Subtracts each 32-bit integer element of the second 64-bit integer
......@@ -578,10 +544,9 @@ _mm_sub_pi16(__m64 __m1, __m64 __m2)
578544/// A 64-bit integer vector of [2 x i32] containing the subtrahends.
579545/// \returns A 64-bit integer vector of [2 x i32] containing the differences of
580546/// both parameters.
581static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
582_mm_sub_pi32(__m64 __m1, __m64 __m2)
583{
584 return (__m64)(((__v2su)__m1) - ((__v2su)__m2));
547static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sub_pi32(__m64 __m1,
548 __m64 __m2) {
549 return (__m64)(((__v2su)__m1) - ((__v2su)__m2));
585550}
586551
587552/// Subtracts, with saturation, each 8-bit signed integer element of the second
......@@ -602,10 +567,9 @@ _mm_sub_pi32(__m64 __m1, __m64 __m2)
602567/// A 64-bit integer vector of [8 x i8] containing the subtrahends.
603568/// \returns A 64-bit integer vector of [8 x i8] containing the saturated
604569/// differences of both parameters.
605static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
606_mm_subs_pi8(__m64 __m1, __m64 __m2)
607{
608 return (__m64)__builtin_elementwise_sub_sat((__v8qs)__m1, (__v8qs)__m2);
570static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_subs_pi8(__m64 __m1,
571 __m64 __m2) {
572 return (__m64)__builtin_elementwise_sub_sat((__v8qs)__m1, (__v8qs)__m2);
609573}
610574
611575/// Subtracts, with saturation, each 16-bit signed integer element of the
......@@ -626,10 +590,9 @@ _mm_subs_pi8(__m64 __m1, __m64 __m2)
626590/// A 64-bit integer vector of [4 x i16] containing the subtrahends.
627591/// \returns A 64-bit integer vector of [4 x i16] containing the saturated
628592/// differences of both parameters.
629static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
630_mm_subs_pi16(__m64 __m1, __m64 __m2)
631{
632 return (__m64)__builtin_elementwise_sub_sat((__v4hi)__m1, (__v4hi)__m2);
593static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_subs_pi16(__m64 __m1,
594 __m64 __m2) {
595 return (__m64)__builtin_elementwise_sub_sat((__v4hi)__m1, (__v4hi)__m2);
633596}
634597
635598/// Subtracts each 8-bit unsigned integer element of the second 64-bit
......@@ -650,10 +613,9 @@ _mm_subs_pi16(__m64 __m1, __m64 __m2)
650613/// A 64-bit integer vector of [8 x i8] containing the subtrahends.
651614/// \returns A 64-bit integer vector of [8 x i8] containing the saturated
652615/// differences of both parameters.
653static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
654_mm_subs_pu8(__m64 __m1, __m64 __m2)
655{
656 return (__m64)__builtin_elementwise_sub_sat((__v8qu)__m1, (__v8qu)__m2);
616static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_subs_pu8(__m64 __m1,
617 __m64 __m2) {
618 return (__m64)__builtin_elementwise_sub_sat((__v8qu)__m1, (__v8qu)__m2);
657619}
658620
659621/// Subtracts each 16-bit unsigned integer element of the second 64-bit
......@@ -674,10 +636,9 @@ _mm_subs_pu8(__m64 __m1, __m64 __m2)
674636/// A 64-bit integer vector of [4 x i16] containing the subtrahends.
675637/// \returns A 64-bit integer vector of [4 x i16] containing the saturated
676638/// differences of both parameters.
677static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
678_mm_subs_pu16(__m64 __m1, __m64 __m2)
679{
680 return (__m64)__builtin_elementwise_sub_sat((__v4hu)__m1, (__v4hu)__m2);
639static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_subs_pu16(__m64 __m1,
640 __m64 __m2) {
641 return (__m64)__builtin_elementwise_sub_sat((__v4hu)__m1, (__v4hu)__m2);
681642}
682643
683644/// Multiplies each 16-bit signed integer element of the first 64-bit
......@@ -701,11 +662,10 @@ _mm_subs_pu16(__m64 __m1, __m64 __m2)
701662/// A 64-bit integer vector of [4 x i16].
702663/// \returns A 64-bit integer vector of [2 x i32] containing the sums of
703664/// products of both parameters.
704static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
705_mm_madd_pi16(__m64 __m1, __m64 __m2)
706{
707 return __trunc64(__builtin_ia32_pmaddwd128((__v8hi)__anyext128(__m1),
708 (__v8hi)__anyext128(__m2)));
665static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_madd_pi16(__m64 __m1,
666 __m64 __m2) {
667 return __trunc64(__builtin_ia32_pmaddwd128((__v8hi)__zext128(__m1),
668 (__v8hi)__zext128(__m2)));
709669}
710670
711671/// Multiplies each 16-bit signed integer element of the first 64-bit
......@@ -723,11 +683,10 @@ _mm_madd_pi16(__m64 __m1, __m64 __m2)
723683/// A 64-bit integer vector of [4 x i16].
724684/// \returns A 64-bit integer vector of [4 x i16] containing the upper 16 bits
725685/// of the products of both parameters.
726static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
727_mm_mulhi_pi16(__m64 __m1, __m64 __m2)
728{
729 return __trunc64(__builtin_ia32_pmulhw128((__v8hi)__anyext128(__m1),
730 (__v8hi)__anyext128(__m2)));
686static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_mulhi_pi16(__m64 __m1,
687 __m64 __m2) {
688 return __trunc64(__builtin_ia32_pmulhw128((__v8hi)__zext128(__m1),
689 (__v8hi)__zext128(__m2)));
731690}
732691
733692/// Multiplies each 16-bit signed integer element of the first 64-bit
......@@ -745,10 +704,9 @@ _mm_mulhi_pi16(__m64 __m1, __m64 __m2)
745704/// A 64-bit integer vector of [4 x i16].
746705/// \returns A 64-bit integer vector of [4 x i16] containing the lower 16 bits
747706/// of the products of both parameters.
748static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
749_mm_mullo_pi16(__m64 __m1, __m64 __m2)
750{
751 return (__m64)(((__v4hu)__m1) * ((__v4hu)__m2));
707static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_mullo_pi16(__m64 __m1,
708 __m64 __m2) {
709 return (__m64)(((__v4hu)__m1) * ((__v4hu)__m2));
752710}
753711
754712/// Left-shifts each 16-bit signed integer element of the first
......@@ -771,8 +729,8 @@ _mm_mullo_pi16(__m64 __m1, __m64 __m2)
771729static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
772730_mm_sll_pi16(__m64 __m, __m64 __count)
773731{
774 return __trunc64(__builtin_ia32_psllw128((__v8hi)__anyext128(__m),
775 (__v8hi)__anyext128(__count)));
732 return __trunc64(__builtin_ia32_psllw128((__v8hi)__zext128(__m),
733 (__v8hi)__zext128(__count)));
776734}
777735
778736/// Left-shifts each 16-bit signed integer element of a 64-bit integer
......@@ -791,11 +749,9 @@ _mm_sll_pi16(__m64 __m, __m64 __count)
791749/// \returns A 64-bit integer vector of [4 x i16] containing the left-shifted
792750/// values. If \a __count is greater or equal to 16, the result is set to all
793751/// 0.
794static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
795_mm_slli_pi16(__m64 __m, int __count)
796{
797 return __trunc64(__builtin_ia32_psllwi128((__v8hi)__anyext128(__m),
798 __count));
752static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_slli_pi16(__m64 __m,
753 int __count) {
754 return __trunc64(__builtin_ia32_psllwi128((__v8hi)__zext128(__m), __count));
799755}
800756
801757/// Left-shifts each 32-bit signed integer element of the first
......@@ -818,8 +774,8 @@ _mm_slli_pi16(__m64 __m, int __count)
818774static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
819775_mm_sll_pi32(__m64 __m, __m64 __count)
820776{
821 return __trunc64(__builtin_ia32_pslld128((__v4si)__anyext128(__m),
822 (__v4si)__anyext128(__count)));
777 return __trunc64(__builtin_ia32_pslld128((__v4si)__zext128(__m),
778 (__v4si)__zext128(__count)));
823779}
824780
825781/// Left-shifts each 32-bit signed integer element of a 64-bit integer
......@@ -838,11 +794,9 @@ _mm_sll_pi32(__m64 __m, __m64 __count)
838794/// \returns A 64-bit integer vector of [2 x i32] containing the left-shifted
839795/// values. If \a __count is greater or equal to 32, the result is set to all
840796/// 0.
841static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
842_mm_slli_pi32(__m64 __m, int __count)
843{
844 return __trunc64(__builtin_ia32_pslldi128((__v4si)__anyext128(__m),
845 __count));
797static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_slli_pi32(__m64 __m,
798 int __count) {
799 return __trunc64(__builtin_ia32_pslldi128((__v4si)__zext128(__m), __count));
846800}
847801
848802/// Left-shifts the first 64-bit integer parameter by the number of bits
......@@ -862,8 +816,8 @@ _mm_slli_pi32(__m64 __m, int __count)
862816static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
863817_mm_sll_si64(__m64 __m, __m64 __count)
864818{
865 return __trunc64(__builtin_ia32_psllq128((__v2di)__anyext128(__m),
866 (__v2di)__anyext128(__count)));
819 return __trunc64(__builtin_ia32_psllq128((__v2di)__zext128(__m),
820 (__v2di)__zext128(__count)));
867821}
868822
869823/// Left-shifts the first parameter, which is a 64-bit integer, by the
......@@ -880,11 +834,9 @@ _mm_sll_si64(__m64 __m, __m64 __count)
880834/// A 32-bit integer value.
881835/// \returns A 64-bit integer vector containing the left-shifted value. If
882836/// \a __count is greater or equal to 64, the result is set to 0.
883static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
884_mm_slli_si64(__m64 __m, int __count)
885{
886 return __trunc64(__builtin_ia32_psllqi128((__v2di)__anyext128(__m),
887 __count));
837static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_slli_si64(__m64 __m,
838 int __count) {
839 return __trunc64(__builtin_ia32_psllqi128((__v2di)__zext128(__m), __count));
888840}
889841
890842/// Right-shifts each 16-bit integer element of the first parameter,
......@@ -908,8 +860,8 @@ _mm_slli_si64(__m64 __m, int __count)
908860static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
909861_mm_sra_pi16(__m64 __m, __m64 __count)
910862{
911 return __trunc64(__builtin_ia32_psraw128((__v8hi)__anyext128(__m),
912 (__v8hi)__anyext128(__count)));
863 return __trunc64(__builtin_ia32_psraw128((__v8hi)__zext128(__m),
864 (__v8hi)__zext128(__count)));
913865}
914866
915867/// Right-shifts each 16-bit integer element of a 64-bit integer vector
......@@ -929,11 +881,9 @@ _mm_sra_pi16(__m64 __m, __m64 __count)
929881/// A 32-bit integer value.
930882/// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
931883/// values.
932static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
933_mm_srai_pi16(__m64 __m, int __count)
934{
935 return __trunc64(__builtin_ia32_psrawi128((__v8hi)__anyext128(__m),
936 __count));
884static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_srai_pi16(__m64 __m,
885 int __count) {
886 return __trunc64(__builtin_ia32_psrawi128((__v8hi)__zext128(__m), __count));
937887}
938888
939889/// Right-shifts each 32-bit integer element of the first parameter,
......@@ -957,8 +907,8 @@ _mm_srai_pi16(__m64 __m, int __count)
957907static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
958908_mm_sra_pi32(__m64 __m, __m64 __count)
959909{
960 return __trunc64(__builtin_ia32_psrad128((__v4si)__anyext128(__m),
961 (__v4si)__anyext128(__count)));
910 return __trunc64(__builtin_ia32_psrad128((__v4si)__zext128(__m),
911 (__v4si)__zext128(__count)));
962912}
963913
964914/// Right-shifts each 32-bit integer element of a 64-bit integer vector
......@@ -978,11 +928,9 @@ _mm_sra_pi32(__m64 __m, __m64 __count)
978928/// A 32-bit integer value.
979929/// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
980930/// values.
981static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
982_mm_srai_pi32(__m64 __m, int __count)
983{
984 return __trunc64(__builtin_ia32_psradi128((__v4si)__anyext128(__m),
985 __count));
931static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_srai_pi32(__m64 __m,
932 int __count) {
933 return __trunc64(__builtin_ia32_psradi128((__v4si)__zext128(__m), __count));
986934}
987935
988936/// Right-shifts each 16-bit integer element of the first parameter,
......@@ -1005,8 +953,8 @@ _mm_srai_pi32(__m64 __m, int __count)
1005953static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1006954_mm_srl_pi16(__m64 __m, __m64 __count)
1007955{
1008 return __trunc64(__builtin_ia32_psrlw128((__v8hi)__anyext128(__m),
1009 (__v8hi)__anyext128(__count)));
956 return __trunc64(__builtin_ia32_psrlw128((__v8hi)__zext128(__m),
957 (__v8hi)__zext128(__count)));
1010958}
1011959
1012960/// Right-shifts each 16-bit integer element of a 64-bit integer vector
......@@ -1025,11 +973,9 @@ _mm_srl_pi16(__m64 __m, __m64 __count)
1025973/// A 32-bit integer value.
1026974/// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
1027975/// values.
1028static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1029_mm_srli_pi16(__m64 __m, int __count)
1030{
1031 return __trunc64(__builtin_ia32_psrlwi128((__v8hi)__anyext128(__m),
1032 __count));
976static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_srli_pi16(__m64 __m,
977 int __count) {
978 return __trunc64(__builtin_ia32_psrlwi128((__v8hi)__zext128(__m), __count));
1033979}
1034980
1035981/// Right-shifts each 32-bit integer element of the first parameter,
......@@ -1052,8 +998,8 @@ _mm_srli_pi16(__m64 __m, int __count)
1052998static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1053999_mm_srl_pi32(__m64 __m, __m64 __count)
10541000{
1055 return __trunc64(__builtin_ia32_psrld128((__v4si)__anyext128(__m),
1056 (__v4si)__anyext128(__count)));
1001 return __trunc64(__builtin_ia32_psrld128((__v4si)__zext128(__m),
1002 (__v4si)__zext128(__count)));
10571003}
10581004
10591005/// Right-shifts each 32-bit integer element of a 64-bit integer vector
......@@ -1072,11 +1018,9 @@ _mm_srl_pi32(__m64 __m, __m64 __count)
10721018/// A 32-bit integer value.
10731019/// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
10741020/// values.
1075static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1076_mm_srli_pi32(__m64 __m, int __count)
1077{
1078 return __trunc64(__builtin_ia32_psrldi128((__v4si)__anyext128(__m),
1079 __count));
1021static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_srli_pi32(__m64 __m,
1022 int __count) {
1023 return __trunc64(__builtin_ia32_psrldi128((__v4si)__zext128(__m), __count));
10801024}
10811025
10821026/// Right-shifts the first 64-bit integer parameter by the number of bits
......@@ -1096,8 +1040,8 @@ _mm_srli_pi32(__m64 __m, int __count)
10961040static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
10971041_mm_srl_si64(__m64 __m, __m64 __count)
10981042{
1099 return __trunc64(__builtin_ia32_psrlq128((__v2di)__anyext128(__m),
1100 (__v2di)__anyext128(__count)));
1043 return __trunc64(__builtin_ia32_psrlq128((__v2di)__zext128(__m),
1044 (__v2di)__zext128(__count)));
11011045}
11021046
11031047/// Right-shifts the first parameter, which is a 64-bit integer, by the
......@@ -1115,11 +1059,9 @@ _mm_srl_si64(__m64 __m, __m64 __count)
11151059/// \param __count
11161060/// A 32-bit integer value.
11171061/// \returns A 64-bit integer vector containing the right-shifted value.
1118static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1119_mm_srli_si64(__m64 __m, int __count)
1120{
1121 return __trunc64(__builtin_ia32_psrlqi128((__v2di)__anyext128(__m),
1122 __count));
1062static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_srli_si64(__m64 __m,
1063 int __count) {
1064 return __trunc64(__builtin_ia32_psrlqi128((__v2di)__zext128(__m), __count));
11231065}
11241066
11251067/// Performs a bitwise AND of two 64-bit integer vectors.
......@@ -1134,10 +1076,9 @@ _mm_srli_si64(__m64 __m, int __count)
11341076/// A 64-bit integer vector.
11351077/// \returns A 64-bit integer vector containing the bitwise AND of both
11361078/// parameters.
1137static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1138_mm_and_si64(__m64 __m1, __m64 __m2)
1139{
1140 return (__m64)(((__v1du)__m1) & ((__v1du)__m2));
1079static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_and_si64(__m64 __m1,
1080 __m64 __m2) {
1081 return (__m64)(((__v1du)__m1) & ((__v1du)__m2));
11411082}
11421083
11431084/// Performs a bitwise NOT of the first 64-bit integer vector, and then
......@@ -1155,10 +1096,9 @@ _mm_and_si64(__m64 __m1, __m64 __m2)
11551096/// A 64-bit integer vector.
11561097/// \returns A 64-bit integer vector containing the bitwise AND of the second
11571098/// parameter and the one's complement of the first parameter.
1158static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1159_mm_andnot_si64(__m64 __m1, __m64 __m2)
1160{
1161 return (__m64)(~((__v1du)__m1) & ((__v1du)__m2));
1099static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_andnot_si64(__m64 __m1,
1100 __m64 __m2) {
1101 return (__m64)(~((__v1du)__m1) & ((__v1du)__m2));
11621102}
11631103
11641104/// Performs a bitwise OR of two 64-bit integer vectors.
......@@ -1173,10 +1113,9 @@ _mm_andnot_si64(__m64 __m1, __m64 __m2)
11731113/// A 64-bit integer vector.
11741114/// \returns A 64-bit integer vector containing the bitwise OR of both
11751115/// parameters.
1176static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1177_mm_or_si64(__m64 __m1, __m64 __m2)
1178{
1179 return (__m64)(((__v1du)__m1) | ((__v1du)__m2));
1116static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_or_si64(__m64 __m1,
1117 __m64 __m2) {
1118 return (__m64)(((__v1du)__m1) | ((__v1du)__m2));
11801119}
11811120
11821121/// Performs a bitwise exclusive OR of two 64-bit integer vectors.
......@@ -1191,10 +1130,9 @@ _mm_or_si64(__m64 __m1, __m64 __m2)
11911130/// A 64-bit integer vector.
11921131/// \returns A 64-bit integer vector containing the bitwise exclusive OR of both
11931132/// parameters.
1194static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1195_mm_xor_si64(__m64 __m1, __m64 __m2)
1196{
1197 return (__m64)(((__v1du)__m1) ^ ((__v1du)__m2));
1133static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_xor_si64(__m64 __m1,
1134 __m64 __m2) {
1135 return (__m64)(((__v1du)__m1) ^ ((__v1du)__m2));
11981136}
11991137
12001138/// Compares the 8-bit integer elements of two 64-bit integer vectors of
......@@ -1213,10 +1151,9 @@ _mm_xor_si64(__m64 __m1, __m64 __m2)
12131151/// A 64-bit integer vector of [8 x i8].
12141152/// \returns A 64-bit integer vector of [8 x i8] containing the comparison
12151153/// results.
1216static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1217_mm_cmpeq_pi8(__m64 __m1, __m64 __m2)
1218{
1219 return (__m64)(((__v8qi)__m1) == ((__v8qi)__m2));
1154static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cmpeq_pi8(__m64 __m1,
1155 __m64 __m2) {
1156 return (__m64)(((__v8qi)__m1) == ((__v8qi)__m2));
12201157}
12211158
12221159/// Compares the 16-bit integer elements of two 64-bit integer vectors of
......@@ -1235,10 +1172,9 @@ _mm_cmpeq_pi8(__m64 __m1, __m64 __m2)
12351172/// A 64-bit integer vector of [4 x i16].
12361173/// \returns A 64-bit integer vector of [4 x i16] containing the comparison
12371174/// results.
1238static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1239_mm_cmpeq_pi16(__m64 __m1, __m64 __m2)
1240{
1241 return (__m64)(((__v4hi)__m1) == ((__v4hi)__m2));
1175static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cmpeq_pi16(__m64 __m1,
1176 __m64 __m2) {
1177 return (__m64)(((__v4hi)__m1) == ((__v4hi)__m2));
12421178}
12431179
12441180/// Compares the 32-bit integer elements of two 64-bit integer vectors of
......@@ -1257,10 +1193,9 @@ _mm_cmpeq_pi16(__m64 __m1, __m64 __m2)
12571193/// A 64-bit integer vector of [2 x i32].
12581194/// \returns A 64-bit integer vector of [2 x i32] containing the comparison
12591195/// results.
1260static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1261_mm_cmpeq_pi32(__m64 __m1, __m64 __m2)
1262{
1263 return (__m64)(((__v2si)__m1) == ((__v2si)__m2));
1196static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cmpeq_pi32(__m64 __m1,
1197 __m64 __m2) {
1198 return (__m64)(((__v2si)__m1) == ((__v2si)__m2));
12641199}
12651200
12661201/// Compares the 8-bit integer elements of two 64-bit integer vectors of
......@@ -1279,9 +1214,8 @@ _mm_cmpeq_pi32(__m64 __m1, __m64 __m2)
12791214/// A 64-bit integer vector of [8 x i8].
12801215/// \returns A 64-bit integer vector of [8 x i8] containing the comparison
12811216/// results.
1282static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1283_mm_cmpgt_pi8(__m64 __m1, __m64 __m2)
1284{
1217static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cmpgt_pi8(__m64 __m1,
1218 __m64 __m2) {
12851219 /* This function always performs a signed comparison, but __v8qi is a char
12861220 which may be signed or unsigned, so use __v8qs. */
12871221 return (__m64)((__v8qs)__m1 > (__v8qs)__m2);
......@@ -1303,10 +1237,9 @@ _mm_cmpgt_pi8(__m64 __m1, __m64 __m2)
13031237/// A 64-bit integer vector of [4 x i16].
13041238/// \returns A 64-bit integer vector of [4 x i16] containing the comparison
13051239/// results.
1306static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1307_mm_cmpgt_pi16(__m64 __m1, __m64 __m2)
1308{
1309 return (__m64)((__v4hi)__m1 > (__v4hi)__m2);
1240static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cmpgt_pi16(__m64 __m1,
1241 __m64 __m2) {
1242 return (__m64)((__v4hi)__m1 > (__v4hi)__m2);
13101243}
13111244
13121245/// Compares the 32-bit integer elements of two 64-bit integer vectors of
......@@ -1325,10 +1258,9 @@ _mm_cmpgt_pi16(__m64 __m1, __m64 __m2)
13251258/// A 64-bit integer vector of [2 x i32].
13261259/// \returns A 64-bit integer vector of [2 x i32] containing the comparison
13271260/// results.
1328static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1329_mm_cmpgt_pi32(__m64 __m1, __m64 __m2)
1330{
1331 return (__m64)((__v2si)__m1 > (__v2si)__m2);
1261static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cmpgt_pi32(__m64 __m1,
1262 __m64 __m2) {
1263 return (__m64)((__v2si)__m1 > (__v2si)__m2);
13321264}
13331265
13341266/// Constructs a 64-bit integer vector initialized to zero.
......@@ -1338,8 +1270,7 @@ _mm_cmpgt_pi32(__m64 __m1, __m64 __m2)
13381270/// This intrinsic corresponds to the <c> PXOR </c> instruction.
13391271///
13401272/// \returns An initialized 64-bit integer vector with all elements set to zero.
1341static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1342_mm_setzero_si64(void) {
1273static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_setzero_si64(void) {
13431274 return __extension__(__m64){0LL};
13441275}
13451276
......@@ -1358,8 +1289,8 @@ _mm_setzero_si64(void) {
13581289/// A 32-bit integer value used to initialize the lower 32 bits of the
13591290/// result.
13601291/// \returns An initialized 64-bit integer vector.
1361static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1362_mm_set_pi32(int __i1, int __i0) {
1292static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_set_pi32(int __i1,
1293 int __i0) {
13631294 return __extension__(__m64)(__v2si){__i0, __i1};
13641295}
13651296
......@@ -1380,8 +1311,10 @@ _mm_set_pi32(int __i1, int __i0) {
13801311/// \param __s0
13811312/// A 16-bit integer value used to initialize bits [15:0] of the result.
13821313/// \returns An initialized 64-bit integer vector.
1383static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1384_mm_set_pi16(short __s3, short __s2, short __s1, short __s0) {
1314static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_set_pi16(short __s3,
1315 short __s2,
1316 short __s1,
1317 short __s0) {
13851318 return __extension__(__m64)(__v4hi){__s0, __s1, __s2, __s3};
13861319}
13871320
......@@ -1410,7 +1343,7 @@ _mm_set_pi16(short __s3, short __s2, short __s1, short __s0) {
14101343/// \param __b0
14111344/// An 8-bit integer value used to initialize bits [7:0] of the result.
14121345/// \returns An initialized 64-bit integer vector.
1413static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1346static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
14141347_mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
14151348 char __b1, char __b0) {
14161349 return __extension__(__m64)(__v8qi){__b0, __b1, __b2, __b3,
......@@ -1430,8 +1363,7 @@ _mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
14301363/// A 32-bit integer value used to initialize each vector element of the
14311364/// result.
14321365/// \returns An initialized 64-bit integer vector of [2 x i32].
1433static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1434_mm_set1_pi32(int __i) {
1366static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_set1_pi32(int __i) {
14351367 return _mm_set_pi32(__i, __i);
14361368}
14371369
......@@ -1448,8 +1380,7 @@ _mm_set1_pi32(int __i) {
14481380/// A 16-bit integer value used to initialize each vector element of the
14491381/// result.
14501382/// \returns An initialized 64-bit integer vector of [4 x i16].
1451static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1452_mm_set1_pi16(short __w) {
1383static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_set1_pi16(short __w) {
14531384 return _mm_set_pi16(__w, __w, __w, __w);
14541385}
14551386
......@@ -1465,8 +1396,7 @@ _mm_set1_pi16(short __w) {
14651396/// An 8-bit integer value used to initialize each vector element of the
14661397/// result.
14671398/// \returns An initialized 64-bit integer vector of [8 x i8].
1468static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1469_mm_set1_pi8(char __b) {
1399static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_set1_pi8(char __b) {
14701400 return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);
14711401}
14721402
......@@ -1485,8 +1415,8 @@ _mm_set1_pi8(char __b) {
14851415/// A 32-bit integer value used to initialize the upper 32 bits of the
14861416/// result.
14871417/// \returns An initialized 64-bit integer vector.
1488static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1489_mm_setr_pi32(int __i0, int __i1) {
1418static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_setr_pi32(int __i0,
1419 int __i1) {
14901420 return _mm_set_pi32(__i1, __i0);
14911421}
14921422
......@@ -1507,8 +1437,10 @@ _mm_setr_pi32(int __i0, int __i1) {
15071437/// \param __w3
15081438/// A 16-bit integer value used to initialize bits [63:48] of the result.
15091439/// \returns An initialized 64-bit integer vector.
1510static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1511_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3) {
1440static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_setr_pi16(short __w0,
1441 short __w1,
1442 short __w2,
1443 short __w3) {
15121444 return _mm_set_pi16(__w3, __w2, __w1, __w0);
15131445}
15141446
......@@ -1537,13 +1469,12 @@ _mm_setr_pi16(short __w0, short __w1, short __w2, short __w3) {
15371469/// \param __b7
15381470/// An 8-bit integer value used to initialize bits [63:56] of the result.
15391471/// \returns An initialized 64-bit integer vector.
1540static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1472static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
15411473_mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,
15421474 char __b6, char __b7) {
15431475 return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
15441476}
15451477
1546#undef __anyext128
15471478#undef __trunc64
15481479#undef __DEFAULT_FN_ATTRS_SSE2
15491480
lib/include/module.modulemap+23-4
......@@ -171,8 +171,22 @@ module _Builtin_intrinsics [system] [extern_c] {
171171// that module. The system float.h (if present) will be treated
172172// as a textual header in the sytem module.
173173module _Builtin_float [system] {
174 header "float.h"
175 export *
174 textual header "float.h"
175
176 explicit module float {
177 header "__float_float.h"
178 export *
179 }
180
181 explicit module header_macro {
182 header "__float_header_macro.h"
183 export *
184 }
185
186 explicit module infinity_nan {
187 header "__float_infinity_nan.h"
188 export *
189 }
176190}
177191
178192module _Builtin_inttypes [system] {
......@@ -239,6 +253,11 @@ module _Builtin_stdbool [system] {
239253 export *
240254}
241255
256module _Builtin_stdckdint [system] {
257 header "stdckdint.h"
258 export *
259}
260
242261module _Builtin_stdcountof [system] {
243262 header "stdcountof.h"
244263 export *
......@@ -329,13 +348,13 @@ module _Builtin_unwind [system] {
329348}
330349// End -fbuiltin-headers-in-system-modules affected modules
331350
332module opencl_c {
351module opencl_c [system] {
333352 requires opencl
334353 header "opencl-c.h"
335354 header "opencl-c-base.h"
336355}
337356
338module ptrauth {
357module ptrauth [system] {
339358 header "ptrauth.h"
340359 export *
341360}
lib/include/movrs_avx10_2_512intrin.h+2-2
......@@ -17,8 +17,8 @@
1717
1818/* Define the default attributes for the functions in this file. */
1919#define __DEFAULT_FN_ATTRS512 \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("movrs, avx10.2-512"), __min_vector_width__(512)))
20 __attribute__((__always_inline__, __nodebug__, __target__("movrs, avx10.2"), \
21 __min_vector_width__(512)))
2222
2323static __inline__ __m512i __DEFAULT_FN_ATTRS512
2424_mm512_loadrs_epi8(void const *__A) {
lib/include/movrs_avx10_2intrin.h+4-4
......@@ -17,11 +17,11 @@
1717
1818/* Define the default attributes for the functions in this file. */
1919#define __DEFAULT_FN_ATTRS128 \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("movrs,avx10.2-256"), __min_vector_width__(128)))
20 __attribute__((__always_inline__, __nodebug__, __target__("movrs,avx10.2"), \
21 __min_vector_width__(128)))
2222#define __DEFAULT_FN_ATTRS256 \
23 __attribute__((__always_inline__, __nodebug__, \
24 __target__("movrs,avx10.2-256"), __min_vector_width__(256)))
23 __attribute__((__always_inline__, __nodebug__, __target__("movrs,avx10.2"), \
24 __min_vector_width__(256)))
2525
2626static __inline__ __m128i __DEFAULT_FN_ATTRS128
2727_mm_loadrs_epi8(void const *__A) {
lib/include/pmmintrin.h+12-24
......@@ -17,15 +17,9 @@
1717#include <emmintrin.h>
1818
1919/* Define the default attributes for the functions in this file. */
20#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
21#define __DEFAULT_FN_ATTRS \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("sse3,no-evex512"), __min_vector_width__(128)))
24#else
2520#define __DEFAULT_FN_ATTRS \
2621 __attribute__((__always_inline__, __nodebug__, __target__("sse3"), \
2722 __min_vector_width__(128)))
28#endif
2923
3024#if defined(__cplusplus) && (__cplusplus >= 201103L)
3125#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
......@@ -66,9 +60,8 @@ _mm_lddqu_si128(__m128i_u const *__p)
6660/// A 128-bit vector of [4 x float] containing the right source operand.
6761/// \returns A 128-bit vector of [4 x float] containing the alternating sums and
6862/// differences of both operands.
69static __inline__ __m128 __DEFAULT_FN_ATTRS
70_mm_addsub_ps(__m128 __a, __m128 __b)
71{
63static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
64_mm_addsub_ps(__m128 __a, __m128 __b) {
7265 return __builtin_ia32_addsubps((__v4sf)__a, (__v4sf)__b);
7366}
7467
......@@ -89,9 +82,8 @@ _mm_addsub_ps(__m128 __a, __m128 __b)
8982/// destination.
9083/// \returns A 128-bit vector of [4 x float] containing the horizontal sums of
9184/// both operands.
92static __inline__ __m128 __DEFAULT_FN_ATTRS
93_mm_hadd_ps(__m128 __a, __m128 __b)
94{
85static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hadd_ps(__m128 __a,
86 __m128 __b) {
9587 return __builtin_ia32_haddps((__v4sf)__a, (__v4sf)__b);
9688}
9789
......@@ -112,9 +104,8 @@ _mm_hadd_ps(__m128 __a, __m128 __b)
112104/// bits of the destination.
113105/// \returns A 128-bit vector of [4 x float] containing the horizontal
114106/// differences of both operands.
115static __inline__ __m128 __DEFAULT_FN_ATTRS
116_mm_hsub_ps(__m128 __a, __m128 __b)
117{
107static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hsub_ps(__m128 __a,
108 __m128 __b) {
118109 return __builtin_ia32_hsubps((__v4sf)__a, (__v4sf)__b);
119110}
120111
......@@ -174,9 +165,8 @@ _mm_moveldup_ps(__m128 __a)
174165/// A 128-bit vector of [2 x double] containing the right source operand.
175166/// \returns A 128-bit vector of [2 x double] containing the alternating sums
176167/// and differences of both operands.
177static __inline__ __m128d __DEFAULT_FN_ATTRS
178_mm_addsub_pd(__m128d __a, __m128d __b)
179{
168static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR
169_mm_addsub_pd(__m128d __a, __m128d __b) {
180170 return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b);
181171}
182172
......@@ -197,9 +187,8 @@ _mm_addsub_pd(__m128d __a, __m128d __b)
197187/// destination.
198188/// \returns A 128-bit vector of [2 x double] containing the horizontal sums of
199189/// both operands.
200static __inline__ __m128d __DEFAULT_FN_ATTRS
201_mm_hadd_pd(__m128d __a, __m128d __b)
202{
190static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR
191_mm_hadd_pd(__m128d __a, __m128d __b) {
203192 return __builtin_ia32_haddpd((__v2df)__a, (__v2df)__b);
204193}
205194
......@@ -220,9 +209,8 @@ _mm_hadd_pd(__m128d __a, __m128d __b)
220209/// the destination.
221210/// \returns A 128-bit vector of [2 x double] containing the horizontal
222211/// differences of both operands.
223static __inline__ __m128d __DEFAULT_FN_ATTRS
224_mm_hsub_pd(__m128d __a, __m128d __b)
225{
212static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR
213_mm_hsub_pd(__m128d __a, __m128d __b) {
226214 return __builtin_ia32_hsubpd((__v2df)__a, (__v2df)__b);
227215}
228216
lib/include/ptrauth.h+16-2
......@@ -95,7 +95,7 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
9595 __ptrauth qualifier; the compiler will perform this check
9696 automatically. */
9797
98#if __has_feature(ptrauth_intrinsics)
98#if __has_feature(ptrauth_intrinsics) || defined(__PTRAUTH__)
9999
100100/* Strip the signature from a value without authenticating it.
101101
......@@ -241,6 +241,18 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
241241#define ptrauth_type_discriminator(__type) \
242242 __builtin_ptrauth_type_discriminator(__type)
243243
244/* Compute the constant discriminator used by Clang to sign pointers with the
245 given C function pointer type.
246
247 A call to this function is an integer constant expression. */
248#if __has_feature(ptrauth_function_pointer_type_discrimination)
249#define ptrauth_function_pointer_type_discriminator(__type) \
250 __builtin_ptrauth_type_discriminator(__type)
251#else
252#define ptrauth_function_pointer_type_discriminator(__type) \
253 ((ptrauth_extra_data_t)0)
254#endif
255
244256/* Compute a signature for the given pair of pointer-sized values.
245257 The order of the arguments is significant.
246258
......@@ -372,6 +384,8 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
372384 })
373385
374386#define ptrauth_type_discriminator(__type) ((ptrauth_extra_data_t)0)
387#define ptrauth_function_pointer_type_discriminator(__type) \
388 ((ptrauth_extra_data_t)0)
375389
376390#define ptrauth_sign_generic_data(__value, __data) \
377391 ({ \
......@@ -388,6 +402,6 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
388402#define __ptrauth_objc_isa_uintptr
389403#define __ptrauth_objc_super_pointer
390404
391#endif /* __has_feature(ptrauth_intrinsics) */
405#endif /* __has_feature(ptrauth_intrinsics) || defined(__PTRAUTH__) */
392406
393407#endif /* __PTRAUTH_H */
lib/include/riscv_mips.h created+34
......@@ -0,0 +1,34 @@
1//===----- riscv_mips.h - RISC-V MIPS Intrinsic definitions
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 __RISCV_MIPS_H
11#define __RISCV_MIPS_H
12
13#if !defined(__riscv)
14#error "This header is only meant to be used on riscv architecture"
15#endif
16
17#define __DEFAULT_FN_ATTRS \
18 __attribute__((__always_inline__, __nodebug__, __target__("xmipsexectl")))
19
20static __inline__ void __DEFAULT_FN_ATTRS __mips_pause() {
21 __builtin_riscv_mips_pause();
22}
23
24static __inline__ void __DEFAULT_FN_ATTRS __mips_ehb() {
25 __builtin_riscv_mips_ehb();
26}
27
28static __inline__ void __DEFAULT_FN_ATTRS __mips_ihb() {
29 __builtin_riscv_mips_ihb();
30}
31
32#undef __DEFAULT_FN_ATTRS
33
34#endif
lib/include/riscv_nds.h created+89
......@@ -0,0 +1,89 @@
1/*===---- riscv_nds.h - Andes 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_NDS_H
11#define __RISCV_NDS_H
12
13#include <stdint.h>
14
15#if defined(__cplusplus)
16extern "C" {
17#endif
18
19#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
20
21#if defined(__riscv_xandesperf)
22
23#if __riscv_xlen == 32
24
25static __inline__ int32_t __DEFAULT_FN_ATTRS __riscv_nds_ffb_32(uint32_t __a,
26 uint32_t __b) {
27 return __builtin_riscv_nds_ffb_32(__a, __b);
28}
29
30static __inline__ int32_t __DEFAULT_FN_ATTRS
31__riscv_nds_ffzmism_32(uint32_t __a, uint32_t __b) {
32 return __builtin_riscv_nds_ffzmism_32(__a, __b);
33}
34
35static __inline__ int32_t __DEFAULT_FN_ATTRS
36__riscv_nds_ffmism_32(uint32_t __a, uint32_t __b) {
37 return __builtin_riscv_nds_ffmism_32(__a, __b);
38}
39
40static __inline__ int32_t __DEFAULT_FN_ATTRS
41__riscv_nds_flmism_32(uint32_t __a, uint32_t __b) {
42 return __builtin_riscv_nds_flmism_32(__a, __b);
43}
44
45#endif
46
47#if __riscv_xlen == 64
48
49static __inline__ int64_t __DEFAULT_FN_ATTRS __riscv_nds_ffb_64(uint64_t __a,
50 uint64_t __b) {
51 return __builtin_riscv_nds_ffb_64(__a, __b);
52}
53
54static __inline__ int64_t __DEFAULT_FN_ATTRS
55__riscv_nds_ffzmism_64(uint64_t __a, uint64_t __b) {
56 return __builtin_riscv_nds_ffzmism_64(__a, __b);
57}
58
59static __inline__ int64_t __DEFAULT_FN_ATTRS
60__riscv_nds_ffmism_64(uint64_t __a, uint64_t __b) {
61 return __builtin_riscv_nds_ffmism_64(__a, __b);
62}
63
64static __inline__ int64_t __DEFAULT_FN_ATTRS
65__riscv_nds_flmism_64(uint64_t __a, uint64_t __b) {
66 return __builtin_riscv_nds_flmism_64(__a, __b);
67}
68
69#endif
70
71#endif // defined(__riscv_xandesperf)
72
73#if defined(__riscv_xandesbfhcvt)
74
75static __inline__ float __DEFAULT_FN_ATTRS __riscv_nds_fcvt_s_bf16(__bf16 bf) {
76 return __builtin_riscv_nds_fcvt_s_bf16(bf);
77}
78
79static __inline__ __bf16 __DEFAULT_FN_ATTRS __riscv_nds_fcvt_bf16_s(float sf) {
80 return __builtin_riscv_nds_fcvt_bf16_s(sf);
81}
82
83#endif // defined(__riscv_xandesbfhcvt)
84
85#if defined(__cplusplus)
86}
87#endif
88
89#endif // define __RISCV_NDS_H
lib/include/sifive_vector.h+58-2
......@@ -47,9 +47,9 @@
4747 __riscv_sf_vc_x_se(p27_26, p24_20, p11_7, (uint32_t)rs1, 32, 3, vl)
4848
4949#define __riscv_sf_vc_i_se_u8mf4(p27_26, p24_20, p11_7, simm5, vl) \
50 __riscv_sf_vc_i_se(p27_26, p24_20, p11_7, simm5, 8, 7, vl)
51#define __riscv_sf_vc_i_se_u8mf2(p27_26, p24_20, p11_7, simm5, vl) \
5250 __riscv_sf_vc_i_se(p27_26, p24_20, p11_7, simm5, 8, 6, vl)
51#define __riscv_sf_vc_i_se_u8mf2(p27_26, p24_20, p11_7, simm5, vl) \
52 __riscv_sf_vc_i_se(p27_26, p24_20, p11_7, simm5, 8, 7, vl)
5353#define __riscv_sf_vc_i_se_u8m1(p27_26, p24_20, p11_7, simm5, vl) \
5454 __riscv_sf_vc_i_se(p27_26, p24_20, p11_7, simm5, 8, 0, vl)
5555#define __riscv_sf_vc_i_se_u8m2(p27_26, p24_20, p11_7, simm5, vl) \
......@@ -115,4 +115,60 @@
115115#endif
116116#endif
117117
118#define __riscv_sf_vsettnt_e8w1(atn) __riscv_sf_vsettnt(atn, 0, 1);
119#define __riscv_sf_vsettnt_e8w2(atn) __riscv_sf_vsettnt(atn, 0, 2);
120#define __riscv_sf_vsettnt_e8w4(atn) __riscv_sf_vsettnt(atn, 0, 3);
121#define __riscv_sf_vsettnt_e16w1(atn) __riscv_sf_vsettnt(atn, 1, 1);
122#define __riscv_sf_vsettnt_e16w2(atn) __riscv_sf_vsettnt(atn, 1, 2);
123#define __riscv_sf_vsettnt_e16w4(atn) __riscv_sf_vsettnt(atn, 1, 3);
124#define __riscv_sf_vsettnt_e32w1(atn) __riscv_sf_vsettnt(atn, 2, 1);
125#define __riscv_sf_vsettnt_e32w2(atn) __riscv_sf_vsettnt(atn, 2, 2);
126#define __riscv_sf_vsettm_e8w1(atm) __riscv_sf_vsettm(atm, 0, 1);
127#define __riscv_sf_vsettm_e8w2(atm) __riscv_sf_vsettm(atm, 0, 2);
128#define __riscv_sf_vsettm_e8w4(atm) __riscv_sf_vsettm(atm, 0, 3);
129#define __riscv_sf_vsettm_e16w1(atm) __riscv_sf_vsettm(atm, 1, 1);
130#define __riscv_sf_vsettm_e16w2(atm) __riscv_sf_vsettm(atm, 1, 2);
131#define __riscv_sf_vsettm_e16w4(atm) __riscv_sf_vsettm(atm, 1, 3);
132#define __riscv_sf_vsettm_e32w1(atm) __riscv_sf_vsettm(atm, 2, 1);
133#define __riscv_sf_vsettm_e32w2(atm) __riscv_sf_vsettm(atm, 2, 2);
134#define __riscv_sf_vsettn_e8w1(atn) __riscv_sf_vsettn(atn, 0, 1);
135#define __riscv_sf_vsettn_e8w2(atn) __riscv_sf_vsettn(atn, 0, 2);
136#define __riscv_sf_vsettn_e8w4(atn) __riscv_sf_vsettn(atn, 0, 3);
137#define __riscv_sf_vsettn_e16w1(atn) __riscv_sf_vsettn(atn, 1, 1);
138#define __riscv_sf_vsettn_e16w2(atn) __riscv_sf_vsettn(atn, 1, 2);
139#define __riscv_sf_vsettn_e16w4(atn) __riscv_sf_vsettn(atn, 1, 3);
140#define __riscv_sf_vsettn_e32w1(atn) __riscv_sf_vsettn(atn, 2, 1);
141#define __riscv_sf_vsettn_e32w2(atn) __riscv_sf_vsettn(atn, 2, 2);
142#define __riscv_sf_vsettk_e8w1(atk) __riscv_sf_vsettk(atk, 0, 1);
143#define __riscv_sf_vsettk_e8w2(atk) __riscv_sf_vsettk(atk, 0, 2);
144#define __riscv_sf_vsettk_e8w4(atk) __riscv_sf_vsettk(atk, 0, 3);
145#define __riscv_sf_vsettk_e16w1(atk) __riscv_sf_vsettk(atk, 1, 1);
146#define __riscv_sf_vsettk_e16w2(atk) __riscv_sf_vsettk(atk, 1, 2);
147#define __riscv_sf_vsettk_e16w4(atk) __riscv_sf_vsettk(atk, 1, 3);
148#define __riscv_sf_vsettk_e32w1(atk) __riscv_sf_vsettk(atk, 2, 1);
149#define __riscv_sf_vsettk_e32w2(atk) __riscv_sf_vsettk(atk, 2, 2);
150#define __riscv_sf_vtzero_t_e8w1(tile, atm, atn) \
151 __riscv_sf_vtzero_t(tile, atm, atn, 3, 1);
152#define __riscv_sf_vtzero_t_e8w2(tile, atm, atn) \
153 __riscv_sf_vtzero_t(tile, atm, atn, 3, 2);
154#define __riscv_sf_vtzero_t_e8w4(tile, atm, atn) \
155 __riscv_sf_vtzero_t(tile, atm, atn, 3, 4);
156#define __riscv_sf_vtzero_t_e16w1(tile, atm, atn) \
157 __riscv_sf_vtzero_t(tile, atm, atn, 4, 1);
158#define __riscv_sf_vtzero_t_e16w2(tile, atm, atn) \
159 __riscv_sf_vtzero_t(tile, atm, atn, 4, 2);
160#define __riscv_sf_vtzero_t_e16w4(tile, atm, atn) \
161 __riscv_sf_vtzero_t(tile, atm, atn, 4, 4);
162#define __riscv_sf_vtzero_t_e32w1(tile, atm, atn) \
163 __riscv_sf_vtzero_t(tile, atm, atn, 5, 1);
164#define __riscv_sf_vtzero_t_e32w2(tile, atm, atn) \
165 __riscv_sf_vtzero_t(tile, atm, atn, 5, 2);
166#if __riscv_v_elen >= 64
167#define __riscv_sf_vsettnt_e64w1(atn) __riscv_sf_vsettnt(atn, 3, 1);
168#define __riscv_sf_vsettm_e64w1(atm) __riscv_sf_vsettm(atm, 3, 1);
169#define __riscv_sf_vsettn_e64w1(atn) __riscv_sf_vsettn(atn, 3, 1);
170#define __riscv_sf_vsettk_e64w1(atk) __riscv_sf_vsettk(atk, 3, 1);
171#define __riscv_sf_vtzero_t_e64w1(tile, atm, atn) \
172 __riscv_sf_vtzero_t(tile, atm, atn, 6, 1);
173#endif
118174#endif //_SIFIVE_VECTOR_H_
lib/include/sm4evexintrin.h+2-2
......@@ -14,8 +14,8 @@
1414#define __SM4EVEXINTRIN_H
1515
1616#define __DEFAULT_FN_ATTRS512 \
17 __attribute__((__always_inline__, __nodebug__, \
18 __target__("sm4,avx10.2-512"), __min_vector_width__(512)))
17 __attribute__((__always_inline__, __nodebug__, __target__("sm4,avx10.2"), \
18 __min_vector_width__(512)))
1919
2020static __inline__ __m512i __DEFAULT_FN_ATTRS512
2121_mm512_sm4key4_epi32(__m512i __A, __m512i __B) {
lib/include/smmintrin.h+77-59
......@@ -17,14 +17,14 @@
1717#include <tmmintrin.h>
1818
1919/* Define the default attributes for the functions in this file. */
20#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
21#define __DEFAULT_FN_ATTRS \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("sse4.1,no-evex512"), __min_vector_width__(128)))
24#else
2520#define __DEFAULT_FN_ATTRS \
2621 __attribute__((__always_inline__, __nodebug__, __target__("sse4.1"), \
2722 __min_vector_width__(128)))
23
24#if defined(__cplusplus) && (__cplusplus >= 201103L)
25#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
26#else
27#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
2828#endif
2929
3030/* SSE4 Rounding macros. */
......@@ -439,9 +439,8 @@
439439/// position in the result. When a mask bit is 1, the corresponding 64-bit
440440/// element in operand \a __V2 is copied to the same position in the result.
441441/// \returns A 128-bit vector of [2 x double] containing the copied values.
442static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_blendv_pd(__m128d __V1,
443 __m128d __V2,
444 __m128d __M) {
442static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR
443_mm_blendv_pd(__m128d __V1, __m128d __V2, __m128d __M) {
445444 return (__m128d)__builtin_ia32_blendvpd((__v2df)__V1, (__v2df)__V2,
446445 (__v2df)__M);
447446}
......@@ -466,9 +465,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_blendv_pd(__m128d __V1,
466465/// position in the result. When a mask bit is 1, the corresponding 32-bit
467466/// element in operand \a __V2 is copied to the same position in the result.
468467/// \returns A 128-bit vector of [4 x float] containing the copied values.
469static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_blendv_ps(__m128 __V1,
470 __m128 __V2,
471 __m128 __M) {
468static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
469_mm_blendv_ps(__m128 __V1, __m128 __V2, __m128 __M) {
472470 return (__m128)__builtin_ia32_blendvps((__v4sf)__V1, (__v4sf)__V2,
473471 (__v4sf)__M);
474472}
......@@ -493,9 +491,8 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_blendv_ps(__m128 __V1,
493491/// position in the result. When a mask bit is 1, the corresponding 8-bit
494492/// element in operand \a __V2 is copied to the same position in the result.
495493/// \returns A 128-bit vector of [16 x i8] containing the copied values.
496static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_blendv_epi8(__m128i __V1,
497 __m128i __V2,
498 __m128i __M) {
494static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
495_mm_blendv_epi8(__m128i __V1, __m128i __V2, __m128i __M) {
499496 return (__m128i)__builtin_ia32_pblendvb128((__v16qi)__V1, (__v16qi)__V2,
500497 (__v16qi)__M);
501498}
......@@ -542,8 +539,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_blendv_epi8(__m128i __V1,
542539/// \param __V2
543540/// A 128-bit integer vector.
544541/// \returns A 128-bit integer vector containing the products of both operands.
545static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mullo_epi32(__m128i __V1,
546 __m128i __V2) {
542static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
543_mm_mullo_epi32(__m128i __V1, __m128i __V2) {
547544 return (__m128i)((__v4su)__V1 * (__v4su)__V2);
548545}
549546
......@@ -561,8 +558,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mullo_epi32(__m128i __V1,
561558/// A 128-bit vector of [4 x i32].
562559/// \returns A 128-bit vector of [2 x i64] containing the products of both
563560/// operands.
564static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mul_epi32(__m128i __V1,
565 __m128i __V2) {
561static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
562_mm_mul_epi32(__m128i __V1, __m128i __V2) {
566563 return (__m128i)__builtin_ia32_pmuldq128((__v4si)__V1, (__v4si)__V2);
567564}
568565
......@@ -669,8 +666,8 @@ _mm_stream_load_si128(const void *__V) {
669666/// \param __V2
670667/// A 128-bit vector of [16 x i8]
671668/// \returns A 128-bit vector of [16 x i8] containing the lesser values.
672static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epi8(__m128i __V1,
673 __m128i __V2) {
669static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
670_mm_min_epi8(__m128i __V1, __m128i __V2) {
674671 return (__m128i)__builtin_elementwise_min((__v16qs)__V1, (__v16qs)__V2);
675672}
676673
......@@ -687,8 +684,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epi8(__m128i __V1,
687684/// \param __V2
688685/// A 128-bit vector of [16 x i8].
689686/// \returns A 128-bit vector of [16 x i8] containing the greater values.
690static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epi8(__m128i __V1,
691 __m128i __V2) {
687static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
688_mm_max_epi8(__m128i __V1, __m128i __V2) {
692689 return (__m128i)__builtin_elementwise_max((__v16qs)__V1, (__v16qs)__V2);
693690}
694691
......@@ -705,8 +702,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epi8(__m128i __V1,
705702/// \param __V2
706703/// A 128-bit vector of [8 x u16].
707704/// \returns A 128-bit vector of [8 x u16] containing the lesser values.
708static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epu16(__m128i __V1,
709 __m128i __V2) {
705static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
706_mm_min_epu16(__m128i __V1, __m128i __V2) {
710707 return (__m128i)__builtin_elementwise_min((__v8hu)__V1, (__v8hu)__V2);
711708}
712709
......@@ -723,8 +720,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epu16(__m128i __V1,
723720/// \param __V2
724721/// A 128-bit vector of [8 x u16].
725722/// \returns A 128-bit vector of [8 x u16] containing the greater values.
726static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epu16(__m128i __V1,
727 __m128i __V2) {
723static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
724_mm_max_epu16(__m128i __V1, __m128i __V2) {
728725 return (__m128i)__builtin_elementwise_max((__v8hu)__V1, (__v8hu)__V2);
729726}
730727
......@@ -741,8 +738,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epu16(__m128i __V1,
741738/// \param __V2
742739/// A 128-bit vector of [4 x i32].
743740/// \returns A 128-bit vector of [4 x i32] containing the lesser values.
744static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epi32(__m128i __V1,
745 __m128i __V2) {
741static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
742_mm_min_epi32(__m128i __V1, __m128i __V2) {
746743 return (__m128i)__builtin_elementwise_min((__v4si)__V1, (__v4si)__V2);
747744}
748745
......@@ -759,8 +756,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epi32(__m128i __V1,
759756/// \param __V2
760757/// A 128-bit vector of [4 x i32].
761758/// \returns A 128-bit vector of [4 x i32] containing the greater values.
762static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epi32(__m128i __V1,
763 __m128i __V2) {
759static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
760_mm_max_epi32(__m128i __V1, __m128i __V2) {
764761 return (__m128i)__builtin_elementwise_max((__v4si)__V1, (__v4si)__V2);
765762}
766763
......@@ -777,8 +774,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epi32(__m128i __V1,
777774/// \param __V2
778775/// A 128-bit vector of [4 x u32].
779776/// \returns A 128-bit vector of [4 x u32] containing the lesser values.
780static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epu32(__m128i __V1,
781 __m128i __V2) {
777static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
778_mm_min_epu32(__m128i __V1, __m128i __V2) {
782779 return (__m128i)__builtin_elementwise_min((__v4su)__V1, (__v4su)__V2);
783780}
784781
......@@ -795,8 +792,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_min_epu32(__m128i __V1,
795792/// \param __V2
796793/// A 128-bit vector of [4 x u32].
797794/// \returns A 128-bit vector of [4 x u32] containing the greater values.
798static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epu32(__m128i __V1,
799 __m128i __V2) {
795static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
796_mm_max_epu32(__m128i __V1, __m128i __V2) {
800797 return (__m128i)__builtin_elementwise_max((__v4su)__V1, (__v4su)__V2);
801798}
802799
......@@ -1096,8 +1093,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_max_epu32(__m128i __V1,
10961093/// \param __V
10971094/// A 128-bit integer vector selecting which bits to test in operand \a __M.
10981095/// \returns TRUE if the specified bits are all zeros; FALSE otherwise.
1099static __inline__ int __DEFAULT_FN_ATTRS _mm_testz_si128(__m128i __M,
1100 __m128i __V) {
1096static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
1097_mm_testz_si128(__m128i __M, __m128i __V) {
11011098 return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V);
11021099}
11031100
......@@ -1113,8 +1110,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_testz_si128(__m128i __M,
11131110/// \param __V
11141111/// A 128-bit integer vector selecting which bits to test in operand \a __M.
11151112/// \returns TRUE if the specified bits are all ones; FALSE otherwise.
1116static __inline__ int __DEFAULT_FN_ATTRS _mm_testc_si128(__m128i __M,
1117 __m128i __V) {
1113static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
1114_mm_testc_si128(__m128i __M, __m128i __V) {
11181115 return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V);
11191116}
11201117
......@@ -1131,8 +1128,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_testc_si128(__m128i __M,
11311128/// A 128-bit integer vector selecting which bits to test in operand \a __M.
11321129/// \returns TRUE if the specified bits are neither all zeros nor all ones;
11331130/// FALSE otherwise.
1134static __inline__ int __DEFAULT_FN_ATTRS _mm_testnzc_si128(__m128i __M,
1135 __m128i __V) {
1131static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
1132_mm_testnzc_si128(__m128i __M, __m128i __V) {
11361133 return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V);
11371134}
11381135
......@@ -1205,8 +1202,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_testnzc_si128(__m128i __M,
12051202/// \param __V2
12061203/// A 128-bit integer vector.
12071204/// \returns A 128-bit integer vector containing the comparison results.
1208static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi64(__m128i __V1,
1209 __m128i __V2) {
1205static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1206_mm_cmpeq_epi64(__m128i __V1, __m128i __V2) {
12101207 return (__m128i)((__v2di)__V1 == (__v2di)__V2);
12111208}
12121209
......@@ -1224,7 +1221,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi64(__m128i __V1,
12241221/// A 128-bit vector of [16 x i8]. The lower eight 8-bit elements are
12251222/// sign-extended to 16-bit values.
12261223/// \returns A 128-bit vector of [8 x i16] containing the sign-extended values.
1227static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi8_epi16(__m128i __V) {
1224static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1225_mm_cvtepi8_epi16(__m128i __V) {
12281226 /* This function always performs a signed extension, but __v16qi is a char
12291227 which may be signed or unsigned, so use __v16qs. */
12301228 return (__m128i) __builtin_convertvector(
......@@ -1246,7 +1244,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi8_epi16(__m128i __V) {
12461244/// A 128-bit vector of [16 x i8]. The lower four 8-bit elements are
12471245/// sign-extended to 32-bit values.
12481246/// \returns A 128-bit vector of [4 x i32] containing the sign-extended values.
1249static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi8_epi32(__m128i __V) {
1247static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1248_mm_cvtepi8_epi32(__m128i __V) {
12501249 /* This function always performs a signed extension, but __v16qi is a char
12511250 which may be signed or unsigned, so use __v16qs. */
12521251 return (__m128i) __builtin_convertvector(
......@@ -1266,7 +1265,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi8_epi32(__m128i __V) {
12661265/// A 128-bit vector of [16 x i8]. The lower two 8-bit elements are
12671266/// sign-extended to 64-bit values.
12681267/// \returns A 128-bit vector of [2 x i64] containing the sign-extended values.
1269static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi8_epi64(__m128i __V) {
1268static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1269_mm_cvtepi8_epi64(__m128i __V) {
12701270 /* This function always performs a signed extension, but __v16qi is a char
12711271 which may be signed or unsigned, so use __v16qs. */
12721272 return (__m128i) __builtin_convertvector(
......@@ -1286,7 +1286,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi8_epi64(__m128i __V) {
12861286/// A 128-bit vector of [8 x i16]. The lower four 16-bit elements are
12871287/// sign-extended to 32-bit values.
12881288/// \returns A 128-bit vector of [4 x i32] containing the sign-extended values.
1289static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi16_epi32(__m128i __V) {
1289static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1290_mm_cvtepi16_epi32(__m128i __V) {
12901291 return (__m128i) __builtin_convertvector(
12911292 __builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1, 2, 3), __v4si);
12921293}
......@@ -1304,7 +1305,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi16_epi32(__m128i __V) {
13041305/// A 128-bit vector of [8 x i16]. The lower two 16-bit elements are
13051306/// sign-extended to 64-bit values.
13061307/// \returns A 128-bit vector of [2 x i64] containing the sign-extended values.
1307static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi16_epi64(__m128i __V) {
1308static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1309_mm_cvtepi16_epi64(__m128i __V) {
13081310 return (__m128i) __builtin_convertvector(
13091311 __builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1), __v2di);
13101312}
......@@ -1322,7 +1324,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi16_epi64(__m128i __V) {
13221324/// A 128-bit vector of [4 x i32]. The lower two 32-bit elements are
13231325/// sign-extended to 64-bit values.
13241326/// \returns A 128-bit vector of [2 x i64] containing the sign-extended values.
1325static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi32_epi64(__m128i __V) {
1327static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1328_mm_cvtepi32_epi64(__m128i __V) {
13261329 return (__m128i) __builtin_convertvector(
13271330 __builtin_shufflevector((__v4si)__V, (__v4si)__V, 0, 1), __v2di);
13281331}
......@@ -1341,7 +1344,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepi32_epi64(__m128i __V) {
13411344/// A 128-bit vector of [16 x i8]. The lower eight 8-bit elements are
13421345/// zero-extended to 16-bit values.
13431346/// \returns A 128-bit vector of [8 x i16] containing the zero-extended values.
1344static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu8_epi16(__m128i __V) {
1347static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1348_mm_cvtepu8_epi16(__m128i __V) {
13451349 return (__m128i) __builtin_convertvector(
13461350 __builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3, 4, 5, 6,
13471351 7),
......@@ -1361,7 +1365,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu8_epi16(__m128i __V) {
13611365/// A 128-bit vector of [16 x i8]. The lower four 8-bit elements are
13621366/// zero-extended to 32-bit values.
13631367/// \returns A 128-bit vector of [4 x i32] containing the zero-extended values.
1364static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu8_epi32(__m128i __V) {
1368static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1369_mm_cvtepu8_epi32(__m128i __V) {
13651370 return (__m128i) __builtin_convertvector(
13661371 __builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3), __v4si);
13671372}
......@@ -1379,7 +1384,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu8_epi32(__m128i __V) {
13791384/// A 128-bit vector of [16 x i8]. The lower two 8-bit elements are
13801385/// zero-extended to 64-bit values.
13811386/// \returns A 128-bit vector of [2 x i64] containing the zero-extended values.
1382static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu8_epi64(__m128i __V) {
1387static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1388_mm_cvtepu8_epi64(__m128i __V) {
13831389 return (__m128i) __builtin_convertvector(
13841390 __builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1), __v2di);
13851391}
......@@ -1397,7 +1403,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu8_epi64(__m128i __V) {
13971403/// A 128-bit vector of [8 x i16]. The lower four 16-bit elements are
13981404/// zero-extended to 32-bit values.
13991405/// \returns A 128-bit vector of [4 x i32] containing the zero-extended values.
1400static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu16_epi32(__m128i __V) {
1406static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1407_mm_cvtepu16_epi32(__m128i __V) {
14011408 return (__m128i) __builtin_convertvector(
14021409 __builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1, 2, 3), __v4si);
14031410}
......@@ -1415,7 +1422,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu16_epi32(__m128i __V) {
14151422/// A 128-bit vector of [8 x i16]. The lower two 16-bit elements are
14161423/// zero-extended to 64-bit values.
14171424/// \returns A 128-bit vector of [2 x i64] containing the zero-extended values.
1418static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu16_epi64(__m128i __V) {
1425static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1426_mm_cvtepu16_epi64(__m128i __V) {
14191427 return (__m128i) __builtin_convertvector(
14201428 __builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1), __v2di);
14211429}
......@@ -1433,7 +1441,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu16_epi64(__m128i __V) {
14331441/// A 128-bit vector of [4 x i32]. The lower two 32-bit elements are
14341442/// zero-extended to 64-bit values.
14351443/// \returns A 128-bit vector of [2 x i64] containing the zero-extended values.
1436static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu32_epi64(__m128i __V) {
1444static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1445_mm_cvtepu32_epi64(__m128i __V) {
14371446 return (__m128i) __builtin_convertvector(
14381447 __builtin_shufflevector((__v4su)__V, (__v4su)__V, 0, 1), __v2di);
14391448}
......@@ -1457,8 +1466,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtepu32_epi64(__m128i __V) {
14571466/// A 128-bit vector of [4 x i32]. The converted [4 x i16] values are
14581467/// written to the higher 64 bits of the result.
14591468/// \returns A 128-bit vector of [8 x i16] containing the converted values.
1460static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packus_epi32(__m128i __V1,
1461 __m128i __V2) {
1469static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1470_mm_packus_epi32(__m128i __V1, __m128i __V2) {
14621471 return (__m128i)__builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2);
14631472}
14641473
......@@ -1515,7 +1524,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_packus_epi32(__m128i __V1,
15151524/// \returns A 128-bit value where bits [15:0] contain the minimum value found
15161525/// in parameter \a __V, bits [18:16] contain the index of the minimum value
15171526/// and the remaining bits are set to 0.
1518static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_minpos_epu16(__m128i __V) {
1527static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
1528_mm_minpos_epu16(__m128i __V) {
15191529 return (__m128i)__builtin_ia32_phminposuw128((__v8hi)__V);
15201530}
15211531
......@@ -1525,9 +1535,16 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_minpos_epu16(__m128i __V) {
15251535 so we'll do the same. */
15261536
15271537#undef __DEFAULT_FN_ATTRS
1538#undef __DEFAULT_FN_ATTRS_CONSTEXPR
15281539#define __DEFAULT_FN_ATTRS \
15291540 __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
15301541
1542#if defined(__cplusplus) && (__cplusplus >= 201103L)
1543#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
1544#else
1545#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
1546#endif
1547
15311548/* These specify the type of data that we're comparing. */
15321549#define _SIDD_UBYTE_OPS 0x00
15331550#define _SIDD_UWORD_OPS 0x01
......@@ -2320,12 +2337,13 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_minpos_epu16(__m128i __V) {
23202337/// \param __V2
23212338/// A 128-bit integer vector.
23222339/// \returns A 128-bit integer vector containing the comparison results.
2323static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpgt_epi64(__m128i __V1,
2324 __m128i __V2) {
2340static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2341_mm_cmpgt_epi64(__m128i __V1, __m128i __V2) {
23252342 return (__m128i)((__v2di)__V1 > (__v2di)__V2);
23262343}
23272344
23282345#undef __DEFAULT_FN_ATTRS
2346#undef __DEFAULT_FN_ATTRS_CONSTEXPR
23292347
23302348#include <popcntintrin.h>
23312349
lib/include/spirvintrin.h created+194
......@@ -0,0 +1,194 @@
1//===-- spirvintrin.h - SPIR-V intrinsic 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#ifndef __SPIRVINTRIN_H
10#define __SPIRVINTRIN_H
11
12#ifndef __SPIRV__
13#error "This file is intended for SPIR-V targets or offloading to SPIR-V"
14#endif
15
16#ifndef __GPUINTRIN_H
17#error "Never use <spirvintrin.h> directly; include <gpuintrin.h> instead"
18#endif
19
20_Pragma("omp begin declare target device_type(nohost)");
21_Pragma("omp begin declare variant match(device = {arch(spirv64)})");
22
23// Type aliases to the address spaces used by the SPIR-V backend.
24#define __gpu_private __attribute__((address_space(0)))
25#define __gpu_constant __attribute__((address_space(2)))
26#define __gpu_local __attribute__((address_space(3)))
27#define __gpu_global __attribute__((address_space(1)))
28#define __gpu_generic __attribute__((address_space(4)))
29
30// Attribute to declare a function as a kernel.
31#define __gpu_kernel __attribute__((device_kernel, visibility("protected")))
32
33// Returns the number of workgroups in the 'x' dimension of the grid.
34_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_blocks_x(void) {
35 return __builtin_spirv_num_workgroups(0);
36}
37
38// Returns the number of workgroups in the 'y' dimension of the grid.
39_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_blocks_y(void) {
40 return __builtin_spirv_num_workgroups(1);
41}
42
43// Returns the number of workgroups in the 'z' dimension of the grid.
44_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_blocks_z(void) {
45 return __builtin_spirv_num_workgroups(2);
46}
47
48// Returns the 'x' dimension of the current workgroup's id.
49_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_block_id_x(void) {
50 return __builtin_spirv_workgroup_id(0);
51}
52
53// Returns the 'y' dimension of the current workgroup's id.
54_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_block_id_y(void) {
55 return __builtin_spirv_workgroup_id(1);
56}
57
58// Returns the 'z' dimension of the current workgroup's id.
59_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_block_id_z(void) {
60 return __builtin_spirv_workgroup_id(2);
61}
62
63// Returns the number of workitems in the 'x' dimension.
64_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_threads_x(void) {
65 return __builtin_spirv_workgroup_size(0);
66}
67
68// Returns the number of workitems in the 'y' dimension.
69_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_threads_y(void) {
70 return __builtin_spirv_workgroup_size(1);
71}
72
73// Returns the number of workitems in the 'z' dimension.
74_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_threads_z(void) {
75 return __builtin_spirv_workgroup_size(2);
76}
77
78// Returns the 'x' dimension id of the workitem in the current workgroup.
79_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_thread_id_x(void) {
80 return __builtin_spirv_local_invocation_id(0);
81}
82
83// Returns the 'y' dimension id of the workitem in the current workgroup.
84_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_thread_id_y(void) {
85 return __builtin_spirv_local_invocation_id(1);
86}
87
88// Returns the 'z' dimension id of the workitem in the current workgroup.
89_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_thread_id_z(void) {
90 return __builtin_spirv_local_invocation_id(2);
91}
92
93// Returns the size of an wavefront, either 32 or 64 depending on hardware
94// and compilation options.
95_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_lanes(void) {
96 return __builtin_spirv_subgroup_size();
97}
98
99// Returns the id of the thread inside of an wavefront executing together.
100_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_lane_id(void) {
101 return __builtin_spirv_subgroup_local_invocation_id();
102}
103
104// Returns the bit-mask of active threads in the current wavefront. This
105// implementation is incorrect if the target uses more than 64 lanes.
106_DEFAULT_FN_ATTRS static __inline__ uint64_t __gpu_lane_mask(void) {
107 uint32_t [[clang::ext_vector_type(4)]] __mask =
108 __builtin_spirv_subgroup_ballot(1);
109 return __builtin_bit_cast(uint64_t,
110 __builtin_shufflevector(__mask, __mask, 0, 1));
111}
112
113// Copies the value from the first active thread in the wavefront to the rest.
114_DEFAULT_FN_ATTRS static __inline__ uint32_t
115__gpu_read_first_lane_u32(uint64_t __lane_mask, uint32_t __x) {
116 return __builtin_spirv_subgroup_shuffle(__x,
117 __builtin_ctzg(__gpu_lane_mask()));
118}
119
120// Returns a bitmask of threads in the current lane for which \p x is true. This
121// implementation is incorrect if the target uses more than 64 lanes.
122_DEFAULT_FN_ATTRS static __inline__ uint64_t __gpu_ballot(uint64_t __lane_mask,
123 bool __x) {
124 // The lane_mask & gives the nvptx semantics when lane_mask is a subset of
125 // the active threads.
126 uint32_t [[clang::ext_vector_type(4)]] __mask =
127 __builtin_spirv_subgroup_ballot(__x);
128 return __lane_mask & __builtin_bit_cast(uint64_t, __builtin_shufflevector(
129 __mask, __mask, 0, 1));
130}
131
132// Waits for all the threads in the block to converge and issues a fence.
133_DEFAULT_FN_ATTRS static __inline__ void __gpu_sync_threads(void) {
134 __builtin_spirv_group_barrier();
135}
136
137// Wait for all threads in the wavefront to converge, this is a noop on SPIR-V.
138_DEFAULT_FN_ATTRS static __inline__ void __gpu_sync_lane(uint64_t __lane_mask) {
139}
140
141// Shuffles the the lanes inside the wavefront according to the given index.
142_DEFAULT_FN_ATTRS static __inline__ uint32_t
143__gpu_shuffle_idx_u32(uint64_t __lane_mask, uint32_t __idx, uint32_t __x,
144 uint32_t __width) {
145 uint32_t __lane = __idx + (__gpu_lane_id() & ~(__width - 1));
146 return __builtin_spirv_subgroup_shuffle(__x, __lane);
147}
148
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
173// SPIR-V does not expose this, always return false.
174_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_local(void *ptr) {
175 return 0;
176}
177
178// SPIR-V does not expose this, always return false.
179_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_private(void *ptr) {
180 return 0;
181}
182
183// SPIR-V only supports 'OpTerminateInvocation' in fragment shaders.
184_DEFAULT_FN_ATTRS [[noreturn]] static __inline__ void __gpu_exit(void) {
185 __builtin_trap();
186}
187
188// This is a no-op as SPIR-V does not support it.
189_DEFAULT_FN_ATTRS static __inline__ void __gpu_thread_suspend(void) {}
190
191_Pragma("omp end declare variant");
192_Pragma("omp end declare target");
193
194#endif // __SPIRVINTRIN_H
lib/include/stddefer.h created+19
......@@ -0,0 +1,19 @@
1/*===---- stddefer.h - Standard header for 'defer' -------------------------===
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_STDDEFER_H
11#define __CLANG_STDDEFER_H
12
13/* Provide 'defer' if '_Defer' is supported. */
14#ifdef __STDC_DEFER_TS25755__
15#define __STDC_VERSION_STDDEFER_H__ 202602L
16#define defer _Defer
17#endif
18
19#endif /* __CLANG_STDDEFER_H */
lib/include/tmmintrin.h+116-147
......@@ -17,21 +17,21 @@
1717#include <pmmintrin.h>
1818
1919/* Define the default attributes for the functions in this file. */
20#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
21#define __DEFAULT_FN_ATTRS \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("ssse3,no-evex512"), __min_vector_width__(128)))
24#else
2520#define __DEFAULT_FN_ATTRS \
2621 __attribute__((__always_inline__, __nodebug__, __target__("ssse3"), \
2722 __min_vector_width__(128)))
28#endif
2923
3024#define __trunc64(x) \
3125 (__m64) __builtin_shufflevector((__v2di)(x), __extension__(__v2di){}, 0)
32#define __anyext128(x) \
26#define __zext128(x) \
3327 (__m128i) __builtin_shufflevector((__v2si)(x), __extension__(__v2si){}, 0, \
34 1, -1, -1)
28 1, 2, 3)
29
30#if defined(__cplusplus) && (__cplusplus >= 201103L)
31#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
32#else
33#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
34#endif
3535
3636/// Computes the absolute value of each of the packed 8-bit signed
3737/// integers in the source operand and stores the 8-bit unsigned integer
......@@ -45,9 +45,7 @@
4545/// A 64-bit vector of [8 x i8].
4646/// \returns A 64-bit integer vector containing the absolute values of the
4747/// elements in the operand.
48static __inline__ __m64 __DEFAULT_FN_ATTRS
49_mm_abs_pi8(__m64 __a)
50{
48static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_abs_pi8(__m64 __a) {
5149 return (__m64)__builtin_elementwise_abs((__v8qs)__a);
5250}
5351
......@@ -63,10 +61,9 @@ _mm_abs_pi8(__m64 __a)
6361/// A 128-bit vector of [16 x i8].
6462/// \returns A 128-bit integer vector containing the absolute values of the
6563/// elements in the operand.
66static __inline__ __m128i __DEFAULT_FN_ATTRS
67_mm_abs_epi8(__m128i __a)
68{
69 return (__m128i)__builtin_elementwise_abs((__v16qs)__a);
64static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
65_mm_abs_epi8(__m128i __a) {
66 return (__m128i)__builtin_elementwise_abs((__v16qs)__a);
7067}
7168
7269/// Computes the absolute value of each of the packed 16-bit signed
......@@ -81,10 +78,8 @@ _mm_abs_epi8(__m128i __a)
8178/// A 64-bit vector of [4 x i16].
8279/// \returns A 64-bit integer vector containing the absolute values of the
8380/// elements in the operand.
84static __inline__ __m64 __DEFAULT_FN_ATTRS
85_mm_abs_pi16(__m64 __a)
86{
87 return (__m64)__builtin_elementwise_abs((__v4hi)__a);
81static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_abs_pi16(__m64 __a) {
82 return (__m64)__builtin_elementwise_abs((__v4hi)__a);
8883}
8984
9085/// Computes the absolute value of each of the packed 16-bit signed
......@@ -99,10 +94,9 @@ _mm_abs_pi16(__m64 __a)
9994/// A 128-bit vector of [8 x i16].
10095/// \returns A 128-bit integer vector containing the absolute values of the
10196/// elements in the operand.
102static __inline__ __m128i __DEFAULT_FN_ATTRS
103_mm_abs_epi16(__m128i __a)
104{
105 return (__m128i)__builtin_elementwise_abs((__v8hi)__a);
97static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
98_mm_abs_epi16(__m128i __a) {
99 return (__m128i)__builtin_elementwise_abs((__v8hi)__a);
106100}
107101
108102/// Computes the absolute value of each of the packed 32-bit signed
......@@ -117,10 +111,8 @@ _mm_abs_epi16(__m128i __a)
117111/// A 64-bit vector of [2 x i32].
118112/// \returns A 64-bit integer vector containing the absolute values of the
119113/// elements in the operand.
120static __inline__ __m64 __DEFAULT_FN_ATTRS
121_mm_abs_pi32(__m64 __a)
122{
123 return (__m64)__builtin_elementwise_abs((__v2si)__a);
114static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_abs_pi32(__m64 __a) {
115 return (__m64)__builtin_elementwise_abs((__v2si)__a);
124116}
125117
126118/// Computes the absolute value of each of the packed 32-bit signed
......@@ -135,10 +127,9 @@ _mm_abs_pi32(__m64 __a)
135127/// A 128-bit vector of [4 x i32].
136128/// \returns A 128-bit integer vector containing the absolute values of the
137129/// elements in the operand.
138static __inline__ __m128i __DEFAULT_FN_ATTRS
139_mm_abs_epi32(__m128i __a)
140{
141 return (__m128i)__builtin_elementwise_abs((__v4si)__a);
130static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
131_mm_abs_epi32(__m128i __a) {
132 return (__m128i)__builtin_elementwise_abs((__v4si)__a);
142133}
143134
144135/// Concatenates the two 128-bit integer vector operands, and
......@@ -184,11 +175,12 @@ _mm_abs_epi32(__m128i __a)
184175/// An immediate operand specifying how many bytes to right-shift the result.
185176/// \returns A 64-bit integer vector containing the concatenated right-shifted
186177/// value.
187#define _mm_alignr_pi8(a, b, n) \
188 ((__m64)__builtin_shufflevector( \
189 __builtin_ia32_psrldqi128_byteshift( \
190 __builtin_shufflevector((__v1di)(a), (__v1di)(b), 1, 0), \
191 (n)), __extension__ (__v2di){}, 0))
178#define _mm_alignr_pi8(a, b, n) \
179 ((__m64)__builtin_shufflevector( \
180 (__v2di)__builtin_ia32_psrldqi128_byteshift( \
181 (__v16qi)__builtin_shufflevector((__v1di)(a), (__v1di)(b), 1, 0), \
182 (n)), \
183 __extension__(__v2di){}, 0))
192184
193185/// Horizontally adds the adjacent pairs of values contained in 2 packed
194186/// 128-bit vectors of [8 x i16].
......@@ -207,10 +199,9 @@ _mm_abs_epi32(__m128i __a)
207199/// destination.
208200/// \returns A 128-bit vector of [8 x i16] containing the horizontal sums of
209201/// both operands.
210static __inline__ __m128i __DEFAULT_FN_ATTRS
211_mm_hadd_epi16(__m128i __a, __m128i __b)
212{
213 return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b);
202static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
203_mm_hadd_epi16(__m128i __a, __m128i __b) {
204 return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b);
214205}
215206
216207/// Horizontally adds the adjacent pairs of values contained in 2 packed
......@@ -230,10 +221,9 @@ _mm_hadd_epi16(__m128i __a, __m128i __b)
230221/// destination.
231222/// \returns A 128-bit vector of [4 x i32] containing the horizontal sums of
232223/// both operands.
233static __inline__ __m128i __DEFAULT_FN_ATTRS
234_mm_hadd_epi32(__m128i __a, __m128i __b)
235{
236 return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b);
224static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
225_mm_hadd_epi32(__m128i __a, __m128i __b) {
226 return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b);
237227}
238228
239229/// Horizontally adds the adjacent pairs of values contained in 2 packed
......@@ -253,11 +243,10 @@ _mm_hadd_epi32(__m128i __a, __m128i __b)
253243/// destination.
254244/// \returns A 64-bit vector of [4 x i16] containing the horizontal sums of both
255245/// operands.
256static __inline__ __m64 __DEFAULT_FN_ATTRS
257_mm_hadd_pi16(__m64 __a, __m64 __b)
258{
259 return __trunc64(__builtin_ia32_phaddw128(
260 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
246static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hadd_pi16(__m64 __a,
247 __m64 __b) {
248 return __trunc64(__builtin_ia32_phaddw128(
249 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
261250}
262251
263252/// Horizontally adds the adjacent pairs of values contained in 2 packed
......@@ -277,11 +266,10 @@ _mm_hadd_pi16(__m64 __a, __m64 __b)
277266/// destination.
278267/// \returns A 64-bit vector of [2 x i32] containing the horizontal sums of both
279268/// operands.
280static __inline__ __m64 __DEFAULT_FN_ATTRS
281_mm_hadd_pi32(__m64 __a, __m64 __b)
282{
283 return __trunc64(__builtin_ia32_phaddd128(
284 (__v4si)__builtin_shufflevector(__a, __b, 0, 1), (__v4si){}));
269static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hadd_pi32(__m64 __a,
270 __m64 __b) {
271 return __trunc64(__builtin_ia32_phaddd128(
272 (__v4si)__builtin_shufflevector(__a, __b, 0, 1), (__v4si){}));
285273}
286274
287275/// Horizontally adds, with saturation, the adjacent pairs of values contained
......@@ -304,10 +292,9 @@ _mm_hadd_pi32(__m64 __a, __m64 __b)
304292/// destination.
305293/// \returns A 128-bit vector of [8 x i16] containing the horizontal saturated
306294/// sums of both operands.
307static __inline__ __m128i __DEFAULT_FN_ATTRS
308_mm_hadds_epi16(__m128i __a, __m128i __b)
309{
310 return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b);
295static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
296_mm_hadds_epi16(__m128i __a, __m128i __b) {
297 return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b);
311298}
312299
313300/// Horizontally adds, with saturation, the adjacent pairs of values contained
......@@ -330,11 +317,10 @@ _mm_hadds_epi16(__m128i __a, __m128i __b)
330317/// destination.
331318/// \returns A 64-bit vector of [4 x i16] containing the horizontal saturated
332319/// sums of both operands.
333static __inline__ __m64 __DEFAULT_FN_ATTRS
334_mm_hadds_pi16(__m64 __a, __m64 __b)
335{
336 return __trunc64(__builtin_ia32_phaddsw128(
337 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
320static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hadds_pi16(__m64 __a,
321 __m64 __b) {
322 return __trunc64(__builtin_ia32_phaddsw128(
323 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
338324}
339325
340326/// Horizontally subtracts the adjacent pairs of values contained in 2
......@@ -354,10 +340,9 @@ _mm_hadds_pi16(__m64 __a, __m64 __b)
354340/// the destination.
355341/// \returns A 128-bit vector of [8 x i16] containing the horizontal differences
356342/// of both operands.
357static __inline__ __m128i __DEFAULT_FN_ATTRS
358_mm_hsub_epi16(__m128i __a, __m128i __b)
359{
360 return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b);
343static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
344_mm_hsub_epi16(__m128i __a, __m128i __b) {
345 return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b);
361346}
362347
363348/// Horizontally subtracts the adjacent pairs of values contained in 2
......@@ -377,10 +362,9 @@ _mm_hsub_epi16(__m128i __a, __m128i __b)
377362/// the destination.
378363/// \returns A 128-bit vector of [4 x i32] containing the horizontal differences
379364/// of both operands.
380static __inline__ __m128i __DEFAULT_FN_ATTRS
381_mm_hsub_epi32(__m128i __a, __m128i __b)
382{
383 return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b);
365static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
366_mm_hsub_epi32(__m128i __a, __m128i __b) {
367 return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b);
384368}
385369
386370/// Horizontally subtracts the adjacent pairs of values contained in 2
......@@ -400,11 +384,10 @@ _mm_hsub_epi32(__m128i __a, __m128i __b)
400384/// the destination.
401385/// \returns A 64-bit vector of [4 x i16] containing the horizontal differences
402386/// of both operands.
403static __inline__ __m64 __DEFAULT_FN_ATTRS
404_mm_hsub_pi16(__m64 __a, __m64 __b)
405{
406 return __trunc64(__builtin_ia32_phsubw128(
407 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
387static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hsub_pi16(__m64 __a,
388 __m64 __b) {
389 return __trunc64(__builtin_ia32_phsubw128(
390 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
408391}
409392
410393/// Horizontally subtracts the adjacent pairs of values contained in 2
......@@ -424,11 +407,10 @@ _mm_hsub_pi16(__m64 __a, __m64 __b)
424407/// the destination.
425408/// \returns A 64-bit vector of [2 x i32] containing the horizontal differences
426409/// of both operands.
427static __inline__ __m64 __DEFAULT_FN_ATTRS
428_mm_hsub_pi32(__m64 __a, __m64 __b)
429{
430 return __trunc64(__builtin_ia32_phsubd128(
431 (__v4si)__builtin_shufflevector(__a, __b, 0, 1), (__v4si){}));
410static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hsub_pi32(__m64 __a,
411 __m64 __b) {
412 return __trunc64(__builtin_ia32_phsubd128(
413 (__v4si)__builtin_shufflevector(__a, __b, 0, 1), (__v4si){}));
432414}
433415
434416/// Horizontally subtracts, with saturation, the adjacent pairs of values
......@@ -451,10 +433,9 @@ _mm_hsub_pi32(__m64 __a, __m64 __b)
451433/// the destination.
452434/// \returns A 128-bit vector of [8 x i16] containing the horizontal saturated
453435/// differences of both operands.
454static __inline__ __m128i __DEFAULT_FN_ATTRS
455_mm_hsubs_epi16(__m128i __a, __m128i __b)
456{
457 return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b);
436static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
437_mm_hsubs_epi16(__m128i __a, __m128i __b) {
438 return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b);
458439}
459440
460441/// Horizontally subtracts, with saturation, the adjacent pairs of values
......@@ -477,11 +458,10 @@ _mm_hsubs_epi16(__m128i __a, __m128i __b)
477458/// the destination.
478459/// \returns A 64-bit vector of [4 x i16] containing the horizontal saturated
479460/// differences of both operands.
480static __inline__ __m64 __DEFAULT_FN_ATTRS
481_mm_hsubs_pi16(__m64 __a, __m64 __b)
482{
483 return __trunc64(__builtin_ia32_phsubsw128(
484 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
461static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hsubs_pi16(__m64 __a,
462 __m64 __b) {
463 return __trunc64(__builtin_ia32_phsubsw128(
464 (__v8hi)__builtin_shufflevector(__a, __b, 0, 1), (__v8hi){}));
485465}
486466
487467/// Multiplies corresponding pairs of packed 8-bit unsigned integer
......@@ -512,10 +492,9 @@ _mm_hsubs_pi16(__m64 __a, __m64 __b)
512492/// \a R5 := (\a __a10 * \a __b10) + (\a __a11 * \a __b11) \n
513493/// \a R6 := (\a __a12 * \a __b12) + (\a __a13 * \a __b13) \n
514494/// \a R7 := (\a __a14 * \a __b14) + (\a __a15 * \a __b15)
515static __inline__ __m128i __DEFAULT_FN_ATTRS
516_mm_maddubs_epi16(__m128i __a, __m128i __b)
517{
518 return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b);
495static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
496_mm_maddubs_epi16(__m128i __a, __m128i __b) {
497 return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b);
519498}
520499
521500/// Multiplies corresponding pairs of packed 8-bit unsigned integer
......@@ -542,11 +521,10 @@ _mm_maddubs_epi16(__m128i __a, __m128i __b)
542521/// \a R1 := (\a __a2 * \a __b2) + (\a __a3 * \a __b3) \n
543522/// \a R2 := (\a __a4 * \a __b4) + (\a __a5 * \a __b5) \n
544523/// \a R3 := (\a __a6 * \a __b6) + (\a __a7 * \a __b7)
545static __inline__ __m64 __DEFAULT_FN_ATTRS
546_mm_maddubs_pi16(__m64 __a, __m64 __b)
547{
548 return __trunc64(__builtin_ia32_pmaddubsw128((__v16qi)__anyext128(__a),
549 (__v16qi)__anyext128(__b)));
524static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR
525_mm_maddubs_pi16(__m64 __a, __m64 __b) {
526 return __trunc64(__builtin_ia32_pmaddubsw128((__v16qi)__zext128(__a),
527 (__v16qi)__zext128(__b)));
550528}
551529
552530/// Multiplies packed 16-bit signed integer values, truncates the 32-bit
......@@ -563,10 +541,9 @@ _mm_maddubs_pi16(__m64 __a, __m64 __b)
563541/// A 128-bit vector of [8 x i16] containing one of the source operands.
564542/// \returns A 128-bit vector of [8 x i16] containing the rounded and scaled
565543/// products of both operands.
566static __inline__ __m128i __DEFAULT_FN_ATTRS
567_mm_mulhrs_epi16(__m128i __a, __m128i __b)
568{
569 return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b);
544static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
545_mm_mulhrs_epi16(__m128i __a, __m128i __b) {
546 return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b);
570547}
571548
572549/// Multiplies packed 16-bit signed integer values, truncates the 32-bit
......@@ -583,11 +560,10 @@ _mm_mulhrs_epi16(__m128i __a, __m128i __b)
583560/// A 64-bit vector of [4 x i16] containing one of the source operands.
584561/// \returns A 64-bit vector of [4 x i16] containing the rounded and scaled
585562/// products of both operands.
586static __inline__ __m64 __DEFAULT_FN_ATTRS
587_mm_mulhrs_pi16(__m64 __a, __m64 __b)
588{
589 return __trunc64(__builtin_ia32_pmulhrsw128((__v8hi)__anyext128(__a),
590 (__v8hi)__anyext128(__b)));
563static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR
564_mm_mulhrs_pi16(__m64 __a, __m64 __b) {
565 return __trunc64(__builtin_ia32_pmulhrsw128((__v8hi)__zext128(__a),
566 (__v8hi)__zext128(__b)));
591567}
592568
593569/// Copies the 8-bit integers from a 128-bit integer vector to the
......@@ -610,10 +586,9 @@ _mm_mulhrs_pi16(__m64 __a, __m64 __b)
610586/// Bits [6:4] Reserved. \n
611587/// Bits [3:0] select the source byte to be copied.
612588/// \returns A 128-bit integer vector containing the copied or cleared values.
613static __inline__ __m128i __DEFAULT_FN_ATTRS
614_mm_shuffle_epi8(__m128i __a, __m128i __b)
615{
616 return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b);
589static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
590_mm_shuffle_epi8(__m128i __a, __m128i __b) {
591 return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b);
617592}
618593
619594/// Copies the 8-bit integers from a 64-bit integer vector to the
......@@ -635,13 +610,12 @@ _mm_shuffle_epi8(__m128i __a, __m128i __b)
635610/// destination. \n
636611/// Bits [2:0] select the source byte to be copied.
637612/// \returns A 64-bit integer vector containing the copied or cleared values.
638static __inline__ __m64 __DEFAULT_FN_ATTRS
639_mm_shuffle_pi8(__m64 __a, __m64 __b)
640{
641 return __trunc64(__builtin_ia32_pshufb128(
642 (__v16qi)__builtin_shufflevector(
643 (__v2si)(__a), __extension__ (__v2si){}, 0, 1, 0, 1),
644 (__v16qi)__anyext128(__b)));
613static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR
614_mm_shuffle_pi8(__m64 __a, __m64 __b) {
615 return __trunc64(__builtin_ia32_pshufb128(
616 (__v16qi)__builtin_shufflevector((__v2si)(__a), __extension__(__v2si){},
617 0, 1, 0, 1),
618 (__v16qi)__zext128(__b)));
645619}
646620
647621/// For each 8-bit integer in the first source operand, perform one of
......@@ -664,10 +638,9 @@ _mm_shuffle_pi8(__m64 __a, __m64 __b)
664638/// A 128-bit integer vector containing control bytes corresponding to
665639/// positions in the destination.
666640/// \returns A 128-bit integer vector containing the resultant values.
667static __inline__ __m128i __DEFAULT_FN_ATTRS
668_mm_sign_epi8(__m128i __a, __m128i __b)
669{
670 return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b);
641static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
642_mm_sign_epi8(__m128i __a, __m128i __b) {
643 return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b);
671644}
672645
673646/// For each 16-bit integer in the first source operand, perform one of
......@@ -690,10 +663,9 @@ _mm_sign_epi8(__m128i __a, __m128i __b)
690663/// A 128-bit integer vector containing control words corresponding to
691664/// positions in the destination.
692665/// \returns A 128-bit integer vector containing the resultant values.
693static __inline__ __m128i __DEFAULT_FN_ATTRS
694_mm_sign_epi16(__m128i __a, __m128i __b)
695{
696 return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b);
666static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
667_mm_sign_epi16(__m128i __a, __m128i __b) {
668 return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b);
697669}
698670
699671/// For each 32-bit integer in the first source operand, perform one of
......@@ -716,10 +688,9 @@ _mm_sign_epi16(__m128i __a, __m128i __b)
716688/// A 128-bit integer vector containing control doublewords corresponding to
717689/// positions in the destination.
718690/// \returns A 128-bit integer vector containing the resultant values.
719static __inline__ __m128i __DEFAULT_FN_ATTRS
720_mm_sign_epi32(__m128i __a, __m128i __b)
721{
722 return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b);
691static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
692_mm_sign_epi32(__m128i __a, __m128i __b) {
693 return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b);
723694}
724695
725696/// For each 8-bit integer in the first source operand, perform one of
......@@ -742,11 +713,10 @@ _mm_sign_epi32(__m128i __a, __m128i __b)
742713/// A 64-bit integer vector containing control bytes corresponding to
743714/// positions in the destination.
744715/// \returns A 64-bit integer vector containing the resultant values.
745static __inline__ __m64 __DEFAULT_FN_ATTRS
746_mm_sign_pi8(__m64 __a, __m64 __b)
747{
748 return __trunc64(__builtin_ia32_psignb128((__v16qi)__anyext128(__a),
749 (__v16qi)__anyext128(__b)));
716static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_sign_pi8(__m64 __a,
717 __m64 __b) {
718 return __trunc64(__builtin_ia32_psignb128((__v16qi)__zext128(__a),
719 (__v16qi)__zext128(__b)));
750720}
751721
752722/// For each 16-bit integer in the first source operand, perform one of
......@@ -769,11 +739,10 @@ _mm_sign_pi8(__m64 __a, __m64 __b)
769739/// A 64-bit integer vector containing control words corresponding to
770740/// positions in the destination.
771741/// \returns A 64-bit integer vector containing the resultant values.
772static __inline__ __m64 __DEFAULT_FN_ATTRS
773_mm_sign_pi16(__m64 __a, __m64 __b)
774{
775 return __trunc64(__builtin_ia32_psignw128((__v8hi)__anyext128(__a),
776 (__v8hi)__anyext128(__b)));
742static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_sign_pi16(__m64 __a,
743 __m64 __b) {
744 return __trunc64(
745 __builtin_ia32_psignw128((__v8hi)__zext128(__a), (__v8hi)__zext128(__b)));
777746}
778747
779748/// For each 32-bit integer in the first source operand, perform one of
......@@ -796,15 +765,15 @@ _mm_sign_pi16(__m64 __a, __m64 __b)
796765/// A 64-bit integer vector containing two control doublewords corresponding
797766/// to positions in the destination.
798767/// \returns A 64-bit integer vector containing the resultant values.
799static __inline__ __m64 __DEFAULT_FN_ATTRS
800_mm_sign_pi32(__m64 __a, __m64 __b)
801{
802 return __trunc64(__builtin_ia32_psignd128((__v4si)__anyext128(__a),
803 (__v4si)__anyext128(__b)));
768static __inline__ __m64 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_sign_pi32(__m64 __a,
769 __m64 __b) {
770 return __trunc64(
771 __builtin_ia32_psignd128((__v4si)__zext128(__a), (__v4si)__zext128(__b)));
804772}
805773
806#undef __anyext128
774#undef __zext128
807775#undef __trunc64
808776#undef __DEFAULT_FN_ATTRS
777#undef __DEFAULT_FN_ATTRS_CONSTEXPR
809778
810779#endif /* __TMMINTRIN_H */
lib/include/vaesintrin.h+1-2
......@@ -19,8 +19,7 @@
1919
2020/* Default attributes for ZMM forms. */
2121#define __DEFAULT_FN_ATTRS_F \
22 __attribute__((__always_inline__, __nodebug__, \
23 __target__("avx512f,evex512,vaes"), \
22 __attribute__((__always_inline__, __nodebug__, __target__("avx512f,vaes"), \
2423 __min_vector_width__(512)))
2524
2625static __inline__ __m256i __DEFAULT_FN_ATTRS
lib/include/xmmintrin.h+44-70
......@@ -16,7 +16,6 @@
1616
1717#include <mmintrin.h>
1818
19typedef int __v4si __attribute__((__vector_size__(16)));
2019typedef float __v4sf __attribute__((__vector_size__(16)));
2120typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));
2221
......@@ -24,6 +23,8 @@ typedef float __m128_u __attribute__((__vector_size__(16), __aligned__(1)));
2423
2524/* Unsigned types */
2625typedef unsigned int __v4su __attribute__((__vector_size__(16)));
26typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
27typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
2728
2829/* This header should only be included in a hosted environment as it depends on
2930 * a standard library to provide allocation routines. */
......@@ -32,21 +33,12 @@ typedef unsigned int __v4su __attribute__((__vector_size__(16)));
3233#endif
3334
3435/* Define the default attributes for the functions in this file. */
35#if defined(__EVEX512__) && !defined(__AVX10_1_512__)
36#define __DEFAULT_FN_ATTRS \
37 __attribute__((__always_inline__, __nodebug__, __target__("sse,no-evex512"), \
38 __min_vector_width__(128)))
39#define __DEFAULT_FN_ATTRS_SSE2 \
40 __attribute__((__always_inline__, __nodebug__, \
41 __target__("sse2,no-evex512"), __min_vector_width__(128)))
42#else
4336#define __DEFAULT_FN_ATTRS \
4437 __attribute__((__always_inline__, __nodebug__, __target__("sse"), \
4538 __min_vector_width__(128)))
4639#define __DEFAULT_FN_ATTRS_SSE2 \
4740 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), \
4841 __min_vector_width__(128)))
49#endif
5042
5143#if defined(__cplusplus) && (__cplusplus >= 201103L)
5244#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
......@@ -239,10 +231,9 @@ _mm_div_ps(__m128 __a, __m128 __b) {
239231/// used in the calculation.
240232/// \returns A 128-bit vector of [4 x float] containing the square root of the
241233/// value in the low-order bits of the operand.
242static __inline__ __m128 __DEFAULT_FN_ATTRS
243_mm_sqrt_ss(__m128 __a)
244{
245 return (__m128)__builtin_ia32_sqrtss((__v4sf)__a);
234static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_sqrt_ss(__m128 __a) {
235 __a[0] = __builtin_elementwise_sqrt(__a[0]);
236 return __a;
246237}
247238
248239/// Calculates the square roots of the values stored in a 128-bit vector
......@@ -256,10 +247,8 @@ _mm_sqrt_ss(__m128 __a)
256247/// A 128-bit vector of [4 x float].
257248/// \returns A 128-bit vector of [4 x float] containing the square roots of the
258249/// values in the operand.
259static __inline__ __m128 __DEFAULT_FN_ATTRS
260_mm_sqrt_ps(__m128 __a)
261{
262 return __builtin_ia32_sqrtps((__v4sf)__a);
250static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_sqrt_ps(__m128 __a) {
251 return __builtin_elementwise_sqrt(__a);
263252}
264253
265254/// Calculates the approximate reciprocal of the value stored in the
......@@ -352,9 +341,7 @@ _mm_rsqrt_ps(__m128 __a)
352341/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
353342/// minimum value between both operands. The upper 96 bits are copied from
354343/// the upper 96 bits of the first source operand.
355static __inline__ __m128 __DEFAULT_FN_ATTRS
356_mm_min_ss(__m128 __a, __m128 __b)
357{
344static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_min_ss(__m128 __a, __m128 __b) {
358345 return __builtin_ia32_minss((__v4sf)__a, (__v4sf)__b);
359346}
360347
......@@ -373,9 +360,8 @@ _mm_min_ss(__m128 __a, __m128 __b)
373360/// A 128-bit vector of [4 x float] containing one of the operands.
374361/// \returns A 128-bit vector of [4 x float] containing the minimum values
375362/// between both operands.
376static __inline__ __m128 __DEFAULT_FN_ATTRS
377_mm_min_ps(__m128 __a, __m128 __b)
378{
363static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_min_ps(__m128 __a,
364 __m128 __b) {
379365 return __builtin_ia32_minps((__v4sf)__a, (__v4sf)__b);
380366}
381367
......@@ -398,9 +384,7 @@ _mm_min_ps(__m128 __a, __m128 __b)
398384/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
399385/// maximum value between both operands. The upper 96 bits are copied from
400386/// the upper 96 bits of the first source operand.
401static __inline__ __m128 __DEFAULT_FN_ATTRS
402_mm_max_ss(__m128 __a, __m128 __b)
403{
387static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_max_ss(__m128 __a, __m128 __b) {
404388 return __builtin_ia32_maxss((__v4sf)__a, (__v4sf)__b);
405389}
406390
......@@ -419,9 +403,8 @@ _mm_max_ss(__m128 __a, __m128 __b)
419403/// A 128-bit vector of [4 x float] containing one of the operands.
420404/// \returns A 128-bit vector of [4 x float] containing the maximum values
421405/// between both operands.
422static __inline__ __m128 __DEFAULT_FN_ATTRS
423_mm_max_ps(__m128 __a, __m128 __b)
424{
406static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_max_ps(__m128 __a,
407 __m128 __b) {
425408 return __builtin_ia32_maxps((__v4sf)__a, (__v4sf)__b);
426409}
427410
......@@ -1688,7 +1671,7 @@ _mm_cvtsi64_ss(__m128 __a, long long __b) {
16881671/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
16891672/// converted value of the second operand. The upper 64 bits are copied from
16901673/// the upper 64 bits of the first operand.
1691static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
1674static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
16921675_mm_cvtpi32_ps(__m128 __a, __m64 __b)
16931676{
16941677 return (__m128)__builtin_shufflevector(
......@@ -1714,7 +1697,7 @@ _mm_cvtpi32_ps(__m128 __a, __m64 __b)
17141697/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
17151698/// converted value from the second operand. The upper 64 bits are copied
17161699/// from the upper 64 bits of the first operand.
1717static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
1700static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
17181701_mm_cvt_pi2ps(__m128 __a, __m64 __b)
17191702{
17201703 return _mm_cvtpi32_ps(__a, __b);
......@@ -2353,9 +2336,8 @@ void _mm_sfence(void);
23532336/// \param __b
23542337/// A 64-bit integer vector containing one of the source operands.
23552338/// \returns A 64-bit integer vector containing the comparison results.
2356static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2357_mm_max_pi16(__m64 __a, __m64 __b)
2358{
2339static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2340_mm_max_pi16(__m64 __a, __m64 __b) {
23592341 return (__m64)__builtin_elementwise_max((__v4hi)__a, (__v4hi)__b);
23602342}
23612343
......@@ -2372,9 +2354,8 @@ _mm_max_pi16(__m64 __a, __m64 __b)
23722354/// \param __b
23732355/// A 64-bit integer vector containing one of the source operands.
23742356/// \returns A 64-bit integer vector containing the comparison results.
2375static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2376_mm_max_pu8(__m64 __a, __m64 __b)
2377{
2357static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2358_mm_max_pu8(__m64 __a, __m64 __b) {
23782359 return (__m64)__builtin_elementwise_max((__v8qu)__a, (__v8qu)__b);
23792360}
23802361
......@@ -2391,9 +2372,8 @@ _mm_max_pu8(__m64 __a, __m64 __b)
23912372/// \param __b
23922373/// A 64-bit integer vector containing one of the source operands.
23932374/// \returns A 64-bit integer vector containing the comparison results.
2394static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2395_mm_min_pi16(__m64 __a, __m64 __b)
2396{
2375static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2376_mm_min_pi16(__m64 __a, __m64 __b) {
23972377 return (__m64)__builtin_elementwise_min((__v4hi)__a, (__v4hi)__b);
23982378}
23992379
......@@ -2410,9 +2390,8 @@ _mm_min_pi16(__m64 __a, __m64 __b)
24102390/// \param __b
24112391/// A 64-bit integer vector containing one of the source operands.
24122392/// \returns A 64-bit integer vector containing the comparison results.
2413static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2414_mm_min_pu8(__m64 __a, __m64 __b)
2415{
2393static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2394_mm_min_pu8(__m64 __a, __m64 __b) {
24162395 return (__m64)__builtin_elementwise_min((__v8qu)__a, (__v8qu)__b);
24172396}
24182397
......@@ -2428,9 +2407,8 @@ _mm_min_pu8(__m64 __a, __m64 __b)
24282407/// A 64-bit integer vector containing the values with bits to be extracted.
24292408/// \returns The most significant bit from each 8-bit element in \a __a,
24302409/// written to bits [7:0].
2431static __inline__ int __DEFAULT_FN_ATTRS_SSE2
2432_mm_movemask_pi8(__m64 __a)
2433{
2410static __inline__ int __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2411_mm_movemask_pi8(__m64 __a) {
24342412 return __builtin_ia32_pmovmskb128((__v16qi)__zext128(__a));
24352413}
24362414
......@@ -2447,11 +2425,11 @@ _mm_movemask_pi8(__m64 __a)
24472425/// \param __b
24482426/// A 64-bit integer vector containing one of the source operands.
24492427/// \returns A 64-bit integer vector containing the products of both operands.
2450static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2428static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
24512429_mm_mulhi_pu16(__m64 __a, __m64 __b)
24522430{
2453 return __trunc64(__builtin_ia32_pmulhuw128((__v8hi)__anyext128(__a),
2454 (__v8hi)__anyext128(__b)));
2431 return __trunc64(__builtin_ia32_pmulhuw128((__v8hu)__zext128(__a),
2432 (__v8hu)__zext128(__b)));
24552433}
24562434
24572435/// Shuffles the 4 16-bit integers from a 64-bit integer vector to the
......@@ -2530,8 +2508,8 @@ _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
25302508 // If there's a risk of spurious trap due to a 128-bit write, back up the
25312509 // pointer by 8 bytes and shift values in registers to match.
25322510 __p -= 8;
2533 __d128 = __builtin_ia32_pslldqi128_byteshift((__v2di)__d128, 8);
2534 __n128 = __builtin_ia32_pslldqi128_byteshift((__v2di)__n128, 8);
2511 __d128 = (__m128i)__builtin_ia32_pslldqi128_byteshift((__v16qi)__d128, 8);
2512 __n128 = (__m128i)__builtin_ia32_pslldqi128_byteshift((__v16qi)__n128, 8);
25352513 }
25362514
25372515 __builtin_ia32_maskmovdqu((__v16qi)__d128, (__v16qi)__n128, __p);
......@@ -2550,11 +2528,10 @@ _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
25502528/// \param __b
25512529/// A 64-bit integer vector containing one of the source operands.
25522530/// \returns A 64-bit integer vector containing the averages of both operands.
2553static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2554_mm_avg_pu8(__m64 __a, __m64 __b)
2555{
2556 return __trunc64(__builtin_ia32_pavgb128((__v16qi)__anyext128(__a),
2557 (__v16qi)__anyext128(__b)));
2531static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2532_mm_avg_pu8(__m64 __a, __m64 __b) {
2533 return __trunc64(__builtin_ia32_pavgb128((__v16qu)__zext128(__a),
2534 (__v16qu)__zext128(__b)));
25582535}
25592536
25602537/// Computes the rounded averages of the packed unsigned 16-bit integer
......@@ -2570,11 +2547,10 @@ _mm_avg_pu8(__m64 __a, __m64 __b)
25702547/// \param __b
25712548/// A 64-bit integer vector containing one of the source operands.
25722549/// \returns A 64-bit integer vector containing the averages of both operands.
2573static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2574_mm_avg_pu16(__m64 __a, __m64 __b)
2575{
2576 return __trunc64(__builtin_ia32_pavgw128((__v8hi)__anyext128(__a),
2577 (__v8hi)__anyext128(__b)));
2550static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2551_mm_avg_pu16(__m64 __a, __m64 __b) {
2552 return __trunc64(
2553 __builtin_ia32_pavgw128((__v8hu)__zext128(__a), (__v8hu)__zext128(__b)));
25782554}
25792555
25802556/// Subtracts the corresponding 8-bit unsigned integer values of the two
......@@ -2873,7 +2849,7 @@ _mm_movelh_ps(__m128 __a, __m128 __b) {
28732849/// from the corresponding elements in this operand.
28742850/// \returns A 128-bit vector of [4 x float] containing the copied and converted
28752851/// values from the operand.
2876static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2852static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
28772853_mm_cvtpi16_ps(__m64 __a)
28782854{
28792855 return __builtin_convertvector((__v4hi)__a, __v4sf);
......@@ -2891,7 +2867,7 @@ _mm_cvtpi16_ps(__m64 __a)
28912867/// destination are copied from the corresponding elements in this operand.
28922868/// \returns A 128-bit vector of [4 x float] containing the copied and converted
28932869/// values from the operand.
2894static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2870static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
28952871_mm_cvtpu16_ps(__m64 __a)
28962872{
28972873 return __builtin_convertvector((__v4hu)__a, __v4sf);
......@@ -2909,7 +2885,7 @@ _mm_cvtpu16_ps(__m64 __a)
29092885/// from the corresponding lower 4 elements in this operand.
29102886/// \returns A 128-bit vector of [4 x float] containing the copied and converted
29112887/// values from the operand.
2912static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2888static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
29132889_mm_cvtpi8_ps(__m64 __a)
29142890{
29152891 return __builtin_convertvector(
......@@ -2930,7 +2906,7 @@ _mm_cvtpi8_ps(__m64 __a)
29302906/// operand.
29312907/// \returns A 128-bit vector of [4 x float] containing the copied and converted
29322908/// values from the source operand.
2933static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2909static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
29342910_mm_cvtpu8_ps(__m64 __a)
29352911{
29362912 return __builtin_convertvector(
......@@ -2954,7 +2930,7 @@ _mm_cvtpu8_ps(__m64 __a)
29542930/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
29552931/// copied and converted values from the first operand. The upper 64 bits
29562932/// contain the copied and converted values from the second operand.
2957static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2933static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
29582934_mm_cvtpi32x2_ps(__m64 __a, __m64 __b)
29592935{
29602936 return __builtin_convertvector(
......@@ -3029,9 +3005,7 @@ _mm_cvtps_pi8(__m128 __a)
30293005/// \returns A 32-bit integer value. Bits [3:0] contain the sign bits from each
30303006/// single-precision floating-point element of the parameter. Bits [31:4] are
30313007/// set to zero.
3032static __inline__ int __DEFAULT_FN_ATTRS
3033_mm_movemask_ps(__m128 __a)
3034{
3008static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR _mm_movemask_ps(__m128 __a) {
30353009 return __builtin_ia32_movmskps((__v4sf)__a);
30363010}
30373011
lib/include/xopintrin.h+20-10
......@@ -20,6 +20,14 @@
2020#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xop"), __min_vector_width__(128)))
2121#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("xop"), __min_vector_width__(256)))
2222
23#if defined(__cplusplus) && (__cplusplus >= 201103L)
24#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
25#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
26#else
27#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
28#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
29#endif
30
2331static __inline__ __m128i __DEFAULT_FN_ATTRS
2432_mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
2533{
......@@ -182,13 +190,13 @@ _mm_hsubq_epi32(__m128i __A)
182190 return (__m128i)__builtin_ia32_vphsubdq((__v4si)__A);
183191}
184192
185static __inline__ __m128i __DEFAULT_FN_ATTRS
193static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
186194_mm_cmov_si128(__m128i __A, __m128i __B, __m128i __C)
187195{
188196 return (__m128i)(((__v2du)__A & (__v2du)__C) | ((__v2du)__B & ~(__v2du)__C));
189197}
190198
191static __inline__ __m256i __DEFAULT_FN_ATTRS256
199static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
192200_mm256_cmov_si256(__m256i __A, __m256i __B, __m256i __C)
193201{
194202 return (__m256i)(((__v4du)__A & (__v4du)__C) | ((__v4du)__B & ~(__v4du)__C));
......@@ -200,28 +208,28 @@ _mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C)
200208 return (__m128i)__builtin_ia32_vpperm((__v16qi)__A, (__v16qi)__B, (__v16qi)__C);
201209}
202210
203static __inline__ __m128i __DEFAULT_FN_ATTRS
211static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
204212_mm_rot_epi8(__m128i __A, __m128i __B)
205213{
206 return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
214 return (__m128i)__builtin_elementwise_fshl((__v16qu)__A, (__v16qu)__A, (__v16qu)__B);
207215}
208216
209static __inline__ __m128i __DEFAULT_FN_ATTRS
217static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
210218_mm_rot_epi16(__m128i __A, __m128i __B)
211219{
212 return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
220 return (__m128i)__builtin_elementwise_fshl((__v8hu)__A, (__v8hu)__A, (__v8hu)__B);
213221}
214222
215static __inline__ __m128i __DEFAULT_FN_ATTRS
223static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
216224_mm_rot_epi32(__m128i __A, __m128i __B)
217225{
218 return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
226 return (__m128i)__builtin_elementwise_fshl((__v4su)__A, (__v4su)__A, (__v4su)__B);
219227}
220228
221static __inline__ __m128i __DEFAULT_FN_ATTRS
229static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
222230_mm_rot_epi64(__m128i __A, __m128i __B)
223231{
224 return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
232 return (__m128i)__builtin_elementwise_fshl((__v2du)__A, (__v2du)__A, (__v2du)__B);
225233}
226234
227235#define _mm_roti_epi8(A, N) \
......@@ -766,5 +774,7 @@ _mm256_frcz_pd(__m256d __A)
766774
767775#undef __DEFAULT_FN_ATTRS
768776#undef __DEFAULT_FN_ATTRS256
777#undef __DEFAULT_FN_ATTRS_CONSTEXPR
778#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
769779
770780#endif /* __XOPINTRIN_H */
lib/libcxx/include/__algorithm/all_of.h+11-5
......@@ -10,24 +10,28 @@
1010#ifndef _LIBCPP___ALGORITHM_ALL_OF_H
1111#define _LIBCPP___ALGORITHM_ALL_OF_H
1212
13#include <__algorithm/any_of.h>
1314#include <__config>
1415#include <__functional/identity.h>
1516#include <__type_traits/invoke.h>
17#include <__utility/forward.h>
18#include <__utility/move.h>
1619
1720#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1821# pragma GCC system_header
1922#endif
2023
24_LIBCPP_PUSH_MACROS
25#include <__undef_macros>
26
2127_LIBCPP_BEGIN_NAMESPACE_STD
2228
2329template <class _Iter, class _Sent, class _Proj, class _Pred>
2430_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
2531__all_of(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
26 for (; __first != __last; ++__first) {
27 if (!std::__invoke(__pred, std::__invoke(__proj, *__first)))
28 return false;
29 }
30 return true;
32 using _Ref = decltype(std::__invoke(__proj, *__first));
33 auto __negated_pred = [&__pred](_Ref __arg) -> bool { return !std::__invoke(__pred, std::forward<_Ref>(__arg)); };
34 return !std::__any_of(std::move(__first), std::move(__last), __negated_pred, __proj);
3135}
3236
3337template <class _InputIterator, class _Predicate>
......@@ -39,4 +43,6 @@ all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
3943
4044_LIBCPP_END_NAMESPACE_STD
4145
46_LIBCPP_POP_MACROS
47
4248#endif // _LIBCPP___ALGORITHM_ALL_OF_H
lib/libcxx/include/__algorithm/comp.h+4
......@@ -11,6 +11,7 @@
1111
1212#include <__config>
1313#include <__type_traits/desugars_to.h>
14#include <__type_traits/is_generic_transparent_comparator.h>
1415#include <__type_traits/is_integral.h>
1516
1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -48,6 +49,9 @@ inline const bool __desugars_to_v<__less_tag, __less<>, _Tp, _Tp> = true;
4849template <class _Tp>
4950inline const bool __desugars_to_v<__totally_ordered_less_tag, __less<>, _Tp, _Tp> = is_integral<_Tp>::value;
5051
52template <>
53inline const bool __is_generic_transparent_comparator_v<__less<> > = true;
54
5155_LIBCPP_END_NAMESPACE_STD
5256
5357#endif // _LIBCPP___ALGORITHM_COMP_H
lib/libcxx/include/__algorithm/copy.h+28-147
......@@ -12,11 +12,10 @@
1212#include <__algorithm/copy_move_common.h>
1313#include <__algorithm/for_each_segment.h>
1414#include <__algorithm/min.h>
15#include <__algorithm/specialized_algorithms.h>
1516#include <__config>
16#include <__fwd/bit_reference.h>
1717#include <__iterator/iterator_traits.h>
1818#include <__iterator/segmented_iterator.h>
19#include <__memory/pointer_traits.h>
2019#include <__type_traits/common_type.h>
2120#include <__type_traits/enable_if.h>
2221#include <__utility/move.h>
......@@ -38,124 +37,14 @@ copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result);
3837template <class _InIter, class _Sent, class _OutIter>
3938inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter);
4039
41template <class _Cp, bool _IsConst>
42_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> __copy_aligned(
43 __bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) {
44 using _In = __bit_iterator<_Cp, _IsConst>;
45 using difference_type = typename _In::difference_type;
46 using __storage_type = typename _In::__storage_type;
47
48 const int __bits_per_word = _In::__bits_per_word;
49 difference_type __n = __last - __first;
50 if (__n > 0) {
51 // do first word
52 if (__first.__ctz_ != 0) {
53 unsigned __clz = __bits_per_word - __first.__ctz_;
54 difference_type __dn = std::min(static_cast<difference_type>(__clz), __n);
55 __n -= __dn;
56 __storage_type __m = std::__middle_mask<__storage_type>(__clz - __dn, __first.__ctz_);
57 __storage_type __b = *__first.__seg_ & __m;
58 *__result.__seg_ &= ~__m;
59 *__result.__seg_ |= __b;
60 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
61 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
62 ++__first.__seg_;
63 // __first.__ctz_ = 0;
64 }
65 // __first.__ctz_ == 0;
66 // do middle words
67 __storage_type __nw = __n / __bits_per_word;
68 std::copy(std::__to_address(__first.__seg_),
69 std::__to_address(__first.__seg_ + __nw),
70 std::__to_address(__result.__seg_));
71 __n -= __nw * __bits_per_word;
72 __result.__seg_ += __nw;
73 // do last word
74 if (__n > 0) {
75 __first.__seg_ += __nw;
76 __storage_type __m = std::__trailing_mask<__storage_type>(__bits_per_word - __n);
77 __storage_type __b = *__first.__seg_ & __m;
78 *__result.__seg_ &= ~__m;
79 *__result.__seg_ |= __b;
80 __result.__ctz_ = static_cast<unsigned>(__n);
81 }
82 }
83 return __result;
84}
85
86template <class _Cp, bool _IsConst>
87_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> __copy_unaligned(
88 __bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) {
89 using _In = __bit_iterator<_Cp, _IsConst>;
90 using difference_type = typename _In::difference_type;
91 using __storage_type = typename _In::__storage_type;
92
93 const int __bits_per_word = _In::__bits_per_word;
94 difference_type __n = __last - __first;
95 if (__n > 0) {
96 // do first word
97 if (__first.__ctz_ != 0) {
98 unsigned __clz_f = __bits_per_word - __first.__ctz_;
99 difference_type __dn = std::min(static_cast<difference_type>(__clz_f), __n);
100 __n -= __dn;
101 __storage_type __m = std::__middle_mask<__storage_type>(__clz_f - __dn, __first.__ctz_);
102 __storage_type __b = *__first.__seg_ & __m;
103 unsigned __clz_r = __bits_per_word - __result.__ctz_;
104 __storage_type __ddn = std::min<__storage_type>(__dn, __clz_r);
105 __m = std::__middle_mask<__storage_type>(__clz_r - __ddn, __result.__ctz_);
106 *__result.__seg_ &= ~__m;
107 if (__result.__ctz_ > __first.__ctz_)
108 *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_);
109 else
110 *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_);
111 __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
112 __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word);
113 __dn -= __ddn;
114 if (__dn > 0) {
115 __m = std::__trailing_mask<__storage_type>(__bits_per_word - __dn);
116 *__result.__seg_ &= ~__m;
117 *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn);
118 __result.__ctz_ = static_cast<unsigned>(__dn);
119 }
120 ++__first.__seg_;
121 // __first.__ctz_ = 0;
122 }
123 // __first.__ctz_ == 0;
124 // do middle words
125 unsigned __clz_r = __bits_per_word - __result.__ctz_;
126 __storage_type __m = std::__leading_mask<__storage_type>(__result.__ctz_);
127 for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) {
128 __storage_type __b = *__first.__seg_;
129 *__result.__seg_ &= ~__m;
130 *__result.__seg_ |= __b << __result.__ctz_;
131 ++__result.__seg_;
132 *__result.__seg_ &= __m;
133 *__result.__seg_ |= __b >> __clz_r;
134 }
135 // do last word
136 if (__n > 0) {
137 __m = std::__trailing_mask<__storage_type>(__bits_per_word - __n);
138 __storage_type __b = *__first.__seg_ & __m;
139 __storage_type __dn = std::min(__n, static_cast<difference_type>(__clz_r));
140 __m = std::__middle_mask<__storage_type>(__clz_r - __dn, __result.__ctz_);
141 *__result.__seg_ &= ~__m;
142 *__result.__seg_ |= __b << __result.__ctz_;
143 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
144 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
145 __n -= __dn;
146 if (__n > 0) {
147 __m = std::__trailing_mask<__storage_type>(__bits_per_word - __n);
148 *__result.__seg_ &= ~__m;
149 *__result.__seg_ |= __b >> __dn;
150 __result.__ctz_ = static_cast<unsigned>(__n);
151 }
152 }
153 }
154 return __result;
155}
156
15740struct __copy_impl {
158 template <class _InIter, class _Sent, class _OutIter>
41 template <class _InIter,
42 class _Sent,
43 class _OutIter,
44 __enable_if_t<!__specialized_algorithm<_Algorithm::__copy,
45 __iterator_pair<_InIter, _Sent>,
46 __single_iterator<_OutIter> >::__has_algorithm,
47 int> = 0>
15948 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
16049 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
16150 while (__first != __last) {
......@@ -167,37 +56,39 @@ struct __copy_impl {
16756 return std::make_pair(std::move(__first), std::move(__result));
16857 }
16958
170 template <class _InIter, class _OutIter>
171 struct _CopySegment {
172 using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InIter>;
173
174 _OutIter& __result_;
175
176 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit _CopySegment(_OutIter& __result)
177 : __result_(__result) {}
178
179 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
180 operator()(typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
181 __result_ = std::__copy(__lfirst, __llast, std::move(__result_)).second;
182 }
183 };
59 template <class _InIter,
60 class _Sent,
61 class _OutIter,
62 __enable_if_t<__specialized_algorithm<_Algorithm::__copy,
63 __iterator_pair<_InIter, _Sent>,
64 __single_iterator<_OutIter> >::__has_algorithm,
65 int> = 0>
66 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static pair<_InIter, _OutIter>
67 operator()(_InIter __first, _Sent __last, _OutIter __result) {
68 return __specialized_algorithm<_Algorithm::__copy, __iterator_pair<_InIter, _Sent>, __single_iterator<_OutIter> >()(
69 std::move(__first), std::move(__last), std::move(__result));
70 }
18471
185 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
72 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
18673 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
18774 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
188 std::__for_each_segment(__first, __last, _CopySegment<_InIter, _OutIter>(__result));
75 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
76 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 });
18979 return std::make_pair(__last, std::move(__result));
19080 }
19181
19282 template <class _InIter,
19383 class _OutIter,
19484 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
195 !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
85 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
19686 int> = 0>
19787 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
19888 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
19989 using _Traits = __segmented_iterator_traits<_OutIter>;
200 using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
90 using _DiffT =
91 typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
20192
20293 if (__first == __last)
20394 return std::make_pair(std::move(__first), std::move(__result));
......@@ -217,16 +108,6 @@ struct __copy_impl {
217108 }
218109 }
219110
220 template <class _Cp, bool _IsConst>
221 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
222 operator()(__bit_iterator<_Cp, _IsConst> __first,
223 __bit_iterator<_Cp, _IsConst> __last,
224 __bit_iterator<_Cp, false> __result) const {
225 if (__first.__ctz_ == __result.__ctz_)
226 return std::make_pair(__last, std::__copy_aligned(__first, __last, __result));
227 return std::make_pair(__last, std::__copy_unaligned(__first, __last, __result));
228 }
229
230111 // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
231112 template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
232113 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
lib/libcxx/include/__algorithm/copy_backward.h+9-24
......@@ -11,6 +11,7 @@
1111
1212#include <__algorithm/copy_move_common.h>
1313#include <__algorithm/copy_n.h>
14#include <__algorithm/for_each_segment.h>
1415#include <__algorithm/iterator_operations.h>
1516#include <__algorithm/min.h>
1617#include <__config>
......@@ -170,37 +171,20 @@ struct __copy_backward_impl {
170171 return std::make_pair(std::move(__original_last_iter), std::move(__result));
171172 }
172173
173 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
174 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
174175 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
175176 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
176 using _Traits = __segmented_iterator_traits<_InIter>;
177 auto __sfirst = _Traits::__segment(__first);
178 auto __slast = _Traits::__segment(__last);
179 if (__sfirst == __slast) {
180 auto __iters =
181 std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result));
182 return std::make_pair(__last, __iters.second);
183 }
184
185 __result =
186 std::__copy_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__local(__last), std::move(__result))
187 .second;
188 --__slast;
189 while (__sfirst != __slast) {
190 __result =
191 std::__copy_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__end(__slast), std::move(__result))
192 .second;
193 --__slast;
194 }
195 __result = std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result))
196 .second;
177 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
178 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;
180 });
197181 return std::make_pair(__last, std::move(__result));
198182 }
199183
200184 template <class _InIter,
201185 class _OutIter,
202186 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
203 !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
187 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
204188 int> = 0>
205189 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
206190 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
......@@ -214,7 +198,8 @@ struct __copy_backward_impl {
214198
215199 auto __local_last = _Traits::__local(__result);
216200 while (true) {
217 using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
201 using _DiffT =
202 typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
218203
219204 auto __local_first = _Traits::__begin(__segment_iterator);
220205 auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
lib/libcxx/include/__algorithm/copy_n.h+50-16
......@@ -10,31 +10,63 @@
1010#define _LIBCPP___ALGORITHM_COPY_N_H
1111
1212#include <__algorithm/copy.h>
13#include <__algorithm/iterator_operations.h>
1314#include <__config>
1415#include <__iterator/iterator_traits.h>
1516#include <__type_traits/enable_if.h>
1617#include <__utility/convert_to_integral.h>
18#include <__utility/move.h>
19#include <__utility/pair.h>
1720
1821#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1922# pragma GCC system_header
2023#endif
2124
25_LIBCPP_PUSH_MACROS
26#include <__undef_macros>
27
2228_LIBCPP_BEGIN_NAMESPACE_STD
2329
30template <class _AlgPolicy,
31 class _InIter,
32 class _OutIter,
33 __enable_if_t<__has_random_access_iterator_category<_InIter>::value, int> = 0>
34_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
35__copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) {
36 return std::__copy(__first, __first + __n, std::move(__result));
37}
38
39template <class _AlgPolicy,
40 class _InIter,
41 class _OutIter,
42 __enable_if_t<!__has_random_access_iterator_category<_InIter>::value, int> = 0>
43_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
44__copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) {
45 while (__n != 0) {
46 *__result = *__first;
47 ++__first;
48 ++__result;
49 --__n;
50 }
51 return std::make_pair(std::move(__first), std::move(__result));
52}
53
54// The InputIterator case is handled specially here because it's been written in a way to avoid incrementing __first
55// if not absolutely required. This was done to allow its use with istream_iterator and we want to avoid breaking
56// people, at least currently.
57// See https://github.com/llvm/llvm-project/commit/99847d2bf132854fffa019bab19818768102ccad
2458template <class _InputIterator,
2559 class _Size,
2660 class _OutputIterator,
27 __enable_if_t<__has_input_iterator_category<_InputIterator>::value &&
28 !__has_random_access_iterator_category<_InputIterator>::value,
29 int> = 0>
30inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
31copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
32 typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
33 _IntegralSize __n = __orig_n;
34 if (__n > 0) {
61 __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
62_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
63copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) {
64 using _IntegralSize = decltype(std::__convert_to_integral(__n));
65 _IntegralSize __converted = __n;
66 if (__converted > 0) {
3567 *__result = *__first;
3668 ++__result;
37 for (--__n; __n > 0; --__n) {
69 for (--__converted; __converted > 0; --__converted) {
3870 ++__first;
3971 *__result = *__first;
4072 ++__result;
......@@ -46,15 +78,17 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
4678template <class _InputIterator,
4779 class _Size,
4880 class _OutputIterator,
49 __enable_if_t<__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
50inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
51copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
52 typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
53 typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
54 _IntegralSize __n = __orig_n;
55 return std::copy(__first, __first + difference_type(__n), __result);
81 __enable_if_t<!__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
82_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
83copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) {
84 using _IntegralSize = decltype(std::__convert_to_integral(__n));
85 _IntegralSize __converted = __n;
86 return std::__copy_n<_ClassicAlgPolicy>(__first, __iterator_difference_type<_InputIterator>(__converted), __result)
87 .second;
5688}
5789
5890_LIBCPP_END_NAMESPACE_STD
5991
92_LIBCPP_POP_MACROS
93
6094#endif // _LIBCPP___ALGORITHM_COPY_N_H
lib/libcxx/include/__algorithm/count.h+2-2
......@@ -72,7 +72,7 @@ __count_bool(__bit_iterator<_Cp, _IsConst> __first, typename __size_difference_t
7272}
7373
7474template <class, class _Cp, bool _IsConst, class _Tp, class _Proj, __enable_if_t<__is_identity<_Proj>::value, int> = 0>
75_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<__bit_iterator<_Cp, _IsConst> >
75_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iterator_difference_type<__bit_iterator<_Cp, _IsConst> >
7676__count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
7777 if (__value)
7878 return std::__count_bool<true>(
......@@ -82,7 +82,7 @@ __count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __l
8282}
8383
8484template <class _InputIterator, class _Tp>
85[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator>
85[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iterator_difference_type<_InputIterator>
8686count(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
8787 __identity __proj;
8888 return std::__count<_ClassicAlgPolicy>(__first, __last, __value, __proj);
lib/libcxx/include/__algorithm/equal.h+43-55
......@@ -160,22 +160,28 @@ template <class _Cp,
160160 bool _IsConst1,
161161 bool _IsConst2,
162162 class _BinaryPredicate,
163 __enable_if_t<__desugars_to_v<__equal_tag, _BinaryPredicate, bool, bool>, int> = 0>
163 class _Proj1,
164 class _Proj2,
165 __enable_if_t<__is_identity<_Proj1>::value && __is_identity<_Proj2>::value &&
166 __desugars_to_v<__equal_tag, _BinaryPredicate, bool, bool>,
167 int> = 0>
164168[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl(
165169 __bit_iterator<_Cp, _IsConst1> __first1,
166170 __bit_iterator<_Cp, _IsConst1> __last1,
167171 __bit_iterator<_Cp, _IsConst2> __first2,
168 _BinaryPredicate) {
172 _BinaryPredicate,
173 _Proj1&,
174 _Proj2&) {
169175 if (__first1.__ctz_ == __first2.__ctz_)
170176 return std::__equal_aligned(__first1, __last1, __first2);
171177 return std::__equal_unaligned(__first1, __last1, __first2);
172178}
173179
174template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
180template <class _InIter1, class _Sent1, class _InIter2, class _Pred, class _Proj1, class _Proj2>
175181[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl(
176 _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate& __pred) {
182 _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
177183 for (; __first1 != __last1; ++__first1, (void)++__first2)
178 if (!__pred(*__first1, *__first2))
184 if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
179185 return false;
180186 return true;
181187}
......@@ -183,19 +189,23 @@ template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
183189template <class _Tp,
184190 class _Up,
185191 class _BinaryPredicate,
186 __enable_if_t<__desugars_to_v<__equal_tag, _BinaryPredicate, _Tp, _Up> && !is_volatile<_Tp>::value &&
187 !is_volatile<_Up>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
192 class _Proj1,
193 class _Proj2,
194 __enable_if_t<__is_identity<_Proj1>::value && __is_identity<_Proj2>::value &&
195 __desugars_to_v<__equal_tag, _BinaryPredicate, _Tp, _Up> && !is_volatile<_Tp>::value &&
196 !is_volatile<_Up>::value && __is_trivially_equality_comparable_v<_Tp, _Up>,
188197 int> = 0>
189198[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
190__equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&) {
199__equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&, _Proj1&, _Proj2&) {
191200 return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1));
192201}
193202
194203template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
195204[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
196205equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
206 __identity __proj;
197207 return std::__equal_iter_impl(
198 std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2), __pred);
208 std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2), __pred, __proj, __proj);
199209}
200210
201211template <class _InputIterator1, class _InputIterator2>
......@@ -206,52 +216,28 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
206216
207217#if _LIBCPP_STD_VER >= 14
208218
209template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
210[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl(
211 _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __comp, _Proj1& __proj1, _Proj2& __proj2) {
212 while (__first1 != __last1 && __first2 != __last2) {
213 if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
214 return false;
215 ++__first1;
216 ++__first2;
217 }
218 return __first1 == __last1 && __first2 == __last2;
219}
220
221template <class _Tp,
222 class _Up,
223 class _Pred,
224 class _Proj1,
225 class _Proj2,
226 __enable_if_t<__desugars_to_v<__equal_tag, _Pred, _Tp, _Up> && __is_identity<_Proj1>::value &&
227 __is_identity<_Proj2>::value && !is_volatile<_Tp>::value && !is_volatile<_Up>::value &&
228 __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
229 int> = 0>
230[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
231__equal_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&, _Proj2&) {
232 return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1));
233}
234
235template <class _Cp,
236 bool _IsConst1,
237 bool _IsConst2,
219template <bool __known_equal_length,
220 class _Iter1,
221 class _Sent1,
222 class _Iter2,
223 class _Sent2,
238224 class _Pred,
239225 class _Proj1,
240 class _Proj2,
241 __enable_if_t<__desugars_to_v<__equal_tag, _Pred, bool, bool> && __is_identity<_Proj1>::value &&
242 __is_identity<_Proj2>::value,
243 int> = 0>
226 class _Proj2>
244227[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl(
245 __bit_iterator<_Cp, _IsConst1> __first1,
246 __bit_iterator<_Cp, _IsConst1> __last1,
247 __bit_iterator<_Cp, _IsConst2> __first2,
248 __bit_iterator<_Cp, _IsConst2>,
249 _Pred&,
250 _Proj1&,
251 _Proj2&) {
252 if (__first1.__ctz_ == __first2.__ctz_)
253 return std::__equal_aligned(__first1, __last1, __first2);
254 return std::__equal_unaligned(__first1, __last1, __first2);
228 _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __comp, _Proj1& __proj1, _Proj2& __proj2) {
229 if constexpr (__known_equal_length) {
230 return std::__equal_iter_impl(
231 std::move(__first1), std::move(__last1), std::move(__first2), __comp, __proj1, __proj2);
232 } else {
233 while (__first1 != __last1 && __first2 != __last2) {
234 if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
235 return false;
236 ++__first1;
237 ++__first2;
238 }
239 return __first1 == __last1 && __first2 == __last2;
240 }
255241}
256242
257243template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
......@@ -261,13 +247,15 @@ equal(_InputIterator1 __first1,
261247 _InputIterator2 __first2,
262248 _InputIterator2 __last2,
263249 _BinaryPredicate __pred) {
264 if constexpr (__has_random_access_iterator_category<_InputIterator1>::value &&
265 __has_random_access_iterator_category<_InputIterator2>::value) {
250 static constexpr bool __both_random_access =
251 __has_random_access_iterator_category<_InputIterator1>::value &&
252 __has_random_access_iterator_category<_InputIterator2>::value;
253 if constexpr (__both_random_access) {
266254 if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
267255 return false;
268256 }
269257 __identity __proj;
270 return std::__equal_impl(
258 return std::__equal_impl<__both_random_access>(
271259 std::__unwrap_iter(__first1),
272260 std::__unwrap_iter(__last1),
273261 std::__unwrap_iter(__first2),
lib/libcxx/include/__algorithm/fill.h+26-8
......@@ -10,8 +10,12 @@
1010#define _LIBCPP___ALGORITHM_FILL_H
1111
1212#include <__algorithm/fill_n.h>
13#include <__algorithm/for_each_segment.h>
1314#include <__config>
1415#include <__iterator/iterator_traits.h>
16#include <__iterator/segmented_iterator.h>
17#include <__type_traits/enable_if.h>
18#include <__type_traits/is_same.h>
1519
1620#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1721# pragma GCC system_header
......@@ -21,23 +25,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2125
2226// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
2327
24template <class _ForwardIterator, class _Tp>
25inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
26__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) {
28template <class _ForwardIterator, class _Sentinel, class _Tp>
29inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
30__fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __value) {
31#ifndef _LIBCPP_CXX03_LANG
32 if constexpr (is_same<_ForwardIterator, _Sentinel>::value && __is_segmented_iterator_v<_ForwardIterator>) {
33 using __local_iterator_t = typename __segmented_iterator_traits<_ForwardIterator>::__local_iterator;
34 std::__for_each_segment(__first, __last, [&](__local_iterator_t __lfirst, __local_iterator_t __llast) {
35 std::__fill(__lfirst, __llast, __value);
36 });
37 return __last;
38 }
39#endif
2740 for (; __first != __last; ++__first)
2841 *__first = __value;
42 return __first;
2943}
3044
31template <class _RandomAccessIterator, class _Tp>
32inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
33__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) {
34 std::fill_n(__first, __last - __first, __value);
45template <class _RandomAccessIterator,
46 class _Tp,
47 __enable_if_t<__has_random_access_iterator_category<_RandomAccessIterator>::value &&
48 !__is_segmented_iterator_v<_RandomAccessIterator>,
49 int> = 0>
50inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
51__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value) {
52 return std::__fill_n(__first, __last - __first, __value);
3553}
3654
3755template <class _ForwardIterator, class _Tp>
3856inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
3957fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
40 std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
58 std::__fill(__first, __last, __value);
4159}
4260
4361_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/fill_n.h+32-46
......@@ -9,11 +9,14 @@
99#ifndef _LIBCPP___ALGORITHM_FILL_N_H
1010#define _LIBCPP___ALGORITHM_FILL_N_H
1111
12#include <__algorithm/min.h>
12#include <__algorithm/for_each_n_segment.h>
13#include <__algorithm/specialized_algorithms.h>
1314#include <__config>
14#include <__fwd/bit_reference.h>
15#include <__memory/pointer_traits.h>
15#include <__iterator/iterator_traits.h>
16#include <__iterator/segmented_iterator.h>
17#include <__type_traits/enable_if.h>
1618#include <__utility/convert_to_integral.h>
19#include <__utility/move.h>
1720
1821#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1922# pragma GCC system_header
......@@ -26,56 +29,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2629
2730// fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
2831
29template <class _OutputIterator, class _Size, class _Tp>
30inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
31__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
32
33template <bool _FillVal, class _Cp>
34_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
35__fill_n_bool(__bit_iterator<_Cp, false> __first, typename __size_difference_type_traits<_Cp>::size_type __n) {
36 using _It = __bit_iterator<_Cp, false>;
37 using __storage_type = typename _It::__storage_type;
38
39 const int __bits_per_word = _It::__bits_per_word;
40 // do first partial word
41 if (__first.__ctz_ != 0) {
42 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
43 __storage_type __dn = std::min(__clz_f, __n);
44 std::__fill_masked_range(std::__to_address(__first.__seg_), __clz_f - __dn, __first.__ctz_, _FillVal);
45 __n -= __dn;
46 ++__first.__seg_;
47 }
48 // do middle whole words
49 __storage_type __nw = __n / __bits_per_word;
50 std::__fill_n(std::__to_address(__first.__seg_), __nw, _FillVal ? static_cast<__storage_type>(-1) : 0);
51 __n -= __nw * __bits_per_word;
52 // do last partial word
53 if (__n > 0) {
54 __first.__seg_ += __nw;
55 std::__fill_masked_range(std::__to_address(__first.__seg_), __bits_per_word - __n, 0u, _FillVal);
56 }
57}
58
59template <class _Cp, class _Size>
60inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, false>
61__fill_n(__bit_iterator<_Cp, false> __first, _Size __n, const bool& __value) {
62 if (__n > 0) {
63 if (__value)
64 std::__fill_n_bool<true>(__first, __n);
65 else
66 std::__fill_n_bool<false>(__first, __n);
67 }
68 return __first + __n;
69}
70
71template <class _OutputIterator, class _Size, class _Tp>
32template <
33 class _OutputIterator,
34 class _Size,
35 class _Tp,
36 __enable_if_t<!__specialized_algorithm<_Algorithm::__fill_n, __single_iterator<_OutputIterator> >::__has_algorithm,
37 int> = 0>
7238inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
7339__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
40#ifndef _LIBCPP_CXX03_LANG
41 if constexpr (__is_segmented_iterator_v<_OutputIterator>) {
42 using __local_iterator = typename __segmented_iterator_traits<_OutputIterator>::__local_iterator;
43 if constexpr (__has_random_access_iterator_category<__local_iterator>::value) {
44 return std::__for_each_n_segment(__first, __n, [&](__local_iterator __lfirst, __local_iterator __llast) {
45 std::__fill_n(__lfirst, __llast - __lfirst, __value);
46 });
47 }
48 }
49#endif
7450 for (; __n > 0; ++__first, (void)--__n)
7551 *__first = __value;
7652 return __first;
7753}
7854
55template <class _OutIter,
56 class _Size,
57 class _Tp,
58 __enable_if_t<__specialized_algorithm<_Algorithm::__fill_n, __single_iterator<_OutIter> >::__has_algorithm,
59 int> = 0>
60_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutIter __fill_n(_OutIter __first, _Size __n, const _Tp& __value) {
61 return __specialized_algorithm<_Algorithm::__fill_n, __single_iterator<_OutIter> >()(
62 std::move(__first), __n, __value);
63}
64
7965template <class _OutputIterator, class _Size, class _Tp>
8066inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
8167fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
lib/libcxx/include/__algorithm/find.h+96-39
......@@ -12,16 +12,19 @@
1212
1313#include <__algorithm/find_segment_if.h>
1414#include <__algorithm/min.h>
15#include <__algorithm/simd_utils.h>
1516#include <__algorithm/unwrap_iter.h>
1617#include <__bit/countr.h>
1718#include <__bit/invert_if.h>
1819#include <__config>
20#include <__cstddef/size_t.h>
1921#include <__functional/identity.h>
2022#include <__fwd/bit_reference.h>
2123#include <__iterator/segmented_iterator.h>
2224#include <__string/constexpr_c_functions.h>
2325#include <__type_traits/enable_if.h>
2426#include <__type_traits/invoke.h>
27#include <__type_traits/is_constant_evaluated.h>
2528#include <__type_traits/is_equality_comparable.h>
2629#include <__type_traits/is_integral.h>
2730#include <__type_traits/is_signed.h>
......@@ -44,46 +47,108 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4447// generic implementation
4548template <class _Iter, class _Sent, class _Tp, class _Proj>
4649_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
47__find(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
50__find_loop(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
4851 for (; __first != __last; ++__first)
4952 if (std::__invoke(__proj, *__first) == __value)
5053 break;
5154 return __first;
5255}
5356
54// trivially equality comparable implementations
55template <class _Tp,
56 class _Up,
57 class _Proj,
58 __enable_if_t<__is_identity<_Proj>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
59 sizeof(_Tp) == 1,
60 int> = 0>
61_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
62 if (auto __ret = std::__constexpr_memchr(__first, __value, __last - __first))
63 return __ret;
64 return __last;
57template <class _Iter, class _Sent, class _Tp, class _Proj>
58_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
59__find(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
60 return std::__find_loop(std::move(__first), std::move(__last), __value, __proj);
6561}
6662
67#if _LIBCPP_HAS_WIDE_CHARACTERS
63#if _LIBCPP_VECTORIZE_ALGORITHMS
64template <class _Tp, class _Up>
65[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
66_LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find_vectorized(_Tp* __first, _Tp* __last, _Up __value) {
67 if (!__libcpp_is_constant_evaluated()) {
68 constexpr size_t __unroll_count = 4;
69 constexpr size_t __vec_size = __native_vector_size<_Tp>;
70 using __vec = __simd_vector<_Tp, __vec_size>;
71
72 auto __orig_first = __first;
73
74 auto __values = static_cast<__simd_vector<_Tp, __vec_size>>(__value); // broadcast the value
75 while (static_cast<size_t>(__last - __first) >= __unroll_count * __vec_size) [[__unlikely__]] {
76 __vec __lhs[__unroll_count];
77
78 for (size_t __i = 0; __i != __unroll_count; ++__i)
79 __lhs[__i] = std::__load_vector<__vec>(__first + __i * __vec_size);
80
81 for (size_t __i = 0; __i != __unroll_count; ++__i) {
82 if (auto __cmp_res = __lhs[__i] == __values; std::__any_of(__cmp_res)) {
83 auto __offset = __i * __vec_size + std::__find_first_set(__cmp_res);
84 return __first + __offset;
85 }
86 }
87
88 __first += __unroll_count * __vec_size;
89 }
90
91 // check the remaining 0-3 vectors
92 while (static_cast<size_t>(__last - __first) >= __vec_size) {
93 if (auto __cmp_res = std::__load_vector<__vec>(__first) == __values; std::__any_of(__cmp_res)) {
94 return __first + std::__find_first_set(__cmp_res);
95 }
96 __first += __vec_size;
97 }
98
99 if (__last - __first == 0)
100 return __first;
101
102 // Check if we can load elements in front of the current pointer. If that's the case load a vector at
103 // (last - vector_size) to check the remaining elements
104 if (static_cast<size_t>(__first - __orig_first) >= __vec_size) {
105 __first = __last - __vec_size;
106 return __first + std::__find_first_set(std::__load_vector<__vec>(__first) == __values);
107 }
108 }
109
110 __identity __proj;
111 return std::__find_loop(__first, __last, __value, __proj);
112}
113#endif
114
115#ifndef _LIBCPP_CXX03_LANG
116// trivially equality comparable implementations
68117template <class _Tp,
69118 class _Up,
70119 class _Proj,
71 __enable_if_t<__is_identity<_Proj>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
72 sizeof(_Tp) == sizeof(wchar_t) && _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t),
73 int> = 0>
120 __enable_if_t<__is_identity<_Proj>::value && __is_trivially_equality_comparable_v<_Tp, _Up>, int> = 0>
74121_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
75 if (auto __ret = std::__constexpr_wmemchr(__first, __value, __last - __first))
76 return __ret;
77 return __last;
122 if constexpr (sizeof(_Tp) == 1) {
123 if (auto __ret = std::__constexpr_memchr(__first, __value, __last - __first))
124 return __ret;
125 return __last;
126 }
127# if _LIBCPP_HAS_WIDE_CHARACTERS
128 else if constexpr (sizeof(_Tp) == sizeof(wchar_t) && _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t)) {
129 if (auto __ret = std::__constexpr_wmemchr(__first, __value, __last - __first))
130 return __ret;
131 return __last;
132 }
133# endif
134# if _LIBCPP_VECTORIZE_ALGORITHMS
135 else if constexpr (is_integral<_Tp>::value) {
136 return std::__find_vectorized(__first, __last, __value);
137 }
138# endif
139 else {
140 __identity __proj;
141 return std::__find_loop(__first, __last, __value, __proj);
142 }
78143}
79#endif // _LIBCPP_HAS_WIDE_CHARACTERS
144#endif
80145
81146// TODO: This should also be possible to get right with different signedness
82147// cast integral types to allow vectorization
83148template <class _Tp,
84149 class _Up,
85150 class _Proj,
86 __enable_if_t<__is_identity<_Proj>::value && !__libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
151 __enable_if_t<__is_identity<_Proj>::value && !__is_trivially_equality_comparable_v<_Tp, _Up> &&
87152 is_integral<_Tp>::value && is_integral<_Up>::value &&
88153 is_signed<_Tp>::value == is_signed<_Up>::value,
89154 int> = 0>
......@@ -143,31 +208,23 @@ __find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __la
143208
144209// segmented iterator implementation
145210
146template <class>
147struct __find_segment;
148
149211template <class _SegmentedIterator,
150212 class _Tp,
151213 class _Proj,
152 __enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
214 __enable_if_t<__is_segmented_iterator_v<_SegmentedIterator>, int> = 0>
153215_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator
154216__find(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value, _Proj& __proj) {
155 return std::__find_segment_if(std::move(__first), std::move(__last), __find_segment<_Tp>(__value), __proj);
217 using __local_iterator = typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator;
218 return std::__find_segment_if(
219 std::move(__first),
220 std::move(__last),
221 [&__value](__local_iterator __lfirst, __local_iterator __llast, _Proj& __lproj) {
222 return std::__rewrap_iter(
223 __lfirst, std::__find(std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __value, __lproj));
224 },
225 __proj);
156226}
157227
158template <class _Tp>
159struct __find_segment {
160 const _Tp& __value_;
161
162 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __find_segment(const _Tp& __value) : __value_(__value) {}
163
164 template <class _InputIterator, class _Proj>
165 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _InputIterator
166 operator()(_InputIterator __first, _InputIterator __last, _Proj& __proj) const {
167 return std::__find(__first, __last, __value_, __proj);
168 }
169};
170
171228// public API
172229template <class _InputIterator, class _Tp>
173230[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
lib/libcxx/include/__algorithm/find_end.h+105
......@@ -76,6 +76,111 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
7676 }
7777}
7878
79template <class _AlgPolicy,
80 class _Pred,
81 class _Iter1,
82 class _Sent1,
83 class _Iter2,
84 class _Sent2,
85 class _Proj1,
86 class _Proj2>
87_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter1> __find_end_impl(
88 _Iter1 __first1,
89 _Sent1 __sent1,
90 _Iter2 __first2,
91 _Sent2 __sent2,
92 _Pred& __pred,
93 _Proj1& __proj1,
94 _Proj2& __proj2,
95 bidirectional_iterator_tag,
96 bidirectional_iterator_tag) {
97 auto __last1 = _IterOps<_AlgPolicy>::next(__first1, __sent1);
98 auto __last2 = _IterOps<_AlgPolicy>::next(__first2, __sent2);
99 // modeled after search algorithm (in reverse)
100 if (__first2 == __last2)
101 return std::make_pair(__last1, __last1); // Everything matches an empty sequence
102 _Iter1 __l1 = __last1;
103 _Iter2 __l2 = __last2;
104 --__l2;
105 while (true) {
106 // Find last element in sequence 1 that matches *(__last2-1), with a mininum of loop checks
107 while (true) {
108 if (__first1 == __l1) // return __last1 if no element matches *__first2
109 return std::make_pair(__last1, __last1);
110 if (std::__invoke(__pred, std::__invoke(__proj1, *--__l1), std::__invoke(__proj2, *__l2)))
111 break;
112 }
113 // *__l1 matches *__l2, now match elements before here
114 _Iter1 __match_last = __l1;
115 _Iter1 __m1 = __l1;
116 _Iter2 __m2 = __l2;
117 while (true) {
118 if (__m2 == __first2) // If pattern exhausted, __m1 is the answer (works for 1 element pattern)
119 return std::make_pair(__m1, ++__match_last);
120 if (__m1 == __first1) // Otherwise if source exhaused, pattern not found
121 return std::make_pair(__last1, __last1);
122
123 // if there is a mismatch, restart with a new __l1
124 if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2))) {
125 break;
126 } // else there is a match, check next elements
127 }
128 }
129}
130
131template <class _AlgPolicy,
132 class _Pred,
133 class _Iter1,
134 class _Sent1,
135 class _Iter2,
136 class _Sent2,
137 class _Proj1,
138 class _Proj2>
139_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __find_end_impl(
140 _Iter1 __first1,
141 _Sent1 __sent1,
142 _Iter2 __first2,
143 _Sent2 __sent2,
144 _Pred& __pred,
145 _Proj1& __proj1,
146 _Proj2& __proj2,
147 random_access_iterator_tag,
148 random_access_iterator_tag) {
149 typedef typename iterator_traits<_Iter1>::difference_type _D1;
150 auto __last1 = _IterOps<_AlgPolicy>::next(__first1, __sent1);
151 auto __last2 = _IterOps<_AlgPolicy>::next(__first2, __sent2);
152 // Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern
153 auto __len2 = __last2 - __first2;
154 if (__len2 == 0)
155 return std::make_pair(__last1, __last1);
156 auto __len1 = __last1 - __first1;
157 if (__len1 < __len2)
158 return std::make_pair(__last1, __last1);
159 const _Iter1 __s = __first1 + _D1(__len2 - 1); // End of pattern match can't go before here
160 _Iter1 __l1 = __last1;
161 _Iter2 __l2 = __last2;
162 --__l2;
163 while (true) {
164 while (true) {
165 if (__s == __l1)
166 return std::make_pair(__last1, __last1);
167 if (std::__invoke(__pred, std::__invoke(__proj1, *--__l1), std::__invoke(__proj2, *__l2)))
168 break;
169 }
170 _Iter1 __last_match = __l1;
171 _Iter1 __m1 = __l1;
172 _Iter2 __m2 = __l2;
173 while (true) {
174 if (__m2 == __first2)
175 return std::make_pair(__m1, ++__last_match);
176 // no need to check range on __m1 because __s guarantees we have enough source
177 if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2))) {
178 break;
179 }
180 }
181 }
182}
183
79184template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
80185[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_end_classic(
81186 _ForwardIterator1 __first1,
lib/libcxx/include/__algorithm/for_each.h+18-24
......@@ -11,45 +11,41 @@
1111#define _LIBCPP___ALGORITHM_FOR_EACH_H
1212
1313#include <__algorithm/for_each_segment.h>
14#include <__algorithm/specialized_algorithms.h>
1415#include <__config>
1516#include <__functional/identity.h>
1617#include <__iterator/segmented_iterator.h>
17#include <__type_traits/enable_if.h>
1818#include <__type_traits/invoke.h>
19#include <__utility/move.h>
19#include <__type_traits/is_same.h>
2020
2121#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2222# pragma GCC system_header
2323#endif
2424
25_LIBCPP_PUSH_MACROS
26#include <__undef_macros>
27
2825_LIBCPP_BEGIN_NAMESPACE_STD
2926
3027template <class _InputIterator, class _Sent, class _Func, class _Proj>
3128_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
32__for_each(_InputIterator __first, _Sent __last, _Func& __f, _Proj& __proj) {
29__for_each(_InputIterator __first, _Sent __last, _Func& __func, _Proj& __proj) {
30#ifndef _LIBCPP_CXX03_LANG
31 if constexpr (using _SpecialAlg =
32 __specialized_algorithm<_Algorithm::__for_each, __iterator_pair<_InputIterator, _Sent>>;
33 _SpecialAlg::__has_algorithm) {
34 _SpecialAlg()(__first, __last, __func, __proj);
35 return __last;
36 } else if constexpr (is_same<_InputIterator, _Sent>::value && __is_segmented_iterator_v<_InputIterator>) {
37 using __local_iterator_t = typename __segmented_iterator_traits<_InputIterator>::__local_iterator;
38 std::__for_each_segment(__first, __last, [&](__local_iterator_t __lfirst, __local_iterator_t __llast) {
39 std::__for_each(__lfirst, __llast, __func, __proj);
40 });
41 return __last;
42 }
43#endif
3344 for (; __first != __last; ++__first)
34 std::__invoke(__f, std::__invoke(__proj, *__first));
45 std::__invoke(__func, std::__invoke(__proj, *__first));
3546 return __first;
3647}
3748
38#ifndef _LIBCPP_CXX03_LANG
39template <class _SegmentedIterator,
40 class _Func,
41 class _Proj,
42 __enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
43_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _SegmentedIterator
44__for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Func& __func, _Proj& __proj) {
45 using __local_iterator_t = typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator;
46 std::__for_each_segment(__first, __last, [&](__local_iterator_t __lfirst, __local_iterator_t __llast) {
47 std::__for_each(__lfirst, __llast, __func, __proj);
48 });
49 return __last;
50}
51#endif // !_LIBCPP_CXX03_LANG
52
5349template <class _InputIterator, class _Func>
5450_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Func
5551for_each(_InputIterator __first, _InputIterator __last, _Func __f) {
......@@ -60,6 +56,4 @@ for_each(_InputIterator __first, _InputIterator __last, _Func __f) {
6056
6157_LIBCPP_END_NAMESPACE_STD
6258
63_LIBCPP_POP_MACROS
64
6559#endif // _LIBCPP___ALGORITHM_FOR_EACH_H
lib/libcxx/include/__algorithm/for_each_n.h+20-47
......@@ -16,10 +16,7 @@
1616#include <__functional/identity.h>
1717#include <__iterator/iterator_traits.h>
1818#include <__iterator/segmented_iterator.h>
19#include <__type_traits/disjunction.h>
20#include <__type_traits/enable_if.h>
2119#include <__type_traits/invoke.h>
22#include <__type_traits/negation.h>
2320#include <__utility/convert_to_integral.h>
2421#include <__utility/move.h>
2522
......@@ -32,57 +29,33 @@ _LIBCPP_PUSH_MACROS
3229
3330_LIBCPP_BEGIN_NAMESPACE_STD
3431
35template <class _InputIterator,
36 class _Size,
37 class _Func,
38 class _Proj,
39 __enable_if_t<!__has_random_access_iterator_category<_InputIterator>::value &&
40 _Or< _Not<__is_segmented_iterator<_InputIterator> >,
41 _Not<__has_random_access_local_iterator<_InputIterator> > >::value,
42 int> = 0>
32template <class _InputIterator, class _Size, class _Func, class _Proj>
4333_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
4434__for_each_n(_InputIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj) {
4535 typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
4636 _IntegralSize __n = __orig_n;
47 while (__n > 0) {
48 std::__invoke(__f, std::__invoke(__proj, *__first));
49 ++__first;
50 --__n;
51 }
52 return std::move(__first);
53}
54
55template <class _RandIter,
56 class _Size,
57 class _Func,
58 class _Proj,
59 __enable_if_t<__has_random_access_iterator_category<_RandIter>::value, int> = 0>
60_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandIter
61__for_each_n(_RandIter __first, _Size __orig_n, _Func& __f, _Proj& __proj) {
62 typename std::iterator_traits<_RandIter>::difference_type __n = __orig_n;
63 auto __last = __first + __n;
64 std::__for_each(__first, __last, __f, __proj);
65 return __last;
66}
6737
6838#ifndef _LIBCPP_CXX03_LANG
69template <class _SegmentedIterator,
70 class _Size,
71 class _Func,
72 class _Proj,
73 __enable_if_t<!__has_random_access_iterator_category<_SegmentedIterator>::value &&
74 __is_segmented_iterator<_SegmentedIterator>::value &&
75 __has_random_access_iterator_category<
76 typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator>::value,
77 int> = 0>
78_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _SegmentedIterator
79__for_each_n(_SegmentedIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj) {
80 using __local_iterator_t = typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator;
81 return std::__for_each_n_segment(__first, __orig_n, [&](__local_iterator_t __lfirst, __local_iterator_t __llast) {
82 std::__for_each(__lfirst, __llast, __f, __proj);
83 });
39 if constexpr (__is_segmented_iterator_v<_InputIterator>) {
40 using __local_iterator = typename __segmented_iterator_traits<_InputIterator>::__local_iterator;
41 if constexpr (__has_random_access_iterator_category<__local_iterator>::value) {
42 return std::__for_each_n_segment(__first, __orig_n, [&](__local_iterator __lfirst, __local_iterator __llast) {
43 std::__for_each(__lfirst, __llast, __f, __proj);
44 });
45 } else {
46 return std::__for_each(__first, __first + __n, __f, __proj);
47 }
48 } else
49#endif
50 {
51 while (__n > 0) {
52 std::__invoke(__f, std::__invoke(__proj, *__first));
53 ++__first;
54 --__n;
55 }
56 return std::move(__first);
57 }
8458}
85#endif // !_LIBCPP_CXX03_LANG
8659
8760#if _LIBCPP_STD_VER >= 17
8861
lib/libcxx/include/__algorithm/for_each_n_segment.h+1-1
......@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2727template <class _SegmentedIterator, class _Size, class _Functor>
2828_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator
2929__for_each_n_segment(_SegmentedIterator __first, _Size __orig_n, _Functor __func) {
30 static_assert(__is_segmented_iterator<_SegmentedIterator>::value &&
30 static_assert(__is_segmented_iterator_v<_SegmentedIterator> &&
3131 __has_random_access_iterator_category<
3232 typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator>::value,
3333 "__for_each_n_segment only works with segmented iterators with random-access local iterators");
lib/libcxx/include/__algorithm/for_each_segment.h+26
......@@ -48,6 +48,32 @@ __for_each_segment(_SegmentedIterator __first, _SegmentedIterator __last, _Funct
4848 __func(_Traits::__begin(__sfirst), _Traits::__local(__last));
4949}
5050
51template <class _SegmentedIterator, class _Functor>
52_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
53__for_each_segment_backward(_SegmentedIterator __first, _SegmentedIterator __last, _Functor __func) {
54 using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
55
56 auto __sfirst = _Traits::__segment(__first);
57 auto __slast = _Traits::__segment(__last);
58
59 // We are in a single segment, so we might not be at the beginning or end
60 if (__sfirst == __slast) {
61 __func(_Traits::__local(__first), _Traits::__local(__last));
62 return;
63 }
64
65 // We have more than one segment. Iterate over the last segment, since we might not start at the end
66 __func(_Traits::__begin(__slast), _Traits::__local(__last));
67 --__slast;
68 // iterate over the segments which are guaranteed to be completely in the range
69 while (__sfirst != __slast) {
70 __func(_Traits::__begin(__slast), _Traits::__end(__slast));
71 --__slast;
72 }
73 // iterate over the first segment
74 __func(_Traits::__local(__first), _Traits::__end(__slast));
75}
76
5177_LIBCPP_END_NAMESPACE_STD
5278
5379#endif // _LIBCPP___ALGORITHM_FOR_EACH_SEGMENT_H
lib/libcxx/include/__algorithm/generate.h+4-2
......@@ -9,7 +9,9 @@
99#ifndef _LIBCPP___ALGORITHM_GENERATE_H
1010#define _LIBCPP___ALGORITHM_GENERATE_H
1111
12#include <__algorithm/for_each.h>
1213#include <__config>
14#include <__utility/forward.h>
1315
1416#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1517# pragma GCC system_header
......@@ -20,8 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2022template <class _ForwardIterator, class _Generator>
2123inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
2224generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) {
23 for (; __first != __last; ++__first)
24 *__first = __gen();
25 using __iter_ref = decltype(*__first);
26 std::for_each(__first, __last, [&](__iter_ref __element) { std::forward<__iter_ref>(__element) = __gen(); });
2527}
2628
2729_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/generate_n.h+19-6
......@@ -9,25 +9,38 @@
99#ifndef _LIBCPP___ALGORITHM_GENERATE_N_H
1010#define _LIBCPP___ALGORITHM_GENERATE_N_H
1111
12#include <__algorithm/for_each_n.h>
1213#include <__config>
13#include <__utility/convert_to_integral.h>
14#include <__functional/identity.h>
15#include <__utility/forward.h>
16#include <__utility/move.h>
1417
1518#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1619# pragma GCC system_header
1720#endif
1821
22_LIBCPP_PUSH_MACROS
23#include <__undef_macros>
24
1925_LIBCPP_BEGIN_NAMESPACE_STD
2026
27template <class _OutputIterator, class _Size, class _Generator>
28inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
29__generate_n(_OutputIterator __first, _Size __orig_n, _Generator& __gen) {
30 using __iter_ref = decltype(*__first);
31 __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);
34}
35
2136template <class _OutputIterator, class _Size, class _Generator>
2237inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
2338generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) {
24 typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
25 _IntegralSize __n = __orig_n;
26 for (; __n > 0; ++__first, (void)--__n)
27 *__first = __gen();
28 return __first;
39 return std::__generate_n(std::move(__first), __orig_n, __gen);
2940}
3041
3142_LIBCPP_END_NAMESPACE_STD
3243
44_LIBCPP_POP_MACROS
45
3346#endif // _LIBCPP___ALGORITHM_GENERATE_N_H
lib/libcxx/include/__algorithm/is_permutation.h+4-4
......@@ -78,7 +78,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
7878 _Pred&& __pred,
7979 _Proj1&& __proj1,
8080 _Proj2&& __proj2) {
81 using _D1 = __iter_diff_t<_Iter1>;
81 using _D1 = __iterator_difference_type<_Iter1>;
8282
8383 for (auto __i = __first1; __i != __last1; ++__i) {
8484 // Have we already counted the number of *__i in [f1, l1)?
......@@ -126,7 +126,7 @@ template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _Fo
126126 return true;
127127
128128 // __first1 != __last1 && *__first1 != *__first2
129 using _D1 = __iter_diff_t<_ForwardIterator1>;
129 using _D1 = __iterator_difference_type<_ForwardIterator1>;
130130 _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
131131 if (__l1 == _D1(1))
132132 return false;
......@@ -173,10 +173,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
173173 if (__first2 == __last2) // Second range is shorter
174174 return false;
175175
176 using _D1 = __iter_diff_t<_Iter1>;
176 using _D1 = __iterator_difference_type<_Iter1>;
177177 _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
178178
179 using _D2 = __iter_diff_t<_Iter2>;
179 using _D2 = __iterator_difference_type<_Iter2>;
180180 _D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
181181 if (__l1 != __l2)
182182 return false;
lib/libcxx/include/__algorithm/iterator_operations.h+3
......@@ -219,6 +219,9 @@ private:
219219template <class _AlgPolicy, class _Iter>
220220using __policy_iter_diff_t _LIBCPP_NODEBUG = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;
221221
222template <class _AlgPolicy, class _Iter>
223using __policy_value_type _LIBCPP_NODEBUG = typename _IterOps<_AlgPolicy>::template __value_type<_Iter>;
224
222225_LIBCPP_END_NAMESPACE_STD
223226
224227_LIBCPP_POP_MACROS
lib/libcxx/include/__algorithm/lexicographical_compare.h+2-2
......@@ -66,8 +66,8 @@ template <class _Tp,
6666 class _Proj2,
6767 class _Comp,
6868 __enable_if_t<__desugars_to_v<__totally_ordered_less_tag, _Comp, _Tp, _Tp> && !is_volatile<_Tp>::value &&
69 __libcpp_is_trivially_equality_comparable<_Tp, _Tp>::value &&
70 __is_identity<_Proj1>::value && __is_identity<_Proj2>::value,
69 __is_trivially_equality_comparable_v<_Tp, _Tp> && __is_identity<_Proj1>::value &&
70 __is_identity<_Proj2>::value,
7171 int> = 0>
7272_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
7373__lexicographical_compare(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Tp* __last2, _Comp&, _Proj1&, _Proj2&) {
lib/libcxx/include/__algorithm/lexicographical_compare_three_way.h+6-6
......@@ -37,13 +37,13 @@ template <class _InputIterator1, class _InputIterator2, class _Cmp>
3737_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_path(
3838 _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
3939 -> decltype(__comp(*__first1, *__first2)) {
40 static_assert(
41 signed_integral<__iter_diff_t<_InputIterator1>>, "Using a non-integral difference_type is undefined behavior.");
42 static_assert(
43 signed_integral<__iter_diff_t<_InputIterator2>>, "Using a non-integral difference_type is undefined behavior.");
40 static_assert(signed_integral<__iterator_difference_type<_InputIterator1>>,
41 "Using a non-integral difference_type is undefined behavior.");
42 static_assert(signed_integral<__iterator_difference_type<_InputIterator2>>,
43 "Using a non-integral difference_type is undefined behavior.");
4444
45 using _Len1 = __iter_diff_t<_InputIterator1>;
46 using _Len2 = __iter_diff_t<_InputIterator2>;
45 using _Len1 = __iterator_difference_type<_InputIterator1>;
46 using _Len2 = __iterator_difference_type<_InputIterator2>;
4747 using _Common = common_type_t<_Len1, _Len2>;
4848
4949 _Len1 __len1 = __last1 - __first1;
lib/libcxx/include/__algorithm/make_heap.h+16-4
......@@ -12,9 +12,11 @@
1212#include <__algorithm/comp.h>
1313#include <__algorithm/comp_ref_type.h>
1414#include <__algorithm/iterator_operations.h>
15#include <__algorithm/push_heap.h>
1516#include <__algorithm/sift_down.h>
1617#include <__config>
1718#include <__iterator/iterator_traits.h>
19#include <__type_traits/is_arithmetic.h>
1820#include <__utility/move.h>
1921
2022#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -31,13 +33,23 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
3133__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
3234 __comp_ref_type<_Compare> __comp_ref = __comp;
3335
34 using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
35 difference_type __n = __last - __first;
36 using __diff_t = __iterator_difference_type<_RandomAccessIterator>;
37 const __diff_t __n = __last - __first;
38
39 const bool __assume_both_children = is_arithmetic<__iterator_value_type<_RandomAccessIterator> >::value;
40
41 // While it would be correct to always assume we have both children, in practice we observed this to be a performance
42 // improvement only for arithmetic types.
43 const __diff_t __sift_down_n = __assume_both_children ? ((__n & 1) ? __n : __n - 1) : __n;
44
3645 if (__n > 1) {
3746 // start from the first parent, there is no need to consider children
38 for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) {
39 std::__sift_down<_AlgPolicy>(__first, __comp_ref, __n, __first + __start);
47
48 for (__diff_t __start = (__sift_down_n - 2) / 2; __start >= 0; --__start) {
49 std::__sift_down<_AlgPolicy, __assume_both_children>(__first, __comp_ref, __sift_down_n, __start);
4050 }
51 if _LIBCPP_CONSTEXPR (__assume_both_children)
52 std::__sift_up<_AlgPolicy>(__first, __last, __comp, __n);
4153 }
4254}
4355
lib/libcxx/include/__algorithm/mismatch.h+2-2
......@@ -60,7 +60,7 @@ __mismatch(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, _Pro
6060template <class _Iter>
6161[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter>
6262__mismatch_vectorized(_Iter __first1, _Iter __last1, _Iter __first2) {
63 using __value_type = __iter_value_type<_Iter>;
63 using __value_type = __iterator_value_type<_Iter>;
6464 constexpr size_t __unroll_count = 4;
6565 constexpr size_t __vec_size = __native_vector_size<__value_type>;
6666 using __vec = __simd_vector<__value_type, __vec_size>;
......@@ -136,7 +136,7 @@ template <class _Tp,
136136 class _Proj2,
137137 __enable_if_t<!is_integral<_Tp>::value && __desugars_to_v<__equal_tag, _Pred, _Tp, _Tp> &&
138138 __is_identity<_Proj1>::value && __is_identity<_Proj2>::value &&
139 __can_map_to_integer_v<_Tp> && __libcpp_is_trivially_equality_comparable<_Tp, _Tp>::value,
139 __can_map_to_integer_v<_Tp> && __is_trivially_equality_comparable_v<_Tp, _Tp>,
140140 int> = 0>
141141[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*>
142142__mismatch(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
lib/libcxx/include/__algorithm/move.h+8-19
......@@ -50,37 +50,26 @@ struct __move_impl {
5050 return std::make_pair(std::move(__first), std::move(__result));
5151 }
5252
53 template <class _InIter, class _OutIter>
54 struct _MoveSegment {
55 using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InIter>;
56
57 _OutIter& __result_;
58
59 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit _MoveSegment(_OutIter& __result)
60 : __result_(__result) {}
61
62 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
63 operator()(typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
64 __result_ = std::__move<_AlgPolicy>(__lfirst, __llast, std::move(__result_)).second;
65 }
66 };
67
68 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
53 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
6954 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
7055 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
71 std::__for_each_segment(__first, __last, _MoveSegment<_InIter, _OutIter>(__result));
56 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
57 std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) {
58 __result = std::__move<_AlgPolicy>(__lfirst, __llast, std::move(__result)).second;
59 });
7260 return std::make_pair(__last, std::move(__result));
7361 }
7462
7563 template <class _InIter,
7664 class _OutIter,
7765 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
78 !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
66 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
7967 int> = 0>
8068 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
8169 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
8270 using _Traits = __segmented_iterator_traits<_OutIter>;
83 using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
71 using _DiffT =
72 typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
8473
8574 if (__first == __last)
8675 return std::make_pair(std::move(__first), std::move(__result));
lib/libcxx/include/__algorithm/move_backward.h+9-24
......@@ -11,6 +11,7 @@
1111
1212#include <__algorithm/copy_backward.h>
1313#include <__algorithm/copy_move_common.h>
14#include <__algorithm/for_each_segment.h>
1415#include <__algorithm/iterator_operations.h>
1516#include <__algorithm/min.h>
1617#include <__config>
......@@ -51,42 +52,26 @@ struct __move_backward_impl {
5152 return std::make_pair(std::move(__original_last_iter), std::move(__result));
5253 }
5354
54 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
55 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
5556 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
5657 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
57 using _Traits = __segmented_iterator_traits<_InIter>;
58 auto __sfirst = _Traits::__segment(__first);
59 auto __slast = _Traits::__segment(__last);
60 if (__sfirst == __slast) {
61 auto __iters =
62 std::__move_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result));
63 return std::make_pair(__last, __iters.second);
64 }
65
66 __result =
67 std::__move_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__local(__last), std::move(__result))
68 .second;
69 --__slast;
70 while (__sfirst != __slast) {
71 __result =
72 std::__move_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__end(__slast), std::move(__result))
73 .second;
74 --__slast;
75 }
76 __result = std::__move_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result))
77 .second;
58 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
59 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 });
7862 return std::make_pair(__last, std::move(__result));
7963 }
8064
8165 template <class _InIter,
8266 class _OutIter,
8367 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
84 !__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
68 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
8569 int> = 0>
8670 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
8771 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
8872 using _Traits = __segmented_iterator_traits<_OutIter>;
89 using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
73 using _DiffT =
74 typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
9075
9176 // When the range contains no elements, __result might not be a valid iterator
9277 if (__first == __last)
lib/libcxx/include/__algorithm/none_of.h+4-4
......@@ -10,7 +10,9 @@
1010#ifndef _LIBCPP___ALGORITHM_NONE_OF_H
1111#define _LIBCPP___ALGORITHM_NONE_OF_H
1212
13#include <__algorithm/any_of.h>
1314#include <__config>
15#include <__functional/identity.h>
1416
1517#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1618# pragma GCC system_header
......@@ -21,10 +23,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2123template <class _InputIterator, class _Predicate>
2224[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
2325none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
24 for (; __first != __last; ++__first)
25 if (__pred(*__first))
26 return false;
27 return true;
26 __identity __proj;
27 return !std::__any_of(__first, __last, __pred, __proj);
2828}
2929
3030_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/partial_sort.h+1-1
......@@ -45,7 +45,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator __part
4545 for (; __i != __last; ++__i) {
4646 if (__comp(*__i, *__first)) {
4747 _IterOps<_AlgPolicy>::iter_swap(__i, __first);
48 std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first);
48 std::__sift_down<_AlgPolicy, false>(__first, __comp, __len, 0);
4949 }
5050 }
5151 std::__sort_heap<_AlgPolicy>(std::move(__first), std::move(__middle), __comp);
lib/libcxx/include/__algorithm/partial_sort_copy.h+1-1
......@@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _Random
6060 for (; __first != __last; ++__first)
6161 if (std::__invoke(__comp, std::__invoke(__proj1, *__first), std::__invoke(__proj2, *__result_first))) {
6262 *__result_first = *__first;
63 std::__sift_down<_AlgPolicy>(__result_first, __projected_comp, __len, __result_first);
63 std::__sift_down<_AlgPolicy, false>(__result_first, __projected_comp, __len, 0);
6464 }
6565 std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
6666 }
lib/libcxx/include/__algorithm/pstl.h+9-9
......@@ -115,7 +115,7 @@ template <class _ExecutionPolicy,
115115 class _Predicate,
116116 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
117117 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
118_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
118[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __iterator_difference_type<_ForwardIterator>
119119count_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
120120 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
121121 _ForwardIterator, "count_if(first, last, pred) requires [first, last) to be ForwardIterators");
......@@ -129,7 +129,7 @@ template <class _ExecutionPolicy,
129129 class _Tp,
130130 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
131131 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
132_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
132[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __iterator_difference_type<_ForwardIterator>
133133count(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
134134 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
135135 _ForwardIterator, "count(first, last, val) requires [first, last) to be ForwardIterators");
......@@ -144,7 +144,7 @@ template <class _ExecutionPolicy,
144144 class _Pred,
145145 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
146146 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
147_LIBCPP_HIDE_FROM_ABI bool
147[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
148148equal(_ExecutionPolicy&& __policy,
149149 _ForwardIterator1 __first1,
150150 _ForwardIterator1 __last1,
......@@ -166,7 +166,7 @@ template <class _ExecutionPolicy,
166166 class _ForwardIterator2,
167167 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
168168 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
169_LIBCPP_HIDE_FROM_ABI bool
169[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
170170equal(_ExecutionPolicy&& __policy, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
171171 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
172172 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
......@@ -185,7 +185,7 @@ template <class _ExecutionPolicy,
185185 class _Pred,
186186 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
187187 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
188_LIBCPP_HIDE_FROM_ABI bool
188[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
189189equal(_ExecutionPolicy&& __policy,
190190 _ForwardIterator1 __first1,
191191 _ForwardIterator1 __last1,
......@@ -209,7 +209,7 @@ template <class _ExecutionPolicy,
209209 class _ForwardIterator2,
210210 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
211211 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
212_LIBCPP_HIDE_FROM_ABI bool
212[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
213213equal(_ExecutionPolicy&& __policy,
214214 _ForwardIterator1 __first1,
215215 _ForwardIterator1 __last1,
......@@ -259,7 +259,7 @@ template <class _ExecutionPolicy,
259259 class _Predicate,
260260 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
261261 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
262_LIBCPP_HIDE_FROM_ABI _ForwardIterator
262[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator
263263find_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
264264 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if requires ForwardIterators");
265265 using _Implementation = __pstl::__dispatch<__pstl::__find_if, __pstl::__current_configuration, _RawPolicy>;
......@@ -272,7 +272,7 @@ template <class _ExecutionPolicy,
272272 class _Predicate,
273273 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
274274 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
275_LIBCPP_HIDE_FROM_ABI _ForwardIterator
275[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator
276276find_if_not(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
277277 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if_not requires ForwardIterators");
278278 using _Implementation = __pstl::__dispatch<__pstl::__find_if_not, __pstl::__current_configuration, _RawPolicy>;
......@@ -285,7 +285,7 @@ template <class _ExecutionPolicy,
285285 class _Tp,
286286 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
287287 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
288_LIBCPP_HIDE_FROM_ABI _ForwardIterator
288[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator
289289find(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
290290 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find requires ForwardIterators");
291291 using _Implementation = __pstl::__dispatch<__pstl::__find, __pstl::__current_configuration, _RawPolicy>;
lib/libcxx/include/__algorithm/radix_sort.h+27-25
......@@ -72,14 +72,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
7272#if _LIBCPP_STD_VER >= 14
7373
7474template <class _InputIterator, class _OutputIterator>
75_LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iter_value_type<_InputIterator>>
75_LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iterator_value_type<_InputIterator>>
7676__partial_sum_max(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
7777 if (__first == __last)
7878 return {__result, 0};
7979
80 auto __max = *__first;
81 __iter_value_type<_InputIterator> __sum = *__first;
82 *__result = __sum;
80 auto __max = *__first;
81 __iterator_value_type<_InputIterator> __sum = *__first;
82 *__result = __sum;
8383
8484 while (++__first != __last) {
8585 if (__max < *__first) {
......@@ -124,7 +124,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __nth_radix(size_t __radix_number, _Radix _
124124template <class _ForwardIterator, class _Map, class _RandomAccessIterator>
125125_LIBCPP_HIDE_FROM_ABI constexpr void
126126__collect(_ForwardIterator __first, _ForwardIterator __last, _Map __map, _RandomAccessIterator __counters) {
127 using __value_type = __iter_value_type<_ForwardIterator>;
127 using __value_type = __iterator_value_type<_ForwardIterator>;
128128 using __traits = __counting_sort_traits<__value_type, _Map>;
129129
130130 std::for_each(__first, __last, [&__counters, &__map](const auto& __preimage) { ++__counters[__map(__preimage)]; });
......@@ -160,7 +160,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __collect_impl(
160160 _RandomAccessIterator1 __counters,
161161 _RandomAccessIterator2 __maximums,
162162 index_sequence<_Radices...>) {
163 using __value_type = __iter_value_type<_ForwardIterator>;
163 using __value_type = __iterator_value_type<_ForwardIterator>;
164164 constexpr auto __radix_value_range = __radix_sort_traits<__value_type, _Map, _Radix>::__radix_value_range;
165165
166166 auto __previous = numeric_limits<__invoke_result_t<_Map, __value_type>>::min();
......@@ -189,7 +189,7 @@ __collect(_ForwardIterator __first,
189189 _Radix __radix,
190190 _RandomAccessIterator1 __counters,
191191 _RandomAccessIterator2 __maximums) {
192 using __value_type = __iter_value_type<_ForwardIterator>;
192 using __value_type = __iterator_value_type<_ForwardIterator>;
193193 constexpr auto __radix_count = __radix_sort_traits<__value_type, _Map, _Radix>::__radix_count;
194194 return std::__collect_impl(
195195 __first, __last, __map, __radix, __counters, __maximums, make_index_sequence<__radix_count>());
......@@ -213,10 +213,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __dispose_backward(
213213template <class _ForwardIterator, class _RandomAccessIterator, class _Map>
214214_LIBCPP_HIDE_FROM_ABI constexpr _RandomAccessIterator
215215__counting_sort_impl(_ForwardIterator __first, _ForwardIterator __last, _RandomAccessIterator __result, _Map __map) {
216 using __value_type = __iter_value_type<_ForwardIterator>;
216 using __value_type = __iterator_value_type<_ForwardIterator>;
217217 using __traits = __counting_sort_traits<__value_type, _Map>;
218218
219 __iter_diff_t<_RandomAccessIterator> __counters[__traits::__value_range + 1] = {0};
219 __iterator_difference_type<_RandomAccessIterator> __counters[__traits::__value_range + 1] = {0};
220220
221221 std::__collect(__first, __last, __map, std::next(std::begin(__counters)));
222222 std::__dispose(__first, __last, __result, __map, std::begin(__counters));
......@@ -224,12 +224,13 @@ __counting_sort_impl(_ForwardIterator __first, _ForwardIterator __last, _RandomA
224224 return __result + __counters[__traits::__value_range];
225225}
226226
227template <class _RandomAccessIterator1,
228 class _RandomAccessIterator2,
229 class _Map,
230 class _Radix,
231 enable_if_t< __radix_sort_traits<__iter_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count == 1,
232 int> = 0>
227template <
228 class _RandomAccessIterator1,
229 class _RandomAccessIterator2,
230 class _Map,
231 class _Radix,
232 enable_if_t<__radix_sort_traits<__iterator_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count == 1,
233 int> = 0>
233234_LIBCPP_HIDE_FROM_ABI constexpr void __radix_sort_impl(
234235 _RandomAccessIterator1 __first,
235236 _RandomAccessIterator1 __last,
......@@ -243,24 +244,25 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __radix_sort_impl(
243244 std::move(__buffer, __buffer_end, __first);
244245}
245246
246template <
247 class _RandomAccessIterator1,
248 class _RandomAccessIterator2,
249 class _Map,
250 class _Radix,
251 enable_if_t< __radix_sort_traits<__iter_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count % 2 == 0,
252 int> = 0 >
247template <class _RandomAccessIterator1,
248 class _RandomAccessIterator2,
249 class _Map,
250 class _Radix,
251 enable_if_t<
252 __radix_sort_traits<__iterator_value_type<_RandomAccessIterator1>, _Map, _Radix>::__radix_count % 2 == 0,
253 int> = 0>
253254_LIBCPP_HIDE_FROM_ABI constexpr void __radix_sort_impl(
254255 _RandomAccessIterator1 __first,
255256 _RandomAccessIterator1 __last,
256257 _RandomAccessIterator2 __buffer_begin,
257258 _Map __map,
258259 _Radix __radix) {
259 using __value_type = __iter_value_type<_RandomAccessIterator1>;
260 using __value_type = __iterator_value_type<_RandomAccessIterator1>;
260261 using __traits = __radix_sort_traits<__value_type, _Map, _Radix>;
261262
262 __iter_diff_t<_RandomAccessIterator1> __counters[__traits::__radix_count][__traits::__radix_value_range] = {{0}};
263 __iter_diff_t<_RandomAccessIterator1> __maximums[__traits::__radix_count] = {0};
263 __iterator_difference_type<_RandomAccessIterator1>
264 __counters[__traits::__radix_count][__traits::__radix_value_range] = {{0}};
265 __iterator_difference_type<_RandomAccessIterator1> __maximums[__traits::__radix_count] = {0};
264266 const auto __is_sorted = std::__collect(__first, __last, __map, __radix, __counters, __maximums);
265267 if (!__is_sorted) {
266268 const auto __range_size = std::distance(__first, __last);
lib/libcxx/include/__algorithm/ranges_copy_n.h+3-26
......@@ -9,16 +9,12 @@
99#ifndef _LIBCPP___ALGORITHM_RANGES_COPY_N_H
1010#define _LIBCPP___ALGORITHM_RANGES_COPY_N_H
1111
12#include <__algorithm/copy.h>
12#include <__algorithm/copy_n.h>
1313#include <__algorithm/in_out_result.h>
1414#include <__algorithm/iterator_operations.h>
15#include <__algorithm/ranges_copy.h>
1615#include <__config>
17#include <__functional/identity.h>
1816#include <__iterator/concepts.h>
1917#include <__iterator/incrementable_traits.h>
20#include <__iterator/unreachable_sentinel.h>
21#include <__iterator/wrap_iter.h>
2218#include <__utility/move.h>
2319
2420#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -37,32 +33,13 @@ namespace ranges {
3733template <class _Ip, class _Op>
3834using copy_n_result = in_out_result<_Ip, _Op>;
3935
40// TODO: Merge this with copy_n
4136struct __copy_n {
42 template <class _InIter, class _DiffType, class _OutIter>
43 _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
44 __go(_InIter __first, _DiffType __n, _OutIter __result) {
45 while (__n != 0) {
46 *__result = *__first;
47 ++__first;
48 ++__result;
49 --__n;
50 }
51 return {std::move(__first), std::move(__result)};
52 }
53
54 template <random_access_iterator _InIter, class _DiffType, random_access_iterator _OutIter>
55 _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
56 __go(_InIter __first, _DiffType __n, _OutIter __result) {
57 auto __ret = std::__copy(__first, __first + __n, __result);
58 return {__ret.first, __ret.second};
59 }
60
6137 template <input_iterator _Ip, weakly_incrementable _Op>
6238 requires indirectly_copyable<_Ip, _Op>
6339 _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op>
6440 operator()(_Ip __first, iter_difference_t<_Ip> __n, _Op __result) const {
65 return __go(std::move(__first), __n, std::move(__result));
41 auto __res = std::__copy_n<_RangeAlgPolicy>(std::move(__first), __n, std::move(__result));
42 return {std::move(__res.first), std::move(__res.second)};
6643 }
6744};
6845
lib/libcxx/include/__algorithm/ranges_equal.h+17-26
......@@ -13,13 +13,12 @@
1313#include <__algorithm/unwrap_range.h>
1414#include <__config>
1515#include <__functional/identity.h>
16#include <__functional/invoke.h>
1716#include <__functional/ranges_operations.h>
1817#include <__iterator/concepts.h>
19#include <__iterator/distance.h>
2018#include <__iterator/indirectly_comparable.h>
2119#include <__ranges/access.h>
2220#include <__ranges/concepts.h>
21#include <__ranges/size.h>
2322#include <__utility/move.h>
2423
2524#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -51,20 +50,17 @@ struct __equal {
5150 _Pred __pred = {},
5251 _Proj1 __proj1 = {},
5352 _Proj2 __proj2 = {}) const {
54 if constexpr (sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>) {
53 static constexpr bool __both_sized = sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>;
54 if constexpr (__both_sized) {
5555 if (__last1 - __first1 != __last2 - __first2)
5656 return false;
5757 }
58 auto __unwrapped1 = std::__unwrap_range(std::move(__first1), std::move(__last1));
59 auto __unwrapped2 = std::__unwrap_range(std::move(__first2), std::move(__last2));
60 return std::__equal_impl(
61 std::move(__unwrapped1.first),
62 std::move(__unwrapped1.second),
63 std::move(__unwrapped2.first),
64 std::move(__unwrapped2.second),
65 __pred,
66 __proj1,
67 __proj2);
58
59 auto [__ufirst1, __ulast1] = std::__unwrap_range(std::move(__first1), std::move(__last1));
60 auto [__ufirst2, __ulast2] = std::__unwrap_range(std::move(__first2), std::move(__last2));
61
62 return std::__equal_impl<__both_sized>(
63 std::move(__ufirst1), std::move(__ulast1), std::move(__ufirst2), std::move(__ulast2), __pred, __proj1, __proj2);
6864 }
6965
7066 template <input_range _Range1,
......@@ -75,21 +71,16 @@ struct __equal {
7571 requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
7672 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
7773 _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
78 if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
79 if (ranges::distance(__range1) != ranges::distance(__range2))
74 static constexpr bool __both_sized = sized_range<_Range1> && sized_range<_Range2>;
75 if constexpr (__both_sized) {
76 if (ranges::size(__range1) != ranges::size(__range2))
8077 return false;
8178 }
82 auto __unwrapped1 = std::__unwrap_range(ranges::begin(__range1), ranges::end(__range1));
83 auto __unwrapped2 = std::__unwrap_range(ranges::begin(__range2), ranges::end(__range2));
84 return std::__equal_impl(
85 std::move(__unwrapped1.first),
86 std::move(__unwrapped1.second),
87 std::move(__unwrapped2.first),
88 std::move(__unwrapped2.second),
89 __pred,
90 __proj1,
91 __proj2);
92 return false;
79
80 auto [__ufirst1, __ulast1] = std::__unwrap_range(ranges::begin(__range1), ranges::end(__range1));
81 auto [__ufirst2, __ulast2] = std::__unwrap_range(ranges::begin(__range2), ranges::end(__range2));
82 return std::__equal_impl<__both_sized>(
83 std::move(__ufirst1), std::move(__ulast1), std::move(__ufirst2), std::move(__ulast2), __pred, __proj1, __proj2);
9384 }
9485};
9586
lib/libcxx/include/__algorithm/ranges_fill.h+7-6
......@@ -9,12 +9,14 @@
99#ifndef _LIBCPP___ALGORITHM_RANGES_FILL_H
1010#define _LIBCPP___ALGORITHM_RANGES_FILL_H
1111
12#include <__algorithm/ranges_fill_n.h>
12#include <__algorithm/fill.h>
13#include <__algorithm/fill_n.h>
1314#include <__config>
1415#include <__iterator/concepts.h>
1516#include <__ranges/access.h>
1617#include <__ranges/concepts.h>
1718#include <__ranges/dangling.h>
19#include <__utility/move.h>
1820
1921#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2022# pragma GCC system_header
......@@ -31,12 +33,11 @@ namespace ranges {
3133struct __fill {
3234 template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent>
3335 _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
34 if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
35 return ranges::fill_n(__first, __last - __first, __value);
36 if constexpr (sized_sentinel_for<_Sent, _Iter>) {
37 auto __n = __last - __first;
38 return std::__fill_n(std::move(__first), __n, __value);
3639 } else {
37 for (; __first != __last; ++__first)
38 *__first = __value;
39 return __first;
40 return std::__fill(std::move(__first), std::move(__last), __value);
4041 }
4142 }
4243
lib/libcxx/include/__algorithm/ranges_for_each.h+9-1
......@@ -12,6 +12,7 @@
1212#include <__algorithm/for_each.h>
1313#include <__algorithm/for_each_n.h>
1414#include <__algorithm/in_fun_result.h>
15#include <__algorithm/specialized_algorithms.h>
1516#include <__concepts/assignable.h>
1617#include <__config>
1718#include <__functional/identity.h>
......@@ -20,6 +21,7 @@
2021#include <__ranges/access.h>
2122#include <__ranges/concepts.h>
2223#include <__ranges/dangling.h>
24#include <__type_traits/remove_cvref.h>
2325#include <__utility/move.h>
2426
2527#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -71,7 +73,13 @@ public:
7173 indirectly_unary_invocable<projected<iterator_t<_Range>, _Proj>> _Func>
7274 _LIBCPP_HIDE_FROM_ABI constexpr for_each_result<borrowed_iterator_t<_Range>, _Func>
7375 operator()(_Range&& __range, _Func __func, _Proj __proj = {}) const {
74 return __for_each_impl(ranges::begin(__range), ranges::end(__range), __func, __proj);
76 using _SpecialAlg = __specialized_algorithm<_Algorithm::__for_each, __single_range<remove_cvref_t<_Range>>>;
77 if constexpr (_SpecialAlg::__has_algorithm) {
78 auto [__iter, __func2] = _SpecialAlg()(__range, std::move(__func), std::move(__proj));
79 return {std::move(__iter), std::move(__func)};
80 } else {
81 return __for_each_impl(ranges::begin(__range), ranges::end(__range), __func, __proj);
82 }
7583 }
7684};
7785
lib/libcxx/include/__algorithm/ranges_generate_n.h+2-6
......@@ -9,6 +9,7 @@
99#ifndef _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
1010#define _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
1111
12#include <__algorithm/generate_n.h>
1213#include <__concepts/constructible.h>
1314#include <__concepts/invocable.h>
1415#include <__config>
......@@ -38,12 +39,7 @@ struct __generate_n {
3839 requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
3940 _LIBCPP_HIDE_FROM_ABI constexpr _OutIter
4041 operator()(_OutIter __first, iter_difference_t<_OutIter> __n, _Func __gen) const {
41 for (; __n > 0; --__n) {
42 *__first = __gen();
43 ++__first;
44 }
45
46 return __first;
42 return std::__generate_n(std::move(__first), __n, __gen);
4743 }
4844};
4945
lib/libcxx/include/__algorithm/ranges_search_n.h+2-2
......@@ -54,8 +54,8 @@ struct __search_n {
5454 }
5555
5656 if constexpr (random_access_iterator<_Iter1>) {
57 auto __ret = std::__search_n_random_access_impl<_RangeAlgPolicy>(
58 __first, __last, __count, __value, __pred, __proj, __size);
57 auto __ret =
58 std::__search_n_random_access_impl<_RangeAlgPolicy>(__first, __count, __value, __pred, __proj, __size);
5959 return {std::move(__ret.first), std::move(__ret.second)};
6060 }
6161 }
lib/libcxx/include/__algorithm/rotate.h+27-44
......@@ -12,16 +12,13 @@
1212#include <__algorithm/copy.h>
1313#include <__algorithm/copy_backward.h>
1414#include <__algorithm/iterator_operations.h>
15#include <__algorithm/min.h>
1516#include <__algorithm/move.h>
1617#include <__algorithm/move_backward.h>
1718#include <__algorithm/swap_ranges.h>
1819#include <__config>
19#include <__cstddef/size_t.h>
2020#include <__fwd/bit_reference.h>
2121#include <__iterator/iterator_traits.h>
22#include <__memory/construct_at.h>
23#include <__memory/pointer_traits.h>
24#include <__type_traits/is_constant_evaluated.h>
2522#include <__type_traits/is_trivially_assignable.h>
2623#include <__utility/move.h>
2724#include <__utility/pair.h>
......@@ -89,46 +86,32 @@ __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIt
8986 return __r;
9087}
9188
92template <typename _Integral>
93inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Integral __algo_gcd(_Integral __x, _Integral __y) {
94 do {
95 _Integral __t = __x % __y;
96 __x = __y;
97 __y = __t;
98 } while (__y);
99 return __x;
100}
101
102template <class _AlgPolicy, typename _RandomAccessIterator>
103_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _RandomAccessIterator
104__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) {
105 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
106 typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
107 using _Ops = _IterOps<_AlgPolicy>;
108
109 const difference_type __m1 = __middle - __first;
110 const difference_type __m2 = _Ops::distance(__middle, __last);
111 if (__m1 == __m2) {
112 std::__swap_ranges<_AlgPolicy>(__first, __middle, __middle, __last);
113 return __middle;
114 }
115 const difference_type __g = std::__algo_gcd(__m1, __m2);
116 for (_RandomAccessIterator __p = __first + __g; __p != __first;) {
117 value_type __t(_Ops::__iter_move(--__p));
118 _RandomAccessIterator __p1 = __p;
119 _RandomAccessIterator __p2 = __p1 + __m1;
120 do {
121 *__p1 = _Ops::__iter_move(__p2);
122 __p1 = __p2;
123 const difference_type __d = _Ops::distance(__p2, __last);
124 if (__m1 < __d)
125 __p2 += __m1;
126 else
127 __p2 = __first + (__m1 - __d);
128 } while (__p2 != __p);
129 *__p1 = std::move(__t);
89template <class _AlgPolicy, class _Iter, class _Sent>
90_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter
91__rotate_random_access(_Iter __first, _Iter __middle, _Sent __sent) {
92 auto __left = _IterOps<_AlgPolicy>::distance(__first, __middle);
93 auto __right = _IterOps<_AlgPolicy>::distance(__middle, __sent);
94 auto __last = __first + __right;
95
96 auto __min_len = std::min(__left, __right);
97
98 while (__min_len > 0) {
99 if (__left <= __right) {
100 do {
101 std::__swap_ranges<_AlgPolicy>(__first, __first + __left, __first + __left);
102 __first += __left;
103 __right -= __left;
104 } while (__left <= __right);
105 __min_len = __right;
106 } else {
107 do {
108 std::__swap_ranges<_AlgPolicy>(__first + (__left - __right), __first + __left, __first + __left);
109 __left -= __right;
110 } while (__left > __right);
111 __min_len = __left;
112 }
130113 }
131 return __first + __m2;
114 return __last;
132115}
133116
134117template <class _AlgPolicy, class _ForwardIterator>
......@@ -170,7 +153,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator
170153 return std::__rotate_left<_AlgPolicy>(__first, __last);
171154 if (_IterOps<_AlgPolicy>::next(__middle) == __last)
172155 return std::__rotate_right<_AlgPolicy>(__first, __last);
173 return std::__rotate_gcd<_AlgPolicy>(__first, __middle, __last);
156 return std::__rotate_random_access<_AlgPolicy>(__first, __middle, __last);
174157 }
175158 return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
176159}
lib/libcxx/include/__algorithm/search_n.h+49-37
......@@ -14,11 +14,7 @@
1414#include <__algorithm/iterator_operations.h>
1515#include <__config>
1616#include <__functional/identity.h>
17#include <__iterator/advance.h>
18#include <__iterator/concepts.h>
19#include <__iterator/distance.h>
2017#include <__iterator/iterator_traits.h>
21#include <__ranges/concepts.h>
2218#include <__type_traits/enable_if.h>
2319#include <__type_traits/invoke.h>
2420#include <__type_traits/is_callable.h>
......@@ -68,44 +64,60 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> __search_
6864 }
6965}
7066
71template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj, class _DiffT>
67// Finds the longest suffix in [__first, __last) where each element satisfies __pred.
68template <class _RAIter, class _Pred, class _Proj, class _ValueT>
69_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RAIter
70__find_longest_suffix(_RAIter __first, _RAIter __last, const _ValueT& __value, _Pred& __pred, _Proj& __proj) {
71 while (__first != __last) {
72 if (!std::__invoke(__pred, std::__invoke(__proj, *--__last), __value)) {
73 return ++__last;
74 }
75 }
76 return __first;
77}
78
79template <class _AlgPolicy, class _Pred, class _Iter, class _SizeT, class _Type, class _Proj, class _DiffT>
7280_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 std::pair<_Iter, _Iter> __search_n_random_access_impl(
73 _Iter __first, _Sent __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj, _DiffT __size1) {
74 using difference_type = typename iterator_traits<_Iter>::difference_type;
81 _Iter __first, _SizeT __count_in, const _Type& __value, _Pred& __pred, _Proj& __proj, _DiffT __size) {
82 auto __last = __first + __size;
83 auto __count = static_cast<_DiffT>(__count_in);
84
7585 if (__count == 0)
7686 return std::make_pair(__first, __first);
77 if (__size1 < static_cast<_DiffT>(__count)) {
78 _IterOps<_AlgPolicy>::__advance_to(__first, __last);
79 return std::make_pair(__first, __first);
80 }
87 if (__size < __count)
88 return std::make_pair(__last, __last);
89
90 // [__match_start, __match_start + __count) is the subrange which we currently check whether it only contains matching
91 // elements. This subrange is returned in case all the elements match.
92 // [__match_start, __matched_until) is the longest subrange where all elements are known to match at any given point
93 // in time.
94 // [__matched_until, __match_start + __count) is the subrange where we don't know whether the elements match.
95
96 // This algorithm tries to expand the subrange [__match_start, __matched_until) into a range of sufficient length.
97 // When we fail to do that because we find a mismatching element, we move it forward to the beginning of the next
98 // consecutive sequence that is not known not to match.
99
100 const _Iter __try_match_until = __last - __count;
101 _Iter __match_start = __first;
102 _Iter __matched_until = __first;
81103
82 const auto __s = __first + __size1 - difference_type(__count - 1); // Start of pattern match can't go beyond here
83104 while (true) {
84 // Find first element in sequence that matchs __value, with a mininum of loop checks
85 while (true) {
86 if (__first >= __s) { // return __last if no element matches __value
87 _IterOps<_AlgPolicy>::__advance_to(__first, __last);
88 return std::make_pair(__first, __first);
89 }
90 if (std::__invoke(__pred, std::__invoke(__proj, *__first), __value))
91 break;
92 ++__first;
93 }
94 // *__first matches __value_, now match elements after here
95 auto __m = __first;
96 _SizeT __c(0);
97 while (true) {
98 if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
99 return std::make_pair(__first, __first + _DiffT(__count));
100 ++__m; // no need to check range on __m because __s guarantees we have enough source
105 // There's no chance of expanding the subrange into a sequence of sufficient length, since we don't have enough
106 // elements in the haystack anymore.
107 if (__match_start > __try_match_until)
108 return std::make_pair(__last, __last);
101109
102 // if there is a mismatch, restart with a new __first
103 if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value)) {
104 __first = __m;
105 ++__first;
106 break;
107 } // else there is a match, check next elements
108 }
110 auto __mismatch = std::__find_longest_suffix(__matched_until, __match_start + __count, __value, __pred, __proj);
111
112 // If all elements in [__matched_until, __match_start + __count) match, we know that
113 // [__match_start, __match_start + __count) is a full sequence of matching elements, so we're done.
114 if (__mismatch == __matched_until)
115 return std::make_pair(__match_start, __match_start + __count);
116
117 // Otherwise, we have to move the [__match_start, __matched_until) subrange forward past the point where we know for
118 // sure a match is impossible.
119 __matched_until = __match_start + __count;
120 __match_start = __mismatch;
109121 }
110122}
111123
......@@ -119,7 +131,7 @@ template <class _Iter,
119131_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter>
120132__search_n_impl(_Iter __first, _Sent __last, _DiffT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) {
121133 return std::__search_n_random_access_impl<_ClassicAlgPolicy>(
122 __first, __last, __count, __value, __pred, __proj, __last - __first);
134 __first, __count, __value, __pred, __proj, __last - __first);
123135}
124136
125137template <class _Iter1,
lib/libcxx/include/__algorithm/sift_down.h+19-18
......@@ -24,59 +24,60 @@ _LIBCPP_PUSH_MACROS
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
2626
27template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
27template <class _AlgPolicy, bool __assume_both_children, class _Compare, class _RandomAccessIterator>
2828_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
2929__sift_down(_RandomAccessIterator __first,
3030 _Compare&& __comp,
31 typename iterator_traits<_RandomAccessIterator>::difference_type __len,
32 _RandomAccessIterator __start) {
31 __iterator_difference_type<_RandomAccessIterator> __len,
32 __iterator_difference_type<_RandomAccessIterator> __start) {
3333 using _Ops = _IterOps<_AlgPolicy>;
3434
3535 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
3636 typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
3737 // left-child of __start is at 2 * __start + 1
3838 // right-child of __start is at 2 * __start + 2
39 difference_type __child = __start - __first;
39 difference_type __child = __start;
4040
4141 if (__len < 2 || (__len - 2) / 2 < __child)
4242 return;
4343
44 __child = 2 * __child + 1;
45 _RandomAccessIterator __child_i = __first + __child;
44 __child = 2 * __child + 1;
4645
47 if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
46 if _LIBCPP_CONSTEXPR (__assume_both_children) {
47 // right-child exists and is greater than left-child
48 __child += __comp(__first[__child], __first[__child + 1]);
49 } else if ((__child + 1) < __len && __comp(__first[__child], __first[__child + 1])) {
4850 // right-child exists and is greater than left-child
49 ++__child_i;
5051 ++__child;
5152 }
5253
5354 // check if we are in heap-order
54 if (__comp(*__child_i, *__start))
55 if (__comp(__first[__child], __first[__start]))
5556 // we are, __start is larger than its largest child
5657 return;
5758
58 value_type __top(_Ops::__iter_move(__start));
59 value_type __top(_Ops::__iter_move(__first + __start));
5960 do {
6061 // we are not in heap-order, swap the parent with its largest child
61 *__start = _Ops::__iter_move(__child_i);
62 __start = __child_i;
62 __first[__start] = _Ops::__iter_move(__first + __child);
63 __start = __child;
6364
6465 if ((__len - 2) / 2 < __child)
6566 break;
6667
6768 // recompute the child based off of the updated parent
68 __child = 2 * __child + 1;
69 __child_i = __first + __child;
69 __child = 2 * __child + 1;
7070
71 if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
71 if _LIBCPP_CONSTEXPR (__assume_both_children) {
72 __child += __comp(__first[__child], __first[__child + 1]);
73 } else if ((__child + 1) < __len && __comp(__first[__child], __first[__child + 1])) {
7274 // right-child exists and is greater than left-child
73 ++__child_i;
7475 ++__child;
7576 }
7677
7778 // check if we are in heap-order
78 } while (!__comp(*__child_i, __top));
79 *__start = std::move(__top);
79 } while (!__comp(__first[__child], __top));
80 __first[__start] = std::move(__top);
8081}
8182
8283template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
lib/libcxx/include/__algorithm/simd_utils.h+33-4
......@@ -26,9 +26,7 @@ _LIBCPP_PUSH_MACROS
2626#include <__undef_macros>
2727
2828// TODO: Find out how altivec changes things and allow vectorizations there too.
29// TODO: Simplify this condition once we stop building with AppleClang 15 in the CI.
30#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(__ALTIVEC__) && \
31 !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1600)
29#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(__ALTIVEC__)
3230# define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 1
3331#else
3432# define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 0
......@@ -116,16 +114,47 @@ template <class _VecT, class _Iter>
116114 }(make_index_sequence<__simd_vector_size_v<_VecT>>{});
117115}
118116
117// Load the first _Np elements, zero the rest
118_LIBCPP_DIAGNOSTIC_PUSH
119_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi")
120template <class _VecT, size_t _Np, class _Iter>
121[[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT __partial_load(_Iter __iter) noexcept {
122 return [=]<size_t... _LoadIndices, size_t... _ZeroIndices>(
123 index_sequence<_LoadIndices...>, index_sequence<_ZeroIndices...>) _LIBCPP_ALWAYS_INLINE noexcept {
124 return _VecT{__iter[_LoadIndices]..., ((void)_ZeroIndices, 0)...};
125 }(make_index_sequence<_Np>{}, make_index_sequence<__simd_vector_size_v<_VecT> - _Np>{});
126}
127
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
138template <class _Tp, size_t _Np>
139[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __any_of(__simd_vector<_Tp, _Np> __vec) noexcept {
140 return __builtin_reduce_or(__builtin_convertvector(__vec, __simd_vector<bool, _Np>));
141}
142
119143template <class _Tp, size_t _Np>
120144[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __all_of(__simd_vector<_Tp, _Np> __vec) noexcept {
121145 return __builtin_reduce_and(__builtin_convertvector(__vec, __simd_vector<bool, _Np>));
122146}
123147
148template <class _Tp, size_t _Np>
149[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __none_of(__simd_vector<_Tp, _Np> __vec) noexcept {
150 return !__builtin_reduce_or(__builtin_convertvector(__vec, __simd_vector<bool, _Np>));
151}
152
124153template <class _Tp, size_t _Np>
125154[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t __find_first_set(__simd_vector<_Tp, _Np> __vec) noexcept {
126155 using __mask_vec = __simd_vector<bool, _Np>;
127156
128 // This has MSan disabled du to https://github.com/llvm/llvm-project/issues/85876
157 // This has MSan disabled du to https://llvm.org/PR85876
129158 auto __impl = [&]<class _MaskT>(_MaskT) _LIBCPP_NO_SANITIZE("memory") noexcept {
130159# if defined(_LIBCPP_BIG_ENDIAN)
131160 return std::min<size_t>(
lib/libcxx/include/__algorithm/specialized_algorithms.h 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#ifndef _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H
10#define _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_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
20namespace _Algorithm {
21struct __copy {};
22struct __fill_n {};
23struct __for_each {};
24} // namespace _Algorithm
25
26template <class>
27struct __single_iterator;
28
29template <class, class>
30struct __iterator_pair;
31
32template <class>
33struct __single_range;
34
35// This struct allows specializing algorithms for specific arguments. This is useful when we know a more efficient
36// algorithm implementation for e.g. library-defined iterators. _Alg is one of tags defined inside the _Algorithm
37// namespace above. _Ranges is an essentially arbitrary subset of the arguments to the algorithm that are used for
38// dispatching. This set is specific to the algorithm: look at each algorithm to see which arguments they use for
39// dispatching to specialized algorithms.
40//
41// A specialization of `__specialized_algorithm` has to define `__has_algorithm` to true for the specialized algorithm
42// to be used. This is intended for cases where iterators can do generic unwrapping and forward to a different
43// specialization of `__specialized_algorithm`.
44//
45// If __has_algorithm is true, there has to be an operator() which will get called with the actual arguments to the
46// algorithm.
47template <class _Alg, class... _Ranges>
48struct __specialized_algorithm {
49 static const bool __has_algorithm = false;
50};
51
52_LIBCPP_END_NAMESPACE_STD
53
54#endif // _LIBCPP___ALGORITHM_SPECIALIZED_ALGORITHMS_H
lib/libcxx/include/__algorithm/stable_sort.h+1-1
......@@ -247,7 +247,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void __stable_sort(
247247 constexpr auto __default_comp = __desugars_to_v<__less_tag, _Compare, value_type, value_type >;
248248 constexpr auto __radix_sortable =
249249 __is_ordered_integer_representable_v<value_type> &&
250 is_same_v< value_type&, __iter_reference<_RandomAccessIterator>>;
250 is_same_v< value_type&, __iterator_reference<_RandomAccessIterator>>;
251251 if constexpr (__default_comp && __radix_sortable) {
252252 if (__len <= __buff_size && __len >= static_cast<difference_type>(std::__radix_sort_min_bound<value_type>()) &&
253253 __len <= static_cast<difference_type>(std::__radix_sort_max_bound<value_type>())) {
lib/libcxx/include/__assertion_handler+31-4
......@@ -16,6 +16,7 @@
1616# include <__cxx03/__verbose_trap>
1717#else
1818# include <__config>
19# include <__log_hardening_failure>
1920# include <__verbose_abort>
2021# include <__verbose_trap>
2122#endif
......@@ -24,14 +25,40 @@
2425# pragma GCC system_header
2526#endif
2627
27#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
28#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
2829
29# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
30// Keep the old implementation that doesn't support assertion semantics for backward compatibility with the frozen C++03
31// mode.
32# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
33# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
34# else
35# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)
36# endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
3037
3138#else
3239
33# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)
40# if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE
41# define _LIBCPP_ASSERTION_HANDLER(message) ((void)0)
42
43# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
44# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_LOG_HARDENING_FAILURE(message)
45
46# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
47# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)
48
49# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
50# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
51
52# else
53
54# error _LIBCPP_ASSERTION_SEMANTIC must be set to one of the following values: \
55_LIBCPP_ASSERTION_SEMANTIC_IGNORE, \
56_LIBCPP_ASSERTION_SEMANTIC_OBSERVE, \
57_LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE, \
58_LIBCPP_ASSERTION_SEMANTIC_ENFORCE
59
60# endif // _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE
3461
35#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
62#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
3663
3764#endif // _LIBCPP___ASSERTION_HANDLER
lib/libcxx/include/__atomic/atomic.h+36-60
......@@ -10,7 +10,9 @@
1010#define _LIBCPP___ATOMIC_ATOMIC_H
1111
1212#include <__atomic/atomic_sync.h>
13#include <__atomic/atomic_waitable_traits.h>
1314#include <__atomic/check_memory_order.h>
15#include <__atomic/floating_point_helper.h>
1416#include <__atomic/is_always_lock_free.h>
1517#include <__atomic/memory_order.h>
1618#include <__atomic/support.h>
......@@ -47,10 +49,10 @@ struct __atomic_base // false
4749 static constexpr bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
4850#endif
4951
50 _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT {
52 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT {
5153 return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>));
5254 }
53 _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const _NOEXCEPT {
55 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const _NOEXCEPT {
5456 return static_cast<__atomic_base const volatile*>(this)->is_lock_free();
5557 }
5658 _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
......@@ -61,11 +63,11 @@ struct __atomic_base // false
6163 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
6264 std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
6365 }
64 _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
66 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
6567 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
6668 return std::__cxx_atomic_load(std::addressof(__a_), __m);
6769 }
68 _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
70 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
6971 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
7072 return std::__cxx_atomic_load(std::addressof(__a_), __m);
7173 }
......@@ -113,22 +115,16 @@ struct __atomic_base // false
113115 }
114116
115117#if _LIBCPP_STD_VER >= 20
116 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const
117 volatile _NOEXCEPT {
118 _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT {
118119 std::__atomic_wait(*this, __v, __m);
119120 }
120 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
121 wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
121 _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
122122 std::__atomic_wait(*this, __v, __m);
123123 }
124 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
125 std::__atomic_notify_one(*this);
126 }
127 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); }
128 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
129 std::__atomic_notify_all(*this);
130 }
131 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); }
124 _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); }
125 _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); }
126 _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { std::__atomic_notify_all(*this); }
127 _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); }
132128#endif // _LIBCPP_STD_VER >= 20
133129
134130#if _LIBCPP_STD_VER >= 20
......@@ -205,12 +201,15 @@ struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> {
205201 _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __op) _NOEXCEPT { return fetch_xor(__op) ^ __op; }
206202};
207203
204#if _LIBCPP_STD_VER >= 20
208205// Here we need _IsIntegral because the default template argument is not enough
209206// e.g __atomic_base<int> is __atomic_base<int, true>, which inherits from
210207// __atomic_base<int, false> and the caller of the wait function is
211208// __atomic_base<int, false>. So specializing __atomic_base<_Tp> does not work
212209template <class _Tp, bool _IsIntegral>
213210struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > {
211 using __value_type _LIBCPP_NODEBUG = _Tp;
212
214213 static _LIBCPP_HIDE_FROM_ABI _Tp __atomic_load(const __atomic_base<_Tp, _IsIntegral>& __a, memory_order __order) {
215214 return __a.load(__order);
216215 }
......@@ -231,6 +230,8 @@ struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > {
231230 }
232231};
233232
233#endif // _LIBCPP_STD_VER >= 20
234
234235template <typename _Tp>
235236struct __check_atomic_mandates {
236237 using type _LIBCPP_NODEBUG = _Tp;
......@@ -324,50 +325,26 @@ struct atomic<_Tp*> : public __atomic_base<_Tp*> {
324325 atomic& operator=(const atomic&) volatile = delete;
325326};
326327
328#if _LIBCPP_STD_VER >= 20
327329template <class _Tp>
328330struct __atomic_waitable_traits<atomic<_Tp> > : __atomic_waitable_traits<__atomic_base<_Tp> > {};
329331
330#if _LIBCPP_STD_VER >= 20
331332template <class _Tp>
332333 requires is_floating_point_v<_Tp>
333334struct atomic<_Tp> : __atomic_base<_Tp> {
334335private:
335 _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_fp80_long_double() {
336 // Only x87-fp80 long double has 64-bit mantissa
337 return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>;
338 }
339
340 _LIBCPP_HIDE_FROM_ABI static constexpr bool __has_rmw_builtin() {
341# ifndef _LIBCPP_COMPILER_CLANG_BASED
342 return false;
343# else
344 // The builtin __cxx_atomic_fetch_add errors during compilation for
345 // long double on platforms with fp80 format.
346 // For more details, see
347 // lib/Sema/SemaChecking.cpp function IsAllowedValueType
348 // LLVM Parser does not allow atomicrmw with x86_fp80 type.
349 // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) &&
350 // &Context.getTargetInfo().getLongDoubleFormat() ==
351 // &llvm::APFloat::x87DoubleExtended())
352 // For more info
353 // https://github.com/llvm/llvm-project/issues/68602
354 // https://reviews.llvm.org/D53965
355 return !__is_fp80_long_double();
356# endif
357 }
358
359336 template <class _This, class _Operation, class _BuiltinOp>
360337 _LIBCPP_HIDE_FROM_ABI static _Tp
361338 __rmw_op(_This&& __self, _Tp __operand, memory_order __m, _Operation __operation, _BuiltinOp __builtin_op) {
362 if constexpr (__has_rmw_builtin()) {
339 if constexpr (std::__has_rmw_builtin<_Tp>()) {
363340 return __builtin_op(std::addressof(std::forward<_This>(__self).__a_), __operand, __m);
364341 } else {
365342 _Tp __old = __self.load(memory_order_relaxed);
366343 _Tp __new = __operation(__old, __operand);
367344 while (!__self.compare_exchange_weak(__old, __new, __m, memory_order_relaxed)) {
368345# ifdef _LIBCPP_COMPILER_CLANG_BASED
369 if constexpr (__is_fp80_long_double()) {
370 // https://github.com/llvm/llvm-project/issues/47978
346 if constexpr (std::__is_fp80_long_double<_Tp>()) {
347 // https://llvm.org/PR47978
371348 // clang bug: __old is not updated on failure for atomic<long double>::compare_exchange_weak
372349 // Note __old = __self.load(memory_order_relaxed) will not work
373350 std::__cxx_atomic_load_inplace(std::addressof(__self.__a_), std::addressof(__old), memory_order_relaxed);
......@@ -462,12 +439,12 @@ public:
462439// atomic_is_lock_free
463440
464441template <class _Tp>
465_LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT {
442[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT {
466443 return __o->is_lock_free();
467444}
468445
469446template <class _Tp>
470_LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT {
447[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT {
471448 return __o->is_lock_free();
472449}
473450
......@@ -516,25 +493,25 @@ atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, me
516493// atomic_load
517494
518495template <class _Tp>
519_LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT {
496[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT {
520497 return __o->load();
521498}
522499
523500template <class _Tp>
524_LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const atomic<_Tp>* __o) _NOEXCEPT {
501[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const atomic<_Tp>* __o) _NOEXCEPT {
525502 return __o->load();
526503}
527504
528505// atomic_load_explicit
529506
530507template <class _Tp>
531_LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
532 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
508[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp
509atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
533510 return __o->load(__m);
534511}
535512
536513template <class _Tp>
537_LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
514[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
538515 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
539516 return __o->load(__m);
540517}
......@@ -642,28 +619,27 @@ _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
642619// atomic_wait
643620
644621template <class _Tp>
645_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
622_LIBCPP_HIDE_FROM_ABI void
646623atomic_wait(const volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
647624 return __o->wait(__v);
648625}
649626
650627template <class _Tp>
651_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
652atomic_wait(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
628_LIBCPP_HIDE_FROM_ABI void atomic_wait(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
653629 return __o->wait(__v);
654630}
655631
656632// atomic_wait_explicit
657633
658634template <class _Tp>
659_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
635_LIBCPP_HIDE_FROM_ABI void
660636atomic_wait_explicit(const volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v, memory_order __m) _NOEXCEPT
661637 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
662638 return __o->wait(__v, __m);
663639}
664640
665641template <class _Tp>
666_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
642_LIBCPP_HIDE_FROM_ABI void
667643atomic_wait_explicit(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v, memory_order __m) _NOEXCEPT
668644 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
669645 return __o->wait(__v, __m);
......@@ -672,22 +648,22 @@ atomic_wait_explicit(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __
672648// atomic_notify_one
673649
674650template <class _Tp>
675_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT {
651_LIBCPP_HIDE_FROM_ABI void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT {
676652 __o->notify_one();
677653}
678654template <class _Tp>
679_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT {
655_LIBCPP_HIDE_FROM_ABI void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT {
680656 __o->notify_one();
681657}
682658
683659// atomic_notify_all
684660
685661template <class _Tp>
686_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT {
662_LIBCPP_HIDE_FROM_ABI void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT {
687663 __o->notify_all();
688664}
689665template <class _Tp>
690_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT {
666_LIBCPP_HIDE_FROM_ABI void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT {
691667 __o->notify_all();
692668}
693669
lib/libcxx/include/__atomic/atomic_flag.h+19-37
......@@ -10,6 +10,7 @@
1010#define _LIBCPP___ATOMIC_ATOMIC_FLAG_H
1111
1212#include <__atomic/atomic_sync.h>
13#include <__atomic/atomic_waitable_traits.h>
1314#include <__atomic/contention_t.h>
1415#include <__atomic/memory_order.h>
1516#include <__atomic/support.h>
......@@ -49,22 +50,16 @@ struct atomic_flag {
4950 }
5051
5152#if _LIBCPP_STD_VER >= 20
52 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const
53 volatile _NOEXCEPT {
53 _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT {
5454 std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
5555 }
56 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
57 wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
56 _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
5857 std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
5958 }
60 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
61 std::__atomic_notify_one(*this);
62 }
63 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); }
64 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
65 std::__atomic_notify_all(*this);
66 }
67 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); }
59 _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); }
60 _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); }
61 _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { std::__atomic_notify_all(*this); }
62 _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); }
6863#endif
6964
7065#if _LIBCPP_STD_VER >= 20
......@@ -80,8 +75,11 @@ struct atomic_flag {
8075 atomic_flag& operator=(const atomic_flag&) volatile = delete;
8176};
8277
78#if _LIBCPP_STD_VER >= 20
8379template <>
8480struct __atomic_waitable_traits<atomic_flag> {
81 using __value_type _LIBCPP_NODEBUG = _LIBCPP_ATOMIC_FLAG_TYPE;
82
8583 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE __atomic_load(const atomic_flag& __a, memory_order __order) {
8684 return std::__cxx_atomic_load(&__a.__a_, __order);
8785 }
......@@ -101,6 +99,7 @@ struct __atomic_waitable_traits<atomic_flag> {
10199 return std::addressof(__a.__a_);
102100 }
103101};
102#endif // _LIBCPP_STD_VER >= 20
104103
105104inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT { return __o->test(); }
106105
......@@ -143,43 +142,26 @@ inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(atomic_flag* __o, m
143142}
144143
145144#if _LIBCPP_STD_VER >= 20
146inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
147atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT {
145inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT {
148146 __o->wait(__v);
149147}
150148
151inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
152atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT {
153 __o->wait(__v);
154}
149inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT { __o->wait(__v); }
155150
156inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
151inline _LIBCPP_HIDE_FROM_ABI void
157152atomic_flag_wait_explicit(const volatile atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT {
158153 __o->wait(__v, __m);
159154}
160155
161inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
156inline _LIBCPP_HIDE_FROM_ABI void
162157atomic_flag_wait_explicit(const atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT {
163158 __o->wait(__v, __m);
164159}
165160
166inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
167atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT {
168 __o->notify_one();
169}
170
171inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT {
172 __o->notify_one();
173}
174
175inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
176atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT {
177 __o->notify_all();
178}
179
180inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT {
181 __o->notify_all();
182}
161inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT { __o->notify_one(); }
162inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT { __o->notify_one(); }
163inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT { __o->notify_all(); }
164inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT { __o->notify_all(); }
183165#endif // _LIBCPP_STD_VER >= 20
184166
185167_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__atomic/atomic_ref.h+29-12
......@@ -19,7 +19,9 @@
1919
2020#include <__assert>
2121#include <__atomic/atomic_sync.h>
22#include <__atomic/atomic_waitable_traits.h>
2223#include <__atomic/check_memory_order.h>
24#include <__atomic/floating_point_helper.h>
2325#include <__atomic/memory_order.h>
2426#include <__atomic/to_gcc_order.h>
2527#include <__concepts/arithmetic.h>
......@@ -121,7 +123,9 @@ public:
121123 static constexpr bool is_always_lock_free =
122124 __atomic_always_lock_free(sizeof(_Tp), std::addressof(__get_aligner_instance<required_alignment>::__instance));
123125
124 _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const noexcept { return __atomic_is_lock_free(sizeof(_Tp), __ptr_); }
126 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const noexcept {
127 return __atomic_is_lock_free(sizeof(_Tp), __ptr_);
128 }
125129
126130 _LIBCPP_HIDE_FROM_ABI void store(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept
127131 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__order) {
......@@ -136,7 +140,7 @@ public:
136140 return __desired;
137141 }
138142
139 _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __order = memory_order::seq_cst) const noexcept
143 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __order = memory_order::seq_cst) const noexcept
140144 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__order) {
141145 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
142146 __order == memory_order::relaxed || __order == memory_order::consume || __order == memory_order::acquire ||
......@@ -219,6 +223,9 @@ public:
219223 }
220224 _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); }
221225 _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); }
226# if _LIBCPP_STD_VER >= 26
227 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* address() const noexcept { return __ptr_; }
228# endif
222229
223230protected:
224231 using _Aligned_Tp [[__gnu__::__aligned__(required_alignment), __gnu__::__nodebug__]] = _Tp;
......@@ -229,6 +236,8 @@ protected:
229236
230237template <class _Tp>
231238struct __atomic_waitable_traits<__atomic_ref_base<_Tp>> {
239 using __value_type _LIBCPP_NODEBUG = _Tp;
240
232241 static _LIBCPP_HIDE_FROM_ABI _Tp __atomic_load(const __atomic_ref_base<_Tp>& __a, memory_order __order) {
233242 return __a.load(__order);
234243 }
......@@ -322,20 +331,28 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
322331 atomic_ref& operator=(const atomic_ref&) = delete;
323332
324333 _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
325 _Tp __old = this->load(memory_order_relaxed);
326 _Tp __new = __old + __arg;
327 while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)) {
328 __new = __old + __arg;
334 if constexpr (std::__has_rmw_builtin<_Tp>()) {
335 return __atomic_fetch_add(this->__ptr_, __arg, std::__to_gcc_order(__order));
336 } else {
337 _Tp __old = this->load(memory_order_relaxed);
338 _Tp __new = __old + __arg;
339 while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)) {
340 __new = __old + __arg;
341 }
342 return __old;
329343 }
330 return __old;
331344 }
332345 _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
333 _Tp __old = this->load(memory_order_relaxed);
334 _Tp __new = __old - __arg;
335 while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)) {
336 __new = __old - __arg;
346 if constexpr (std::__has_rmw_builtin<_Tp>()) {
347 return __atomic_fetch_sub(this->__ptr_, __arg, std::__to_gcc_order(__order));
348 } else {
349 _Tp __old = this->load(memory_order_relaxed);
350 _Tp __new = __old - __arg;
351 while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)) {
352 __new = __old - __arg;
353 }
354 return __old;
337355 }
338 return __old;
339356 }
340357
341358 _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
lib/libcxx/include/__atomic/atomic_sync.h+127-55
......@@ -9,6 +9,7 @@
99#ifndef _LIBCPP___ATOMIC_ATOMIC_SYNC_H
1010#define _LIBCPP___ATOMIC_ATOMIC_SYNC_H
1111
12#include <__atomic/atomic_waitable_traits.h>
1213#include <__atomic/contention_t.h>
1314#include <__atomic/memory_order.h>
1415#include <__atomic/to_gcc_order.h>
......@@ -19,6 +20,7 @@
1920#include <__type_traits/conjunction.h>
2021#include <__type_traits/decay.h>
2122#include <__type_traits/invoke.h>
23#include <__type_traits/is_same.h>
2224#include <__type_traits/void_t.h>
2325#include <__utility/declval.h>
2426#include <cstring>
......@@ -29,50 +31,89 @@
2931
3032_LIBCPP_BEGIN_NAMESPACE_STD
3133
32// The customisation points to enable the following functions:
33// - __atomic_wait
34// - __atomic_wait_unless
35// - __atomic_notify_one
36// - __atomic_notify_all
37// Note that std::atomic<T>::wait was back-ported to C++03
38// The below implementations look ugly to support C++03
39template <class _Tp, class = void>
40struct __atomic_waitable_traits {
41 template <class _AtomicWaitable>
42 static void __atomic_load(_AtomicWaitable&&, memory_order) = delete;
43
44 template <class _AtomicWaitable>
45 static void __atomic_contention_address(_AtomicWaitable&&) = delete;
46};
47
48template <class _Tp, class = void>
49struct __atomic_waitable : false_type {};
50
51template <class _Tp>
52struct __atomic_waitable< _Tp,
53 __void_t<decltype(__atomic_waitable_traits<__decay_t<_Tp> >::__atomic_load(
54 std::declval<const _Tp&>(), std::declval<memory_order>())),
55 decltype(__atomic_waitable_traits<__decay_t<_Tp> >::__atomic_contention_address(
56 std::declval<const _Tp&>()))> > : true_type {};
57
5834#if _LIBCPP_STD_VER >= 20
5935# if _LIBCPP_HAS_THREADS
6036
61_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*) _NOEXCEPT;
62_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*) _NOEXCEPT;
63_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
64__libcpp_atomic_monitor(void const volatile*) _NOEXCEPT;
65_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
66__libcpp_atomic_wait(void const volatile*, __cxx_contention_t) _NOEXCEPT;
67
68_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
69__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
70_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
71__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
72_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
37# if !_LIBCPP_AVAILABILITY_HAS_NEW_SYNC
38
39// old dylib interface kept for backwards compatibility
40_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*) _NOEXCEPT;
41_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*) _NOEXCEPT;
42_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*) _NOEXCEPT;
43_LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t) _NOEXCEPT;
44
45_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
46_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
47_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
7348__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
74_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
49_LIBCPP_EXPORTED_FROM_ABI void
7550__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t) _NOEXCEPT;
51# endif // !_LIBCPP_AVAILABILITY_HAS_NEW_SYNC
52
53// new dylib interface
54
55// return the global contention state's current value for the address
56_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
57__atomic_monitor_global(void const* __address) _NOEXCEPT;
58
59// wait on the global contention state to be changed from the given value for the address
60_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
61__atomic_wait_global_table(void const* __address, __cxx_contention_t __monitor_value) _NOEXCEPT;
62
63// notify one waiter waiting on the global contention state for the address
64_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_global_table(void const*) _NOEXCEPT;
65
66// notify all waiters waiting on the global contention state for the address
67_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_global_table(void const*) _NOEXCEPT;
68
69// wait on the address directly with the native platform wait
70template <std::size_t _Size>
71_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
72__atomic_wait_native(void const* __address, void const* __old_value) _NOEXCEPT;
73
74// notify one waiter waiting on the address directly with the native platform wait
75template <std::size_t _Size>
76_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_native(const void*) _NOEXCEPT;
77
78// notify all waiters waiting on the address directly with the native platform wait
79template <std::size_t _Size>
80_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(const void*) _NOEXCEPT;
81
82# if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
83
84template <class _AtomicWaitable, class _Poll>
85struct __atomic_wait_backoff_impl {
86 const _AtomicWaitable& __a_;
87 _Poll __poll_;
88 memory_order __order_;
89
90 using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
91 using __value_type _LIBCPP_NODEBUG = typename __waitable_traits::__value_type;
92
93 _LIBCPP_HIDE_FROM_ABI __backoff_results operator()(chrono::nanoseconds __elapsed) const {
94 if (__elapsed > chrono::microseconds(4)) {
95 auto __contention_address = const_cast<const void*>(
96 static_cast<const volatile void*>(__waitable_traits::__atomic_contention_address(__a_)));
97
98 if constexpr (__has_native_atomic_wait<__value_type>) {
99 auto __atomic_value = __waitable_traits::__atomic_load(__a_, __order_);
100 if (__poll_(__atomic_value))
101 return __backoff_results::__poll_success;
102 std::__atomic_wait_native<sizeof(__value_type)>(__contention_address, std::addressof(__atomic_value));
103 } else {
104 __cxx_contention_t __monitor_val = std::__atomic_monitor_global(__contention_address);
105 auto __atomic_value = __waitable_traits::__atomic_load(__a_, __order_);
106 if (__poll_(__atomic_value))
107 return __backoff_results::__poll_success;
108 std::__atomic_wait_global_table(__contention_address, __monitor_val);
109 }
110 } else {
111 } // poll
112 return __backoff_results::__continue_poll;
113 }
114};
115
116# else // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
76117
77118template <class _AtomicWaitable, class _Poll>
78119struct __atomic_wait_backoff_impl {
......@@ -82,7 +123,6 @@ struct __atomic_wait_backoff_impl {
82123
83124 using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
84125
85 _LIBCPP_AVAILABILITY_SYNC
86126 _LIBCPP_HIDE_FROM_ABI bool
87127 __update_monitor_val_and_poll(__cxx_atomic_contention_t const volatile*, __cxx_contention_t& __monitor_val) const {
88128 // In case the contention type happens to be __cxx_atomic_contention_t, i.e. __cxx_atomic_impl<int64_t>,
......@@ -95,7 +135,6 @@ struct __atomic_wait_backoff_impl {
95135 return __poll_(__monitor_val);
96136 }
97137
98 _LIBCPP_AVAILABILITY_SYNC
99138 _LIBCPP_HIDE_FROM_ABI bool
100139 __update_monitor_val_and_poll(void const volatile* __contention_address, __cxx_contention_t& __monitor_val) const {
101140 // In case the contention type is anything else, platform wait is monitoring a __cxx_atomic_contention_t
......@@ -105,20 +144,21 @@ struct __atomic_wait_backoff_impl {
105144 return __poll_(__current_val);
106145 }
107146
108 _LIBCPP_AVAILABILITY_SYNC
109 _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
147 _LIBCPP_HIDE_FROM_ABI __backoff_results operator()(chrono::nanoseconds __elapsed) const {
110148 if (__elapsed > chrono::microseconds(4)) {
111149 auto __contention_address = __waitable_traits::__atomic_contention_address(__a_);
112150 __cxx_contention_t __monitor_val;
113151 if (__update_monitor_val_and_poll(__contention_address, __monitor_val))
114 return true;
152 return __backoff_results::__poll_success;
115153 std::__libcpp_atomic_wait(__contention_address, __monitor_val);
116154 } else {
117155 } // poll
118 return false;
156 return __backoff_results::__continue_poll;
119157 }
120158};
121159
160# endif // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
161
122162// The semantics of this function are similar to `atomic`'s
123163// `.wait(T old, std::memory_order order)`, but instead of having a hardcoded
124164// predicate (is the loaded value unequal to `old`?), the predicate function is
......@@ -128,9 +168,8 @@ struct __atomic_wait_backoff_impl {
128168// `false`, it must set the argument to its current understanding of the atomic
129169// value. The predicate function must not return `false` spuriously.
130170template <class _AtomicWaitable, class _Poll>
131_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
132__atomic_wait_unless(const _AtomicWaitable& __a, memory_order __order, _Poll&& __poll) {
133 static_assert(__atomic_waitable<_AtomicWaitable>::value, "");
171_LIBCPP_HIDE_FROM_ABI void __atomic_wait_unless(const _AtomicWaitable& __a, memory_order __order, _Poll&& __poll) {
172 static_assert(__atomic_waitable<_AtomicWaitable>);
134173 __atomic_wait_backoff_impl<_AtomicWaitable, __decay_t<_Poll> > __backoff_fn = {__a, __poll, __order};
135174 std::__libcpp_thread_poll_with_backoff(
136175 /* poll */
......@@ -141,18 +180,52 @@ __atomic_wait_unless(const _AtomicWaitable& __a, memory_order __order, _Poll&& _
141180 /* backoff */ __backoff_fn);
142181}
143182
183# if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
184
144185template <class _AtomicWaitable>
145_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __atomic_notify_one(const _AtomicWaitable& __a) {
146 static_assert(__atomic_waitable<_AtomicWaitable>::value, "");
186_LIBCPP_HIDE_FROM_ABI void __atomic_notify_one(const _AtomicWaitable& __a) {
187 static_assert(__atomic_waitable<_AtomicWaitable>);
188 using __value_type _LIBCPP_NODEBUG = typename __atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__value_type;
189 using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
190 auto __contention_address =
191 const_cast<const void*>(static_cast<const volatile void*>(__waitable_traits::__atomic_contention_address(__a)));
192 if constexpr (__has_native_atomic_wait<__value_type>) {
193 std::__atomic_notify_one_native<sizeof(__value_type)>(__contention_address);
194 } else {
195 std::__atomic_notify_one_global_table(__contention_address);
196 }
197}
198
199template <class _AtomicWaitable>
200_LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable& __a) {
201 static_assert(__atomic_waitable<_AtomicWaitable>);
202 using __value_type _LIBCPP_NODEBUG = typename __atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__value_type;
203 using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
204 auto __contention_address =
205 const_cast<const void*>(static_cast<const volatile void*>(__waitable_traits::__atomic_contention_address(__a)));
206 if constexpr (__has_native_atomic_wait<__value_type>) {
207 std::__atomic_notify_all_native<sizeof(__value_type)>(__contention_address);
208 } else {
209 std::__atomic_notify_all_global_table(__contention_address);
210 }
211}
212
213# else // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
214
215template <class _AtomicWaitable>
216_LIBCPP_HIDE_FROM_ABI void __atomic_notify_one(const _AtomicWaitable& __a) {
217 static_assert(__atomic_waitable<_AtomicWaitable>);
147218 std::__cxx_atomic_notify_one(__atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_contention_address(__a));
148219}
149220
150221template <class _AtomicWaitable>
151_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable& __a) {
152 static_assert(__atomic_waitable<_AtomicWaitable>::value, "");
222_LIBCPP_HIDE_FROM_ABI void __atomic_notify_all(const _AtomicWaitable& __a) {
223 static_assert(__atomic_waitable<_AtomicWaitable>);
153224 std::__cxx_atomic_notify_all(__atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_contention_address(__a));
154225}
155226
227# endif
228
156229# else // _LIBCPP_HAS_THREADS
157230
158231template <class _AtomicWaitable, class _Poll>
......@@ -180,9 +253,8 @@ _LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp c
180253}
181254
182255template <class _AtomicWaitable, class _Tp>
183_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
184__atomic_wait(_AtomicWaitable& __a, _Tp __val, memory_order __order) {
185 static_assert(__atomic_waitable<_AtomicWaitable>::value, "");
256_LIBCPP_HIDE_FROM_ABI void __atomic_wait(_AtomicWaitable& __a, _Tp __val, memory_order __order) {
257 static_assert(__atomic_waitable<_AtomicWaitable>);
186258 std::__atomic_wait_unless(__a, __order, [&](_Tp const& __current) {
187259 return !std::__cxx_nonatomic_compare_equal(__current, __val);
188260 });
lib/libcxx/include/__atomic/atomic_sync_timed.h created+144
......@@ -0,0 +1,144 @@
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___ATOMIC_ATOMIC_SYNC_TIMED_H
10#define _LIBCPP___ATOMIC_ATOMIC_SYNC_TIMED_H
11
12#include <__atomic/atomic_waitable_traits.h>
13#include <__atomic/contention_t.h>
14#include <__atomic/memory_order.h>
15#include <__atomic/to_gcc_order.h>
16#include <__chrono/duration.h>
17#include <__config>
18#include <__memory/addressof.h>
19#include <__thread/poll_with_backoff.h>
20#include <__thread/timed_backoff_policy.h>
21#include <__type_traits/conjunction.h>
22#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>
29#include <cstdint>
30#include <cstring>
31
32#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
33# pragma GCC system_header
34#endif
35
36_LIBCPP_BEGIN_NAMESPACE_STD
37
38#if _LIBCPP_STD_VER >= 20
39# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
40
41_LIBCPP_AVAILABILITY_NEW_SYNC
42_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __address) _NOEXCEPT;
43
44// wait on the global contention state to be changed from the given value for the address
45_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_global_table_with_timeout(
46 void const* __address, __cxx_contention_t __monitor_value, uint64_t __timeout_ns) _NOEXCEPT;
47
48// wait on the address directly with the native platform wait
49template <std::size_t _Size>
50_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
51__atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) _NOEXCEPT;
52
53template <class _AtomicWaitable, class _Poll, class _Rep, class _Period>
54struct __atomic_wait_timed_backoff_impl {
55 const _AtomicWaitable& __a_;
56 _Poll __poll_;
57 memory_order __order_;
58 chrono::duration<_Rep, _Period> __rel_time_;
59
60 using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
61 using __value_type _LIBCPP_NODEBUG = typename __waitable_traits::__value_type;
62
63 _LIBCPP_HIDE_FROM_ABI __backoff_results operator()(chrono::nanoseconds __elapsed) const {
64 if (__elapsed > chrono::microseconds(4)) {
65 auto __contention_address = const_cast<const void*>(
66 static_cast<const volatile void*>(__waitable_traits::__atomic_contention_address(__a_)));
67
68 uint64_t __timeout_ns =
69 static_cast<uint64_t>((chrono::duration_cast<chrono::nanoseconds>(__rel_time_) - __elapsed).count());
70
71 if constexpr (__has_native_atomic_wait<__value_type>) {
72 auto __atomic_value = __waitable_traits::__atomic_load(__a_, __order_);
73 if (__poll_(__atomic_value))
74 return __backoff_results::__poll_success;
75 std::__atomic_wait_native_with_timeout<sizeof(__value_type)>(
76 __contention_address, std::addressof(__atomic_value), __timeout_ns);
77 } else {
78 __cxx_contention_t __monitor_val = std::__atomic_monitor_global(__contention_address);
79 auto __atomic_value = __waitable_traits::__atomic_load(__a_, __order_);
80 if (__poll_(__atomic_value))
81 return __backoff_results::__poll_success;
82 std::__atomic_wait_global_table_with_timeout(__contention_address, __monitor_val, __timeout_ns);
83 }
84 } else {
85 } // poll
86 return __backoff_results::__continue_poll;
87 }
88};
89
90// The semantics of this function are similar to `atomic`'s
91// `.wait(T old, std::memory_order order)` with a timeout, but instead of having a hardcoded
92// predicate (is the loaded value unequal to `old`?), the predicate function is
93// specified as an argument. The loaded value is given as an in-out argument to
94// the predicate. If the predicate function returns `true`,
95// `__atomic_wait_unless_with_timeout` will return. If the predicate function returns
96// `false`, it must set the argument to its current understanding of the atomic
97// value. The predicate function must not return `false` spuriously.
98template <class _AtomicWaitable, class _Poll, class _Rep, class _Period>
99_LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout(
100 const _AtomicWaitable& __a,
101 memory_order __order,
102 _Poll&& __poll,
103 chrono::duration<_Rep, _Period> const& __rel_time) {
104 static_assert(__atomic_waitable<_AtomicWaitable>, "");
105 __atomic_wait_timed_backoff_impl<_AtomicWaitable, __decay_t<_Poll>, _Rep, _Period> __backoff_fn = {
106 __a, __poll, __order, __rel_time};
107 auto __poll_result = std::__libcpp_thread_poll_with_backoff(
108 /* poll */
109 [&]() {
110 auto __current_val = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_load(__a, __order);
111 return __poll(__current_val);
112 },
113 /* backoff */ __backoff_fn,
114 __rel_time);
115
116 return __poll_result == __poll_with_backoff_results::__poll_success;
117}
118
119# elif _LIBCPP_HAS_THREADS // _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
120
121template <class _AtomicWaitable, class _Poll, class _Rep, class _Period>
122_LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout(
123 const _AtomicWaitable& __a,
124 memory_order __order,
125 _Poll&& __poll,
126 chrono::duration<_Rep, _Period> const& __rel_time) {
127 auto __res = std::__libcpp_thread_poll_with_backoff(
128 /* poll */
129 [&]() {
130 auto __current_val = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >::__atomic_load(__a, __order);
131 return __poll(__current_val);
132 },
133 /* backoff */ __libcpp_timed_backoff_policy(),
134 __rel_time);
135 return __res == __poll_with_backoff_results::__poll_success;
136}
137
138# endif // _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
139
140#endif // C++20
141
142_LIBCPP_END_NAMESPACE_STD
143
144#endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_TIMED_H
lib/libcxx/include/__atomic/atomic_waitable_traits.h created+103
......@@ -0,0 +1,103 @@
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___ATOMIC_ATOMIC_WAITABLE_TRAITS_H
10#define _LIBCPP___ATOMIC_ATOMIC_WAITABLE_TRAITS_H
11
12#include <__atomic/contention_t.h>
13#include <__atomic/memory_order.h>
14#include <__config>
15#include <__type_traits/decay.h>
16#include <__type_traits/has_unique_object_representation.h>
17#include <__type_traits/is_same.h>
18#include <__type_traits/is_trivially_copyable.h>
19#include <__type_traits/void_t.h>
20#include <__utility/declval.h>
21#include <cstring>
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 >= 20
30
31// The customisation points to enable the following functions:
32// - __atomic_wait
33// - __atomic_wait_unless
34// - __atomic_notify_one
35// - __atomic_notify_all
36template <class _Tp, class = void>
37struct __atomic_waitable_traits {
38 using __value_type _LIBCPP_NODEBUG = void;
39
40 template <class _AtomicWaitable>
41 static void __atomic_load(_AtomicWaitable&&, memory_order) = delete;
42
43 template <class _AtomicWaitable>
44 static void __atomic_contention_address(_AtomicWaitable&&) = delete;
45};
46
47template <class _Tp>
48concept __atomic_waitable = requires(const _Tp __t, memory_order __order) {
49 typename __atomic_waitable_traits<__decay_t<_Tp> >::__value_type;
50 { __atomic_waitable_traits<__decay_t<_Tp> >::__atomic_load(__t, __order) };
51 { __atomic_waitable_traits<__decay_t<_Tp> >::__atomic_contention_address(__t) };
52};
53
54# ifdef __linux__
55# define _LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_APPLY) _APPLY(4)
56# elif defined(__APPLE__)
57# define _LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_APPLY) \
58 _APPLY(4) \
59 _APPLY(8)
60# elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8
61# define _LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_APPLY) _APPLY(8)
62# elif defined(_WIN32)
63# define _LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_APPLY) _APPLY(8)
64# else
65# define _LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_APPLY) _APPLY(sizeof(__cxx_contention_t))
66# endif // __linux__
67
68// concepts defines the types are supported natively by the platform's wait
69
70# if defined(_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE)
71
72template <class _Tp>
73_LIBCPP_HIDE_FROM_ABI constexpr bool __has_native_atomic_wait_impl() {
74 if (alignof(_Tp) % sizeof(_Tp) != 0)
75 return false;
76 switch (sizeof(_Tp)) {
77# define _LIBCPP_MAKE_CASE(n) \
78 case n: \
79 return true;
80 _LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_LIBCPP_MAKE_CASE)
81 default:
82 return false;
83# undef _LIBCPP_MAKE_CASE
84 };
85}
86
87template <class _Tp>
88concept __has_native_atomic_wait =
89 has_unique_object_representations_v<_Tp> && is_trivially_copyable_v<_Tp> &&
90 std::__has_native_atomic_wait_impl<_Tp>();
91
92# else // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
93
94template <class _Tp>
95concept __has_native_atomic_wait = is_same_v<_Tp, __cxx_contention_t>;
96
97# endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
98
99#endif // C++20
100
101_LIBCPP_END_NAMESPACE_STD
102
103#endif // _LIBCPP___ATOMIC_ATOMIC_WAITABLE_TRAITS_H
lib/libcxx/include/__atomic/contention_t.h+27-3
......@@ -19,11 +19,35 @@
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
2121
22#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
22// The original definition of `__cxx_contention_t` seemed a bit arbitrary.
23// When we enable the _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE ABI,
24// use definitions that are based on what the underlying platform supports
25// instead.
26#if defined(_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE)
27
28# ifdef __linux__
29using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
30# elif defined(__APPLE__)
31using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
32# elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8
33using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
34# elif defined(_AIX) && !defined(__64BIT__)
35using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
36# elif defined(_WIN32)
37using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
38# else
39using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
40# endif // __linux__
41
42#else // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
43
44# if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
2345using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
24#else
46# else
2547using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
26#endif // __linux__ || (_AIX && !__64BIT__)
48# endif // __linux__ || (_AIX && !__64BIT__)
49
50#endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
2751
2852using __cxx_atomic_contention_t _LIBCPP_NODEBUG = __cxx_atomic_impl<__cxx_contention_t>;
2953
lib/libcxx/include/__atomic/floating_point_helper.h created+55
......@@ -0,0 +1,55 @@
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___ATOMIC_FLOATING_POINT_HELPER_H
10#define _LIBCPP___ATOMIC_FLOATING_POINT_HELPER_H
11
12#include <__config>
13#include <__type_traits/is_floating_point.h>
14#include <__type_traits/is_same.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
22#if _LIBCPP_STD_VER >= 20
23
24template <class _Tp>
25_LIBCPP_HIDE_FROM_ABI constexpr bool __is_fp80_long_double() {
26 // Only x87-fp80 long double has 64-bit mantissa
27 return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>;
28}
29
30template <class _Tp>
31_LIBCPP_HIDE_FROM_ABI constexpr bool __has_rmw_builtin() {
32 static_assert(std::is_floating_point_v<_Tp>);
33# ifndef _LIBCPP_COMPILER_CLANG_BASED
34 return false;
35# else
36 // The builtin __cxx_atomic_fetch_add errors during compilation for
37 // long double on platforms with fp80 format.
38 // For more details, see
39 // lib/Sema/SemaChecking.cpp function IsAllowedValueType
40 // LLVM Parser does not allow atomicrmw with x86_fp80 type.
41 // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) &&
42 // &Context.getTargetInfo().getLongDoubleFormat() ==
43 // &llvm::APFloat::x87DoubleExtended())
44 // For more info
45 // https://llvm.org/PR68602
46 // https://reviews.llvm.org/D53965
47 return !std::__is_fp80_long_double<_Tp>();
48# endif
49}
50
51#endif
52
53_LIBCPP_END_NAMESPACE_STD
54
55#endif // _LIBCPP___ATOMIC_FLOATING_POINT_HELPER_H
lib/libcxx/include/__bit/countl.h+1-2
......@@ -24,7 +24,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424
2525template <class _Tp>
2626_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {
27 static_assert(__is_unsigned_integer_v<_Tp>, "__countl_zero requires an unsigned integer type");
2827 return __builtin_clzg(__t, numeric_limits<_Tp>::digits);
2928}
3029
......@@ -37,7 +36,7 @@ template <__unsigned_integer _Tp>
3736
3837template <__unsigned_integer _Tp>
3938[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int countl_one(_Tp __t) noexcept {
40 return __t != numeric_limits<_Tp>::max() ? std::countl_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits;
39 return std::countl_zero(static_cast<_Tp>(~__t));
4140}
4241
4342#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__bit/countr.h+1-2
......@@ -24,7 +24,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424
2525template <class _Tp>
2626[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __countr_zero(_Tp __t) _NOEXCEPT {
27 static_assert(__is_unsigned_integer_v<_Tp>, "__countr_zero only works with unsigned types");
2827 return __builtin_ctzg(__t, numeric_limits<_Tp>::digits);
2928}
3029
......@@ -37,7 +36,7 @@ template <__unsigned_integer _Tp>
3736
3837template <__unsigned_integer _Tp>
3938[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int countr_one(_Tp __t) noexcept {
40 return __t != numeric_limits<_Tp>::max() ? std::countr_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits;
39 return std::countr_zero(static_cast<_Tp>(~__t));
4140}
4241
4342#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__bit/has_single_bit.h+1-1
......@@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2525
2626template <__unsigned_integer _Tp>
2727[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept {
28 return __t != 0 && (((__t & (__t - 1)) == 0));
28 return __builtin_popcountg(__t) == 1;
2929}
3030
3131_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__bit/popcount.h-1
......@@ -23,7 +23,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2323
2424template <class _Tp>
2525[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __popcount(_Tp __t) _NOEXCEPT {
26 static_assert(__is_unsigned_integer_v<_Tp>, "__popcount only works with unsigned types");
2726 return __builtin_popcountg(__t);
2827}
2928
lib/libcxx/include/__bit/rotate.h+15-26
......@@ -22,46 +22,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222// Writing two full functions for rotl and rotr makes it easier for the compiler
2323// to optimize the code. On x86 this function becomes the ROL instruction and
2424// the rotr function becomes the ROR instruction.
25template <class _Tp>
26_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotl(_Tp __x, int __s) _NOEXCEPT {
27 static_assert(__is_unsigned_integer_v<_Tp>, "__rotl requires an unsigned integer type");
25
26#if _LIBCPP_STD_VER >= 20
27
28template <__unsigned_integer _Tp>
29[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotl(_Tp __t, int __cnt) noexcept {
2830 const int __n = numeric_limits<_Tp>::digits;
29 int __r = __s % __n;
31 int __r = __cnt % __n;
3032
3133 if (__r == 0)
32 return __x;
34 return __t;
3335
3436 if (__r > 0)
35 return (__x << __r) | (__x >> (__n - __r));
37 return (__t << __r) | (__t >> (__n - __r));
3638
37 return (__x >> -__r) | (__x << (__n + __r));
39 return (__t >> -__r) | (__t << (__n + __r));
3840}
3941
40template <class _Tp>
41_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __x, int __s) _NOEXCEPT {
42 static_assert(__is_unsigned_integer_v<_Tp>, "__rotr requires an unsigned integer type");
42template <__unsigned_integer _Tp>
43[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotr(_Tp __t, int __cnt) noexcept {
4344 const int __n = numeric_limits<_Tp>::digits;
44 int __r = __s % __n;
45 int __r = __cnt % __n;
4546
4647 if (__r == 0)
47 return __x;
48 return __t;
4849
4950 if (__r > 0)
50 return (__x >> __r) | (__x << (__n - __r));
51
52 return (__x << -__r) | (__x >> (__n + __r));
53}
51 return (__t >> __r) | (__t << (__n - __r));
5452
55#if _LIBCPP_STD_VER >= 20
56
57template <__unsigned_integer _Tp>
58[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotl(_Tp __t, int __cnt) noexcept {
59 return std::__rotl(__t, __cnt);
60}
61
62template <__unsigned_integer _Tp>
63[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotr(_Tp __t, int __cnt) noexcept {
64 return std::__rotr(__t, __cnt);
53 return (__t << -__r) | (__t >> (__n + __r));
6554}
6655
6756#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__bit_reference+207-18
......@@ -15,8 +15,10 @@
1515#include <__algorithm/copy_backward.h>
1616#include <__algorithm/copy_n.h>
1717#include <__algorithm/equal.h>
18#include <__algorithm/fill_n.h>
1819#include <__algorithm/min.h>
1920#include <__algorithm/rotate.h>
21#include <__algorithm/specialized_algorithms.h>
2022#include <__algorithm/swap_ranges.h>
2123#include <__assert>
2224#include <__bit/countr.h>
......@@ -137,7 +139,7 @@ public:
137139 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator bool() const _NOEXCEPT {
138140 return static_cast<bool>(*__seg_ & __mask_);
139141 }
140 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool operator~() const _NOEXCEPT {
142 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool operator~() const _NOEXCEPT {
141143 return !static_cast<bool>(*this);
142144 }
143145
......@@ -307,6 +309,15 @@ public:
307309 {
308310 }
309311
312#ifdef _LIBCPP_ABI_TRIVIALLY_COPYABLE_BIT_ITERATOR
313 template <bool _IsConstDep = _IsConst, __enable_if_t<_IsConstDep, int> = 0>
314 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
315 : __seg_(__it.__seg_),
316 __ctz_(__it.__ctz_) {}
317
318 _LIBCPP_HIDE_FROM_ABI __bit_iterator(const __bit_iterator&) = default;
319 _LIBCPP_HIDE_FROM_ABI __bit_iterator& operator=(const __bit_iterator&) = default;
320#else
310321 // When _IsConst=false, this is the copy constructor.
311322 // It is non-trivial. Making it trivial would break ABI.
312323 // When _IsConst=true, this is a converting constructor;
......@@ -327,6 +338,7 @@ public:
327338 __ctz_ = __it.__ctz_;
328339 return *this;
329340 }
341#endif
330342
331343 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT {
332344 _LIBCPP_ASSERT_INTERNAL(__ctz_ < __bits_per_word, "Dereferencing an invalid __bit_iterator.");
......@@ -467,20 +479,6 @@ private:
467479 template <class _Dp>
468480 friend struct __bit_array;
469481
470 template <bool _FillVal, class _Dp>
471 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend void
472 __fill_n_bool(__bit_iterator<_Dp, false> __first, typename __size_difference_type_traits<_Dp>::size_type __n);
473
474 template <class _Dp, bool _IC>
475 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Dp, false> __copy_aligned(
476 __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result);
477 template <class _Dp, bool _IC>
478 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Dp, false> __copy_unaligned(
479 __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result);
480 template <class _Dp, bool _IC>
481 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend pair<__bit_iterator<_Dp, _IC>, __bit_iterator<_Dp, false> >
482 __copy_impl::operator()(
483 __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result) const;
484482 template <class _Dp, bool _IC>
485483 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Dp, false> __copy_backward_aligned(
486484 __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result);
......@@ -511,10 +509,20 @@ private:
511509 bool _IsConst1,
512510 bool _IsConst2,
513511 class _BinaryPredicate,
514 __enable_if_t<__desugars_to_v<__equal_tag, _BinaryPredicate, bool, bool>, int> >
512 class _Proj1,
513 class _Proj2,
514 __enable_if_t<__is_identity<_Proj1>::value && __is_identity<_Proj2>::value &&
515 __desugars_to_v<__equal_tag, _BinaryPredicate, bool, bool>,
516 int> >
515517 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool __equal_iter_impl(
516 __bit_iterator<_Dp, _IsConst1>, __bit_iterator<_Dp, _IsConst1>, __bit_iterator<_Dp, _IsConst2>, _BinaryPredicate);
517 template <class _Dp,
518 __bit_iterator<_Dp, _IsConst1>,
519 __bit_iterator<_Dp, _IsConst1>,
520 __bit_iterator<_Dp, _IsConst2>,
521 _BinaryPredicate,
522 _Proj1&,
523 _Proj2&);
524 template <bool,
525 class _Dp,
518526 bool _IsConst1,
519527 bool _IsConst2,
520528 class _Pred,
......@@ -537,6 +545,187 @@ private:
537545 template <bool _ToCount, class _Dp, bool _IC>
538546 friend typename __bit_iterator<_Dp, _IC>::difference_type _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
539547 __count_bool(__bit_iterator<_Dp, _IC>, typename __size_difference_type_traits<_Dp>::size_type);
548
549 template <class, class...>
550 friend struct __specialized_algorithm;
551};
552
553template <class _Cp>
554struct __specialized_algorithm<_Algorithm::__fill_n, __single_iterator<__bit_iterator<_Cp, false> > > {
555 static const bool __has_algorithm = true;
556
557 template <bool _FillVal>
558 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
559 __impl(__bit_iterator<_Cp, false> __first, typename __size_difference_type_traits<_Cp>::size_type __n) {
560 using _It = __bit_iterator<_Cp, false>;
561 using __storage_type = typename _It::__storage_type;
562
563 const int __bits_per_word = _It::__bits_per_word;
564 // do first partial word
565 if (__first.__ctz_ != 0) {
566 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
567 __storage_type __dn = std::min(__clz_f, __n);
568 std::__fill_masked_range(std::__to_address(__first.__seg_), __clz_f - __dn, __first.__ctz_, _FillVal);
569 __n -= __dn;
570 ++__first.__seg_;
571 }
572 // do middle whole words
573 __storage_type __nw = __n / __bits_per_word;
574 std::__fill_n(std::__to_address(__first.__seg_), __nw, _FillVal ? static_cast<__storage_type>(-1) : 0);
575 __n -= __nw * __bits_per_word;
576 // do last partial word
577 if (__n > 0) {
578 __first.__seg_ += __nw;
579 std::__fill_masked_range(std::__to_address(__first.__seg_), __bits_per_word - __n, 0u, _FillVal);
580 }
581 }
582
583 template <class _Size, class _Tp>
584 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static __bit_iterator<_Cp, false>
585 operator()(__bit_iterator<_Cp, false> __first, _Size __n, const _Tp& __value) {
586 if (__n > 0) {
587 if (__value)
588 __impl<true>(__first, __n);
589 else
590 __impl<false>(__first, __n);
591 }
592 return __first + __n;
593 }
594};
595
596template <class _Cp, bool _IsConst>
597struct __specialized_algorithm<_Algorithm::__copy,
598 __iterator_pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, _IsConst> >,
599 __single_iterator<__bit_iterator<_Cp, false> > > {
600 static const bool __has_algorithm = true;
601
602 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static __bit_iterator<_Cp, false>
603 __aligned_impl(__bit_iterator<_Cp, _IsConst> __first,
604 __bit_iterator<_Cp, _IsConst> __last,
605 __bit_iterator<_Cp, false> __result) {
606 using _In = __bit_iterator<_Cp, _IsConst>;
607 using difference_type = typename _In::difference_type;
608 using __storage_type = typename _In::__storage_type;
609
610 const int __bits_per_word = _In::__bits_per_word;
611 difference_type __n = __last - __first;
612 if (__n > 0) {
613 // do first word
614 if (__first.__ctz_ != 0) {
615 unsigned __clz = __bits_per_word - __first.__ctz_;
616 difference_type __dn = std::min(static_cast<difference_type>(__clz), __n);
617 __n -= __dn;
618 __storage_type __m = std::__middle_mask<__storage_type>(__clz - __dn, __first.__ctz_);
619 __storage_type __b = *__first.__seg_ & __m;
620 *__result.__seg_ &= ~__m;
621 *__result.__seg_ |= __b;
622 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
623 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
624 ++__first.__seg_;
625 // __first.__ctz_ = 0;
626 }
627 // __first.__ctz_ == 0;
628 // do middle words
629 __storage_type __nw = __n / __bits_per_word;
630 std::copy(std::__to_address(__first.__seg_),
631 std::__to_address(__first.__seg_ + __nw),
632 std::__to_address(__result.__seg_));
633 __n -= __nw * __bits_per_word;
634 __result.__seg_ += __nw;
635 // do last word
636 if (__n > 0) {
637 __first.__seg_ += __nw;
638 __storage_type __m = std::__trailing_mask<__storage_type>(__bits_per_word - __n);
639 __storage_type __b = *__first.__seg_ & __m;
640 *__result.__seg_ &= ~__m;
641 *__result.__seg_ |= __b;
642 __result.__ctz_ = static_cast<unsigned>(__n);
643 }
644 }
645 return __result;
646 }
647
648 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static __bit_iterator<_Cp, false>
649 __unaligned_impl(__bit_iterator<_Cp, _IsConst> __first,
650 __bit_iterator<_Cp, _IsConst> __last,
651 __bit_iterator<_Cp, false> __result) {
652 using _In = __bit_iterator<_Cp, _IsConst>;
653 using difference_type = typename _In::difference_type;
654 using __storage_type = typename _In::__storage_type;
655
656 const int __bits_per_word = _In::__bits_per_word;
657 difference_type __n = __last - __first;
658 if (__n > 0) {
659 // do first word
660 if (__first.__ctz_ != 0) {
661 unsigned __clz_f = __bits_per_word - __first.__ctz_;
662 difference_type __dn = std::min(static_cast<difference_type>(__clz_f), __n);
663 __n -= __dn;
664 __storage_type __m = std::__middle_mask<__storage_type>(__clz_f - __dn, __first.__ctz_);
665 __storage_type __b = *__first.__seg_ & __m;
666 unsigned __clz_r = __bits_per_word - __result.__ctz_;
667 __storage_type __ddn = std::min<__storage_type>(__dn, __clz_r);
668 __m = std::__middle_mask<__storage_type>(__clz_r - __ddn, __result.__ctz_);
669 *__result.__seg_ &= ~__m;
670 if (__result.__ctz_ > __first.__ctz_)
671 *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_);
672 else
673 *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_);
674 __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
675 __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word);
676 __dn -= __ddn;
677 if (__dn > 0) {
678 __m = std::__trailing_mask<__storage_type>(__bits_per_word - __dn);
679 *__result.__seg_ &= ~__m;
680 *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn);
681 __result.__ctz_ = static_cast<unsigned>(__dn);
682 }
683 ++__first.__seg_;
684 // __first.__ctz_ = 0;
685 }
686 // __first.__ctz_ == 0;
687 // do middle words
688 unsigned __clz_r = __bits_per_word - __result.__ctz_;
689 __storage_type __m = std::__leading_mask<__storage_type>(__result.__ctz_);
690 for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) {
691 __storage_type __b = *__first.__seg_;
692 *__result.__seg_ &= ~__m;
693 *__result.__seg_ |= __b << __result.__ctz_;
694 ++__result.__seg_;
695 *__result.__seg_ &= __m;
696 *__result.__seg_ |= __b >> __clz_r;
697 }
698 // do last word
699 if (__n > 0) {
700 __m = std::__trailing_mask<__storage_type>(__bits_per_word - __n);
701 __storage_type __b = *__first.__seg_ & __m;
702 __storage_type __dn = std::min(__n, static_cast<difference_type>(__clz_r));
703 __m = std::__middle_mask<__storage_type>(__clz_r - __dn, __result.__ctz_);
704 *__result.__seg_ &= ~__m;
705 *__result.__seg_ |= __b << __result.__ctz_;
706 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
707 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
708 __n -= __dn;
709 if (__n > 0) {
710 __m = std::__trailing_mask<__storage_type>(__bits_per_word - __n);
711 *__result.__seg_ &= ~__m;
712 *__result.__seg_ |= __b >> __dn;
713 __result.__ctz_ = static_cast<unsigned>(__n);
714 }
715 }
716 }
717 return __result;
718 }
719
720 _LIBCPP_HIDE_FROM_ABI
721 _LIBCPP_CONSTEXPR_SINCE_CXX20 static pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
722 operator()(__bit_iterator<_Cp, _IsConst> __first,
723 __bit_iterator<_Cp, _IsConst> __last,
724 __bit_iterator<_Cp, false> __result) {
725 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));
728 }
540729};
541730
542731_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__charconv/from_chars_integral.h+1-1
......@@ -18,8 +18,8 @@
1818#include <__memory/addressof.h>
1919#include <__system_error/errc.h>
2020#include <__type_traits/enable_if.h>
21#include <__type_traits/integral_constant.h>
2221#include <__type_traits/is_integral.h>
22#include <__type_traits/is_signed.h>
2323#include <__type_traits/is_unsigned.h>
2424#include <__type_traits/make_unsigned.h>
2525#include <limits>
lib/libcxx/include/__charconv/from_chars_result.h+1-1
......@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121
2222#if _LIBCPP_STD_VER >= 17
2323
24struct _LIBCPP_EXPORTED_FROM_ABI from_chars_result {
24struct from_chars_result {
2525 const char* ptr;
2626 errc ec;
2727# if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__charconv/to_chars_integral.h+1
......@@ -24,6 +24,7 @@
2424#include <__type_traits/integral_constant.h>
2525#include <__type_traits/is_integral.h>
2626#include <__type_traits/is_same.h>
27#include <__type_traits/is_signed.h>
2728#include <__type_traits/make_32_64_or_128_bit.h>
2829#include <__type_traits/make_unsigned.h>
2930#include <__utility/unreachable.h>
lib/libcxx/include/__charconv/to_chars_result.h+1-1
......@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121
2222#if _LIBCPP_STD_VER >= 17
2323
24struct _LIBCPP_EXPORTED_FROM_ABI to_chars_result {
24struct to_chars_result {
2525 char* ptr;
2626 errc ec;
2727# if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__charconv/traits.h+3-24
......@@ -113,31 +113,10 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__u
113113};
114114# endif
115115
116template <typename _Tp>
117inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool
118__mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) {
119 auto __c = __a * __b;
120 __r = __c;
121 return __c > numeric_limits<unsigned char>::max();
122}
123
124template <typename _Tp>
125inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool
126__mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) {
127 auto __c = __a * __b;
128 __r = __c;
129 return __c > numeric_limits<unsigned short>::max();
130}
131
132template <typename _Tp>
133inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) {
134 static_assert(is_unsigned<_Tp>::value, "");
135 return __builtin_mul_overflow(__a, __b, std::addressof(__r));
136}
137
138116template <typename _Tp, typename _Up>
139inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) {
140 return __itoa::__mul_overflowed(__a, static_cast<_Tp>(__b), __r);
117_LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) {
118 static_assert(is_unsigned<_Tp>::value);
119 return __builtin_mul_overflow(__a, static_cast<_Tp>(__b), std::addressof(__r));
141120}
142121
143122template <typename _Tp>
lib/libcxx/include/__chrono/day.h+11
......@@ -13,6 +13,8 @@
1313#include <__chrono/duration.h>
1414#include <__compare/ordering.h>
1515#include <__config>
16#include <__cstddef/size_t.h>
17#include <__functional/hash.h>
1618
1719#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1820# pragma GCC system_header
......@@ -92,6 +94,15 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) no
9294
9395} // namespace chrono
9496
97# if _LIBCPP_STD_VER >= 26
98
99template <>
100struct hash<chrono::day> {
101 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept { return static_cast<unsigned>(__d); }
102};
103
104# endif // _LIBCPP_STD_VER >= 26
105
95106_LIBCPP_END_NAMESPACE_STD
96107
97108#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/duration.h+58-33
......@@ -13,6 +13,8 @@
1313#include <__compare/ordering.h>
1414#include <__compare/three_way_comparable.h>
1515#include <__config>
16#include <__cstddef/size_t.h>
17#include <__functional/hash.h>
1618#include <__type_traits/common_type.h>
1719#include <__type_traits/enable_if.h>
1820#include <__type_traits/is_convertible.h>
......@@ -102,7 +104,8 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
102104};
103105
104106template <class _ToDuration, class _Rep, class _Period, __enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
105inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration duration_cast(const duration<_Rep, _Period>& __fd) {
107[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration
108duration_cast(const duration<_Rep, _Period>& __fd) {
106109 return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
107110}
108111
......@@ -117,14 +120,18 @@ inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>:
117120template <class _Rep>
118121struct duration_values {
119122public:
120 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT { return _Rep(0); }
121 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT { return numeric_limits<_Rep>::max(); }
122 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT { return numeric_limits<_Rep>::lowest(); }
123 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT { return _Rep(0); }
124 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT {
125 return numeric_limits<_Rep>::max();
126 }
127 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT {
128 return numeric_limits<_Rep>::lowest();
129 }
123130};
124131
125132#if _LIBCPP_STD_VER >= 17
126133template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
127inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) {
134[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) {
128135 _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
129136 if (__t > __d)
130137 __t = __t - _ToDuration{1};
......@@ -132,7 +139,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<
132139}
133140
134141template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
135inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) {
142[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) {
136143 _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
137144 if (__t < __d)
138145 __t = __t + _ToDuration{1};
......@@ -140,7 +147,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_
140147}
141148
142149template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
143inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) {
150[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) {
144151 _ToDuration __lower = chrono::floor<_ToDuration>(__d);
145152 _ToDuration __upper = __lower + _ToDuration{1};
146153 auto __lower_diff = __d - __lower;
......@@ -220,14 +227,14 @@ public:
220227
221228 // observer
222229
223 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const { return __rep_; }
230 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const { return __rep_; }
224231
225232 // arithmetic
226233
227 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {
234 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {
228235 return typename common_type<duration>::type(*this);
229236 }
230 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {
237 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {
231238 return typename common_type<duration>::type(-__rep_);
232239 }
233240 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {
......@@ -269,13 +276,13 @@ public:
269276
270277 // special values
271278
272 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {
279 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {
273280 return duration(duration_values<rep>::zero());
274281 }
275 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {
282 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {
276283 return duration(duration_values<rep>::min());
277284 }
278 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {
285 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {
279286 return duration(duration_values<rep>::max());
280287 }
281288};
......@@ -389,7 +396,7 @@ operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Perio
389396// Duration +
390397
391398template <class _Rep1, class _Period1, class _Rep2, class _Period2>
392inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
399[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
393400typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
394401operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
395402 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
......@@ -399,7 +406,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
399406// Duration -
400407
401408template <class _Rep1, class _Period1, class _Rep2, class _Period2>
402inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
409[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
403410typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
404411operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
405412 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
......@@ -412,7 +419,8 @@ template <class _Rep1,
412419 class _Period,
413420 class _Rep2,
414421 __enable_if_t<is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
415inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
422[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
423_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
416424operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
417425 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
418426 typedef duration<_Cr, _Period> _Cd;
......@@ -423,7 +431,8 @@ template <class _Rep1,
423431 class _Period,
424432 class _Rep2,
425433 __enable_if_t<is_convertible<const _Rep1&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
426inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
434[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
435_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
427436operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
428437 return __d * __s;
429438}
......@@ -436,7 +445,8 @@ template <class _Rep1,
436445 __enable_if_t<!__is_duration_v<_Rep2> &&
437446 is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
438447 int> = 0>
439inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
448[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
449_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
440450operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
441451 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
442452 typedef duration<_Cr, _Period> _Cd;
......@@ -444,7 +454,7 @@ operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
444454}
445455
446456template <class _Rep1, class _Period1, class _Rep2, class _Period2>
447inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type
457[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type
448458operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
449459 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
450460 return _Ct(__lhs).count() / _Ct(__rhs).count();
......@@ -458,7 +468,8 @@ template <class _Rep1,
458468 __enable_if_t<!__is_duration_v<_Rep2> &&
459469 is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
460470 int> = 0>
461inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
471[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
472_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
462473operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
463474 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
464475 typedef duration<_Cr, _Period> _Cd;
......@@ -466,7 +477,7 @@ operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
466477}
467478
468479template <class _Rep1, class _Period1, class _Rep2, class _Period2>
469inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
480[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
470481typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
471482operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
472483 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
......@@ -481,51 +492,53 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
481492inline namespace literals {
482493inline namespace chrono_literals {
483494
484_LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) {
495[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) {
485496 return chrono::hours(static_cast<chrono::hours::rep>(__h));
486497}
487498
488_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600, 1>> operator""h(long double __h) {
499[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600, 1>>
500operator""h(long double __h) {
489501 return chrono::duration<long double, ratio<3600, 1>>(__h);
490502}
491503
492_LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) {
504[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) {
493505 return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
494506}
495507
496_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60, 1>> operator""min(long double __m) {
508[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60, 1>>
509operator""min(long double __m) {
497510 return chrono::duration<long double, ratio<60, 1>>(__m);
498511}
499512
500_LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) {
513[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) {
501514 return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
502515}
503516
504_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) {
517[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) {
505518 return chrono::duration<long double>(__s);
506519}
507520
508_LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) {
521[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) {
509522 return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
510523}
511524
512_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms) {
525[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms) {
513526 return chrono::duration<long double, milli>(__ms);
514527}
515528
516_LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) {
529[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) {
517530 return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
518531}
519532
520_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us) {
533[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us) {
521534 return chrono::duration<long double, micro>(__us);
522535}
523536
524_LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) {
537[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) {
525538 return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
526539}
527540
528_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns) {
541[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns) {
529542 return chrono::duration<long double, nano>(__ns);
530543}
531544
......@@ -538,6 +551,18 @@ using namespace literals::chrono_literals;
538551
539552#endif // _LIBCPP_STD_VER >= 14
540553
554#if _LIBCPP_STD_VER >= 26
555
556template <class _Rep, class _Period>
557 requires __has_enabled_hash<_Rep>::value
558struct hash<chrono::duration<_Rep, _Period>> {
559 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::duration<_Rep, _Period>& __d) {
560 return hash<_Rep>{}(__d.count());
561 }
562};
563
564#endif // _LIBCPP_STD_VER >= 26
565
541566_LIBCPP_END_NAMESPACE_STD
542567
543568_LIBCPP_POP_MACROS
lib/libcxx/include/__chrono/file_clock.h+4-2
......@@ -60,16 +60,18 @@ struct _FilesystemClock {
6060
6161 _LIBCPP_EXPORTED_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
6262
63 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
63 [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
6464
6565# if _LIBCPP_STD_VER >= 20
6666 template <class _Duration>
67 [[nodiscard]]
6768 _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
6869 return chrono::sys_time<_Duration>(__t.time_since_epoch());
6970 }
7071
7172 template <class _Duration>
72 _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
73 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration>
74 from_sys(const chrono::sys_time<_Duration>& __t) {
7375 return chrono::file_time<_Duration>(__t.time_since_epoch());
7476 }
7577# endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/is_clock.h created+72
......@@ -0,0 +1,72 @@
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___CHRONO_IS_CLOCK_H
11#define _LIBCPP___CHRONO_IS_CLOCK_H
12
13#include <__config>
14
15#include <__chrono/duration.h>
16#include <__chrono/time_point.h>
17#include <__concepts/same_as.h>
18#include <__type_traits/integral_constant.h>
19#include <__type_traits/is_arithmetic.h>
20#include <__type_traits/is_class.h>
21#include <__type_traits/is_union.h>
22#include <ratio>
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28#if _LIBCPP_STD_VER >= 20
29
30_LIBCPP_BEGIN_NAMESPACE_STD
31
32namespace chrono {
33
34// Helper to check that _Tp::time_point has the form time_point<_, typename _Tp::duration>.
35template <class _TimePoint, class _ClockType>
36inline constexpr bool __is_valid_clock_time_point_v = false;
37
38template <class _TimePointClock, class _ClockType>
39inline constexpr bool
40 __is_valid_clock_time_point_v<time_point<_TimePointClock, typename _ClockType::duration>, _ClockType> = true;
41
42// Check if a clock satisfies the Cpp17Clock requirements as defined in [time.clock.req]
43template <class _Tp>
44_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_clock_v = requires {
45 typename _Tp::rep;
46 requires is_arithmetic_v<typename _Tp::rep> || is_class_v<typename _Tp::rep> || is_union_v<typename _Tp::rep>;
47
48 typename _Tp::period;
49 requires __is_ratio_v<typename _Tp::period>;
50
51 typename _Tp::duration;
52 requires same_as<typename _Tp::duration, duration<typename _Tp::rep, typename _Tp::period>>;
53
54 typename _Tp::time_point;
55 requires __is_valid_clock_time_point_v<typename _Tp::time_point, _Tp>;
56
57 _Tp::is_steady;
58 requires same_as<decltype((_Tp::is_steady)), const bool&>;
59
60 _Tp::now();
61 requires same_as<decltype(_Tp::now()), typename _Tp::time_point>;
62};
63
64template <class _Tp>
65struct _LIBCPP_NO_SPECIALIZATIONS is_clock : bool_constant<is_clock_v<_Tp>> {};
66
67} // namespace chrono
68
69_LIBCPP_END_NAMESPACE_STD
70
71#endif // _LIBCPP_STD_VER
72#endif // _LIBCPP___CHRONO_IS_CLOCK_H
lib/libcxx/include/__chrono/leap_second.h+13
......@@ -22,6 +22,8 @@
2222# include <__compare/ordering.h>
2323# include <__compare/three_way_comparable.h>
2424# include <__config>
25# include <__cstddef/size_t.h>
26# include <__functional/hash.h>
2527# include <__utility/private_constructor_tag.h>
2628
2729# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -122,6 +124,17 @@ private:
122124
123125} // namespace chrono
124126
127# if _LIBCPP_STD_VER >= 26
128
129template <>
130struct hash<chrono::leap_second> {
131 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::leap_second& __lp) noexcept {
132 return std::__hash_combine(hash<chrono::sys_seconds>{}(__lp.date()), hash<chrono::seconds>{}(__lp.value()));
133 }
134};
135
136# endif // _LIBCPP_STD_VER >= 26
137
125138# endif // _LIBCPP_STD_VER >= 20
126139
127140_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__chrono/month.h+13
......@@ -13,6 +13,8 @@
1313#include <__chrono/duration.h>
1414#include <__compare/ordering.h>
1515#include <__config>
16#include <__cstddef/size_t.h>
17#include <__functional/hash.h>
1618
1719#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1820# pragma GCC system_header
......@@ -108,6 +110,17 @@ inline constexpr month December{12};
108110
109111} // namespace chrono
110112
113# if _LIBCPP_STD_VER >= 26
114
115template <>
116struct hash<chrono::month> {
117 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month& __m) noexcept {
118 return static_cast<unsigned>(__m);
119 }
120};
121
122# endif // _LIBCPP_STD_VER >= 26
123
111124_LIBCPP_END_NAMESPACE_STD
112125
113126#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/month_weekday.h+22
......@@ -13,6 +13,8 @@
1313#include <__chrono/month.h>
1414#include <__chrono/weekday.h>
1515#include <__config>
16#include <__cstddef/size_t.h>
17#include <__functional/hash.h>
1618
1719#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1820# pragma GCC system_header
......@@ -98,6 +100,26 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekda
98100}
99101} // namespace chrono
100102
103# if _LIBCPP_STD_VER >= 26
104
105template <>
106struct hash<chrono::month_weekday> {
107 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday& __mw) noexcept {
108 return std::__hash_combine(
109 hash<chrono::month>{}(__mw.month()), hash<chrono::weekday_indexed>{}(__mw.weekday_indexed()));
110 }
111};
112
113template <>
114struct hash<chrono::month_weekday_last> {
115 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday_last& __mwl) noexcept {
116 return std::__hash_combine(
117 hash<chrono::month>{}(__mwl.month()), hash<chrono::weekday_last>{}(__mwl.weekday_last()));
118 }
119};
120
121# endif // _LIBCPP_STD_VER >= 26
122
101123_LIBCPP_END_NAMESPACE_STD
102124
103125#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/monthday.h+20
......@@ -15,6 +15,8 @@
1515#include <__chrono/month.h>
1616#include <__compare/ordering.h>
1717#include <__config>
18#include <__cstddef/size_t.h>
19#include <__functional/hash.h>
1820
1921#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2022# pragma GCC system_header
......@@ -126,6 +128,24 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int _
126128
127129} // namespace chrono
128130
131# if _LIBCPP_STD_VER >= 26
132
133template <>
134struct hash<chrono::month_day> {
135 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day& __md) noexcept {
136 return std::__hash_combine(hash<chrono::month>{}(__md.month()), hash<chrono::day>{}(__md.day()));
137 }
138};
139
140template <>
141struct hash<chrono::month_day_last> {
142 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day_last& __mdl) noexcept {
143 return hash<chrono::month>{}(__mdl.month());
144 }
145};
146
147# endif // _LIBCPP_STD_VER >= 26
148
129149_LIBCPP_END_NAMESPACE_STD
130150
131151#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/steady_clock.h+1-1
......@@ -31,7 +31,7 @@ public:
3131 typedef chrono::time_point<steady_clock, duration> time_point;
3232 static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true;
3333
34 static time_point now() _NOEXCEPT;
34 [[__nodiscard__]] static time_point now() _NOEXCEPT;
3535};
3636#endif
3737
lib/libcxx/include/__chrono/system_clock.h+3-3
......@@ -31,9 +31,9 @@ public:
3131 typedef chrono::time_point<system_clock> time_point;
3232 static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
3333
34 static time_point now() _NOEXCEPT;
35 static time_t to_time_t(const time_point& __t) _NOEXCEPT;
36 static time_point from_time_t(time_t __t) _NOEXCEPT;
34 [[__nodiscard__]] static time_point now() _NOEXCEPT;
35 [[__nodiscard__]] static time_t to_time_t(const time_point& __t) _NOEXCEPT;
36 [[__nodiscard__]] static time_point from_time_t(time_t __t) _NOEXCEPT;
3737};
3838
3939#if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/time_point.h+37-13
......@@ -14,6 +14,8 @@
1414#include <__compare/ordering.h>
1515#include <__compare/three_way_comparable.h>
1616#include <__config>
17#include <__cstddef/size_t.h>
18#include <__functional/hash.h>
1719#include <__type_traits/common_type.h>
1820#include <__type_traits/enable_if.h>
1921#include <__type_traits/is_convertible.h>
......@@ -54,7 +56,9 @@ public:
5456
5557 // observer
5658
57 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const { return __d_; }
59 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const {
60 return __d_;
61 }
5862
5963 // arithmetic
6064
......@@ -82,8 +86,12 @@ public:
8286
8387 // special values
8488
85 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT { return time_point(duration::min()); }
86 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT { return time_point(duration::max()); }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT {
90 return time_point(duration::min());
91 }
92 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT {
93 return time_point(duration::max());
94 }
8795};
8896
8997} // namespace chrono
......@@ -95,30 +103,33 @@ struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_C
95103
96104namespace chrono {
97105
98template <class _ToDuration, class _Clock, class _Duration>
99inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, _ToDuration>
106template <class _ToDuration, class _Clock, class _Duration, __enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
107[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, _ToDuration>
100108time_point_cast(const time_point<_Clock, _Duration>& __t) {
101109 return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
102110}
103111
104112#if _LIBCPP_STD_VER >= 17
105113template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
106inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> floor(const time_point<_Clock, _Duration>& __t) {
114[[nodiscard]] inline
115 _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> floor(const time_point<_Clock, _Duration>& __t) {
107116 return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
108117}
109118
110119template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
111inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> ceil(const time_point<_Clock, _Duration>& __t) {
120[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration>
121ceil(const time_point<_Clock, _Duration>& __t) {
112122 return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
113123}
114124
115125template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
116inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> round(const time_point<_Clock, _Duration>& __t) {
126[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration>
127round(const time_point<_Clock, _Duration>& __t) {
117128 return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
118129}
119130
120131template <class _Rep, class _Period, enable_if_t<numeric_limits<_Rep>::is_signed, int> = 0>
121inline _LIBCPP_HIDE_FROM_ABI constexpr duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
132[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
122133 return __d >= __d.zero() ? +__d : -__d;
123134}
124135#endif // _LIBCPP_STD_VER >= 17
......@@ -188,7 +199,7 @@ operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock
188199// time_point operator+(time_point x, duration y);
189200
190201template <class _Clock, class _Duration1, class _Rep2, class _Period2>
191inline _LIBCPP_HIDE_FROM_ABI
202[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
192203_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
193204operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
194205 typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
......@@ -198,7 +209,7 @@ operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
198209// time_point operator+(duration x, time_point y);
199210
200211template <class _Rep1, class _Period1, class _Clock, class _Duration2>
201inline _LIBCPP_HIDE_FROM_ABI
212[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
202213_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
203214operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
204215 return __rhs + __lhs;
......@@ -207,7 +218,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura
207218// time_point operator-(time_point x, duration y);
208219
209220template <class _Clock, class _Duration1, class _Rep2, class _Period2>
210inline _LIBCPP_HIDE_FROM_ABI
221[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
211222_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
212223operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
213224 typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
......@@ -217,13 +228,26 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
217228// duration operator-(time_point x, time_point y);
218229
219230template <class _Clock, class _Duration1, class _Duration2>
220inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename common_type<_Duration1, _Duration2>::type
231[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
232typename common_type<_Duration1, _Duration2>::type
221233operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
222234 return __lhs.time_since_epoch() - __rhs.time_since_epoch();
223235}
224236
225237} // namespace chrono
226238
239#if _LIBCPP_STD_VER >= 26
240
241template <class _Clock, class _Duration>
242 requires __has_enabled_hash<_Duration>::value
243struct hash<chrono::time_point<_Clock, _Duration>> {
244 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::time_point<_Clock, _Duration>& __tp) {
245 return hash<_Duration>{}(__tp.time_since_epoch());
246 }
247};
248
249#endif // _LIBCPP_STD_VER >= 26
250
227251_LIBCPP_END_NAMESPACE_STD
228252
229253_LIBCPP_POP_MACROS
lib/libcxx/include/__chrono/weekday.h+25
......@@ -15,6 +15,8 @@
1515#include <__chrono/system_clock.h>
1616#include <__chrono/time_point.h>
1717#include <__config>
18#include <__cstddef/size_t.h>
19#include <__functional/hash.h>
1820
1921#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2022# pragma GCC system_header
......@@ -160,6 +162,29 @@ inline constexpr weekday Saturday{6};
160162
161163} // namespace chrono
162164
165# if _LIBCPP_STD_VER >= 26
166
167template <>
168struct hash<chrono::weekday> {
169 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday& __w) noexcept { return __w.c_encoding(); }
170};
171
172template <>
173struct hash<chrono::weekday_indexed> {
174 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_indexed& __wi) noexcept {
175 return std::__hash_combine(hash<chrono::weekday>{}(__wi.weekday()), __wi.index());
176 }
177};
178
179template <>
180struct hash<chrono::weekday_last> {
181 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_last& __wl) noexcept {
182 return hash<chrono::weekday>{}(__wl.weekday());
183 }
184};
185
186# endif // _LIBCPP_STD_VER >= 26
187
163188_LIBCPP_END_NAMESPACE_STD
164189
165190#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/year.h+11
......@@ -13,6 +13,8 @@
1313#include <__chrono/duration.h>
1414#include <__compare/ordering.h>
1515#include <__config>
16#include <__cstddef/size_t.h>
17#include <__functional/hash.h>
1618#include <limits>
1719
1820#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -109,6 +111,15 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
109111
110112} // namespace chrono
111113
114# if _LIBCPP_STD_VER >= 26
115
116template <>
117struct hash<chrono::year> {
118 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept { return static_cast<int>(__y); }
119};
120
121# endif // _LIBCPP_STD_VER >= 26
122
112123_LIBCPP_END_NAMESPACE_STD
113124
114125#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/year_month.h+13
......@@ -15,6 +15,8 @@
1515#include <__chrono/year.h>
1616#include <__compare/ordering.h>
1717#include <__config>
18#include <__cstddef/size_t.h>
19#include <__functional/hash.h>
1820
1921#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2022# pragma GCC system_header
......@@ -116,6 +118,17 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const
116118
117119} // namespace chrono
118120
121# if _LIBCPP_STD_VER >= 26
122
123template <>
124struct hash<chrono::year_month> {
125 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month& __ym) noexcept {
126 return std::__hash_combine(hash<chrono::year>{}(__ym.year()), hash<chrono::month>{}(__ym.month()));
127 }
128};
129
130# endif // _LIBCPP_STD_VER >= 26
131
119132_LIBCPP_END_NAMESPACE_STD
120133
121134#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/year_month_day.h+23
......@@ -21,6 +21,8 @@
2121#include <__chrono/year_month.h>
2222#include <__compare/ordering.h>
2323#include <__config>
24#include <__cstddef/size_t.h>
25#include <__functional/hash.h>
2426#include <limits>
2527
2628#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -330,6 +332,27 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept
330332
331333} // namespace chrono
332334
335# if _LIBCPP_STD_VER >= 26
336
337template <>
338struct hash<chrono::year_month_day> {
339 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day& __ymd) noexcept {
340 return std::__hash_combine(
341 hash<chrono::year>{}(__ymd.year()),
342 std::__hash_combine(hash<chrono::month>{}(__ymd.month()), hash<chrono::day>{}(__ymd.day())));
343 }
344};
345
346template <>
347struct hash<chrono::year_month_day_last> {
348 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day_last& __ymdl) noexcept {
349 return std::__hash_combine(
350 hash<chrono::year>{}(__ymdl.year()), hash<chrono::month_day_last>{}(__ymdl.month_day_last()));
351 }
352};
353
354# endif // _LIBCPP_STD_VER >= 26
355
333356_LIBCPP_END_NAMESPACE_STD
334357
335358#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/year_month_weekday.h+26
......@@ -22,6 +22,8 @@
2222#include <__chrono/year_month.h>
2323#include <__chrono/year_month_day.h>
2424#include <__config>
25#include <__cstddef/size_t.h>
26#include <__functional/hash.h>
2527
2628#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2729# pragma GCC system_header
......@@ -280,6 +282,30 @@ year_month_weekday_last::operator-=(const years& __dy) noexcept {
280282
281283} // namespace chrono
282284
285# if _LIBCPP_STD_VER >= 26
286
287template <>
288struct hash<chrono::year_month_weekday> {
289 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday& __ymw) noexcept {
290 return std::__hash_combine(
291 hash<chrono::year>{}(__ymw.year()),
292 std::__hash_combine(
293 hash<chrono::month>{}(__ymw.month()), hash<chrono::weekday_indexed>{}(__ymw.weekday_indexed())));
294 }
295};
296
297template <>
298struct hash<chrono::year_month_weekday_last> {
299 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday_last& __ymwl) noexcept {
300 return std::__hash_combine(
301 hash<chrono::year>{}(__ymwl.year()),
302 std::__hash_combine(
303 hash<chrono::month>{}(__ymwl.month()), hash<chrono::weekday_last>{}(__ymwl.weekday_last())));
304 }
305};
306
307# endif // _LIBCPP_STD_VER >= 26
308
283309_LIBCPP_END_NAMESPACE_STD
284310
285311#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__chrono/zoned_time.h+16
......@@ -24,6 +24,8 @@
2424# include <__chrono/tzdb_list.h>
2525# include <__concepts/constructible.h>
2626# include <__config>
27# include <__cstddef/size_t.h>
28# include <__functional/hash.h>
2729# include <__type_traits/common_type.h>
2830# include <__type_traits/conditional.h>
2931# include <__type_traits/remove_cvref.h>
......@@ -216,6 +218,20 @@ operator==(const zoned_time<_Duration1, _TimeZonePtr>& __lhs, const zoned_time<_
216218
217219} // namespace chrono
218220
221# if _LIBCPP_STD_VER >= 26
222
223template <class _Duration, class _TimeZonePtr>
224 requires __has_enabled_hash<_Duration>::value && __has_enabled_hash<_TimeZonePtr>::value
225struct hash<chrono::zoned_time<_Duration, _TimeZonePtr>> {
226 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t
227 operator()(const chrono::zoned_time<_Duration, _TimeZonePtr>& __zt) {
228 return std::__hash_combine(
229 hash<chrono::sys_time<_Duration>>{}(__zt.get_sys_time()), hash<_TimeZonePtr>{}(__zt.get_time_zone()));
230 }
231};
232
233# endif // _LIBCPP_STD_VER >= 26
234
219235# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
220236 // _LIBCPP_HAS_LOCALIZATION
221237
lib/libcxx/include/__compare/is_eq.h+6-6
......@@ -20,12 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2020
2121#if _LIBCPP_STD_VER >= 20
2222
23_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_eq(partial_ordering __c) noexcept { return __c == 0; }
24_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_neq(partial_ordering __c) noexcept { return __c != 0; }
25_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lt(partial_ordering __c) noexcept { return __c < 0; }
26_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lteq(partial_ordering __c) noexcept { return __c <= 0; }
27_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gt(partial_ordering __c) noexcept { return __c > 0; }
28_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gteq(partial_ordering __c) noexcept { return __c >= 0; }
23[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_eq(partial_ordering __c) noexcept { return __c == 0; }
24[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_neq(partial_ordering __c) noexcept { return __c != 0; }
25[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lt(partial_ordering __c) noexcept { return __c < 0; }
26[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lteq(partial_ordering __c) noexcept { return __c <= 0; }
27[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gt(partial_ordering __c) noexcept { return __c > 0; }
28[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gteq(partial_ordering __c) noexcept { return __c >= 0; }
2929
3030#endif // _LIBCPP_STD_VER >= 20
3131
lib/libcxx/include/__compare/strong_order.h+12-30
......@@ -13,7 +13,6 @@
1313#include <__compare/compare_three_way.h>
1414#include <__compare/ordering.h>
1515#include <__config>
16#include <__math/exponential_functions.h>
1716#include <__math/traits.h>
1817#include <__type_traits/conditional.h>
1918#include <__type_traits/decay.h>
......@@ -53,38 +52,21 @@ struct __fn {
5352 template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
5453 requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
5554 _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept {
56 if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
57 int32_t __rx = std::bit_cast<int32_t>(__t);
58 int32_t __ry = std::bit_cast<int32_t>(__u);
59 __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
60 __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
61 return (__rx <=> __ry);
62 } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
63 int64_t __rx = std::bit_cast<int64_t>(__t);
64 int64_t __ry = std::bit_cast<int64_t>(__u);
65 __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
66 __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
55 if constexpr (numeric_limits<_Dp>::is_iec559 &&
56 (sizeof(_Dp) == sizeof(int32_t) || sizeof(_Dp) == sizeof(int64_t))) {
57 using _IntT = conditional_t<sizeof(_Dp) == sizeof(int32_t), int32_t, int64_t>;
58 _IntT __rx = std::bit_cast<_IntT>(__t);
59 _IntT __ry = std::bit_cast<_IntT>(__u);
60 __rx = (__rx < 0) ? (numeric_limits<_IntT>::min() - __rx - 1) : __rx;
61 __ry = (__ry < 0) ? (numeric_limits<_IntT>::min() - __ry - 1) : __ry;
6762 return (__rx <=> __ry);
6863 } else if (__t < __u) {
6964 return strong_ordering::less;
7065 } else if (__t > __u) {
7166 return strong_ordering::greater;
7267 } else if (__t == __u) {
73 if constexpr (numeric_limits<_Dp>::radix == 2) {
74 return __math::signbit(__u) <=> __math::signbit(__t);
75 } else {
76 // This is bullet 3 of the IEEE754 algorithm, relevant
77 // only for decimal floating-point;
78 // see https://stackoverflow.com/questions/69068075/
79 if (__t == 0 || __math::isinf(__t)) {
80 return __math::signbit(__u) <=> __math::signbit(__t);
81 } else {
82 int __texp, __uexp;
83 (void)__math::frexp(__t, &__texp);
84 (void)__math::frexp(__u, &__uexp);
85 return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
86 }
87 }
68 static_assert(numeric_limits<_Dp>::radix == 2, "floating point type with a radix other than 2?");
69 return __math::signbit(__u) <=> __math::signbit(__t);
8870 } else {
8971 // They're unordered, so one of them must be a NAN.
9072 // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
......@@ -93,9 +75,9 @@ struct __fn {
9375 bool __t_is_negative = __math::signbit(__t);
9476 bool __u_is_negative = __math::signbit(__u);
9577 using _IntType =
96 conditional_t< sizeof(__t) == sizeof(int32_t),
97 int32_t,
98 conditional_t< sizeof(__t) == sizeof(int64_t), int64_t, void> >;
78 conditional_t<sizeof(__t) == sizeof(int32_t),
79 int32_t,
80 conditional_t<sizeof(__t) == sizeof(int64_t), int64_t, void>>;
9981 if constexpr (is_same_v<_IntType, void>) {
10082 static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
10183 } else if (__t_is_nan && __u_is_nan) {
lib/libcxx/include/__compare/three_way_comparable.h+2-2
......@@ -12,6 +12,7 @@
1212#include <__compare/common_comparison_category.h>
1313#include <__compare/ordering.h>
1414#include <__concepts/common_reference_with.h>
15#include <__concepts/comparison_common_type.h>
1516#include <__concepts/equality_comparable.h>
1617#include <__concepts/same_as.h>
1718#include <__concepts/totally_ordered.h>
......@@ -39,8 +40,7 @@ concept three_way_comparable =
3940
4041template <class _Tp, class _Up, class _Cat = partial_ordering>
4142concept three_way_comparable_with =
42 three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> &&
43 common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
43 three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> && __comparison_common_type_with<_Tp, _Up> &&
4444 three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
4545 __weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&
4646 requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
lib/libcxx/include/__concepts/comparison_common_type.h created+40
......@@ -0,0 +1,40 @@
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___CONCEPTS_COMPARISON_COMMON_TYPE_H
10#define _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H
11
12#include <__concepts/convertible_to.h>
13#include <__concepts/same_as.h>
14#include <__config>
15#include <__type_traits/common_reference.h>
16#include <__type_traits/remove_cvref.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#if _LIBCPP_STD_VER >= 20
25
26template <class _Tp, class _Up, class _CommonRef = common_reference_t<const _Tp&, const _Up&>>
27concept __comparison_common_type_with_impl =
28 same_as<common_reference_t<const _Tp&, const _Up&>, common_reference_t<const _Up&, const _Tp&>> && requires {
29 requires convertible_to<const _Tp&, const _CommonRef&> || convertible_to<_Tp, const _CommonRef&>;
30 requires convertible_to<const _Up&, const _CommonRef&> || convertible_to<_Up, const _CommonRef&>;
31 };
32
33template <class _Tp, class _Up>
34concept __comparison_common_type_with = __comparison_common_type_with_impl<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>;
35
36#endif // _LIBCPP_STD_VER >= 20
37
38_LIBCPP_END_NAMESPACE_STD
39
40#endif // _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H
lib/libcxx/include/__concepts/equality_comparable.h+2-1
......@@ -11,6 +11,7 @@
1111
1212#include <__concepts/boolean_testable.h>
1313#include <__concepts/common_reference_with.h>
14#include <__concepts/comparison_common_type.h>
1415#include <__config>
1516#include <__type_traits/common_reference.h>
1617#include <__type_traits/make_const_lvalue_ref.h>
......@@ -41,7 +42,7 @@ concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
4142template <class _Tp, class _Up>
4243concept equality_comparable_with =
4344 equality_comparable<_Tp> && equality_comparable<_Up> &&
44 common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
45 __comparison_common_type_with<_Tp, _Up> &&
4546 equality_comparable<
4647 common_reference_t<
4748 __make_const_lvalue_ref<_Tp>,
lib/libcxx/include/__condition_variable/condition_variable.h+1-1
......@@ -170,7 +170,7 @@ public:
170170 wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred);
171171
172172 typedef __libcpp_condvar_t* native_handle_type;
173 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__cv_; }
173 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__cv_; }
174174
175175private:
176176 void
lib/libcxx/include/__config+63-280
......@@ -14,6 +14,8 @@
1414#include <__configuration/abi.h>
1515#include <__configuration/availability.h>
1616#include <__configuration/compiler.h>
17#include <__configuration/experimental.h>
18#include <__configuration/hardening.h>
1719#include <__configuration/language.h>
1820#include <__configuration/platform.h>
1921
......@@ -28,7 +30,7 @@
2830// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
2931// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
3032// defined to XXYYZZ.
31# define _LIBCPP_VERSION 210100
33# define _LIBCPP_VERSION 220104
3234
3335# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
3436# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
......@@ -38,195 +40,6 @@
3840# define _LIBCPP_FREESTANDING
3941# endif
4042
41// NOLINTNEXTLINE(libcpp-cpp-version-check)
42# if __cplusplus < 201103L
43# define _LIBCPP_CXX03_LANG
44# endif
45
46# if __has_feature(experimental_library)
47# ifndef _LIBCPP_ENABLE_EXPERIMENTAL
48# define _LIBCPP_ENABLE_EXPERIMENTAL
49# endif
50# endif
51
52// Incomplete features get their own specific disabling flags. This makes it
53// easier to grep for target specific flags once the feature is complete.
54# if defined(_LIBCPP_ENABLE_EXPERIMENTAL) || defined(_LIBCPP_BUILDING_LIBRARY)
55# define _LIBCPP_HAS_EXPERIMENTAL_LIBRARY 1
56# else
57# define _LIBCPP_HAS_EXPERIMENTAL_LIBRARY 0
58# endif
59
60# define _LIBCPP_HAS_EXPERIMENTAL_PSTL _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
61# define _LIBCPP_HAS_EXPERIMENTAL_TZDB _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
62# define _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
63# define _LIBCPP_HAS_EXPERIMENTAL_HARDENING_OBSERVE_SEMANTIC _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
64
65// HARDENING {
66
67// TODO(LLVM 23): Remove this. We're making these an error to catch folks who might not have migrated.
68// Since hardening went through several changes (many of which impacted user-facing macros),
69// we're keeping these checks around for a bit longer than usual. Failure to properly configure
70// hardening results in checks being dropped silently, which is a pretty big deal.
71# if defined(_LIBCPP_ENABLE_ASSERTIONS)
72# error "_LIBCPP_ENABLE_ASSERTIONS has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
73# endif
74# if defined(_LIBCPP_ENABLE_HARDENED_MODE)
75# error "_LIBCPP_ENABLE_HARDENED_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
76# endif
77# if defined(_LIBCPP_ENABLE_SAFE_MODE)
78# error "_LIBCPP_ENABLE_SAFE_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
79# endif
80# if defined(_LIBCPP_ENABLE_DEBUG_MODE)
81# error "_LIBCPP_ENABLE_DEBUG_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
82# endif
83
84// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
85//
86// - `_LIBCPP_HARDENING_MODE_NONE`;
87// - `_LIBCPP_HARDENING_MODE_FAST`;
88// - `_LIBCPP_HARDENING_MODE_EXTENSIVE`;
89// - `_LIBCPP_HARDENING_MODE_DEBUG`.
90//
91// These values have the following effects:
92//
93// - `_LIBCPP_HARDENING_MODE_NONE` -- sets the hardening mode to "none" which disables all runtime hardening checks;
94//
95// - `_LIBCPP_HARDENING_MODE_FAST` -- sets that hardening mode to "fast". The fast mode enables security-critical checks
96// that can be done with relatively little runtime overhead in constant time;
97//
98// - `_LIBCPP_HARDENING_MODE_EXTENSIVE` -- sets the hardening mode to "extensive". The extensive mode is a superset of
99// the fast mode that additionally enables checks that are relatively cheap and prevent common types of logic errors
100// but are not necessarily security-critical;
101//
102// - `_LIBCPP_HARDENING_MODE_DEBUG` -- sets the hardening mode to "debug". The debug mode is a superset of the extensive
103// mode and enables all checks available in the library, including internal assertions. Checks that are part of the
104// debug mode can be very expensive and thus the debug mode is intended to be used for testing, not in production.
105
106// Inside the library, assertions are categorized so they can be cherry-picked based on the chosen hardening mode. These
107// macros are only for internal use -- users should only pick one of the high-level hardening modes described above.
108//
109// - `_LIBCPP_ASSERT_VALID_INPUT_RANGE` -- checks that ranges (whether expressed as an iterator pair, an iterator and
110// a sentinel, an iterator and a count, or a `std::range`) given as input to library functions are valid:
111// - the sentinel is reachable from the begin iterator;
112// - TODO(hardening): both iterators refer to the same container.
113//
114// - `_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS` -- checks that any attempts to access a container element, whether through
115// the container object or through an iterator, are valid and do not attempt to go out of bounds or otherwise access
116// a non-existent element. For iterator checks to work, bounded iterators must be enabled in the ABI. Types like
117// `optional` and `function` are considered one-element containers for the purposes of this check.
118//
119// - `_LIBCPP_ASSERT_NON_NULL` -- checks that the pointer being dereferenced is not null. On most modern platforms zero
120// address does not refer to an actual location in memory, so a null pointer dereference would not compromize the
121// memory security of a program (however, it is still undefined behavior that can result in strange errors due to
122// compiler optimizations).
123//
124// - `_LIBCPP_ASSERT_NON_OVERLAPPING_RANGES` -- for functions that take several ranges as arguments, checks that the
125// given ranges do not overlap.
126//
127// - `_LIBCPP_ASSERT_VALID_DEALLOCATION` -- checks that an attempt to deallocate memory is valid (e.g. the given object
128// was allocated by the given allocator). Violating this category typically results in a memory leak.
129//
130// - `_LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL` -- checks that a call to an external API doesn't fail in
131// an unexpected manner. This includes triggering documented cases of undefined behavior in an external library (like
132// attempting to unlock an unlocked mutex in pthreads). Any API external to the library falls under this category
133// (from system calls to compiler intrinsics). We generally don't expect these failures to compromize memory safety or
134// otherwise create an immediate security issue.
135//
136// - `_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR` -- checks any operations that exchange nodes between containers to make sure
137// the containers have compatible allocators.
138//
139// - `_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN` -- checks that the given argument is within the domain of valid arguments
140// for the function. Violating this typically produces an incorrect result (e.g. the clamp algorithm returns the
141// original value without clamping it due to incorrect functors) or puts an object into an invalid state (e.g.
142// a string view where only a subset of elements is possible to access). This category is for assertions violating
143// which doesn't cause any immediate issues in the library -- whatever the consequences are, they will happen in the
144// user code.
145//
146// - `_LIBCPP_ASSERT_PEDANTIC` -- checks prerequisites which are imposed by the Standard, but violating which happens to
147// be benign in our implementation.
148//
149// - `_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT` -- checks that the given argument satisfies the semantic requirements imposed
150// by the Standard. Typically, there is no simple way to completely prove that a semantic requirement is satisfied;
151// thus, this would often be a heuristic check and it might be quite expensive.
152//
153// - `_LIBCPP_ASSERT_INTERNAL` -- checks that internal invariants of the library hold. These assertions don't depend on
154// user input.
155//
156// - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet.
157
158// clang-format off
159# define _LIBCPP_HARDENING_MODE_NONE (1 << 1)
160# define _LIBCPP_HARDENING_MODE_FAST (1 << 2)
161# define _LIBCPP_HARDENING_MODE_EXTENSIVE (1 << 4) // Deliberately not ordered.
162# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3)
163// clang-format on
164
165# ifndef _LIBCPP_HARDENING_MODE
166
167# ifndef _LIBCPP_HARDENING_MODE_DEFAULT
168# error _LIBCPP_HARDENING_MODE_DEFAULT is not defined. This definition should be set at configuration time in the \
169`__config_site` header, please make sure your installation of libc++ is not broken.
170# endif
171
172# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT
173# endif
174
175# if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_NONE && \
176 _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_FAST && \
177 _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE && \
178 _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
179# error _LIBCPP_HARDENING_MODE must be set to one of the following values: \
180_LIBCPP_HARDENING_MODE_NONE, \
181_LIBCPP_HARDENING_MODE_FAST, \
182_LIBCPP_HARDENING_MODE_EXTENSIVE, \
183_LIBCPP_HARDENING_MODE_DEBUG
184# endif
185
186// Hardening assertion semantics generally mirror the evaluation semantics of C++26 Contracts:
187// - `ignore` evaluates the assertion but doesn't do anything if it fails (note that it differs from the Contracts
188// `ignore` semantic which wouldn't evaluate the assertion at all);
189// - `observe` logs an error (indicating, if possible, that the error is fatal) and continues execution;
190// - `quick-enforce` terminates the program as fast as possible (via trapping);
191// - `enforce` logs an error and then terminates the program.
192//
193// Notes:
194// - Continuing execution after a hardening check fails results in undefined behavior; the `observe` semantic is meant
195// to make adopting hardening easier but should not be used outside of this scenario;
196// - C++26 wording for Library Hardening precludes a conforming Hardened implementation from using the Contracts
197// `ignore` semantic when evaluating hardened preconditions in the Library. Libc++ allows using this semantic for
198// hardened preconditions, however, be aware that using `ignore` does not produce a conforming "Hardened"
199// implementation, unlike the other semantics above.
200// clang-format off
201# define _LIBCPP_ASSERTION_SEMANTIC_IGNORE (1 << 1)
202# define _LIBCPP_ASSERTION_SEMANTIC_OBSERVE (1 << 2)
203# define _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE (1 << 3)
204# define _LIBCPP_ASSERTION_SEMANTIC_ENFORCE (1 << 4)
205// clang-format on
206
207// Allow users to define an arbitrary assertion semantic; otherwise, use the default mapping from modes to semantics.
208// The default is for production-capable modes to use `quick-enforce` (i.e., trap) and for the `debug` mode to use
209// `enforce` (i.e., log and abort).
210# ifndef _LIBCPP_ASSERTION_SEMANTIC
211
212# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
213# define _LIBCPP_ASSERTION_SEMANTIC _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
214# else
215# define _LIBCPP_ASSERTION_SEMANTIC _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
216# endif
217
218# else
219# if !_LIBCPP_HAS_EXPERIMENTAL_LIBRARY
220# error "Assertion semantics are an experimental feature."
221# endif
222# if defined(_LIBCPP_CXX03_LANG)
223# error "Assertion semantics are not available in the C++03 mode."
224# endif
225
226# endif // _LIBCPP_ASSERTION_SEMANTIC
227
228// } HARDENING
229
23043# define _LIBCPP_TOSTRING2(x) #x
23144# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
23245
......@@ -320,13 +133,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
320133// When this option is used, the token passed to `std::random_device`'s
321134// constructor *must* be "/dev/urandom" -- anything else is an error.
322135//
323// _LIBCPP_USING_NACL_RANDOM
324// NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
325// including accesses to the special files under `/dev`. This implementation
326// uses the NaCL syscall `nacl_secure_random_init()` to get entropy.
327// When this option is used, the token passed to `std::random_device`'s
328// constructor *must* be "/dev/urandom" -- anything else is an error.
329//
330136// _LIBCPP_USING_WIN32_RANDOM
331137// Use rand_s(), for use on Windows.
332138// When this option is used, the token passed to `std::random_device`'s
......@@ -338,8 +144,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
338144# define _LIBCPP_USING_GETENTROPY
339145# elif defined(__Fuchsia__)
340146# define _LIBCPP_USING_FUCHSIA_CPRNG
341# elif defined(__native_client__)
342# define _LIBCPP_USING_NACL_RANDOM
343147# elif defined(_LIBCPP_WIN32API)
344148# define _LIBCPP_USING_WIN32_RANDOM
345149# else
......@@ -348,7 +152,7 @@ _LIBCPP_HARDENING_MODE_DEBUG
348152
349153# ifndef _LIBCPP_CXX03_LANG
350154
351# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp)
155# define _LIBCPP_ALIGNOF(...) alignof(__VA_ARGS__)
352156# define _ALIGNAS_TYPE(x) alignas(x)
353157# define _ALIGNAS(x) alignas(x)
354158# define _NOEXCEPT noexcept
......@@ -357,7 +161,7 @@ _LIBCPP_HARDENING_MODE_DEBUG
357161
358162# else
359163
360# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
164# define _LIBCPP_ALIGNOF(...) _Alignof(__VA_ARGS__)
361165# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
362166# define _ALIGNAS(x) __attribute__((__aligned__(x)))
363167# define nullptr __nullptr
......@@ -471,6 +275,12 @@ typedef __char32_t char32_t;
471275# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
472276# endif
473277
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
474284# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
475285# define _LIBCPP_HARDENING_SIG f
476286# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
......@@ -481,6 +291,16 @@ typedef __char32_t char32_t;
481291# define _LIBCPP_HARDENING_SIG n // "none"
482292# endif
483293
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
484304# if !_LIBCPP_HAS_EXCEPTIONS
485305# define _LIBCPP_EXCEPTIONS_SIG n
486306# else
......@@ -488,7 +308,9 @@ typedef __char32_t char32_t;
488308# endif
489309
490310# define _LIBCPP_ODR_SIGNATURE \
491 _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_VERSION)
311 _LIBCPP_CONCAT( \
312 _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG), \
313 _LIBCPP_VERSION)
492314
493315// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved
494316// on two levels:
......@@ -550,16 +372,6 @@ typedef __char32_t char32_t;
550372# endif
551373# define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
552374
553# ifdef _LIBCPP_BUILDING_LIBRARY
554# if _LIBCPP_ABI_VERSION > 1
555# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
556# else
557# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1
558# endif
559# else
560# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
561# endif
562
563375// Clang modules take a significant compile time hit when pushing and popping diagnostics.
564376// Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can
565377// simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined.
......@@ -676,27 +488,6 @@ typedef __char32_t char32_t;
676488# endif
677489# endif
678490
679// It is not yet possible to use aligned_alloc() on all Apple platforms since
680// 10.15 was the first version to ship an implementation of aligned_alloc().
681# if defined(__APPLE__)
682# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
683 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
684 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
685 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
686 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \
687 __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) || \
688 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000)
689# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
690# else
691# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
692# endif
693# elif defined(__ANDROID__) && __ANDROID_API__ < 28
694// Android only provides aligned_alloc when targeting API 28 or higher.
695# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
696# else
697# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
698# endif
699
700491# if defined(__APPLE__) || defined(__FreeBSD__)
701492# define _LIBCPP_WCTYPE_IS_MASK
702493# endif
......@@ -727,6 +518,15 @@ typedef __char32_t char32_t;
727518# define _LIBCPP_DEPRECATED_(m)
728519# endif
729520
521// FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be
522// enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that
523// allows suppression in system headers.
524# if defined(__DEPRECATED) && __DEPRECATED && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) && 0
525# define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 1
526# else
527# define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 0
528# endif
529
730530# if !defined(_LIBCPP_CXX03_LANG)
731531# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
732532# else
......@@ -771,17 +571,6 @@ typedef __char32_t char32_t;
771571# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
772572# endif
773573
774// Macros to enter and leave a state where deprecation warnings are suppressed.
775# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC)
776# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
777 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
778 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
779# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop")
780# else
781# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
782# define _LIBCPP_SUPPRESS_DEPRECATED_POP
783# endif
784
785574# if _LIBCPP_STD_VER <= 11
786575# define _LIBCPP_EXPLICIT_SINCE_CXX14
787576# else
......@@ -861,18 +650,10 @@ typedef __char32_t char32_t;
861650# endif // _LIBCPP_HAS_THREAD_API
862651# endif // _LIBCPP_HAS_THREADS
863652
864# if _LIBCPP_HAS_THREAD_API_PTHREAD
865# if defined(__ANDROID__) && __ANDROID_API__ >= 30
866# define _LIBCPP_HAS_COND_CLOCKWAIT 1
867# elif defined(_LIBCPP_GLIBC_PREREQ)
868# if _LIBCPP_GLIBC_PREREQ(2, 30)
869# define _LIBCPP_HAS_COND_CLOCKWAIT 1
870# else
871# define _LIBCPP_HAS_COND_CLOCKWAIT 0
872# endif
873# else
874# define _LIBCPP_HAS_COND_CLOCKWAIT 0
875# endif
653# if !_LIBCPP_HAS_THREAD_API_PTHREAD
654# define _LIBCPP_HAS_COND_CLOCKWAIT 0
655# elif (defined(__ANDROID__) && __ANDROID_API__ >= 30) || _LIBCPP_GLIBC_PREREQ(2, 30)
656# define _LIBCPP_HAS_COND_CLOCKWAIT 1
876657# else
877658# define _LIBCPP_HAS_COND_CLOCKWAIT 0
878659# endif
......@@ -951,8 +732,8 @@ typedef __char32_t char32_t;
951732# endif
952733# endif
953734
954# if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(__no_thread_safety_analysis__)
955# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((__no_thread_safety_analysis__))
735# if __has_cpp_attribute(_Clang::__no_thread_safety_analysis__)
736# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[_Clang::__no_thread_safety_analysis__]]
956737# else
957738# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
958739# endif
......@@ -1038,12 +819,8 @@ typedef __char32_t char32_t;
1038819// the latter depends on internal GNU libc details that are not appropriate
1039820// to depend on here, so any declarations present when __cpp_char8_t is not
1040821// defined are ignored.
1041# if defined(_LIBCPP_GLIBC_PREREQ)
1042# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
1043# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
1044# else
1045# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
1046# endif
822# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
823# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
1047824# else
1048825# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
1049826# endif
......@@ -1067,8 +844,7 @@ typedef __char32_t char32_t;
1067844# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")
1068845# endif
1069846
1070// TODO(LLVM 22): Remove the workaround
1071# if defined(__OBJC__) && (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER < 2001)
847# if defined(__OBJC__) && defined(_LIBCPP_APPLE_CLANG_VER)
1072848# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS
1073849# endif
1074850
......@@ -1153,12 +929,33 @@ typedef __char32_t char32_t;
1153929# define _LIBCPP_DIAGNOSE_WARNING(...)
1154930# endif
1155931
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
1156946# if __has_cpp_attribute(_Clang::__lifetimebound__)
1157947# define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]
1158948# else
1159949# define _LIBCPP_LIFETIMEBOUND
1160950# endif
1161951
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
1162959# if __has_cpp_attribute(_Clang::__noescape__)
1163960# define _LIBCPP_NOESCAPE [[_Clang::__noescape__]]
1164961# else
......@@ -1172,12 +969,6 @@ typedef __char32_t char32_t;
1172969# define _LIBCPP_NO_SPECIALIZATIONS
1173970# endif
1174971
1175# if __has_cpp_attribute(_Clang::__standalone_debug__)
1176# define _LIBCPP_STANDALONE_DEBUG [[_Clang::__standalone_debug__]]
1177# else
1178# define _LIBCPP_STANDALONE_DEBUG
1179# endif
1180
1181972# if __has_cpp_attribute(_Clang::__preferred_name__)
1182973# define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]]
1183974# else
......@@ -1257,14 +1048,6 @@ typedef __char32_t char32_t;
12571048# define _LIBCPP_DIAGNOSE_NULLPTR
12581049# endif
12591050
1260// TODO(LLVM 22): Remove this macro once LLVM19 support ends. __cpp_explicit_this_parameter has been set in LLVM20.
1261// Clang-18 has support for deducing this, but it does not set the FTM.
1262# if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1800)
1263# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 1
1264# else
1265# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 0
1266# endif
1267
12681051#endif // __cplusplus
12691052
12701053#endif // _LIBCPP___CONFIG
lib/libcxx/include/__configuration/abi.h+14-24
......@@ -61,19 +61,9 @@
6161// According to the Standard, `bitset::operator[] const` returns bool
6262# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
6363
64// In LLVM 20, we've changed to take these ABI breaks unconditionally. These flags only exist in case someone is running
65// into the static_asserts we added to catch the ABI break and don't care that it is one.
66// TODO(LLVM 22): Remove these flags
67# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
68# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
69# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
70# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
71
7264// These flags are documented in ABIGuarantees.rst
7365# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
74# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
75# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
76# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
66# define _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
7767# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
7868# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
7969# define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION
......@@ -84,25 +74,16 @@
8474# define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
8575# define _LIBCPP_ABI_NO_ITERATOR_BASES
8676# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT
77# define _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER
8778# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
8879# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
8980# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
9081# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
9182# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
9283# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
84# define _LIBCPP_ABI_TRIVIALLY_COPYABLE_BIT_ITERATOR
9385
9486#elif _LIBCPP_ABI_VERSION == 1
95# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
96// Enable compiling copies of now inline methods into the dylib to support
97// applications compiled against older libraries. This is unnecessary with
98// COFF dllexport semantics, since dllexport forces a non-inline definition
99// of inline functions to be emitted anyway. Our own non-inline copy would
100// conflict with the dllexport-emitted copy, so we disable it. For XCOFF,
101// the linker will take issue with the symbols in the shared object if the
102// weak inline methods get visibility (such as from -fvisibility-inlines-hidden),
103// so disable it.
104# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
105# endif
10687// Feature macros for disabling pre ABI v1 features. All of these options
10788// are deprecated.
10889# if defined(__FreeBSD__)
......@@ -110,11 +91,20 @@
11091# endif
11192#endif
11293
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
113103// We had some bugs where we use [[no_unique_address]] together with construct_at,
114104// which causes UB as the call on construct_at could write to overlapping subobjects
115105//
116// https://github.com/llvm/llvm-project/issues/70506
117// https://github.com/llvm/llvm-project/issues/70494
106// https://llvm.org/PR70506
107// https://llvm.org/PR70494
118108//
119109// To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions.
120110// The macro below is used for all classes whose ABI have changed as part of fixing these bugs.
lib/libcxx/include/__configuration/availability.h+65-118
......@@ -17,62 +17,17 @@
1717# pragma GCC system_header
1818#endif
1919
20// Libc++ is shipped by various vendors. In particular, it is used as a system
21// library on macOS, iOS and other Apple platforms. In order for users to be
22// able to compile a binary that is intended to be deployed to an older version
23// of a platform, Clang provides availability attributes [1]. These attributes
24// can be placed on declarations and are used to describe the life cycle of a
25// symbol in the library.
26//
27// The main goal is to ensure a compile-time error if a symbol that hasn't been
28// introduced in a previously released library is used in a program that targets
29// that previously released library. Normally, this would be a load-time error
30// when one tries to launch the program against the older library.
31//
32// For example, the filesystem library was introduced in the dylib in LLVM 9.
33// On Apple platforms, this corresponds to macOS 10.15. If a user compiles on
34// a macOS 10.15 host but targets macOS 10.13 with their program, the compiler
35// would normally not complain (because the required declarations are in the
36// headers), but the dynamic loader would fail to find the symbols when actually
37// trying to launch the program on macOS 10.13. To turn this into a compile-time
38// issue instead, declarations are annotated with when they were introduced, and
39// the compiler can produce a diagnostic if the program references something that
40// isn't available on the deployment target.
41//
42// This mechanism is general in nature, and any vendor can add their markup to
43// the library (see below). Whenever a new feature is added that requires support
44// in the shared library, two macros are added below to allow marking the feature
45// as unavailable:
46// 1. A macro named `_LIBCPP_AVAILABILITY_HAS_<feature>` which must be defined
47// to `_LIBCPP_INTRODUCED_IN_<version>` for the appropriate LLVM version.
48// 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must be defined to
49// `_LIBCPP_INTRODUCED_IN_<version>_MARKUP` for the appropriate LLVM version.
50//
51// When vendors decide to ship the feature as part of their shared library, they
52// can update the `_LIBCPP_INTRODUCED_IN_<version>` macro (and the markup counterpart)
53// based on the platform version they shipped that version of LLVM in. The library
54// will then use this markup to provide an optimal user experience on these platforms.
55//
56// Furthermore, many features in the standard library have corresponding
57// feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_<feature>` macros
58// are checked by the corresponding feature-test macros generated by
59// generate_feature_test_macro_components.py to ensure that the library
60// doesn't announce a feature as being implemented if it is unavailable on
61// the deployment target.
62//
63// Note that this mechanism is disabled by default in the "upstream" libc++.
64// Availability annotations are only meaningful when shipping libc++ inside
65// a platform (i.e. as a system library), and so vendors that want them should
66// turn those annotations on at CMake configuration time.
67//
68// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
20// This file defines a framework that can be used by vendors to encode the version of an operating system that various
21// features of libc++ has been shipped in. This is primarily intended to allow safely deploying an executable built with
22// a new version of the library on a platform containing an older version of the built library.
23// Detailed documentation for this can be found at https://libcxx.llvm.org/VendorDocumentation.html#availability-markup
6924
7025// Availability markup is disabled when building the library, or when a non-Clang
7126// compiler is used because only Clang supports the necessary attributes.
7227//
7328// We also allow users to force-disable availability markup via the `_LIBCPP_DISABLE_AVAILABILITY`
7429// macro because that is the only way to work around a Clang bug related to availability
75// attributes: https://github.com/llvm/llvm-project/issues/134151.
30// attributes: https://llvm.org/PR134151.
7631// Once that bug has been fixed, we should remove the macro.
7732#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || \
7833 !defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_DISABLE_AVAILABILITY)
......@@ -84,6 +39,9 @@
8439// in all versions of the library are available.
8540#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
8641
42# define _LIBCPP_INTRODUCED_IN_LLVM_22 1
43# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */
44
8745# define _LIBCPP_INTRODUCED_IN_LLVM_21 1
8846# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE /* nothing */
8947
......@@ -108,32 +66,55 @@
10866# define _LIBCPP_INTRODUCED_IN_LLVM_12 1
10967# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */
11068
111# define _LIBCPP_INTRODUCED_IN_LLVM_11 1
112# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */
113
114# define _LIBCPP_INTRODUCED_IN_LLVM_9 1
115# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE /* nothing */
116# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */
117# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP /* nothing */
118
11969#elif defined(__APPLE__)
12070
12171// clang-format off
12272
73// LLVM 22
74// TODO: Fill this in
75# define _LIBCPP_INTRODUCED_IN_LLVM_22 0
76# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable))
77
12378// LLVM 21
12479// TODO: Fill this in
12580# define _LIBCPP_INTRODUCED_IN_LLVM_21 0
12681# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE __attribute__((unavailable))
12782
12883// LLVM 20
129// TODO: Fill this in
130# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
131# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE __attribute__((unavailable))
84//
85// Note that versions for most Apple OSes were bumped forward and aligned in that release.
86# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260000) || \
87 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \
88 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \
89 (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)
91# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
92# else
93# define _LIBCPP_INTRODUCED_IN_LLVM_20 1
94# endif
95# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE \
96 __attribute__((availability(macos, strict, introduced = 26.0))) \
97 __attribute__((availability(ios, strict, introduced = 26.0))) \
98 __attribute__((availability(tvos, strict, introduced = 26.0))) \
99 __attribute__((availability(watchos, strict, introduced = 26.0))) \
100 __attribute__((availability(bridgeos, strict, introduced = 10.0)))
132101
133102// LLVM 19
134// TODO: Fill this in
135# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
136# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))
103# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \
104 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \
105 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \
106 (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)
108# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
109# else
110# define _LIBCPP_INTRODUCED_IN_LLVM_19 1
111# endif
112# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE \
113 __attribute__((availability(macos, strict, introduced = 15.4))) \
114 __attribute__((availability(ios, strict, introduced = 18.4))) \
115 __attribute__((availability(tvos, strict, introduced = 18.4))) \
116 __attribute__((availability(watchos, strict, introduced = 11.4))) \
117 __attribute__((availability(bridgeos, strict, introduced = 9.4)))
137118
138119// LLVM 18
139120# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \
......@@ -215,47 +196,13 @@
215196 __attribute__((availability(bridgeos, strict, introduced = 6.0))) \
216197 __attribute__((availability(driverkit, strict, introduced = 21.3)))
217198
218// LLVM 11
219# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
220 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
221 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
222 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
223# define _LIBCPP_INTRODUCED_IN_LLVM_11 0
224# else
225# define _LIBCPP_INTRODUCED_IN_LLVM_11 1
199# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
200 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \
201 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150000) || \
202 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80000) || \
203 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 200000)
204# warning "The selected platform is no longer supported by libc++."
226205# endif
227# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE \
228 __attribute__((availability(macos, strict, introduced = 11.0))) \
229 __attribute__((availability(ios, strict, introduced = 14.0))) \
230 __attribute__((availability(tvos, strict, introduced = 14.0))) \
231 __attribute__((availability(watchos, strict, introduced = 7.0)))
232
233// LLVM 9
234# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
235 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
236 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
237 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
238# define _LIBCPP_INTRODUCED_IN_LLVM_9 0
239# else
240# define _LIBCPP_INTRODUCED_IN_LLVM_9 1
241# endif
242# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE \
243 __attribute__((availability(macos, strict, introduced = 10.15))) \
244 __attribute__((availability(ios, strict, introduced = 13.0))) \
245 __attribute__((availability(tvos, strict, introduced = 13.0))) \
246 __attribute__((availability(watchos, strict, introduced = 6.0)))
247# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH \
248 _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
249 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
250 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
251 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
252# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP \
253 _Pragma("clang attribute pop") \
254 _Pragma("clang attribute pop") \
255 _Pragma("clang attribute pop") \
256 _Pragma("clang attribute pop")
257
258// clang-format on
259206
260207#else
261208
......@@ -266,19 +213,12 @@
266213
267214#endif
268215
269// These macros control the availability of all parts of <filesystem> that
270// depend on something in the dylib.
271#define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9
272#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE
273#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH
274#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP
275
276// This controls the availability of the C++20 synchronization library,
277// which requires shared library support for various operations
278// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
279// <semaphore>, and notification functions on std::atomic.
280#define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11
281#define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
216// This controls the availability of new implementation of std::atomic's
217// wait, notify_one and notify_all. The new implementation uses
218// the native atomic wait/notify operations on platforms that support them
219// based on the size of the atomic type, instead of the type itself.
220#define _LIBCPP_AVAILABILITY_HAS_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22
221#define _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE
282222
283223// Enable additional explicit instantiations of iostreams components. This
284224// reduces the number of weak definitions generated in programs that use
......@@ -307,7 +247,7 @@
307247// This controls the availability of the C++17 std::pmr library,
308248// which is implemented in large part in the built library.
309249//
310// TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed
250// TODO: Enable std::pmr markup once https://llvm.org/PR40340 has been fixed
311251// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
312252// 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
313253// use availability annotations until that bug has been fixed.
......@@ -364,4 +304,11 @@
364304# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
365305#endif
366306
307// Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older
308# if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8
309# define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8
310# else
311# define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 _LIBCPP_HIDE_FROM_ABI
312# endif
313
367314#endif // _LIBCPP___CONFIGURATION_AVAILABILITY_H
lib/libcxx/include/__configuration/compiler.h+6-6
......@@ -33,16 +33,16 @@
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 < 1900
37# warning "Libc++ only supports Clang 19 and later"
36# if _LIBCPP_CLANG_VER < 2001
37# warning "Libc++ only supports Clang 20 and later"
3838# endif
3939# elif defined(_LIBCPP_APPLE_CLANG_VER)
40# if _LIBCPP_APPLE_CLANG_VER < 1500
41# warning "Libc++ only supports AppleClang 15 and later"
40# if _LIBCPP_APPLE_CLANG_VER < 1700
41# warning "Libc++ only supports AppleClang 26 and later"
4242# endif
4343# elif defined(_LIBCPP_GCC_VER)
44# if _LIBCPP_GCC_VER < 1400
45# warning "Libc++ only supports GCC 14 and later"
44# if _LIBCPP_GCC_VER < 1500
45# warning "Libc++ only supports GCC 15 and later"
4646# endif
4747# endif
4848
lib/libcxx/include/__configuration/experimental.h created+38
......@@ -0,0 +1,38 @@
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_EXPERIMENTAL_H
10#define _LIBCPP___CONFIGURATION_EXPERIMENTAL_H
11
12/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
13
14#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
15# pragma GCC system_header
16#endif
17
18#if __has_feature(experimental_library)
19# ifndef _LIBCPP_ENABLE_EXPERIMENTAL
20# define _LIBCPP_ENABLE_EXPERIMENTAL
21# endif
22#endif
23
24// Incomplete features get their own specific disabling flags. This makes it
25// easier to grep for target specific flags once the feature is complete.
26#if defined(_LIBCPP_ENABLE_EXPERIMENTAL) || defined(_LIBCPP_BUILDING_LIBRARY)
27# define _LIBCPP_HAS_EXPERIMENTAL_LIBRARY 1
28#else
29# define _LIBCPP_HAS_EXPERIMENTAL_LIBRARY 0
30#endif
31
32#define _LIBCPP_HAS_EXPERIMENTAL_PSTL _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
33#define _LIBCPP_HAS_EXPERIMENTAL_TZDB _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
34#define _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
35#define _LIBCPP_HAS_EXPERIMENTAL_HARDENING_OBSERVE_SEMANTIC _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
36#define _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR _LIBCPP_HAS_EXPERIMENTAL_LIBRARY
37
38#endif // _LIBCPP___CONFIGURATION_EXPERIMENTAL_H
lib/libcxx/include/__configuration/hardening.h created+215
......@@ -0,0 +1,215 @@
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_HARDENING_H
10#define _LIBCPP___CONFIGURATION_HARDENING_H
11
12/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
13#include <__configuration/experimental.h>
14#include <__configuration/language.h>
15
16#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
17# pragma GCC system_header
18#endif
19
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
37// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
38//
39// - `_LIBCPP_HARDENING_MODE_NONE`;
40// - `_LIBCPP_HARDENING_MODE_FAST`;
41// - `_LIBCPP_HARDENING_MODE_EXTENSIVE`;
42// - `_LIBCPP_HARDENING_MODE_DEBUG`.
43//
44// These values have the following effects:
45//
46// - `_LIBCPP_HARDENING_MODE_NONE` -- sets the hardening mode to "none" which disables all runtime hardening checks;
47//
48// - `_LIBCPP_HARDENING_MODE_FAST` -- sets that hardening mode to "fast". The fast mode enables security-critical checks
49// that can be done with relatively little runtime overhead in constant time;
50//
51// - `_LIBCPP_HARDENING_MODE_EXTENSIVE` -- sets the hardening mode to "extensive". The extensive mode is a superset of
52// the fast mode that additionally enables checks that are relatively cheap and prevent common types of logic errors
53// but are not necessarily security-critical;
54//
55// - `_LIBCPP_HARDENING_MODE_DEBUG` -- sets the hardening mode to "debug". The debug mode is a superset of the extensive
56// mode and enables all checks available in the library, including internal assertions. Checks that are part of the
57// debug mode can be very expensive and thus the debug mode is intended to be used for testing, not in production.
58
59// Inside the library, assertions are categorized so they can be cherry-picked based on the chosen hardening mode. These
60// macros are only for internal use -- users should only pick one of the high-level hardening modes described above.
61//
62// - `_LIBCPP_ASSERT_VALID_INPUT_RANGE` -- checks that ranges (whether expressed as an iterator pair, an iterator and
63// a sentinel, an iterator and a count, or a `std::range`) given as input to library functions are valid:
64// - the sentinel is reachable from the begin iterator;
65// - TODO(hardening): both iterators refer to the same container.
66//
67// - `_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS` -- checks that any attempts to access a container element, whether through
68// the container object or through an iterator, are valid and do not attempt to go out of bounds or otherwise access
69// a non-existent element. For iterator checks to work, bounded iterators must be enabled in the ABI. Types like
70// `optional` and `function` are considered one-element containers for the purposes of this check.
71//
72// - `_LIBCPP_ASSERT_NON_NULL` -- checks that the pointer being dereferenced is not null. On most modern platforms zero
73// address does not refer to an actual location in memory, so a null pointer dereference would not compromize the
74// memory security of a program (however, it is still undefined behavior that can result in strange errors due to
75// compiler optimizations).
76//
77// - `_LIBCPP_ASSERT_NON_OVERLAPPING_RANGES` -- for functions that take several ranges as arguments, checks that the
78// given ranges do not overlap.
79//
80// - `_LIBCPP_ASSERT_VALID_DEALLOCATION` -- checks that an attempt to deallocate memory is valid (e.g. the given object
81// was allocated by the given allocator). Violating this category typically results in a memory leak.
82//
83// - `_LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL` -- checks that a call to an external API doesn't fail in
84// an unexpected manner. This includes triggering documented cases of undefined behavior in an external library (like
85// attempting to unlock an unlocked mutex in pthreads). Any API external to the library falls under this category
86// (from system calls to compiler intrinsics). We generally don't expect these failures to compromize memory safety or
87// otherwise create an immediate security issue.
88//
89// - `_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR` -- checks any operations that exchange nodes between containers to make sure
90// the containers have compatible allocators.
91//
92// - `_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN` -- checks that the given argument is within the domain of valid arguments
93// for the function. Violating this typically produces an incorrect result (e.g. the clamp algorithm returns the
94// original value without clamping it due to incorrect functors) or puts an object into an invalid state (e.g.
95// a string view where only a subset of elements is possible to access). This category is for assertions violating
96// which doesn't cause any immediate issues in the library -- whatever the consequences are, they will happen in the
97// user code.
98//
99// - `_LIBCPP_ASSERT_PEDANTIC` -- checks prerequisites which are imposed by the Standard, but violating which happens to
100// be benign in our implementation.
101//
102// - `_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT` -- checks that the given argument satisfies the semantic requirements imposed
103// by the Standard. Typically, there is no simple way to completely prove that a semantic requirement is satisfied;
104// thus, this would often be a heuristic check and it might be quite expensive.
105//
106// - `_LIBCPP_ASSERT_INTERNAL` -- checks that internal invariants of the library hold. These assertions don't depend on
107// user input.
108//
109// - `_LIBCPP_ASSERT_UNCATEGORIZED` -- for assertions that haven't been properly classified yet.
110
111// clang-format off
112# define _LIBCPP_HARDENING_MODE_NONE (1 << 1)
113# define _LIBCPP_HARDENING_MODE_FAST (1 << 2)
114# define _LIBCPP_HARDENING_MODE_EXTENSIVE (1 << 4) // Deliberately not ordered.
115# define _LIBCPP_HARDENING_MODE_DEBUG (1 << 3)
116// clang-format on
117
118#ifndef _LIBCPP_HARDENING_MODE
119
120# ifndef _LIBCPP_HARDENING_MODE_DEFAULT
121# error _LIBCPP_HARDENING_MODE_DEFAULT is not defined. This definition should be set at configuration time in the \
122`__config_site` header, please make sure your installation of libc++ is not broken.
123# endif
124
125# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT
126#endif
127
128#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_NONE && _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_FAST && \
129 _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE && \
130 _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG
131# error _LIBCPP_HARDENING_MODE must be set to one of the following values: \
132_LIBCPP_HARDENING_MODE_NONE, \
133_LIBCPP_HARDENING_MODE_FAST, \
134_LIBCPP_HARDENING_MODE_EXTENSIVE, \
135_LIBCPP_HARDENING_MODE_DEBUG
136#endif
137
138// The library provides the macro `_LIBCPP_ASSERTION_SEMANTIC` for configuring the assertion semantic used by hardening;
139// it can be set to one of the following values:
140//
141// - `_LIBCPP_ASSERTION_SEMANTIC_IGNORE`;
142// - `_LIBCPP_ASSERTION_SEMANTIC_OBSERVE`;
143// - `_LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE`;
144// - `_LIBCPP_ASSERTION_SEMANTIC_ENFORCE`.
145//
146// libc++ assertion semantics generally mirror the evaluation semantics of C++26 Contracts:
147// - `ignore` evaluates the assertion but doesn't do anything if it fails (note that it differs from the Contracts
148// `ignore` semantic which wouldn't evaluate the assertion at all);
149// - `observe` logs an error (indicating, if possible, that the error is fatal) and continues execution;
150// - `quick-enforce` terminates the program as fast as possible (via trapping);
151// - `enforce` logs an error and then terminates the program.
152//
153// Additionally, a special `hardening-dependent` value selects the assertion semantic based on the hardening mode in
154// effect: the production-capable modes (`fast` and `extensive`) map to `quick_enforce` and the `debug` mode maps to
155// `enforce`. The `hardening-dependent` semantic cannot be selected explicitly, it is only used when no assertion
156// semantic is provided by the user _and_ the library's default semantic is configured to be dependent on hardening.
157//
158// Notes:
159// - Continuing execution after a hardening check fails results in undefined behavior; the `observe` semantic is meant
160// to make adopting hardening easier but should not be used outside of this scenario;
161// - C++26 wording for Library Hardening precludes a conforming Hardened implementation from using the Contracts
162// `ignore` semantic when evaluating hardened preconditions in the Library. Libc++ allows using this semantic for
163// hardened preconditions, however, be aware that using `ignore` does not produce a conforming "Hardened"
164// implementation, unlike the other semantics above.
165// clang-format off
166# define _LIBCPP_ASSERTION_SEMANTIC_HARDENING_DEPENDENT (1 << 1)
167# define _LIBCPP_ASSERTION_SEMANTIC_IGNORE (1 << 2)
168# define _LIBCPP_ASSERTION_SEMANTIC_OBSERVE (1 << 3)
169# define _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE (1 << 4)
170# define _LIBCPP_ASSERTION_SEMANTIC_ENFORCE (1 << 5)
171// clang-format on
172
173// If the user attempts to configure the assertion semantic, check that it is allowed in the current environment.
174#if defined(_LIBCPP_ASSERTION_SEMANTIC)
175# if !_LIBCPP_HAS_EXPERIMENTAL_LIBRARY
176# error "Assertion semantics are an experimental feature."
177# endif
178# if defined(_LIBCPP_CXX03_LANG)
179# error "Assertion semantics are not available in the C++03 mode."
180# endif
181#endif // defined(_LIBCPP_ASSERTION_SEMANTIC)
182
183// User-provided semantic takes top priority -- don't override if set.
184#ifndef _LIBCPP_ASSERTION_SEMANTIC
185
186# ifndef _LIBCPP_ASSERTION_SEMANTIC_DEFAULT
187# error _LIBCPP_ASSERTION_SEMANTIC_DEFAULT is not defined. This definition should be set at configuration time in \
188the `__config_site` header, please make sure your installation of libc++ is not broken.
189# endif
190
191# if _LIBCPP_ASSERTION_SEMANTIC_DEFAULT != _LIBCPP_ASSERTION_SEMANTIC_HARDENING_DEPENDENT
192# define _LIBCPP_ASSERTION_SEMANTIC _LIBCPP_ASSERTION_SEMANTIC_DEFAULT
193# else
194# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
195# define _LIBCPP_ASSERTION_SEMANTIC _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
196# else
197# define _LIBCPP_ASSERTION_SEMANTIC _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
198# endif
199# endif // _LIBCPP_ASSERTION_SEMANTIC_DEFAULT != _LIBCPP_ASSERTION_SEMANTIC_HARDENING_DEPENDENT
200
201#endif // #ifndef _LIBCPP_ASSERTION_SEMANTIC
202
203// Finally, validate the selected semantic (in case the user tries setting it to an incorrect value):
204#if _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_IGNORE && \
205 _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_OBSERVE && \
206 _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE && \
207 _LIBCPP_ASSERTION_SEMANTIC != _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
208# error _LIBCPP_ASSERTION_SEMANTIC must be set to one of the following values: \
209_LIBCPP_ASSERTION_SEMANTIC_IGNORE, \
210_LIBCPP_ASSERTION_SEMANTIC_OBSERVE, \
211_LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE, \
212_LIBCPP_ASSERTION_SEMANTIC_ENFORCE
213#endif
214
215#endif // _LIBCPP___CONFIGURATION_HARDENING_H
lib/libcxx/include/__configuration/language.h+3
......@@ -18,6 +18,9 @@
1818
1919// NOLINTBEGIN(libcpp-cpp-version-check)
2020#ifdef __cplusplus
21# if __cplusplus < 201103L
22# define _LIBCPP_CXX03_LANG
23# endif
2124# if __cplusplus <= 201103L
2225# define _LIBCPP_STD_VER 11
2326# elif __cplusplus <= 201402L
lib/libcxx/include/__configuration/platform.h+9-16
......@@ -31,22 +31,15 @@
3131#endif
3232
3333// Need to detect which libc we're using if we're on Linux.
34#if defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)
35# if __has_include(<features.h>)
36# include <features.h>
37# if defined(__GLIBC_PREREQ)
38# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
39# else
40# define _LIBCPP_GLIBC_PREREQ(a, b) 0
41# endif // defined(__GLIBC_PREREQ)
42# endif
43#endif
44
45// This is required in order for _NEWLIB_VERSION to be defined in places where we use it.
46// TODO: We shouldn't be including arbitrarily-named headers from libc++ since this can break valid
47// user code. Move code paths that need _NEWLIB_VERSION to another customization mechanism.
48#if __has_include(<picolibc.h>)
49# include <picolibc.h>
34#if (defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)) && __has_include(<features.h>)
35# include <features.h>
36# if defined(__GLIBC_PREREQ)
37# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
38# else
39# define _LIBCPP_GLIBC_PREREQ(a, b) 0
40# endif // defined(__GLIBC_PREREQ)
41#else
42# define _LIBCPP_GLIBC_PREREQ(a, b) 0
5043#endif
5144
5245#ifndef __BYTE_ORDER__
lib/libcxx/include/__coroutine/coroutine_handle.h+9-9
......@@ -44,9 +44,9 @@ public:
4444 }
4545
4646 // [coroutine.handle.export.import], export/import
47 _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
4848
49 _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
49 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
5050 coroutine_handle __tmp;
5151 __tmp.__handle_ = __addr;
5252 return __tmp;
......@@ -55,7 +55,7 @@ public:
5555 // [coroutine.handle.observers], observers
5656 _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
5757
58 _LIBCPP_HIDE_FROM_ABI bool done() const {
58 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool done() const {
5959 _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
6060 return __builtin_coro_done(__handle_);
6161 }
......@@ -100,7 +100,7 @@ public:
100100
101101 _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
102102
103 _LIBCPP_HIDE_FROM_ABI static coroutine_handle from_promise(_Promise& __promise) {
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static coroutine_handle from_promise(_Promise& __promise) {
104104 using _RawPromise = __remove_cv_t<_Promise>;
105105 coroutine_handle __tmp;
106106 __tmp.__handle_ =
......@@ -114,9 +114,9 @@ public:
114114 }
115115
116116 // [coroutine.handle.export.import], export/import
117 _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
117 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
118118
119 _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
119 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
120120 coroutine_handle __tmp;
121121 __tmp.__handle_ = __addr;
122122 return __tmp;
......@@ -130,7 +130,7 @@ public:
130130 // [coroutine.handle.observers], observers
131131 _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
132132
133 _LIBCPP_HIDE_FROM_ABI bool done() const {
133 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool done() const {
134134 _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
135135 return __builtin_coro_done(__handle_);
136136 }
......@@ -150,7 +150,7 @@ public:
150150 }
151151
152152 // [coroutine.handle.promise], promise access
153 _LIBCPP_HIDE_FROM_ABI _Promise& promise() const {
153 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Promise& promise() const {
154154 return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
155155 }
156156
......@@ -165,7 +165,7 @@ private:
165165// [coroutine.handle.hash]
166166template <class _Tp>
167167struct hash<coroutine_handle<_Tp>> {
168 _LIBCPP_HIDE_FROM_ABI size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept {
168 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept {
169169 return hash<void*>()(__v.address());
170170 }
171171};
lib/libcxx/include/__coroutine/noop_coroutine_handle.h+11-13
......@@ -20,8 +20,6 @@
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
2222
23# if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
24
2523// [coroutine.noop]
2624// [coroutine.promise.noop]
2725struct noop_coroutine_promise {};
......@@ -37,7 +35,7 @@ public:
3735
3836 // [coroutine.handle.noop.observers], observers
3937 _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return true; }
40 _LIBCPP_HIDE_FROM_ABI constexpr bool done() const noexcept { return false; }
38 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool done() const noexcept { return false; }
4139
4240 // [coroutine.handle.noop.resumption], resumption
4341 _LIBCPP_HIDE_FROM_ABI constexpr void operator()() const noexcept {}
......@@ -45,23 +43,23 @@ public:
4543 _LIBCPP_HIDE_FROM_ABI constexpr void destroy() const noexcept {}
4644
4745 // [coroutine.handle.noop.promise], promise access
48 _LIBCPP_HIDE_FROM_ABI noop_coroutine_promise& promise() const noexcept {
46 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI noop_coroutine_promise& promise() const noexcept {
4947 return *static_cast<noop_coroutine_promise*>(
5048 __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
5149 }
5250
5351 // [coroutine.handle.noop.address], address
54 _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
52 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
5553
5654private:
5755 _LIBCPP_HIDE_FROM_ABI friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
5856
59# if __has_builtin(__builtin_coro_noop)
57# if __has_builtin(__builtin_coro_noop)
6058 _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept { this->__handle_ = __builtin_coro_noop(); }
6159
6260 void* __handle_ = nullptr;
6361
64# elif defined(_LIBCPP_COMPILER_GCC)
62# elif defined(_LIBCPP_COMPILER_GCC)
6563 // GCC doesn't implement __builtin_coro_noop().
6664 // Construct the coroutine frame manually instead.
6765 struct __noop_coroutine_frame_ty_ {
......@@ -78,19 +76,19 @@ private:
7876
7977 _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
8078
81# endif // __has_builtin(__builtin_coro_noop)
79# endif // __has_builtin(__builtin_coro_noop)
8280};
8381
8482using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
8583
86# if defined(_LIBCPP_COMPILER_GCC)
84# if defined(_LIBCPP_COMPILER_GCC)
8785inline noop_coroutine_handle::__noop_coroutine_frame_ty_ noop_coroutine_handle::__noop_coroutine_frame_{};
88# endif
86# endif
8987
9088// [coroutine.noop.coroutine]
91inline _LIBCPP_HIDE_FROM_ABI noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
92
93# endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
89[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI noop_coroutine_handle noop_coroutine() noexcept {
90 return noop_coroutine_handle();
91}
9492
9593_LIBCPP_END_NAMESPACE_STD
9694
lib/libcxx/include/__debug_utils/strict_weak_ordering_check.h+1-1
......@@ -27,7 +27,7 @@ template <class _RandomAccessIterator, class _Comp>
2727_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
2828__check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
2929#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
30 using __diff_t = __iter_diff_t<_RandomAccessIterator>;
30 using __diff_t = __iterator_difference_type<_RandomAccessIterator>;
3131 using _Comp_ref = __comp_ref_type<_Comp>;
3232 if (!__libcpp_is_constant_evaluated()) {
3333 // Check if the range is actually sorted.
lib/libcxx/include/__exception/exception.h+6-4
......@@ -48,13 +48,15 @@ public:
4848 __data_._DoFree = true;
4949 }
5050
51 exception(exception const&) _NOEXCEPT {}
51 exception(exception const&) _NOEXCEPT : __data_() {}
5252
5353 exception& operator=(exception const&) _NOEXCEPT { return *this; }
5454
5555 virtual ~exception() _NOEXCEPT {}
5656
57 virtual char const* what() const _NOEXCEPT { return __data_._What ? __data_._What : "Unknown exception"; }
57 [[__nodiscard__]] virtual char const* what() const _NOEXCEPT {
58 return __data_._What ? __data_._What : "Unknown exception";
59 }
5860
5961private:
6062 __std_exception_data __data_;
......@@ -76,7 +78,7 @@ public:
7678 _LIBCPP_HIDE_FROM_ABI exception& operator=(const exception&) _NOEXCEPT = default;
7779
7880 virtual ~exception() _NOEXCEPT;
79 virtual const char* what() const _NOEXCEPT;
81 [[__nodiscard__]] virtual const char* what() const _NOEXCEPT;
8082};
8183
8284class _LIBCPP_EXPORTED_FROM_ABI bad_exception : public exception {
......@@ -85,7 +87,7 @@ public:
8587 _LIBCPP_HIDE_FROM_ABI bad_exception(const bad_exception&) _NOEXCEPT = default;
8688 _LIBCPP_HIDE_FROM_ABI bad_exception& operator=(const bad_exception&) _NOEXCEPT = default;
8789 ~bad_exception() _NOEXCEPT override;
88 const char* what() const _NOEXCEPT override;
90 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
8991};
9092#endif // !_LIBCPP_ABI_VCRUNTIME
9193
lib/libcxx/include/__exception/exception_ptr.h+27-5
......@@ -11,18 +11,24 @@
1111
1212#include <__config>
1313#include <__cstddef/nullptr_t.h>
14#include <__cstddef/size_t.h>
1415#include <__exception/operations.h>
1516#include <__memory/addressof.h>
1617#include <__memory/construct_at.h>
1718#include <__type_traits/decay.h>
1819#include <__type_traits/is_pointer.h>
19#include <cstdlib>
20#include <__utility/move.h>
21#include <__utility/swap.h>
22#include <__verbose_abort>
2023#include <typeinfo>
2124
2225#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2326# pragma GCC system_header
2427#endif
2528
29_LIBCPP_PUSH_MACROS
30#include <__undef_macros>
31
2632#ifndef _LIBCPP_ABI_MICROSOFT
2733
2834# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
......@@ -30,7 +36,7 @@
3036namespace __cxxabiv1 {
3137
3238extern "C" {
33_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(size_t) throw();
39_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(std::size_t) throw();
3440_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_free_exception(void*) throw();
3541
3642struct __cxa_exception;
......@@ -57,6 +63,8 @@ _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
5763
5864#ifndef _LIBCPP_ABI_MICROSOFT
5965
66inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT;
67
6068class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
6169 void* __ptr_;
6270
......@@ -67,15 +75,21 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
6775
6876public:
6977 // exception_ptr is basically a COW string so it is trivially relocatable.
70 // It is also replaceable because assignment has normal value semantics.
7178 using __trivially_relocatable _LIBCPP_NODEBUG = exception_ptr;
72 using __replaceable _LIBCPP_NODEBUG = exception_ptr;
7379
7480 _LIBCPP_HIDE_FROM_ABI exception_ptr() _NOEXCEPT : __ptr_() {}
7581 _LIBCPP_HIDE_FROM_ABI exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
7682
7783 exception_ptr(const exception_ptr&) _NOEXCEPT;
84 _LIBCPP_HIDE_FROM_ABI exception_ptr(exception_ptr&& __other) _NOEXCEPT : __ptr_(__other.__ptr_) {
85 __other.__ptr_ = nullptr;
86 }
7887 exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
88 _LIBCPP_HIDE_FROM_ABI exception_ptr& operator=(exception_ptr&& __other) _NOEXCEPT {
89 exception_ptr __tmp(std::move(__other));
90 std::swap(__tmp, *this);
91 return *this;
92 }
7993 ~exception_ptr() _NOEXCEPT;
8094
8195 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __ptr_ != nullptr; }
......@@ -88,10 +102,16 @@ public:
88102 return !(__x == __y);
89103 }
90104
105 friend _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT;
106
91107 friend _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
92108 friend _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
93109};
94110
111inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT {
112 std::swap(__x.__ptr_, __y.__ptr_);
113}
114
95115# if _LIBCPP_HAS_EXCEPTIONS
96116# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
97117template <class _Ep>
......@@ -153,7 +173,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
153173# else // !_LIBCPP_HAS_EXCEPTIONS
154174template <class _Ep>
155175_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT {
156 std::abort();
176 _LIBCPP_VERBOSE_ABORT("make_exception_ptr was called in -fno-exceptions mode");
157177}
158178# endif // _LIBCPP_HAS_EXCEPTIONS
159179
......@@ -201,4 +221,6 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
201221#endif // _LIBCPP_ABI_MICROSOFT
202222_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
203223
224_LIBCPP_POP_MACROS
225
204226#endif // _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
lib/libcxx/include/__exception/nested_exception.h+2-2
......@@ -40,7 +40,7 @@ public:
4040
4141 // access functions
4242 [[__noreturn__]] void rethrow_nested() const;
43 _LIBCPP_HIDE_FROM_ABI exception_ptr nested_ptr() const _NOEXCEPT { return __ptr_; }
43 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI exception_ptr nested_ptr() const _NOEXCEPT { return __ptr_; }
4444};
4545
4646template <class _Tp>
......@@ -73,7 +73,7 @@ template <class _Tp>
7373 __throw_with_nested<_Tp,
7474 _Up,
7575 is_class<_Up>::value && !is_base_of<nested_exception, _Up>::value &&
76 !__libcpp_is_final<_Up>::value>::__do_throw(std::forward<_Tp>(__t));
76 !__is_final_v<_Up> >::__do_throw(std::forward<_Tp>(__t));
7777#else
7878 ((void)__t);
7979 // FIXME: Make this abort
lib/libcxx/include/__exception/operations.h+5-5
......@@ -20,22 +20,22 @@ _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
2020 defined(_LIBCPP_BUILDING_LIBRARY)
2121using unexpected_handler = void (*)();
2222_LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
23_LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
23[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
2424[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void unexpected();
2525#endif
2626
2727using terminate_handler = void (*)();
2828_LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
29_LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT;
29[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT;
3030
3131#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION)
32_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 bool uncaught_exception() _NOEXCEPT;
32[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 bool uncaught_exception() _NOEXCEPT;
3333#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION)
34_LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT;
34[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT;
3535
3636class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
3737
38_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
38[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
3939[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
4040_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
4141
lib/libcxx/include/__expected/bad_expected_access.h+8-6
......@@ -43,9 +43,11 @@ protected:
4343
4444public:
4545# if _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION
46 const char* what() const noexcept override;
46 [[nodiscard]] const char* what() const noexcept override;
4747# else
48 _LIBCPP_HIDE_FROM_ABI_VIRTUAL const char* what() const noexcept override { return "bad access to std::expected"; }
48 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL const char* what() const noexcept override {
49 return "bad access to std::expected";
50 }
4951# endif
5052};
5153_LIBCPP_DIAGNOSTIC_POP
......@@ -55,10 +57,10 @@ class bad_expected_access : public bad_expected_access<void> {
5557public:
5658 _LIBCPP_HIDE_FROM_ABI explicit bad_expected_access(_Err __e) : __unex_(std::move(__e)) {}
5759
58 _LIBCPP_HIDE_FROM_ABI _Err& error() & noexcept { return __unex_; }
59 _LIBCPP_HIDE_FROM_ABI const _Err& error() const& noexcept { return __unex_; }
60 _LIBCPP_HIDE_FROM_ABI _Err&& error() && noexcept { return std::move(__unex_); }
61 _LIBCPP_HIDE_FROM_ABI const _Err&& error() const&& noexcept { return std::move(__unex_); }
60 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Err& error() & noexcept { return __unex_; }
61 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const _Err& error() const& noexcept { return __unex_; }
62 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Err&& error() && noexcept { return std::move(__unex_); }
63 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const _Err&& error() const&& noexcept { return std::move(__unex_); }
6264
6365private:
6466 _Err __unex_;
lib/libcxx/include/__expected/expected.h+62-64
......@@ -30,7 +30,6 @@
3030#include <__type_traits/is_nothrow_assignable.h>
3131#include <__type_traits/is_nothrow_constructible.h>
3232#include <__type_traits/is_reference.h>
33#include <__type_traits/is_replaceable.h>
3433#include <__type_traits/is_same.h>
3534#include <__type_traits/is_swappable.h>
3635#include <__type_traits/is_trivially_constructible.h>
......@@ -472,8 +471,6 @@ public:
472471 __conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value && __libcpp_is_trivially_relocatable<_Err>::value,
473472 expected,
474473 void>;
475 using __replaceable _LIBCPP_NODEBUG =
476 __conditional_t<__is_replaceable_v<_Tp> && __is_replaceable_v<_Err>, expected, void>;
477474
478475 template <class _Up>
479476 using rebind = expected<_Up, error_type>;
......@@ -555,9 +552,10 @@ public:
555552 is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
556553 : __base(__other.__has_val(), std::move(__other.__union())) {}
557554
558 template <class _Up = _Tp>
555 template <class _Up = remove_cv_t<_Tp>>
559556 requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> &&
560 is_constructible_v<_Tp, _Up> && !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
557 !is_same_v<remove_cvref_t<_Up>, unexpect_t> && is_constructible_v<_Tp, _Up> &&
558 !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
561559 (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_expected<remove_cvref_t<_Up>>::value))
562560 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>)
563561 expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
......@@ -668,7 +666,7 @@ public:
668666 return *this;
669667 }
670668
671 template <class _Up = _Tp>
669 template <class _Up = remove_cv_t<_Tp>>
672670 _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
673671 requires(!is_same_v<expected, remove_cvref_t<_Up>> && !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
674672 is_constructible_v<_Tp, _Up> && is_assignable_v<_Tp&, _Up> &&
......@@ -800,25 +798,25 @@ public:
800798 return std::addressof(this->__val());
801799 }
802800
803 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept {
801 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept {
804802 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
805803 this->__has_val(), "expected::operator* requires the expected to contain a value");
806804 return this->__val();
807805 }
808806
809 _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept {
807 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept {
810808 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
811809 this->__has_val(), "expected::operator* requires the expected to contain a value");
812810 return this->__val();
813811 }
814812
815 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept {
813 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept {
816814 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
817815 this->__has_val(), "expected::operator* requires the expected to contain a value");
818816 return std::move(this->__val());
819817 }
820818
821 _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept {
819 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept {
822820 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
823821 this->__has_val(), "expected::operator* requires the expected to contain a value");
824822 return std::move(this->__val());
......@@ -826,9 +824,9 @@ public:
826824
827825 _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); }
828826
829 _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
827 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
830828
831 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& {
829 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& {
832830 static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
833831 if (!this->__has_val()) {
834832 std::__throw_bad_expected_access<_Err>(std::as_const(error()));
......@@ -836,7 +834,7 @@ public:
836834 return this->__val();
837835 }
838836
839 _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & {
837 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & {
840838 static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
841839 if (!this->__has_val()) {
842840 std::__throw_bad_expected_access<_Err>(std::as_const(error()));
......@@ -844,7 +842,7 @@ public:
844842 return this->__val();
845843 }
846844
847 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& value() const&& {
845 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& value() const&& {
848846 static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>,
849847 "error_type has to be both copy constructible and constructible from decltype(std::move(error()))");
850848 if (!this->__has_val()) {
......@@ -853,7 +851,7 @@ public:
853851 return std::move(this->__val());
854852 }
855853
856 _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && {
854 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && {
857855 static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>,
858856 "error_type has to be both copy constructible and constructible from decltype(std::move(error()))");
859857 if (!this->__has_val()) {
......@@ -862,46 +860,46 @@ public:
862860 return std::move(this->__val());
863861 }
864862
865 _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
863 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
866864 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
867865 !this->__has_val(), "expected::error requires the expected to contain an error");
868866 return this->__unex();
869867 }
870868
871 _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
869 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
872870 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
873871 !this->__has_val(), "expected::error requires the expected to contain an error");
874872 return this->__unex();
875873 }
876874
877 _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
875 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
878876 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
879877 !this->__has_val(), "expected::error requires the expected to contain an error");
880878 return std::move(this->__unex());
881879 }
882880
883 _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
881 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
884882 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
885883 !this->__has_val(), "expected::error requires the expected to contain an error");
886884 return std::move(this->__unex());
887885 }
888886
889 template <class _Up>
890 _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
887 template <class _Up = remove_cv_t<_Tp>>
888 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
891889 static_assert(is_copy_constructible_v<_Tp>, "value_type has to be copy constructible");
892890 static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type");
893891 return this->__has_val() ? this->__val() : static_cast<_Tp>(std::forward<_Up>(__v));
894892 }
895893
896 template <class _Up>
897 _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
894 template <class _Up = remove_cv_t<_Tp>>
895 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
898896 static_assert(is_move_constructible_v<_Tp>, "value_type has to be move constructible");
899897 static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type");
900898 return this->__has_val() ? std::move(this->__val()) : static_cast<_Tp>(std::forward<_Up>(__v));
901899 }
902900
903901 template <class _Up = _Err>
904 _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) const& {
902 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) const& {
905903 static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
906904 static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
907905 if (has_value())
......@@ -910,7 +908,7 @@ public:
910908 }
911909
912910 template <class _Up = _Err>
913 _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) && {
911 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) && {
914912 static_assert(is_move_constructible_v<_Err>, "error_type has to be move constructible");
915913 static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
916914 if (has_value())
......@@ -921,7 +919,7 @@ public:
921919 // [expected.void.monadic], monadic
922920 template <class _Func>
923921 requires is_constructible_v<_Err, _Err&>
924 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
922 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
925923 using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>;
926924 static_assert(__is_std_expected<_Up>::value, "The result of f(value()) must be a specialization of std::expected");
927925 static_assert(is_same_v<typename _Up::error_type, _Err>,
......@@ -934,7 +932,7 @@ public:
934932
935933 template <class _Func>
936934 requires is_constructible_v<_Err, const _Err&>
937 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
935 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
938936 using _Up = remove_cvref_t<invoke_result_t<_Func, const _Tp&>>;
939937 static_assert(__is_std_expected<_Up>::value, "The result of f(value()) must be a specialization of std::expected");
940938 static_assert(is_same_v<typename _Up::error_type, _Err>,
......@@ -947,7 +945,7 @@ public:
947945
948946 template <class _Func>
949947 requires is_constructible_v<_Err, _Err&&>
950 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
948 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
951949 using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&&>>;
952950 static_assert(
953951 __is_std_expected<_Up>::value, "The result of f(std::move(value())) must be a specialization of std::expected");
......@@ -961,7 +959,7 @@ public:
961959
962960 template <class _Func>
963961 requires is_constructible_v<_Err, const _Err&&>
964 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
962 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
965963 using _Up = remove_cvref_t<invoke_result_t<_Func, const _Tp&&>>;
966964 static_assert(
967965 __is_std_expected<_Up>::value, "The result of f(std::move(value())) must be a specialization of std::expected");
......@@ -975,7 +973,7 @@ public:
975973
976974 template <class _Func>
977975 requires is_constructible_v<_Tp, _Tp&>
978 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) & {
976 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) & {
979977 using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&>>;
980978 static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
981979 static_assert(is_same_v<typename _Gp::value_type, _Tp>,
......@@ -988,7 +986,7 @@ public:
988986
989987 template <class _Func>
990988 requires is_constructible_v<_Tp, const _Tp&>
991 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const& {
989 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const& {
992990 using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&>>;
993991 static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
994992 static_assert(is_same_v<typename _Gp::value_type, _Tp>,
......@@ -1001,7 +999,7 @@ public:
1001999
10021000 template <class _Func>
10031001 requires is_constructible_v<_Tp, _Tp&&>
1004 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
1002 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
10051003 using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&&>>;
10061004 static_assert(
10071005 __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
......@@ -1015,7 +1013,7 @@ public:
10151013
10161014 template <class _Func>
10171015 requires is_constructible_v<_Tp, const _Tp&&>
1018 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
1016 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
10191017 using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&&>>;
10201018 static_assert(
10211019 __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
......@@ -1029,7 +1027,7 @@ public:
10291027
10301028 template <class _Func>
10311029 requires is_constructible_v<_Err, _Err&>
1032 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
1030 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
10331031 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>;
10341032 if (!has_value()) {
10351033 return expected<_Up, _Err>(unexpect, error());
......@@ -1045,7 +1043,7 @@ public:
10451043
10461044 template <class _Func>
10471045 requires is_constructible_v<_Err, const _Err&>
1048 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
1046 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
10491047 using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>;
10501048 if (!has_value()) {
10511049 return expected<_Up, _Err>(unexpect, error());
......@@ -1061,7 +1059,7 @@ public:
10611059
10621060 template <class _Func>
10631061 requires is_constructible_v<_Err, _Err&&>
1064 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
1062 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
10651063 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>;
10661064 if (!has_value()) {
10671065 return expected<_Up, _Err>(unexpect, std::move(error()));
......@@ -1077,7 +1075,7 @@ public:
10771075
10781076 template <class _Func>
10791077 requires is_constructible_v<_Err, const _Err&&>
1080 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
1078 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
10811079 using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>;
10821080 if (!has_value()) {
10831081 return expected<_Up, _Err>(unexpect, std::move(error()));
......@@ -1093,7 +1091,7 @@ public:
10931091
10941092 template <class _Func>
10951093 requires is_constructible_v<_Tp, _Tp&>
1096 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) & {
1094 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) & {
10971095 using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&>>;
10981096 static_assert(__valid_std_unexpected<_Gp>::value,
10991097 "The result of f(error()) must be a valid template argument for unexpected");
......@@ -1105,7 +1103,7 @@ public:
11051103
11061104 template <class _Func>
11071105 requires is_constructible_v<_Tp, const _Tp&>
1108 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const& {
1106 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const& {
11091107 using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&>>;
11101108 static_assert(__valid_std_unexpected<_Gp>::value,
11111109 "The result of f(error()) must be a valid template argument for unexpected");
......@@ -1117,7 +1115,7 @@ public:
11171115
11181116 template <class _Func>
11191117 requires is_constructible_v<_Tp, _Tp&&>
1120 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) && {
1118 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) && {
11211119 using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&&>>;
11221120 static_assert(__valid_std_unexpected<_Gp>::value,
11231121 "The result of f(std::move(error())) must be a valid template argument for unexpected");
......@@ -1130,7 +1128,7 @@ public:
11301128
11311129 template <class _Func>
11321130 requires is_constructible_v<_Tp, const _Tp&&>
1133 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const&& {
1131 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const&& {
11341132 using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&&>>;
11351133 static_assert(__valid_std_unexpected<_Gp>::value,
11361134 "The result of f(std::move(error())) must be a valid template argument for unexpected");
......@@ -1597,7 +1595,7 @@ public:
15971595 // [expected.void.obs], observers
15981596 _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); }
15991597
1600 _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
1598 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
16011599
16021600 _LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept {
16031601 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
......@@ -1618,32 +1616,32 @@ public:
16181616 }
16191617 }
16201618
1621 _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
1619 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
16221620 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
16231621 !this->__has_val(), "expected::error requires the expected to contain an error");
16241622 return this->__unex();
16251623 }
16261624
1627 _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
1625 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
16281626 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
16291627 !this->__has_val(), "expected::error requires the expected to contain an error");
16301628 return this->__unex();
16311629 }
16321630
1633 _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
1631 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
16341632 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
16351633 !this->__has_val(), "expected::error requires the expected to contain an error");
16361634 return std::move(this->__unex());
16371635 }
16381636
1639 _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
1637 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
16401638 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
16411639 !this->__has_val(), "expected::error requires the expected to contain an error");
16421640 return std::move(this->__unex());
16431641 }
16441642
16451643 template <class _Up = _Err>
1646 _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) const& {
1644 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) const& {
16471645 static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
16481646 static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
16491647 if (has_value()) {
......@@ -1653,7 +1651,7 @@ public:
16531651 }
16541652
16551653 template <class _Up = _Err>
1656 _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) && {
1654 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) && {
16571655 static_assert(is_move_constructible_v<_Err>, "error_type has to be move constructible");
16581656 static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
16591657 if (has_value()) {
......@@ -1665,7 +1663,7 @@ public:
16651663 // [expected.void.monadic], monadic
16661664 template <class _Func>
16671665 requires is_constructible_v<_Err, _Err&>
1668 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
1666 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
16691667 using _Up = remove_cvref_t<invoke_result_t<_Func>>;
16701668 static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
16711669 static_assert(
......@@ -1678,7 +1676,7 @@ public:
16781676
16791677 template <class _Func>
16801678 requires is_constructible_v<_Err, const _Err&>
1681 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
1679 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
16821680 using _Up = remove_cvref_t<invoke_result_t<_Func>>;
16831681 static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
16841682 static_assert(
......@@ -1691,7 +1689,7 @@ public:
16911689
16921690 template <class _Func>
16931691 requires is_constructible_v<_Err, _Err&&>
1694 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
1692 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
16951693 using _Up = remove_cvref_t<invoke_result_t<_Func>>;
16961694 static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
16971695 static_assert(
......@@ -1704,7 +1702,7 @@ public:
17041702
17051703 template <class _Func>
17061704 requires is_constructible_v<_Err, const _Err&&>
1707 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
1705 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
17081706 using _Up = remove_cvref_t<invoke_result_t<_Func>>;
17091707 static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
17101708 static_assert(
......@@ -1716,7 +1714,7 @@ public:
17161714 }
17171715
17181716 template <class _Func>
1719 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) & {
1717 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) & {
17201718 using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&>>;
17211719 static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
17221720 static_assert(is_same_v<typename _Gp::value_type, _Tp>,
......@@ -1728,7 +1726,7 @@ public:
17281726 }
17291727
17301728 template <class _Func>
1731 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const& {
1729 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const& {
17321730 using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&>>;
17331731 static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
17341732 static_assert(is_same_v<typename _Gp::value_type, _Tp>,
......@@ -1740,7 +1738,7 @@ public:
17401738 }
17411739
17421740 template <class _Func>
1743 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
1741 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
17441742 using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&&>>;
17451743 static_assert(
17461744 __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
......@@ -1753,7 +1751,7 @@ public:
17531751 }
17541752
17551753 template <class _Func>
1756 _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
1754 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
17571755 using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&&>>;
17581756 static_assert(
17591757 __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
......@@ -1767,7 +1765,7 @@ public:
17671765
17681766 template <class _Func>
17691767 requires is_constructible_v<_Err, _Err&>
1770 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
1768 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
17711769 using _Up = remove_cv_t<invoke_result_t<_Func>>;
17721770 if (!has_value()) {
17731771 return expected<_Up, _Err>(unexpect, error());
......@@ -1782,7 +1780,7 @@ public:
17821780
17831781 template <class _Func>
17841782 requires is_constructible_v<_Err, const _Err&>
1785 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
1783 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
17861784 using _Up = remove_cv_t<invoke_result_t<_Func>>;
17871785 if (!has_value()) {
17881786 return expected<_Up, _Err>(unexpect, error());
......@@ -1797,7 +1795,7 @@ public:
17971795
17981796 template <class _Func>
17991797 requires is_constructible_v<_Err, _Err&&>
1800 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
1798 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
18011799 using _Up = remove_cv_t<invoke_result_t<_Func>>;
18021800 if (!has_value()) {
18031801 return expected<_Up, _Err>(unexpect, std::move(error()));
......@@ -1812,7 +1810,7 @@ public:
18121810
18131811 template <class _Func>
18141812 requires is_constructible_v<_Err, const _Err&&>
1815 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
1813 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
18161814 using _Up = remove_cv_t<invoke_result_t<_Func>>;
18171815 if (!has_value()) {
18181816 return expected<_Up, _Err>(unexpect, std::move(error()));
......@@ -1826,7 +1824,7 @@ public:
18261824 }
18271825
18281826 template <class _Func>
1829 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) & {
1827 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) & {
18301828 using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&>>;
18311829 static_assert(__valid_std_unexpected<_Gp>::value,
18321830 "The result of f(error()) must be a valid template argument for unexpected");
......@@ -1837,7 +1835,7 @@ public:
18371835 }
18381836
18391837 template <class _Func>
1840 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const& {
1838 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const& {
18411839 using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&>>;
18421840 static_assert(__valid_std_unexpected<_Gp>::value,
18431841 "The result of f(error()) must be a valid template argument for unexpected");
......@@ -1848,7 +1846,7 @@ public:
18481846 }
18491847
18501848 template <class _Func>
1851 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) && {
1849 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) && {
18521850 using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&&>>;
18531851 static_assert(__valid_std_unexpected<_Gp>::value,
18541852 "The result of f(std::move(error())) must be a valid template argument for unexpected");
......@@ -1860,7 +1858,7 @@ public:
18601858 }
18611859
18621860 template <class _Func>
1863 _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const&& {
1861 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const&& {
18641862 using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&&>>;
18651863 static_assert(__valid_std_unexpected<_Gp>::value,
18661864 "The result of f(std::move(error())) must be a valid template argument for unexpected");
lib/libcxx/include/__expected/unexpected.h+4-4
......@@ -89,10 +89,10 @@ public:
8989 _LIBCPP_HIDE_FROM_ABI constexpr unexpected& operator=(const unexpected&) = default;
9090 _LIBCPP_HIDE_FROM_ABI constexpr unexpected& operator=(unexpected&&) = default;
9191
92 _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { return __unex_; }
93 _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { return __unex_; }
94 _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { return std::move(__unex_); }
95 _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { return std::move(__unex_); }
92 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { return __unex_; }
93 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { return __unex_; }
94 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { return std::move(__unex_); }
95 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { return std::move(__unex_); }
9696
9797 _LIBCPP_HIDE_FROM_ABI constexpr void swap(unexpected& __other) noexcept(is_nothrow_swappable_v<_Err>) {
9898 static_assert(is_swappable_v<_Err>, "unexpected::swap requires is_swappable_v<E> to be true");
lib/libcxx/include/__filesystem/copy_options.h+4-4
......@@ -34,19 +34,19 @@ enum class copy_options : unsigned short {
3434 __in_recursive_copy = 512,
3535};
3636
37_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
37[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
3838 return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
3939}
4040
41_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
41[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
4242 return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
4343}
4444
45_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
45[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
4646 return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
4747}
4848
49_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
49[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
5050 return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
5151}
5252
lib/libcxx/include/__filesystem/directory_entry.h+37-33
......@@ -40,8 +40,6 @@ _LIBCPP_PUSH_MACROS
4040
4141_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
4242
43_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
44
4543class directory_entry {
4644 typedef filesystem::path _Path;
4745
......@@ -89,80 +87,88 @@ public:
8987
9088 _LIBCPP_HIDE_FROM_ABI void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
9189
92 _LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
9391
9492 _LIBCPP_HIDE_FROM_ABI operator const _Path&() const noexcept { return __p_; }
9593
96 _LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
94 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
9795
98 _LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
96 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
9997 return filesystem::exists(file_status{__get_ft(&__ec)});
10098 }
10199
102 _LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
100 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
103101
104 _LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
102 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
105103 return __get_ft(&__ec) == file_type::block;
106104 }
107105
108 _LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
106 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
109107
110 _LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
108 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
111109 return __get_ft(&__ec) == file_type::character;
112110 }
113111
114 _LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
112 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
115113
116 _LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
114 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
117115 return __get_ft(&__ec) == file_type::directory;
118116 }
119117
120 _LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
118 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
121119
122 _LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; }
120 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept {
121 return __get_ft(&__ec) == file_type::fifo;
122 }
123123
124 _LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
124 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
125125
126 _LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
126 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
127127 return filesystem::is_other(file_status{__get_ft(&__ec)});
128128 }
129129
130 _LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
130 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
131131
132 _LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
132 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
133133 return __get_ft(&__ec) == file_type::regular;
134134 }
135135
136 _LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
136 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
137137
138 _LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; }
138 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept {
139 return __get_ft(&__ec) == file_type::socket;
140 }
139141
140 _LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
142 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
141143
142 _LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
144 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
143145 return __get_sym_ft(&__ec) == file_type::symlink;
144146 }
145 _LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
147 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
146148
147 _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
149 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
148150
149 _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
151 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
150152
151 _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); }
153 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept {
154 return __get_nlink(&__ec);
155 }
152156
153 _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
157 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
154158
155 _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
159 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
156160 return __get_write_time(&__ec);
157161 }
158162
159 _LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
163 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
160164
161 _LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); }
165 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept {
166 return __get_status(&__ec);
167 }
162168
163 _LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
169 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
164170
165 _LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
171 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
166172 return __get_symlink_status(&__ec);
167173 }
168174
......@@ -459,8 +465,6 @@ private:
459465 directory_entry __elem_;
460466};
461467
462_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
463
464468_LIBCPP_END_NAMESPACE_FILESYSTEM
465469
466470#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
lib/libcxx/include/__filesystem/directory_iterator.h+9-11
......@@ -34,8 +34,6 @@ _LIBCPP_PUSH_MACROS
3434
3535_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
3636
37_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
38
3937class _LIBCPP_HIDDEN __dir_stream;
4038class directory_iterator {
4139public:
......@@ -73,7 +71,7 @@ public:
7371
7472 _LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default;
7573
76 _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const {
74 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const {
7775 // Note: this check duplicates a check in `__dereference()`.
7876 _LIBCPP_ASSERT_NON_NULL(__imp_, "The end iterator cannot be dereferenced");
7977 return __dereference();
......@@ -123,23 +121,23 @@ operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noe
123121}
124122
125123// enable directory_iterator range-based for statements
126inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept { return __iter; }
127
128inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept { return directory_iterator(); }
124[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept {
125 return __iter;
126}
129127
130_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
128[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept {
129 return directory_iterator();
130}
131131
132132_LIBCPP_END_NAMESPACE_FILESYSTEM
133133
134134# if _LIBCPP_STD_VER >= 20
135135
136136template <>
137_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
138 std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
137inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
139138
140139template <>
141_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
142 std::ranges::enable_view<std::filesystem::directory_iterator> = true;
140inline constexpr bool std::ranges::enable_view<std::filesystem::directory_iterator> = true;
143141
144142# endif // _LIBCPP_STD_VER >= 20
145143
lib/libcxx/include/__filesystem/directory_options.h+7-4
......@@ -22,19 +22,22 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2222
2323enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
2424
25_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator&(directory_options __lhs, directory_options __rhs) {
25[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options
26operator&(directory_options __lhs, directory_options __rhs) {
2627 return static_cast<directory_options>(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs));
2728}
2829
29_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator|(directory_options __lhs, directory_options __rhs) {
30[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options
31operator|(directory_options __lhs, directory_options __rhs) {
3032 return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
3133}
3234
33_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator^(directory_options __lhs, directory_options __rhs) {
35[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options
36operator^(directory_options __lhs, directory_options __rhs) {
3437 return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
3538}
3639
37_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
40[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
3841 return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
3942}
4043
lib/libcxx/include/__filesystem/file_status.h+3-3
......@@ -22,7 +22,7 @@
2222
2323_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2424
25class _LIBCPP_EXPORTED_FROM_ABI file_status {
25class file_status {
2626public:
2727 // constructors
2828 _LIBCPP_HIDE_FROM_ABI file_status() noexcept : file_status(file_type::none) {}
......@@ -38,9 +38,9 @@ public:
3838 _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
3939
4040 // observers
41 _LIBCPP_HIDE_FROM_ABI file_type type() const noexcept { return __ft_; }
41 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI file_type type() const noexcept { return __ft_; }
4242
43 _LIBCPP_HIDE_FROM_ABI perms permissions() const noexcept { return __prms_; }
43 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI perms permissions() const noexcept { return __prms_; }
4444
4545 // modifiers
4646 _LIBCPP_HIDE_FROM_ABI void type(file_type __ft) noexcept { __ft_ = __ft; }
lib/libcxx/include/__filesystem/filesystem_error.h+9-10
......@@ -27,7 +27,7 @@
2727
2828_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2929
30class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error {
30class _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error {
3131public:
3232 _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, error_code __ec)
3333 : system_error(__ec, __what), __storage_(make_shared<_Storage>(path(), path())) {
......@@ -44,15 +44,16 @@ public:
4444 __create_what(2);
4545 }
4646
47 _LIBCPP_HIDE_FROM_ABI const path& path1() const noexcept { return __storage_->__p1_; }
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const path& path1() const noexcept { return __storage_->__p1_; }
4848
49 _LIBCPP_HIDE_FROM_ABI const path& path2() const noexcept { return __storage_->__p2_; }
49 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const path& path2() const noexcept { return __storage_->__p2_; }
5050
51 _LIBCPP_HIDE_FROM_ABI filesystem_error(const filesystem_error&) = default;
51 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI filesystem_error(const filesystem_error&) = default;
5252 ~filesystem_error() override; // key function
5353
54 _LIBCPP_HIDE_FROM_ABI_VIRTUAL
55 const char* what() const noexcept override { return __storage_->__what_.c_str(); }
54 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL const char* what() const noexcept override {
55 return __storage_->__what_.c_str();
56 }
5657
5758 void __create_what(int __num_paths);
5859
......@@ -69,14 +70,12 @@ private:
6970
7071# if _LIBCPP_HAS_EXCEPTIONS
7172template <class... _Args>
72[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
73__throw_filesystem_error(_Args&&... __args) {
73[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_filesystem_error(_Args&&... __args) {
7474 throw filesystem_error(std::forward<_Args>(__args)...);
7575}
7676# else
7777template <class... _Args>
78[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
79__throw_filesystem_error(_Args&&...) {
78[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_filesystem_error(_Args&&...) {
8079 _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
8180}
8281# endif
lib/libcxx/include/__filesystem/operations.h+97-66
......@@ -31,8 +31,6 @@
3131
3232_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
3333
34_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
35
3634_LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr);
3735_LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr);
3836_LIBCPP_EXPORTED_FROM_ABI bool
......@@ -70,10 +68,14 @@ _LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec =
7068_LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr);
7169_LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr);
7270
73inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
74inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); }
75inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
76inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); }
71[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
72[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) {
73 return __absolute(__p, &__ec);
74}
75[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
76[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p, error_code& __ec) {
77 return __canonical(__p, &__ec);
78}
7779inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) {
7880 return __copy_file(__from, __to, copy_options::none);
7981}
......@@ -137,85 +139,112 @@ inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const pat
137139inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
138140 return __create_symlink(__target, __link, &__ec);
139141}
140inline _LIBCPP_HIDE_FROM_ABI path current_path() { return __current_path(); }
141inline _LIBCPP_HIDE_FROM_ABI path current_path(error_code& __ec) { return __current_path(&__ec); }
142[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path current_path() { return __current_path(); }
143[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path current_path(error_code& __ec) { return __current_path(&__ec); }
142144inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p) { __current_path(__p); }
143145inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept {
144146 __current_path(__p, &__ec);
145147}
146inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); }
147inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept {
148[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2) {
149 return __equivalent(__p1, __p2);
150}
151[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool
152equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept {
148153 return __equivalent(__p1, __p2, &__ec);
149154}
150inline _LIBCPP_HIDE_FROM_ABI bool status_known(file_status __s) noexcept { return __s.type() != file_type::none; }
151inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept {
155[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool status_known(file_status __s) noexcept {
156 return __s.type() != file_type::none;
157}
158[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept {
152159 return status_known(__s) && __s.type() != file_type::not_found;
153160}
154inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p) { return exists(__status(__p)); }
161[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p) { return exists(__status(__p)); }
155162
156inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noexcept {
163[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noexcept {
157164 auto __s = __status(__p, &__ec);
158165 if (status_known(__s))
159166 __ec.clear();
160167 return exists(__s);
161168}
162169
163inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p) { return __file_size(__p); }
164inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept {
170[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p) { return __file_size(__p); }
171[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept {
165172 return __file_size(__p, &__ec);
166173}
167inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); }
168inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept {
174[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); }
175[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept {
169176 return __hard_link_count(__p, &__ec);
170177}
171inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(file_status __s) noexcept { return __s.type() == file_type::block; }
172inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p) { return is_block_file(__status(__p)); }
173inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept {
178[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(file_status __s) noexcept {
179 return __s.type() == file_type::block;
180}
181[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p) { return is_block_file(__status(__p)); }
182[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept {
174183 return is_block_file(__status(__p, &__ec));
175184}
176inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept {
185[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept {
177186 return __s.type() == file_type::character;
178187}
179inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p) { return is_character_file(__status(__p)); }
180inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept {
188[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p) {
189 return is_character_file(__status(__p));
190}
191[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept {
181192 return is_character_file(__status(__p, &__ec));
182193}
183inline _LIBCPP_HIDE_FROM_ABI bool is_directory(file_status __s) noexcept { return __s.type() == file_type::directory; }
184inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p) { return is_directory(__status(__p)); }
185inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept {
194[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_directory(file_status __s) noexcept {
195 return __s.type() == file_type::directory;
196}
197[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p) { return is_directory(__status(__p)); }
198[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept {
186199 return is_directory(__status(__p, &__ec));
187200}
188inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p) { return __fs_is_empty(__p); }
189inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); }
190inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; }
191inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p) { return is_fifo(__status(__p)); }
192inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept {
201[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p) { return __fs_is_empty(__p); }
202[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p, error_code& __ec) {
203 return __fs_is_empty(__p, &__ec);
204}
205[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(file_status __s) noexcept {
206 return __s.type() == file_type::fifo;
207}
208[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p) { return is_fifo(__status(__p)); }
209[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept {
193210 return is_fifo(__status(__p, &__ec));
194211}
195inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(file_status __s) noexcept { return __s.type() == file_type::regular; }
196inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); }
197inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept {
212[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(file_status __s) noexcept {
213 return __s.type() == file_type::regular;
214}
215[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p) {
216 return is_regular_file(__status(__p));
217}
218[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept {
198219 return is_regular_file(__status(__p, &__ec));
199220}
200inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(file_status __s) noexcept { return __s.type() == file_type::symlink; }
201inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); }
202inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept {
221[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(file_status __s) noexcept {
222 return __s.type() == file_type::symlink;
223}
224[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p) {
225 return is_symlink(__symlink_status(__p));
226}
227[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept {
203228 return is_symlink(__symlink_status(__p, &__ec));
204229}
205inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept {
230[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept {
206231 return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s);
207232}
208inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p) { return is_other(__status(__p)); }
209inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept {
233[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p) { return is_other(__status(__p)); }
234[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept {
210235 return is_other(__status(__p, &__ec));
211236}
212inline _LIBCPP_HIDE_FROM_ABI bool is_socket(file_status __s) noexcept { return __s.type() == file_type::socket; }
213inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p) { return is_socket(__status(__p)); }
214inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept {
237[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_socket(file_status __s) noexcept {
238 return __s.type() == file_type::socket;
239}
240[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p) { return is_socket(__status(__p)); }
241[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept {
215242 return is_socket(__status(__p, &__ec));
216243}
217inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p) { return __last_write_time(__p); }
218inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept {
244[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p) {
245 return __last_write_time(__p);
246}
247[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept {
219248 return __last_write_time(__p, &__ec);
220249}
221250inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); }
......@@ -233,7 +262,7 @@ inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, per
233262 __permissions(__p, __prms, __opts, &__ec);
234263}
235264
236inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base, error_code& __ec) {
265[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base, error_code& __ec) {
237266 path __tmp = __weakly_canonical(__p, &__ec);
238267 if (__ec)
239268 return {};
......@@ -243,16 +272,18 @@ inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base,
243272 return __tmp.lexically_proximate(__tmp_base);
244273}
245274
246inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) {
275[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) {
247276 return proximate(__p, current_path(), __ec);
248277}
249inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) {
278[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) {
250279 return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base));
251280}
252inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p) { return __read_symlink(__p); }
253inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); }
281[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p) { return __read_symlink(__p); }
282[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p, error_code& __ec) {
283 return __read_symlink(__p, &__ec);
284}
254285
255inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base, error_code& __ec) {
286[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base, error_code& __ec) {
256287 path __tmp = __weakly_canonical(__p, &__ec);
257288 if (__ec)
258289 return path();
......@@ -262,10 +293,10 @@ inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base,
262293 return __tmp.lexically_relative(__tmpbase);
263294}
264295
265inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) {
296[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) {
266297 return relative(__p, current_path(), __ec);
267298}
268inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) {
299[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) {
269300 return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base));
270301}
271302inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p) { return __remove_all(__p); }
......@@ -282,27 +313,27 @@ inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns) {
282313inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept {
283314 return __resize_file(__p, __ns, &__ec);
284315}
285inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p) { return __space(__p); }
286inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept {
316[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p) { return __space(__p); }
317[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept {
287318 return __space(__p, &__ec);
288319}
289inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p) { return __status(__p); }
290inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept {
320[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p) { return __status(__p); }
321[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept {
291322 return __status(__p, &__ec);
292323}
293inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p) { return __symlink_status(__p); }
294inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept {
324[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p) { return __symlink_status(__p); }
325[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept {
295326 return __symlink_status(__p, &__ec);
296327}
297inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path() { return __temp_directory_path(); }
298inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); }
299inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p) { return __weakly_canonical(__p); }
300inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) {
328[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path() { return __temp_directory_path(); }
329[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path(error_code& __ec) {
330 return __temp_directory_path(&__ec);
331}
332[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p) { return __weakly_canonical(__p); }
333[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) {
301334 return __weakly_canonical(__p, &__ec);
302335}
303336
304_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
305
306337_LIBCPP_END_NAMESPACE_FILESYSTEM
307338
308339#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
lib/libcxx/include/__filesystem/path.h+68-64
......@@ -42,8 +42,6 @@ _LIBCPP_PUSH_MACROS
4242
4343_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
4444
45_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
46
4745template <class _Tp>
4846struct __can_convert_char {
4947 static const bool value = false;
......@@ -326,6 +324,7 @@ struct _PathCVT<char> {
326324 }
327325};
328326
327# if _LIBCPP_HAS_LOCALIZATION
329328template <class _ECharT>
330329struct _PathExport {
331330 typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
......@@ -366,7 +365,7 @@ struct _PathExport<char16_t> {
366365 }
367366};
368367
369# if _LIBCPP_HAS_CHAR8_T
368# if _LIBCPP_HAS_CHAR8_T
370369template <>
371370struct _PathExport<char8_t> {
372371 typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
......@@ -376,8 +375,9 @@ struct _PathExport<char8_t> {
376375 _Narrower()(back_inserter(__dest), __src.data(), __src.data() + __src.size());
377376 }
378377};
379# endif // _LIBCPP_HAS_CHAR8_T
380# endif /* _LIBCPP_WIN32API */
378# endif // _LIBCPP_HAS_CHAR8_T
379# endif // _LIBCPP_HAS_LOCALIZATION
380# endif // _LIBCPP_WIN32API
381381
382382class _LIBCPP_EXPORTED_FROM_ABI path {
383383 template <class _SourceOrIter, class _Tp = path&>
......@@ -667,16 +667,16 @@ public:
667667 _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); }
668668
669669 // native format observers
670 _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; }
670 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; }
671671
672 _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); }
672 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); }
673673
674674 _LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; }
675675
676676# if defined(_LIBCPP_WIN32API)
677 _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return __pn_; }
677 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return __pn_; }
678678
679 _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const {
679 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const {
680680 std::wstring __s;
681681 __s.resize(__pn_.size());
682682 std::replace_copy(__pn_.begin(), __pn_.end(), __s.begin(), '\\', '/');
......@@ -685,6 +685,7 @@ public:
685685
686686# if _LIBCPP_HAS_LOCALIZATION
687687 template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
688 [[nodiscard]]
688689 _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
689690 using _Str = basic_string<_ECharT, _Traits, _Allocator>;
690691 _Str __s(__a);
......@@ -693,8 +694,8 @@ public:
693694 return __s;
694695 }
695696
696 _LIBCPP_HIDE_FROM_ABI std::string string() const { return string<char>(); }
697 _LIBCPP_HIDE_FROM_ABI __u8_string u8string() const {
697 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::string string() const { return string<char>(); }
698 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __u8_string u8string() const {
698699 using _CVT = __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
699700 __u8_string __s;
700701 __s.reserve(__pn_.size());
......@@ -702,12 +703,12 @@ public:
702703 return __s;
703704 }
704705
705 _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
706 _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
706 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
707 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
707708
708709 // generic format observers
709710 template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
710 _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
711 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
711712 generic_string(const _Allocator& __a = _Allocator()) const {
712713 using _Str = basic_string<_ECharT, _Traits, _Allocator>;
713714 _Str __s = string<_ECharT, _Traits, _Allocator>(__a);
......@@ -718,10 +719,10 @@ public:
718719 return __s;
719720 }
720721
721 _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return generic_string<char>(); }
722 _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return generic_string<char16_t>(); }
723 _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return generic_string<char32_t>(); }
724 _LIBCPP_HIDE_FROM_ABI __u8_string generic_u8string() const {
722 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return generic_string<char>(); }
723 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return generic_string<char16_t>(); }
724 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return generic_string<char32_t>(); }
725 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __u8_string generic_u8string() const {
725726 __u8_string __s = u8string();
726727 std::replace(__s.begin(), __s.end(), '\\', '/');
727728 return __s;
......@@ -729,15 +730,18 @@ public:
729730# endif // _LIBCPP_HAS_LOCALIZATION
730731# else /* _LIBCPP_WIN32API */
731732
732 _LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
733 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
733734# if _LIBCPP_HAS_CHAR8_T
734 _LIBCPP_HIDE_FROM_ABI std::u8string u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
735 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u8string u8string() const {
736 return std::u8string(__pn_.begin(), __pn_.end());
737 }
735738# else
736 _LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
739 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
737740# endif
738741
739742# if _LIBCPP_HAS_LOCALIZATION
740743 template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
744 [[nodiscard]]
741745 _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
742746 using _CVT = __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__>;
743747 using _Str = basic_string<_ECharT, _Traits, _Allocator>;
......@@ -748,32 +752,34 @@ public:
748752 }
749753
750754# if _LIBCPP_HAS_WIDE_CHARACTERS
751 _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return string<wchar_t>(); }
755 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return string<wchar_t>(); }
752756# endif
753 _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
754 _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
757 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
758 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
755759# endif // _LIBCPP_HAS_LOCALIZATION
756760
757761 // generic format observers
758 _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
762 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
759763# if _LIBCPP_HAS_CHAR8_T
760 _LIBCPP_HIDE_FROM_ABI std::u8string generic_u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
764 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u8string generic_u8string() const {
765 return std::u8string(__pn_.begin(), __pn_.end());
766 }
761767# else
762 _LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }
768 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }
763769# endif
764770
765771# if _LIBCPP_HAS_LOCALIZATION
766772 template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
767 _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
773 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
768774 generic_string(const _Allocator& __a = _Allocator()) const {
769775 return string<_ECharT, _Traits, _Allocator>(__a);
770776 }
771777
772778# if _LIBCPP_HAS_WIDE_CHARACTERS
773 _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const { return string<wchar_t>(); }
779 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const { return string<wchar_t>(); }
774780# endif
775 _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string<char16_t>(); }
776 _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string<char32_t>(); }
781 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string<char16_t>(); }
782 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string<char32_t>(); }
777783# endif // _LIBCPP_HAS_LOCALIZATION
778784# endif /* !_LIBCPP_WIN32API */
779785
......@@ -790,40 +796,40 @@ private:
790796
791797public:
792798 // compare
793 _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept { return __compare(__p.__pn_); }
794 _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return __compare(__s); }
795 _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const { return __compare(__s); }
796 _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return __compare(__s); }
799 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept { return __compare(__p.__pn_); }
800 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return __compare(__s); }
801 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const { return __compare(__s); }
802 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return __compare(__s); }
797803
798804 // decomposition
799 _LIBCPP_HIDE_FROM_ABI path root_name() const { return string_type(__root_name()); }
800 _LIBCPP_HIDE_FROM_ABI path root_directory() const { return string_type(__root_directory()); }
801 _LIBCPP_HIDE_FROM_ABI path root_path() const {
805 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path root_name() const { return string_type(__root_name()); }
806 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path root_directory() const { return string_type(__root_directory()); }
807 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path root_path() const {
802808# if defined(_LIBCPP_WIN32API)
803809 return string_type(__root_path_raw());
804810# else
805811 return root_name().append(string_type(__root_directory()));
806812# endif
807813 }
808 _LIBCPP_HIDE_FROM_ABI path relative_path() const { return string_type(__relative_path()); }
809 _LIBCPP_HIDE_FROM_ABI path parent_path() const { return string_type(__parent_path()); }
810 _LIBCPP_HIDE_FROM_ABI path filename() const { return string_type(__filename()); }
811 _LIBCPP_HIDE_FROM_ABI path stem() const { return string_type(__stem()); }
812 _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); }
814 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path relative_path() const { return string_type(__relative_path()); }
815 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path parent_path() const { return string_type(__parent_path()); }
816 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path filename() const { return string_type(__filename()); }
817 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path stem() const { return string_type(__stem()); }
818 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); }
813819
814820 // query
815821 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); }
816822
817 _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); }
818 _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); }
819 _LIBCPP_HIDE_FROM_ABI bool has_root_path() const { return !__root_path_raw().empty(); }
820 _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const { return !__relative_path().empty(); }
821 _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const { return !__parent_path().empty(); }
822 _LIBCPP_HIDE_FROM_ABI bool has_filename() const { return !__filename().empty(); }
823 _LIBCPP_HIDE_FROM_ABI bool has_stem() const { return !__stem().empty(); }
824 _LIBCPP_HIDE_FROM_ABI bool has_extension() const { return !__extension().empty(); }
823 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); }
824 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); }
825 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_root_path() const { return !__root_path_raw().empty(); }
826 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const { return !__relative_path().empty(); }
827 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const { return !__parent_path().empty(); }
828 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_filename() const { return !__filename().empty(); }
829 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_stem() const { return !__stem().empty(); }
830 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_extension() const { return !__extension().empty(); }
825831
826 _LIBCPP_HIDE_FROM_ABI bool is_absolute() const {
832 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_absolute() const {
827833# if defined(_LIBCPP_WIN32API)
828834 __string_view __root_name_str = __root_name();
829835 __string_view __root_dir = __root_directory();
......@@ -847,13 +853,13 @@ public:
847853 return has_root_directory();
848854# endif
849855 }
850 _LIBCPP_HIDE_FROM_ABI bool is_relative() const { return !is_absolute(); }
856 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_relative() const { return !is_absolute(); }
851857
852858 // relative paths
853 path lexically_normal() const;
854 path lexically_relative(const path& __base) const;
859 [[nodiscard]] path lexically_normal() const;
860 [[nodiscard]] path lexically_relative(const path& __base) const;
855861
856 _LIBCPP_HIDE_FROM_ABI path lexically_proximate(const path& __base) const {
862 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI path lexically_proximate(const path& __base) const {
857863 path __result = this->lexically_relative(__base);
858864 if (__result.native().empty())
859865 return *this;
......@@ -861,11 +867,11 @@ public:
861867 }
862868
863869 // iterators
864 class _LIBCPP_EXPORTED_FROM_ABI iterator;
870 class iterator;
865871 typedef iterator const_iterator;
866872
867 iterator begin() const;
868 iterator end() const;
873 [[nodiscard]] iterator begin() const;
874 [[nodiscard]] iterator end() const;
869875
870876# if _LIBCPP_HAS_LOCALIZATION
871877 template <
......@@ -908,17 +914,15 @@ private:
908914
909915inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
910916
911_LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept;
912
913_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
917[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept;
914918
915919_LIBCPP_END_NAMESPACE_FILESYSTEM
916920
917921_LIBCPP_BEGIN_NAMESPACE_STD
918922
919923template <>
920struct _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY hash<filesystem::path> : __unary_function<filesystem::path, size_t> {
921 _LIBCPP_HIDE_FROM_ABI size_t operator()(filesystem::path const& __p) const noexcept {
924struct hash<filesystem::path> : __unary_function<filesystem::path, size_t> {
925 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t operator()(filesystem::path const& __p) const noexcept {
922926 return filesystem::hash_value(__p);
923927 }
924928};
lib/libcxx/include/__filesystem/path_iterator.h+1-3
......@@ -52,7 +52,7 @@ public:
5252
5353 _LIBCPP_HIDE_FROM_ABI iterator& operator=(const iterator&) = default;
5454
55 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __stashed_elem_; }
55 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __stashed_elem_; }
5656
5757 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return &__stashed_elem_; }
5858
......@@ -95,12 +95,10 @@ private:
9595 _ParserState __state_;
9696};
9797
98_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
9998inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) {
10099 return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data();
101100}
102101
103_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
104102inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) {
105103 return !(__lhs == __rhs);
106104}
lib/libcxx/include/__filesystem/perm_options.h+4-4
......@@ -22,19 +22,19 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2222
2323enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
2424
25_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
25[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
2626 return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
2727}
2828
29_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
29[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
3030 return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
3131}
3232
33_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
33[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
3434 return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
3535}
3636
37_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
37[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
3838 return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
3939}
4040
lib/libcxx/include/__filesystem/perms.h+4-4
......@@ -51,19 +51,19 @@ enum class perms : unsigned {
5151 unknown = 0xFFFF,
5252};
5353
54_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
54[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
5555 return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
5656}
5757
58_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
58[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
5959 return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
6060}
6161
62_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
62[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
6363 return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
6464}
6565
66_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
66[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
6767 return static_cast<perms>(~static_cast<unsigned>(__lhs));
6868}
6969
lib/libcxx/include/__filesystem/recursive_directory_iterator.h+9-14
......@@ -33,8 +33,6 @@ _LIBCPP_PUSH_MACROS
3333
3434_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
3535
36_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
37
3836class recursive_directory_iterator {
3937public:
4038 using value_type = directory_entry;
......@@ -73,7 +71,7 @@ public:
7371
7472 _LIBCPP_HIDE_FROM_ABI ~recursive_directory_iterator() = default;
7573
76 _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { return __dereference(); }
74 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { return __dereference(); }
7775
7876 _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &__dereference(); }
7977
......@@ -87,14 +85,14 @@ public:
8785
8886 _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
8987
90 _LIBCPP_EXPORTED_FROM_ABI directory_options options() const;
91 _LIBCPP_EXPORTED_FROM_ABI int depth() const;
88 [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI directory_options options() const;
89 [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI int depth() const;
9290
9391 _LIBCPP_HIDE_FROM_ABI void pop() { __pop(); }
9492
9593 _LIBCPP_HIDE_FROM_ABI void pop(error_code& __ec) { __pop(&__ec); }
9694
97 _LIBCPP_HIDE_FROM_ABI bool recursion_pending() const { return __rec_; }
95 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool recursion_pending() const { return __rec_; }
9896
9997 _LIBCPP_HIDE_FROM_ABI void disable_recursion_pending() { __rec_ = false; }
10098
......@@ -132,27 +130,24 @@ operator!=(const recursive_directory_iterator& __lhs, const recursive_directory_
132130 return !(__lhs == __rhs);
133131}
134132// enable recursive_directory_iterator range-based for statements
135inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept {
133[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator
134begin(recursive_directory_iterator __iter) noexcept {
136135 return __iter;
137136}
138137
139inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator end(recursive_directory_iterator) noexcept {
138[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator end(recursive_directory_iterator) noexcept {
140139 return recursive_directory_iterator();
141140}
142141
143_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
144
145142_LIBCPP_END_NAMESPACE_FILESYSTEM
146143
147144# if _LIBCPP_STD_VER >= 20
148145
149146template <>
150_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
151 std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
147inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
152148
153149template <>
154_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
155 std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
150inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
156151
157152# endif // _LIBCPP_STD_VER >= 20
158153
lib/libcxx/include/__filesystem/space_info.h+1-1
......@@ -21,7 +21,7 @@
2121
2222_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2323
24struct _LIBCPP_EXPORTED_FROM_ABI space_info {
24struct space_info {
2525 uintmax_t capacity;
2626 uintmax_t free;
2727 uintmax_t available;
lib/libcxx/include/__filesystem/u8path.h+12-14
......@@ -24,32 +24,32 @@
2424
2525_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
2626
27_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
28
27# if !defined(_LIBCPP_WIN32API) || _LIBCPP_HAS_LOCALIZATION
2928template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
30_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
29[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
3130 static_assert(
32# if _LIBCPP_HAS_CHAR8_T
31# if _LIBCPP_HAS_CHAR8_T
3332 is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
34# endif
33# endif
3534 is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
3635 "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
3736 " or 'char8_t'");
38# if defined(_LIBCPP_WIN32API)
37# if defined(_LIBCPP_WIN32API)
3938 string __tmp(__f, __l);
4039 using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
4140 std::wstring __w;
4241 __w.reserve(__tmp.size());
4342 _CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
4443 return path(__w);
45# else
44# else
4645 return path(__f, __l);
47# endif /* !_LIBCPP_WIN32API */
46# endif // defined(_LIBCPP_WIN32API)
4847}
48# endif // !defined(_LIBCPP_WIN32API) || _LIBCPP_HAS_LOCALIZATION
4949
50# if defined(_LIBCPP_WIN32API)
50# if defined(_LIBCPP_WIN32API) && _LIBCPP_HAS_LOCALIZATION
5151template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
52_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
52[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
5353 static_assert(
5454# if _LIBCPP_HAS_CHAR8_T
5555 is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
......@@ -67,10 +67,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f,
6767 _CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
6868 return path(__w);
6969}
70# endif /* _LIBCPP_WIN32API */
70# endif // defined(_LIBCPP_WIN32API) && _LIBCPP_HAS_LOCALIZATION
7171
7272template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
73_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
73[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
7474 static_assert(
7575# if _LIBCPP_HAS_CHAR8_T
7676 is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
......@@ -86,8 +86,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source&
8686# endif
8787}
8888
89_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
90
9189_LIBCPP_END_NAMESPACE_FILESYSTEM
9290
9391#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__flat_map/flat_map.h+88-71
......@@ -29,7 +29,6 @@
2929#include <__flat_map/key_value_iterator.h>
3030#include <__flat_map/sorted_unique.h>
3131#include <__flat_map/utils.h>
32#include <__functional/invoke.h>
3332#include <__functional/is_transparent.h>
3433#include <__functional/operations.h>
3534#include <__fwd/memory.h>
......@@ -48,7 +47,7 @@
4847#include <__ranges/container_compatible_range.h>
4948#include <__ranges/drop_view.h>
5049#include <__ranges/from_range.h>
51#include <__ranges/ref_view.h>
50#include <__ranges/range_adaptor.h>
5251#include <__ranges/size.h>
5352#include <__ranges/subrange.h>
5453#include <__ranges/zip_view.h>
......@@ -410,41 +409,45 @@ public:
410409 }
411410
412411 // iterators
413 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
412 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
414413 return iterator(__containers_.keys.begin(), __containers_.values.begin());
415414 }
416415
417 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
416 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
418417 return const_iterator(__containers_.keys.begin(), __containers_.values.begin());
419418 }
420419
421 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
420 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
422421 return iterator(__containers_.keys.end(), __containers_.values.end());
423422 }
424423
425 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
424 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
426425 return const_iterator(__containers_.keys.end(), __containers_.values.end());
427426 }
428427
429 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
428 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
430429 return reverse_iterator(end());
431430 }
432 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
431 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
433432 return const_reverse_iterator(end());
434433 }
435 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
434 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
436435 return reverse_iterator(begin());
437436 }
438 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
437 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
439438 return const_reverse_iterator(begin());
440439 }
441440
442 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept { return begin(); }
443 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept { return end(); }
444 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
441 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept {
442 return begin();
443 }
444 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept {
445 return end();
446 }
447 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
445448 return const_reverse_iterator(end());
446449 }
447 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
450 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
448451 return const_reverse_iterator(begin());
449452 }
450453
......@@ -453,11 +456,11 @@ public:
453456 return __containers_.keys.empty();
454457 }
455458
456 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
459 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
457460 return __containers_.keys.size();
458461 }
459462
460 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
463 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
461464 return std::min<size_type>(__containers_.keys.max_size(), __containers_.values.max_size());
462465 }
463466
......@@ -481,7 +484,7 @@ public:
481484 return try_emplace(std::forward<_Kp>(__x)).first->second;
482485 }
483486
484 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __x) {
487 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __x) {
485488 auto __it = find(__x);
486489 if (__it == end()) {
487490 std::__throw_out_of_range("flat_map::at(const key_type&): Key does not exist");
......@@ -489,7 +492,7 @@ public:
489492 return __it->second;
490493 }
491494
492 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const key_type& __x) const {
495 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const key_type& __x) const {
493496 auto __it = find(__x);
494497 if (__it == end()) {
495498 std::__throw_out_of_range("flat_map::at(const key_type&) const: Key does not exist");
......@@ -499,7 +502,7 @@ public:
499502
500503 template <class _Kp>
501504 requires __is_compare_transparent
502 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const _Kp& __x) {
505 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const _Kp& __x) {
503506 auto __it = find(__x);
504507 if (__it == end()) {
505508 std::__throw_out_of_range("flat_map::at(const K&): Key does not exist");
......@@ -509,7 +512,7 @@ public:
509512
510513 template <class _Kp>
511514 requires __is_compare_transparent
512 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const _Kp& __x) const {
515 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const _Kp& __x) const {
513516 auto __it = find(__x);
514517 if (__it == end()) {
515518 std::__throw_out_of_range("flat_map::at(const K&) const: Key does not exist");
......@@ -589,6 +592,15 @@ public:
589592 __append_sort_merge_unique</*WasSorted = */ false>(ranges::begin(__range), ranges::end(__range));
590593 }
591594
595 template <_ContainerCompatibleRange<value_type> _Range>
596 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(sorted_unique_t, _Range&& __range) {
597 if constexpr (ranges::sized_range<_Range>) {
598 __reserve(ranges::size(__range));
599 }
600
601 __append_sort_merge_unique</*WasSorted = */ true>(ranges::begin(__range), ranges::end(__range));
602 }
603
592604 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
593605 insert(__il.begin(), __il.end());
594606 }
......@@ -597,7 +609,7 @@ public:
597609 insert(sorted_unique, __il.begin(), __il.end());
598610 }
599611
600 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 containers extract() && {
612 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 containers extract() && {
601613 auto __guard = std::__make_scope_guard([&]() noexcept { clear() /* noexcept */; });
602614 auto __ret = std::move(__containers_);
603615 return __ret;
......@@ -738,14 +750,17 @@ public:
738750 return iterator(std::move(__key_it), std::move(__mapped_it));
739751 }
740752
741 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(flat_map& __y) noexcept {
742 // warning: The spec has unconditional noexcept, which means that
743 // if any of the following functions throw an exception,
744 // std::terminate will be called.
745 // This is discussed in P2767, which hasn't been voted on yet.
753 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
754 swap(flat_map& __y) noexcept(is_nothrow_swappable_v<key_container_type> &&
755 is_nothrow_swappable_v<mapped_container_type> && is_nothrow_swappable_v<key_compare>) {
756 auto __on_failure = std::__make_exception_guard([&]() noexcept {
757 clear() /* noexcept */;
758 __y.clear() /* noexcept */;
759 });
746760 ranges::swap(__compare_, __y.__compare_);
747761 ranges::swap(__containers_.keys, __y.__containers_.keys);
748762 ranges::swap(__containers_.values, __y.__containers_.values);
763 __on_failure.__complete();
749764 }
750765
751766 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() noexcept {
......@@ -754,116 +769,121 @@ public:
754769 }
755770
756771 // observers
757 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
758 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
772 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
773 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
759774 return value_compare(__compare_);
760775 }
761776
762 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys() const noexcept {
777 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys() const noexcept {
763778 return __containers_.keys;
764779 }
765 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type& values() const noexcept {
780 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type&
781 values() const noexcept {
766782 return __containers_.values;
767783 }
768784
769785 // map operations
770 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
786 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
771787 return __find_impl(*this, __x);
772788 }
773789
774 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
790 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
775791 return __find_impl(*this, __x);
776792 }
777793
778794 template <class _Kp>
779795 requires __is_compare_transparent
780 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
796 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
781797 return __find_impl(*this, __x);
782798 }
783799
784800 template <class _Kp>
785801 requires __is_compare_transparent
786 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
802 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
787803 return __find_impl(*this, __x);
788804 }
789805
790 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
806 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
791807 return contains(__x) ? 1 : 0;
792808 }
793809
794810 template <class _Kp>
795811 requires __is_compare_transparent
796 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
812 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
797813 return contains(__x) ? 1 : 0;
798814 }
799815
800 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
816 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
801817 return find(__x) != end();
802818 }
803819
804820 template <class _Kp>
805821 requires __is_compare_transparent
806 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
822 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
807823 return find(__x) != end();
808824 }
809825
810 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
826 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
811827 return __lower_bound<iterator>(*this, __x);
812828 }
813829
814 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const key_type& __x) const {
830 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
831 lower_bound(const key_type& __x) const {
815832 return __lower_bound<const_iterator>(*this, __x);
816833 }
817834
818835 template <class _Kp>
819836 requires __is_compare_transparent
820 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
837 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
821838 return __lower_bound<iterator>(*this, __x);
822839 }
823840
824841 template <class _Kp>
825842 requires __is_compare_transparent
826 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
843 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
827844 return __lower_bound<const_iterator>(*this, __x);
828845 }
829846
830 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
847 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
831848 return __upper_bound<iterator>(*this, __x);
832849 }
833850
834 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const key_type& __x) const {
851 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
852 upper_bound(const key_type& __x) const {
835853 return __upper_bound<const_iterator>(*this, __x);
836854 }
837855
838856 template <class _Kp>
839857 requires __is_compare_transparent
840 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
858 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
841859 return __upper_bound<iterator>(*this, __x);
842860 }
843861
844862 template <class _Kp>
845863 requires __is_compare_transparent
846 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
864 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
847865 return __upper_bound<const_iterator>(*this, __x);
848866 }
849867
850 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __x) {
868 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
869 equal_range(const key_type& __x) {
851870 return __equal_range_impl(*this, __x);
852871 }
853872
854 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
873 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
855874 equal_range(const key_type& __x) const {
856875 return __equal_range_impl(*this, __x);
857876 }
858877
859878 template <class _Kp>
860879 requires __is_compare_transparent
861 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _Kp& __x) {
880 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
881 equal_range(const _Kp& __x) {
862882 return __equal_range_impl(*this, __x);
863883 }
864884 template <class _Kp>
865885 requires __is_compare_transparent
866 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
886 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
867887 equal_range(const _Kp& __x) const {
868888 return __equal_range_impl(*this, __x);
869889 }
......@@ -878,7 +898,8 @@ public:
878898 __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
879899 }
880900
881 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(flat_map& __x, flat_map& __y) noexcept {
901 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
902 swap(flat_map& __x, flat_map& __y) noexcept(noexcept(__x.swap(__y))) {
882903 __x.swap(__y);
883904 }
884905
......@@ -913,7 +934,7 @@ private:
913934 __compare_(std::forward<_CompArg>(__comp)...) {}
914935
915936 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __is_sorted_and_unique(auto&& __key_container) const {
916 auto __greater_or_equal_to = [this](const auto& __x, const auto& __y) { return !__compare_(__x, __y); };
937 auto __greater_or_equal_to = [this](const auto& __x, const auto& __y) -> bool { return !__compare_(__x, __y); };
917938 return ranges::adjacent_find(__key_container, __greater_or_equal_to) == ranges::end(__key_container);
918939 }
919940
......@@ -946,7 +967,7 @@ private:
946967 auto __zv = ranges::views::zip(__containers_.keys, __containers_.values);
947968 auto __append_start_offset = __containers_.keys.size() - __num_of_appended;
948969 auto __end = __zv.end();
949 auto __compare_key = [this](const auto& __p1, const auto& __p2) {
970 auto __compare_key = [this](const auto& __p1, const auto& __p2) -> bool {
950971 return __compare_(std::get<0>(__p1), std::get<0>(__p2));
951972 };
952973 if constexpr (!_WasSorted) {
......@@ -1125,8 +1146,7 @@ private:
11251146};
11261147
11271148template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>>
1128 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
1129 !__is_allocator<_MappedContainer>::value &&
1149 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
11301150 is_invocable_v<const _Compare&,
11311151 const typename _KeyContainer::value_type&,
11321152 const typename _KeyContainer::value_type&>)
......@@ -1139,7 +1159,7 @@ flat_map(_KeyContainer, _MappedContainer, _Compare = _Compare())
11391159
11401160template <class _KeyContainer, class _MappedContainer, class _Allocator>
11411161 requires(uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
1142 !__is_allocator<_KeyContainer>::value && !__is_allocator<_MappedContainer>::value)
1162 !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer>)
11431163flat_map(_KeyContainer, _MappedContainer, _Allocator)
11441164 -> flat_map<typename _KeyContainer::value_type,
11451165 typename _MappedContainer::value_type,
......@@ -1148,9 +1168,8 @@ flat_map(_KeyContainer, _MappedContainer, _Allocator)
11481168 _MappedContainer>;
11491169
11501170template <class _KeyContainer, class _MappedContainer, class _Compare, class _Allocator>
1151 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
1152 !__is_allocator<_MappedContainer>::value && uses_allocator_v<_KeyContainer, _Allocator> &&
1153 uses_allocator_v<_MappedContainer, _Allocator> &&
1171 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
1172 uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
11541173 is_invocable_v<const _Compare&,
11551174 const typename _KeyContainer::value_type&,
11561175 const typename _KeyContainer::value_type&>)
......@@ -1162,8 +1181,7 @@ flat_map(_KeyContainer, _MappedContainer, _Compare, _Allocator)
11621181 _MappedContainer>;
11631182
11641183template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>>
1165 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
1166 !__is_allocator<_MappedContainer>::value &&
1184 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
11671185 is_invocable_v<const _Compare&,
11681186 const typename _KeyContainer::value_type&,
11691187 const typename _KeyContainer::value_type&>)
......@@ -1176,7 +1194,7 @@ flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Compare = _Compare()
11761194
11771195template <class _KeyContainer, class _MappedContainer, class _Allocator>
11781196 requires(uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
1179 !__is_allocator<_KeyContainer>::value && !__is_allocator<_MappedContainer>::value)
1197 !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer>)
11801198flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Allocator)
11811199 -> flat_map<typename _KeyContainer::value_type,
11821200 typename _MappedContainer::value_type,
......@@ -1185,9 +1203,8 @@ flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Allocator)
11851203 _MappedContainer>;
11861204
11871205template <class _KeyContainer, class _MappedContainer, class _Compare, class _Allocator>
1188 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
1189 !__is_allocator<_MappedContainer>::value && uses_allocator_v<_KeyContainer, _Allocator> &&
1190 uses_allocator_v<_MappedContainer, _Allocator> &&
1206 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
1207 uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
11911208 is_invocable_v<const _Compare&,
11921209 const typename _KeyContainer::value_type&,
11931210 const typename _KeyContainer::value_type&>)
......@@ -1199,19 +1216,19 @@ flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Compare, _Allocator)
11991216 _MappedContainer>;
12001217
12011218template <class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>>
1202 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
1219 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
12031220flat_map(_InputIterator, _InputIterator, _Compare = _Compare())
12041221 -> flat_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare>;
12051222
12061223template <class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>>
1207 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
1224 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
12081225flat_map(sorted_unique_t, _InputIterator, _InputIterator, _Compare = _Compare())
12091226 -> flat_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare>;
12101227
12111228template <ranges::input_range _Range,
12121229 class _Compare = less<__range_key_type<_Range>>,
12131230 class _Allocator = allocator<byte>,
1214 class = __enable_if_t<!__is_allocator<_Compare>::value && __is_allocator<_Allocator>::value>>
1231 class = __enable_if_t<!__is_allocator_v<_Compare> && __is_allocator_v<_Allocator>>>
12151232flat_map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator()) -> flat_map<
12161233 __range_key_type<_Range>,
12171234 __range_mapped_type<_Range>,
......@@ -1219,7 +1236,7 @@ flat_map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator(
12191236 vector<__range_key_type<_Range>, __allocator_traits_rebind_t<_Allocator, __range_key_type<_Range>>>,
12201237 vector<__range_mapped_type<_Range>, __allocator_traits_rebind_t<_Allocator, __range_mapped_type<_Range>>>>;
12211238
1222template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator<_Allocator>::value>>
1239template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator_v<_Allocator>>>
12231240flat_map(from_range_t, _Range&&, _Allocator) -> flat_map<
12241241 __range_key_type<_Range>,
12251242 __range_mapped_type<_Range>,
......@@ -1228,11 +1245,11 @@ flat_map(from_range_t, _Range&&, _Allocator) -> flat_map<
12281245 vector<__range_mapped_type<_Range>, __allocator_traits_rebind_t<_Allocator, __range_mapped_type<_Range>>>>;
12291246
12301247template <class _Key, class _Tp, class _Compare = less<_Key>>
1231 requires(!__is_allocator<_Compare>::value)
1248 requires(!__is_allocator_v<_Compare>)
12321249flat_map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare()) -> flat_map<_Key, _Tp, _Compare>;
12331250
12341251template <class _Key, class _Tp, class _Compare = less<_Key>>
1235 requires(!__is_allocator<_Compare>::value)
1252 requires(!__is_allocator_v<_Compare>)
12361253flat_map(sorted_unique_t, initializer_list<pair<_Key, _Tp>>, _Compare = _Compare()) -> flat_map<_Key, _Tp, _Compare>;
12371254
12381255template <class _Key, class _Tp, class _Compare, class _KeyContainer, class _MappedContainer, class _Allocator>
lib/libcxx/include/__flat_map/flat_multimap.h+251-172
......@@ -22,7 +22,6 @@
2222#include <__algorithm/upper_bound.h>
2323#include <__assert>
2424#include <__compare/synth_three_way.h>
25#include <__concepts/convertible_to.h>
2625#include <__concepts/swappable.h>
2726#include <__config>
2827#include <__cstddef/byte.h>
......@@ -30,7 +29,6 @@
3029#include <__flat_map/key_value_iterator.h>
3130#include <__flat_map/sorted_equivalent.h>
3231#include <__flat_map/utils.h>
33#include <__functional/invoke.h>
3432#include <__functional/is_transparent.h>
3533#include <__functional/operations.h>
3634#include <__fwd/vector.h>
......@@ -47,7 +45,7 @@
4745#include <__ranges/container_compatible_range.h>
4846#include <__ranges/drop_view.h>
4947#include <__ranges/from_range.h>
50#include <__ranges/ref_view.h>
48#include <__ranges/range_adaptor.h>
5149#include <__ranges/size.h>
5250#include <__ranges/subrange.h>
5351#include <__ranges/zip_view.h>
......@@ -57,14 +55,12 @@
5755#include <__type_traits/is_allocator.h>
5856#include <__type_traits/is_nothrow_constructible.h>
5957#include <__type_traits/is_same.h>
60#include <__type_traits/maybe_const.h>
6158#include <__utility/exception_guard.h>
6259#include <__utility/move.h>
6360#include <__utility/pair.h>
6461#include <__utility/scope_guard.h>
6562#include <__vector/vector.h>
6663#include <initializer_list>
67#include <stdexcept>
6864
6965#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
7066# pragma GCC system_header
......@@ -114,11 +110,12 @@ public:
114110 class value_compare {
115111 private:
116112 _LIBCPP_NO_UNIQUE_ADDRESS key_compare __comp_;
117 _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : __comp_(__c) {}
113 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : __comp_(__c) {}
118114 friend flat_multimap;
119115
120116 public:
121 _LIBCPP_HIDE_FROM_ABI bool operator()(const_reference __x, const_reference __y) const {
117 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
118 operator()(const_reference __x, const_reference __y) const {
122119 return __comp_(__x.first, __y.first);
123120 }
124121 };
......@@ -137,17 +134,17 @@ private:
137134
138135public:
139136 // [flat.map.cons], construct/copy/destroy
140 _LIBCPP_HIDE_FROM_ABI flat_multimap() noexcept(
137 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap() noexcept(
141138 is_nothrow_default_constructible_v<_KeyContainer> && is_nothrow_default_constructible_v<_MappedContainer> &&
142139 is_nothrow_default_constructible_v<_Compare>)
143140 : __containers_(), __compare_() {}
144141
145 _LIBCPP_HIDE_FROM_ABI flat_multimap(const flat_multimap&) = default;
142 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(const flat_multimap&) = default;
146143
147144 // The copy/move constructors are not specified in the spec, which means they should be defaulted.
148145 // However, the move constructor can potentially leave a moved-from object in an inconsistent
149146 // state if an exception is thrown.
150 _LIBCPP_HIDE_FROM_ABI flat_multimap(flat_multimap&& __other) noexcept(
147 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(flat_multimap&& __other) noexcept(
151148 is_nothrow_move_constructible_v<_KeyContainer> && is_nothrow_move_constructible_v<_MappedContainer> &&
152149 is_nothrow_move_constructible_v<_Compare>)
153150# if _LIBCPP_HAS_EXCEPTIONS
......@@ -168,7 +165,8 @@ public:
168165
169166 template <class _Allocator>
170167 requires __allocator_ctor_constraint<_Allocator>
171 _LIBCPP_HIDE_FROM_ABI flat_multimap(const flat_multimap& __other, const _Allocator& __alloc)
168 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
169 flat_multimap(const flat_multimap& __other, const _Allocator& __alloc)
172170 : flat_multimap(__ctor_uses_allocator_tag{},
173171 __alloc,
174172 __other.__containers_.keys,
......@@ -177,7 +175,7 @@ public:
177175
178176 template <class _Allocator>
179177 requires __allocator_ctor_constraint<_Allocator>
180 _LIBCPP_HIDE_FROM_ABI flat_multimap(flat_multimap&& __other, const _Allocator& __alloc)
178 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(flat_multimap&& __other, const _Allocator& __alloc)
181179# if _LIBCPP_HAS_EXCEPTIONS
182180 try
183181# endif // _LIBCPP_HAS_EXCEPTIONS
......@@ -194,7 +192,7 @@ public:
194192# endif // _LIBCPP_HAS_EXCEPTIONS
195193 }
196194
197 _LIBCPP_HIDE_FROM_ABI flat_multimap(
195 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
198196 key_container_type __key_cont, mapped_container_type __mapped_cont, const key_compare& __comp = key_compare())
199197 : __containers_{.keys = std::move(__key_cont), .values = std::move(__mapped_cont)}, __compare_(__comp) {
200198 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__containers_.keys.size() == __containers_.values.size(),
......@@ -204,7 +202,7 @@ public:
204202
205203 template <class _Allocator>
206204 requires __allocator_ctor_constraint<_Allocator>
207 _LIBCPP_HIDE_FROM_ABI flat_multimap(
205 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
208206 const key_container_type& __key_cont, const mapped_container_type& __mapped_cont, const _Allocator& __alloc)
209207 : flat_multimap(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont) {
210208 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__containers_.keys.size() == __containers_.values.size(),
......@@ -214,22 +212,22 @@ public:
214212
215213 template <class _Allocator>
216214 requires __allocator_ctor_constraint<_Allocator>
217 _LIBCPP_HIDE_FROM_ABI
218 flat_multimap(const key_container_type& __key_cont,
219 const mapped_container_type& __mapped_cont,
220 const key_compare& __comp,
221 const _Allocator& __alloc)
215 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
216 const key_container_type& __key_cont,
217 const mapped_container_type& __mapped_cont,
218 const key_compare& __comp,
219 const _Allocator& __alloc)
222220 : flat_multimap(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont, __comp) {
223221 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__containers_.keys.size() == __containers_.values.size(),
224222 "flat_multimap keys and mapped containers have different size");
225223 __sort();
226224 }
227225
228 _LIBCPP_HIDE_FROM_ABI
229 flat_multimap(sorted_equivalent_t,
230 key_container_type __key_cont,
231 mapped_container_type __mapped_cont,
232 const key_compare& __comp = key_compare())
226 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
227 sorted_equivalent_t,
228 key_container_type __key_cont,
229 mapped_container_type __mapped_cont,
230 const key_compare& __comp = key_compare())
233231 : __containers_{.keys = std::move(__key_cont), .values = std::move(__mapped_cont)}, __compare_(__comp) {
234232 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__containers_.keys.size() == __containers_.values.size(),
235233 "flat_multimap keys and mapped containers have different size");
......@@ -238,11 +236,11 @@ public:
238236
239237 template <class _Allocator>
240238 requires __allocator_ctor_constraint<_Allocator>
241 _LIBCPP_HIDE_FROM_ABI
242 flat_multimap(sorted_equivalent_t,
243 const key_container_type& __key_cont,
244 const mapped_container_type& __mapped_cont,
245 const _Allocator& __alloc)
239 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
240 sorted_equivalent_t,
241 const key_container_type& __key_cont,
242 const mapped_container_type& __mapped_cont,
243 const _Allocator& __alloc)
246244 : flat_multimap(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont) {
247245 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__containers_.keys.size() == __containers_.values.size(),
248246 "flat_multimap keys and mapped containers have different size");
......@@ -251,33 +249,35 @@ public:
251249
252250 template <class _Allocator>
253251 requires __allocator_ctor_constraint<_Allocator>
254 _LIBCPP_HIDE_FROM_ABI
255 flat_multimap(sorted_equivalent_t,
256 const key_container_type& __key_cont,
257 const mapped_container_type& __mapped_cont,
258 const key_compare& __comp,
259 const _Allocator& __alloc)
252 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
253 sorted_equivalent_t,
254 const key_container_type& __key_cont,
255 const mapped_container_type& __mapped_cont,
256 const key_compare& __comp,
257 const _Allocator& __alloc)
260258 : flat_multimap(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont, __comp) {
261259 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__containers_.keys.size() == __containers_.values.size(),
262260 "flat_multimap keys and mapped containers have different size");
263261 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__is_sorted(__containers_.keys), "Key container is not sorted");
264262 }
265263
266 _LIBCPP_HIDE_FROM_ABI explicit flat_multimap(const key_compare& __comp) : __containers_(), __compare_(__comp) {}
264 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit flat_multimap(const key_compare& __comp)
265 : __containers_(), __compare_(__comp) {}
267266
268267 template <class _Allocator>
269268 requires __allocator_ctor_constraint<_Allocator>
270 _LIBCPP_HIDE_FROM_ABI flat_multimap(const key_compare& __comp, const _Allocator& __alloc)
269 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
270 flat_multimap(const key_compare& __comp, const _Allocator& __alloc)
271271 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {}
272272
273273 template <class _Allocator>
274274 requires __allocator_ctor_constraint<_Allocator>
275 _LIBCPP_HIDE_FROM_ABI explicit flat_multimap(const _Allocator& __alloc)
275 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit flat_multimap(const _Allocator& __alloc)
276276 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc) {}
277277
278278 template <class _InputIterator>
279279 requires __has_input_iterator_category<_InputIterator>::value
280 _LIBCPP_HIDE_FROM_ABI
280 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
281281 flat_multimap(_InputIterator __first, _InputIterator __last, const key_compare& __comp = key_compare())
282282 : __containers_(), __compare_(__comp) {
283283 insert(__first, __last);
......@@ -285,7 +285,7 @@ public:
285285
286286 template <class _InputIterator, class _Allocator>
287287 requires(__has_input_iterator_category<_InputIterator>::value && __allocator_ctor_constraint<_Allocator>)
288 _LIBCPP_HIDE_FROM_ABI
288 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
289289 flat_multimap(_InputIterator __first, _InputIterator __last, const key_compare& __comp, const _Allocator& __alloc)
290290 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {
291291 insert(__first, __last);
......@@ -293,91 +293,99 @@ public:
293293
294294 template <class _InputIterator, class _Allocator>
295295 requires(__has_input_iterator_category<_InputIterator>::value && __allocator_ctor_constraint<_Allocator>)
296 _LIBCPP_HIDE_FROM_ABI flat_multimap(_InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
296 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
297 flat_multimap(_InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
297298 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc) {
298299 insert(__first, __last);
299300 }
300301
301302 template <_ContainerCompatibleRange<value_type> _Range>
302 _LIBCPP_HIDE_FROM_ABI flat_multimap(from_range_t __fr, _Range&& __rg)
303 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(from_range_t __fr, _Range&& __rg)
303304 : flat_multimap(__fr, std::forward<_Range>(__rg), key_compare()) {}
304305
305306 template <_ContainerCompatibleRange<value_type> _Range, class _Allocator>
306307 requires __allocator_ctor_constraint<_Allocator>
307 _LIBCPP_HIDE_FROM_ABI flat_multimap(from_range_t, _Range&& __rg, const _Allocator& __alloc)
308 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
309 flat_multimap(from_range_t, _Range&& __rg, const _Allocator& __alloc)
308310 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc) {
309311 insert_range(std::forward<_Range>(__rg));
310312 }
311313
312314 template <_ContainerCompatibleRange<value_type> _Range>
313 _LIBCPP_HIDE_FROM_ABI flat_multimap(from_range_t, _Range&& __rg, const key_compare& __comp) : flat_multimap(__comp) {
315 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
316 flat_multimap(from_range_t, _Range&& __rg, const key_compare& __comp)
317 : flat_multimap(__comp) {
314318 insert_range(std::forward<_Range>(__rg));
315319 }
316320
317321 template <_ContainerCompatibleRange<value_type> _Range, class _Allocator>
318322 requires __allocator_ctor_constraint<_Allocator>
319 _LIBCPP_HIDE_FROM_ABI flat_multimap(from_range_t, _Range&& __rg, const key_compare& __comp, const _Allocator& __alloc)
323 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
324 flat_multimap(from_range_t, _Range&& __rg, const key_compare& __comp, const _Allocator& __alloc)
320325 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {
321326 insert_range(std::forward<_Range>(__rg));
322327 }
323328
324329 template <class _InputIterator>
325330 requires __has_input_iterator_category<_InputIterator>::value
326 _LIBCPP_HIDE_FROM_ABI flat_multimap(
331 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
327332 sorted_equivalent_t, _InputIterator __first, _InputIterator __last, const key_compare& __comp = key_compare())
328333 : __containers_(), __compare_(__comp) {
329334 insert(sorted_equivalent, __first, __last);
330335 }
331336 template <class _InputIterator, class _Allocator>
332337 requires(__has_input_iterator_category<_InputIterator>::value && __allocator_ctor_constraint<_Allocator>)
333 _LIBCPP_HIDE_FROM_ABI
334 flat_multimap(sorted_equivalent_t,
335 _InputIterator __first,
336 _InputIterator __last,
337 const key_compare& __comp,
338 const _Allocator& __alloc)
338 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
339 sorted_equivalent_t,
340 _InputIterator __first,
341 _InputIterator __last,
342 const key_compare& __comp,
343 const _Allocator& __alloc)
339344 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {
340345 insert(sorted_equivalent, __first, __last);
341346 }
342347
343348 template <class _InputIterator, class _Allocator>
344349 requires(__has_input_iterator_category<_InputIterator>::value && __allocator_ctor_constraint<_Allocator>)
345 _LIBCPP_HIDE_FROM_ABI
350 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
346351 flat_multimap(sorted_equivalent_t, _InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
347352 : flat_multimap(__ctor_uses_allocator_empty_tag{}, __alloc) {
348353 insert(sorted_equivalent, __first, __last);
349354 }
350355
351 _LIBCPP_HIDE_FROM_ABI flat_multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
356 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
357 flat_multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
352358 : flat_multimap(__il.begin(), __il.end(), __comp) {}
353359
354360 template <class _Allocator>
355361 requires __allocator_ctor_constraint<_Allocator>
356 _LIBCPP_HIDE_FROM_ABI
362 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
357363 flat_multimap(initializer_list<value_type> __il, const key_compare& __comp, const _Allocator& __alloc)
358364 : flat_multimap(__il.begin(), __il.end(), __comp, __alloc) {}
359365
360366 template <class _Allocator>
361367 requires __allocator_ctor_constraint<_Allocator>
362 _LIBCPP_HIDE_FROM_ABI flat_multimap(initializer_list<value_type> __il, const _Allocator& __alloc)
368 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
369 flat_multimap(initializer_list<value_type> __il, const _Allocator& __alloc)
363370 : flat_multimap(__il.begin(), __il.end(), __alloc) {}
364371
365 _LIBCPP_HIDE_FROM_ABI
372 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
366373 flat_multimap(sorted_equivalent_t, initializer_list<value_type> __il, const key_compare& __comp = key_compare())
367374 : flat_multimap(sorted_equivalent, __il.begin(), __il.end(), __comp) {}
368375
369376 template <class _Allocator>
370377 requires __allocator_ctor_constraint<_Allocator>
371 _LIBCPP_HIDE_FROM_ABI flat_multimap(
378 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
372379 sorted_equivalent_t, initializer_list<value_type> __il, const key_compare& __comp, const _Allocator& __alloc)
373380 : flat_multimap(sorted_equivalent, __il.begin(), __il.end(), __comp, __alloc) {}
374381
375382 template <class _Allocator>
376383 requires __allocator_ctor_constraint<_Allocator>
377 _LIBCPP_HIDE_FROM_ABI flat_multimap(sorted_equivalent_t, initializer_list<value_type> __il, const _Allocator& __alloc)
384 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
385 flat_multimap(sorted_equivalent_t, initializer_list<value_type> __il, const _Allocator& __alloc)
378386 : flat_multimap(sorted_equivalent, __il.begin(), __il.end(), __alloc) {}
379387
380 _LIBCPP_HIDE_FROM_ABI flat_multimap& operator=(initializer_list<value_type> __il) {
388 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap& operator=(initializer_list<value_type> __il) {
381389 clear();
382390 insert(__il);
383391 return *this;
......@@ -386,9 +394,9 @@ public:
386394 // copy/move assignment are not specified in the spec (defaulted)
387395 // but move assignment can potentially leave moved from object in an inconsistent
388396 // state if an exception is thrown
389 _LIBCPP_HIDE_FROM_ABI flat_multimap& operator=(const flat_multimap&) = default;
397 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap& operator=(const flat_multimap&) = default;
390398
391 _LIBCPP_HIDE_FROM_ABI flat_multimap& operator=(flat_multimap&& __other) noexcept(
399 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap& operator=(flat_multimap&& __other) noexcept(
392400 is_nothrow_move_assignable_v<_KeyContainer> && is_nothrow_move_assignable_v<_MappedContainer> &&
393401 is_nothrow_move_assignable_v<_Compare>) {
394402 auto __clear_other_guard = std::__make_scope_guard([&]() noexcept { __other.clear() /* noexcept */; });
......@@ -400,38 +408,58 @@ public:
400408 }
401409
402410 // iterators
403 _LIBCPP_HIDE_FROM_ABI iterator begin() noexcept {
411 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
404412 return iterator(__containers_.keys.begin(), __containers_.values.begin());
405413 }
406414
407 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const noexcept {
415 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
408416 return const_iterator(__containers_.keys.begin(), __containers_.values.begin());
409417 }
410418
411 _LIBCPP_HIDE_FROM_ABI iterator end() noexcept {
419 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
412420 return iterator(__containers_.keys.end(), __containers_.values.end());
413421 }
414422
415 _LIBCPP_HIDE_FROM_ABI const_iterator end() const noexcept {
423 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
416424 return const_iterator(__containers_.keys.end(), __containers_.values.end());
417425 }
418426
419 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
420 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
421 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
422 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
427 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
428 return reverse_iterator(end());
429 }
430 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
431 return const_reverse_iterator(end());
432 }
433 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
434 return reverse_iterator(begin());
435 }
436 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
437 return const_reverse_iterator(begin());
438 }
423439
424 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const noexcept { return begin(); }
425 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const noexcept { return end(); }
426 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
427 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
440 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept {
441 return begin();
442 }
443 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept {
444 return end();
445 }
446 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
447 return const_reverse_iterator(end());
448 }
449 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
450 return const_reverse_iterator(begin());
451 }
428452
429453 // [flat.map.capacity], capacity
430 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __containers_.keys.empty(); }
454 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const noexcept {
455 return __containers_.keys.empty();
456 }
431457
432 _LIBCPP_HIDE_FROM_ABI size_type size() const noexcept { return __containers_.keys.size(); }
458 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
459 return __containers_.keys.size();
460 }
433461
434 _LIBCPP_HIDE_FROM_ABI size_type max_size() const noexcept {
462 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
435463 return std::min<size_type>(__containers_.keys.max_size(), __containers_.values.max_size());
436464 }
437465
......@@ -439,7 +467,7 @@ public:
439467 template <class... _Args>
440468 requires is_constructible_v<pair<key_type, mapped_type>, _Args...> && is_move_constructible_v<key_type> &&
441469 is_move_constructible_v<mapped_type>
442 _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
470 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) {
443471 std::pair<key_type, mapped_type> __pair(std::forward<_Args>(__args)...);
444472 auto __key_it = std::upper_bound(__containers_.keys.begin(), __containers_.keys.end(), __pair.first, __compare_);
445473 auto __mapped_it = __corresponding_mapped_it(*this, __key_it);
......@@ -450,7 +478,7 @@ public:
450478
451479 template <class... _Args>
452480 requires is_constructible_v<pair<key_type, mapped_type>, _Args...>
453 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __hint, _Args&&... __args) {
481 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __hint, _Args&&... __args) {
454482 std::pair<key_type, mapped_type> __pair(std::forward<_Args>(__args)...);
455483
456484 auto __prev_larger = __hint != cbegin() && __compare_(__pair.first, (__hint - 1)->first);
......@@ -490,33 +518,35 @@ public:
490518 *this, __key_iter, __mapped_iter, std::move(__pair.first), std::move(__pair.second));
491519 }
492520
493 _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return emplace(__x); }
521 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __x) { return emplace(__x); }
494522
495 _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __x) { return emplace(std::move(__x)); }
523 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __x) {
524 return emplace(std::move(__x));
525 }
496526
497 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, const value_type& __x) {
527 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, const value_type& __x) {
498528 return emplace_hint(__hint, __x);
499529 }
500530
501 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, value_type&& __x) {
531 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, value_type&& __x) {
502532 return emplace_hint(__hint, std::move(__x));
503533 }
504534
505535 template <class _PairLike>
506536 requires is_constructible_v<pair<key_type, mapped_type>, _PairLike>
507 _LIBCPP_HIDE_FROM_ABI iterator insert(_PairLike&& __x) {
537 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(_PairLike&& __x) {
508538 return emplace(std::forward<_PairLike>(__x));
509539 }
510540
511541 template <class _PairLike>
512542 requires is_constructible_v<pair<key_type, mapped_type>, _PairLike>
513 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, _PairLike&& __x) {
543 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, _PairLike&& __x) {
514544 return emplace_hint(__hint, std::forward<_PairLike>(__x));
515545 }
516546
517547 template <class _InputIterator>
518548 requires __has_input_iterator_category<_InputIterator>::value
519 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
549 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
520550 if constexpr (sized_sentinel_for<_InputIterator, _InputIterator>) {
521551 __reserve(__last - __first);
522552 }
......@@ -525,7 +555,8 @@ public:
525555
526556 template <class _InputIterator>
527557 requires __has_input_iterator_category<_InputIterator>::value
528 _LIBCPP_HIDE_FROM_ABI void insert(sorted_equivalent_t, _InputIterator __first, _InputIterator __last) {
558 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
559 insert(sorted_equivalent_t, _InputIterator __first, _InputIterator __last) {
529560 if constexpr (sized_sentinel_for<_InputIterator, _InputIterator>) {
530561 __reserve(__last - __first);
531562 }
......@@ -534,7 +565,7 @@ public:
534565 }
535566
536567 template <_ContainerCompatibleRange<value_type> _Range>
537 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
568 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
538569 if constexpr (ranges::sized_range<_Range>) {
539570 __reserve(ranges::size(__range));
540571 }
......@@ -542,19 +573,32 @@ public:
542573 __append_sort_merge</*WasSorted = */ false>(ranges::begin(__range), ranges::end(__range));
543574 }
544575
545 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
576 template <_ContainerCompatibleRange<value_type> _Range>
577 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(sorted_equivalent_t, _Range&& __range) {
578 if constexpr (ranges::sized_range<_Range>) {
579 __reserve(ranges::size(__range));
580 }
581
582 __append_sort_merge</*WasSorted = */ true>(ranges::begin(__range), ranges::end(__range));
583 }
584
585 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
586 insert(__il.begin(), __il.end());
587 }
546588
547 _LIBCPP_HIDE_FROM_ABI void insert(sorted_equivalent_t, initializer_list<value_type> __il) {
589 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
590 insert(sorted_equivalent_t, initializer_list<value_type> __il) {
548591 insert(sorted_equivalent, __il.begin(), __il.end());
549592 }
550593
551 _LIBCPP_HIDE_FROM_ABI containers extract() && {
594 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 containers extract() && {
552595 auto __guard = std::__make_scope_guard([&]() noexcept { clear() /* noexcept */; });
553596 auto __ret = std::move(__containers_);
554597 return __ret;
555598 }
556599
557 _LIBCPP_HIDE_FROM_ABI void replace(key_container_type&& __key_cont, mapped_container_type&& __mapped_cont) {
600 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
601 replace(key_container_type&& __key_cont, mapped_container_type&& __mapped_cont) {
558602 _LIBCPP_ASSERT_VALID_INPUT_RANGE(
559603 __key_cont.size() == __mapped_cont.size(), "flat_multimap keys and mapped containers have different size");
560604
......@@ -565,15 +609,15 @@ public:
565609 __guard.__complete();
566610 }
567611
568 _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __position) {
612 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __position) {
569613 return __erase(__position.__key_iter_, __position.__mapped_iter_);
570614 }
571615
572 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position) {
616 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __position) {
573617 return __erase(__position.__key_iter_, __position.__mapped_iter_);
574618 }
575619
576 _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __x) {
620 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __x) {
577621 auto [__first, __last] = equal_range(__x);
578622 auto __res = __last - __first;
579623 erase(__first, __last);
......@@ -583,14 +627,14 @@ public:
583627 template <class _Kp>
584628 requires(__is_compare_transparent && !is_convertible_v<_Kp &&, iterator> &&
585629 !is_convertible_v<_Kp &&, const_iterator>)
586 _LIBCPP_HIDE_FROM_ABI size_type erase(_Kp&& __x) {
630 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(_Kp&& __x) {
587631 auto [__first, __last] = equal_range(__x);
588632 auto __res = __last - __first;
589633 erase(__first, __last);
590634 return __res;
591635 }
592636
593 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
637 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __first, const_iterator __last) {
594638 auto __on_failure = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
595639 auto __key_it = __containers_.keys.erase(__first.__key_iter_, __last.__key_iter_);
596640 auto __mapped_it = __containers_.values.erase(__first.__mapped_iter_, __last.__mapped_iter_);
......@@ -598,146 +642,178 @@ public:
598642 return iterator(std::move(__key_it), std::move(__mapped_it));
599643 }
600644
601 _LIBCPP_HIDE_FROM_ABI void swap(flat_multimap& __y) noexcept {
602 // warning: The spec has unconditional noexcept, which means that
603 // if any of the following functions throw an exception,
604 // std::terminate will be called
645 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(flat_multimap& __y) noexcept(
646 is_nothrow_swappable_v<key_container_type> && is_nothrow_swappable_v<mapped_container_type> &&
647 is_nothrow_swappable_v<key_compare>) {
648 auto __on_failure = std::__make_exception_guard([&]() noexcept {
649 clear() /* noexcept */;
650 __y.clear() /* noexcept */;
651 });
605652 ranges::swap(__compare_, __y.__compare_);
606653 ranges::swap(__containers_.keys, __y.__containers_.keys);
607654 ranges::swap(__containers_.values, __y.__containers_.values);
655 __on_failure.__complete();
608656 }
609657
610 _LIBCPP_HIDE_FROM_ABI void clear() noexcept {
658 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() noexcept {
611659 __containers_.keys.clear();
612660 __containers_.values.clear();
613661 }
614662
615663 // observers
616 _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __compare_; }
617 _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__compare_); }
664 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
665 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
666 return value_compare(__compare_);
667 }
618668
619 _LIBCPP_HIDE_FROM_ABI const key_container_type& keys() const noexcept { return __containers_.keys; }
620 _LIBCPP_HIDE_FROM_ABI const mapped_container_type& values() const noexcept { return __containers_.values; }
669 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys() const noexcept {
670 return __containers_.keys;
671 }
672 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type&
673 values() const noexcept {
674 return __containers_.values;
675 }
621676
622677 // map operations
623 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __x) { return __find_impl(*this, __x); }
678 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
679 return __find_impl(*this, __x);
680 }
624681
625 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __x) const { return __find_impl(*this, __x); }
682 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
683 return __find_impl(*this, __x);
684 }
626685
627686 template <class _Kp>
628687 requires __is_compare_transparent
629 _LIBCPP_HIDE_FROM_ABI iterator find(const _Kp& __x) {
688 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
630689 return __find_impl(*this, __x);
631690 }
632691
633692 template <class _Kp>
634693 requires __is_compare_transparent
635 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Kp& __x) const {
694 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
636695 return __find_impl(*this, __x);
637696 }
638697
639 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __x) const {
698 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
640699 auto [__first, __last] = equal_range(__x);
641700 return __last - __first;
642701 }
643702
644703 template <class _Kp>
645704 requires __is_compare_transparent
646 _LIBCPP_HIDE_FROM_ABI size_type count(const _Kp& __x) const {
705 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
647706 auto [__first, __last] = equal_range(__x);
648707 return __last - __first;
649708 }
650709
651 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __x) const { return find(__x) != end(); }
710 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
711 return find(__x) != end();
712 }
652713
653714 template <class _Kp>
654715 requires __is_compare_transparent
655 _LIBCPP_HIDE_FROM_ABI bool contains(const _Kp& __x) const {
716 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
656717 return find(__x) != end();
657718 }
658719
659 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __x) { return __lower_bound<iterator>(*this, __x); }
720 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
721 return __lower_bound<iterator>(*this, __x);
722 }
660723
661 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __x) const {
724 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
725 lower_bound(const key_type& __x) const {
662726 return __lower_bound<const_iterator>(*this, __x);
663727 }
664728
665729 template <class _Kp>
666730 requires __is_compare_transparent
667 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _Kp& __x) {
731 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
668732 return __lower_bound<iterator>(*this, __x);
669733 }
670734
671735 template <class _Kp>
672736 requires __is_compare_transparent
673 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _Kp& __x) const {
737 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
674738 return __lower_bound<const_iterator>(*this, __x);
675739 }
676740
677 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __x) { return __upper_bound<iterator>(*this, __x); }
741 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
742 return __upper_bound<iterator>(*this, __x);
743 }
678744
679 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __x) const {
745 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
746 upper_bound(const key_type& __x) const {
680747 return __upper_bound<const_iterator>(*this, __x);
681748 }
682749
683750 template <class _Kp>
684751 requires __is_compare_transparent
685 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _Kp& __x) {
752 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
686753 return __upper_bound<iterator>(*this, __x);
687754 }
688755
689756 template <class _Kp>
690757 requires __is_compare_transparent
691 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _Kp& __x) const {
758 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
692759 return __upper_bound<const_iterator>(*this, __x);
693760 }
694761
695 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __x) {
762 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
763 equal_range(const key_type& __x) {
696764 return __equal_range_impl(*this, __x);
697765 }
698766
699 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __x) const {
767 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
768 equal_range(const key_type& __x) const {
700769 return __equal_range_impl(*this, __x);
701770 }
702771
703772 template <class _Kp>
704773 requires __is_compare_transparent
705 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _Kp& __x) {
774 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
775 equal_range(const _Kp& __x) {
706776 return __equal_range_impl(*this, __x);
707777 }
708778 template <class _Kp>
709779 requires __is_compare_transparent
710 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _Kp& __x) const {
780 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
781 equal_range(const _Kp& __x) const {
711782 return __equal_range_impl(*this, __x);
712783 }
713784
714 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const flat_multimap& __x, const flat_multimap& __y) {
785 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
786 operator==(const flat_multimap& __x, const flat_multimap& __y) {
715787 return ranges::equal(__x, __y);
716788 }
717789
718 friend _LIBCPP_HIDE_FROM_ABI auto operator<=>(const flat_multimap& __x, const flat_multimap& __y) {
790 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
791 operator<=>(const flat_multimap& __x, const flat_multimap& __y) {
719792 return std::lexicographical_compare_three_way(
720793 __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
721794 }
722795
723 friend _LIBCPP_HIDE_FROM_ABI void swap(flat_multimap& __x, flat_multimap& __y) noexcept { __x.swap(__y); }
796 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
797 swap(flat_multimap& __x, flat_multimap& __y) noexcept(noexcept(__x.swap(__y))) {
798 __x.swap(__y);
799 }
724800
725801private:
726802 struct __ctor_uses_allocator_tag {
727 explicit _LIBCPP_HIDE_FROM_ABI __ctor_uses_allocator_tag() = default;
803 explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __ctor_uses_allocator_tag() = default;
728804 };
729805 struct __ctor_uses_allocator_empty_tag {
730 explicit _LIBCPP_HIDE_FROM_ABI __ctor_uses_allocator_empty_tag() = default;
806 explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __ctor_uses_allocator_empty_tag() = default;
731807 };
732808
733809 template <class _Allocator, class _KeyCont, class _MappedCont, class... _CompArg>
734810 requires __allocator_ctor_constraint<_Allocator>
735 _LIBCPP_HIDE_FROM_ABI
736 flat_multimap(__ctor_uses_allocator_tag,
737 const _Allocator& __alloc,
738 _KeyCont&& __key_cont,
739 _MappedCont&& __mapped_cont,
740 _CompArg&&... __comp)
811 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multimap(
812 __ctor_uses_allocator_tag,
813 const _Allocator& __alloc,
814 _KeyCont&& __key_cont,
815 _MappedCont&& __mapped_cont,
816 _CompArg&&... __comp)
741817 : __containers_{.keys = std::make_obj_using_allocator<key_container_type>(
742818 __alloc, std::forward<_KeyCont>(__key_cont)),
743819 .values = std::make_obj_using_allocator<mapped_container_type>(
......@@ -746,36 +822,39 @@ private:
746822
747823 template <class _Allocator, class... _CompArg>
748824 requires __allocator_ctor_constraint<_Allocator>
749 _LIBCPP_HIDE_FROM_ABI flat_multimap(__ctor_uses_allocator_empty_tag, const _Allocator& __alloc, _CompArg&&... __comp)
825 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
826 flat_multimap(__ctor_uses_allocator_empty_tag, const _Allocator& __alloc, _CompArg&&... __comp)
750827 : __containers_{.keys = std::make_obj_using_allocator<key_container_type>(__alloc),
751828 .values = std::make_obj_using_allocator<mapped_container_type>(__alloc)},
752829 __compare_(std::forward<_CompArg>(__comp)...) {}
753830
754 _LIBCPP_HIDE_FROM_ABI bool __is_sorted(auto&& __key_container) const {
831 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __is_sorted(auto&& __key_container) const {
755832 return ranges::is_sorted(__key_container, __compare_);
756833 }
757834
758 _LIBCPP_HIDE_FROM_ABI void __sort() {
835 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __sort() {
759836 auto __zv = ranges::views::zip(__containers_.keys, __containers_.values);
760837 ranges::sort(__zv, __compare_, [](const auto& __p) -> decltype(auto) { return std::get<0>(__p); });
761838 }
762839
763840 template <class _Self, class _KeyIter>
764 _LIBCPP_HIDE_FROM_ABI static auto __corresponding_mapped_it(_Self&& __self, _KeyIter&& __key_iter) {
841 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto
842 __corresponding_mapped_it(_Self&& __self, _KeyIter&& __key_iter) {
765843 return __self.__containers_.values.begin() +
766844 static_cast<ranges::range_difference_t<mapped_container_type>>(
767845 ranges::distance(__self.__containers_.keys.begin(), __key_iter));
768846 }
769847
770848 template <bool _WasSorted, class _InputIterator, class _Sentinel>
771 _LIBCPP_HIDE_FROM_ABI void __append_sort_merge(_InputIterator __first, _Sentinel __last) {
849 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
850 __append_sort_merge(_InputIterator __first, _Sentinel __last) {
772851 auto __on_failure = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
773852 size_t __num_appended = __flat_map_utils::__append(*this, std::move(__first), std::move(__last));
774853 if (__num_appended != 0) {
775854 auto __zv = ranges::views::zip(__containers_.keys, __containers_.values);
776855 auto __append_start_offset = __containers_.keys.size() - __num_appended;
777856 auto __end = __zv.end();
778 auto __compare_key = [this](const auto& __p1, const auto& __p2) {
857 auto __compare_key = [this](const auto& __p1, const auto& __p2) -> bool {
779858 return __compare_(std::get<0>(__p1), std::get<0>(__p2));
780859 };
781860 if constexpr (!_WasSorted) {
......@@ -791,7 +870,7 @@ private:
791870 }
792871
793872 template <class _Self, class _Kp>
794 _LIBCPP_HIDE_FROM_ABI static auto __find_impl(_Self&& __self, const _Kp& __key) {
873 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto __find_impl(_Self&& __self, const _Kp& __key) {
795874 auto __it = __self.lower_bound(__key);
796875 auto __last = __self.end();
797876 if (__it == __last || __self.__compare_(__key, __it->first)) {
......@@ -801,7 +880,7 @@ private:
801880 }
802881
803882 template <class _Self, class _Kp>
804 _LIBCPP_HIDE_FROM_ABI static auto __equal_range_impl(_Self&& __self, const _Kp& __key) {
883 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto __equal_range_impl(_Self&& __self, const _Kp& __key) {
805884 auto [__key_first, __key_last] =
806885 std::equal_range(__self.__containers_.keys.begin(), __self.__containers_.keys.end(), __key, __self.__compare_);
807886
......@@ -811,7 +890,7 @@ private:
811890 }
812891
813892 template <class _Res, class _Self, class _Kp>
814 _LIBCPP_HIDE_FROM_ABI static _Res __lower_bound(_Self&& __self, _Kp& __x) {
893 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static _Res __lower_bound(_Self&& __self, _Kp& __x) {
815894 auto __key_iter =
816895 std::lower_bound(__self.__containers_.keys.begin(), __self.__containers_.keys.end(), __x, __self.__compare_);
817896 auto __mapped_iter = __corresponding_mapped_it(__self, __key_iter);
......@@ -819,14 +898,14 @@ private:
819898 }
820899
821900 template <class _Res, class _Self, class _Kp>
822 _LIBCPP_HIDE_FROM_ABI static _Res __upper_bound(_Self&& __self, _Kp& __x) {
901 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static _Res __upper_bound(_Self&& __self, _Kp& __x) {
823902 auto __key_iter =
824903 std::upper_bound(__self.__containers_.keys.begin(), __self.__containers_.keys.end(), __x, __self.__compare_);
825904 auto __mapped_iter = __corresponding_mapped_it(__self, __key_iter);
826905 return _Res(std::move(__key_iter), std::move(__mapped_iter));
827906 }
828907
829 _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __size) {
908 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __reserve(size_t __size) {
830909 if constexpr (__container_traits<_KeyContainer>::__reservable) {
831910 __containers_.keys.reserve(__size);
832911 }
......@@ -837,7 +916,8 @@ private:
837916 }
838917
839918 template <class _KIter, class _MIter>
840 _LIBCPP_HIDE_FROM_ABI iterator __erase(_KIter __key_iter_to_remove, _MIter __mapped_iter_to_remove) {
919 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
920 __erase(_KIter __key_iter_to_remove, _MIter __mapped_iter_to_remove) {
841921 auto __on_failure = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
842922 auto __key_iter = __containers_.keys.erase(__key_iter_to_remove);
843923 auto __mapped_iter = __containers_.values.erase(__mapped_iter_to_remove);
......@@ -847,7 +927,8 @@ private:
847927
848928 template <class _Key2, class _Tp2, class _Compare2, class _KeyContainer2, class _MappedContainer2, class _Predicate>
849929 friend typename flat_multimap<_Key2, _Tp2, _Compare2, _KeyContainer2, _MappedContainer2>::size_type
850 erase_if(flat_multimap<_Key2, _Tp2, _Compare2, _KeyContainer2, _MappedContainer2>&, _Predicate);
930 _LIBCPP_CONSTEXPR_SINCE_CXX26
931 erase_if(flat_multimap<_Key2, _Tp2, _Compare2, _KeyContainer2, _MappedContainer2>&, _Predicate);
851932
852933 friend __flat_map_utils;
853934
......@@ -855,8 +936,9 @@ private:
855936 _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_;
856937
857938 struct __key_equiv {
858 _LIBCPP_HIDE_FROM_ABI __key_equiv(key_compare __c) : __comp_(__c) {}
859 _LIBCPP_HIDE_FROM_ABI bool operator()(const_reference __x, const_reference __y) const {
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 {
860942 return !__comp_(std::get<0>(__x), std::get<0>(__y)) && !__comp_(std::get<0>(__y), std::get<0>(__x));
861943 }
862944 key_compare __comp_;
......@@ -864,8 +946,7 @@ private:
864946};
865947
866948template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>>
867 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
868 !__is_allocator<_MappedContainer>::value &&
949 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
869950 is_invocable_v<const _Compare&,
870951 const typename _KeyContainer::value_type&,
871952 const typename _KeyContainer::value_type&>)
......@@ -878,7 +959,7 @@ flat_multimap(_KeyContainer, _MappedContainer, _Compare = _Compare())
878959
879960template <class _KeyContainer, class _MappedContainer, class _Allocator>
880961 requires(uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
881 !__is_allocator<_KeyContainer>::value && !__is_allocator<_MappedContainer>::value)
962 !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer>)
882963flat_multimap(_KeyContainer, _MappedContainer, _Allocator)
883964 -> flat_multimap<typename _KeyContainer::value_type,
884965 typename _MappedContainer::value_type,
......@@ -887,9 +968,8 @@ flat_multimap(_KeyContainer, _MappedContainer, _Allocator)
887968 _MappedContainer>;
888969
889970template <class _KeyContainer, class _MappedContainer, class _Compare, class _Allocator>
890 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
891 !__is_allocator<_MappedContainer>::value && uses_allocator_v<_KeyContainer, _Allocator> &&
892 uses_allocator_v<_MappedContainer, _Allocator> &&
971 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
972 uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
893973 is_invocable_v<const _Compare&,
894974 const typename _KeyContainer::value_type&,
895975 const typename _KeyContainer::value_type&>)
......@@ -901,8 +981,7 @@ flat_multimap(_KeyContainer, _MappedContainer, _Compare, _Allocator)
901981 _MappedContainer>;
902982
903983template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>>
904 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
905 !__is_allocator<_MappedContainer>::value &&
984 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
906985 is_invocable_v<const _Compare&,
907986 const typename _KeyContainer::value_type&,
908987 const typename _KeyContainer::value_type&>)
......@@ -915,7 +994,7 @@ flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Compare = _
915994
916995template <class _KeyContainer, class _MappedContainer, class _Allocator>
917996 requires(uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
918 !__is_allocator<_KeyContainer>::value && !__is_allocator<_MappedContainer>::value)
997 !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer>)
919998flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Allocator)
920999 -> flat_multimap<typename _KeyContainer::value_type,
9211000 typename _MappedContainer::value_type,
......@@ -924,9 +1003,8 @@ flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Allocator)
9241003 _MappedContainer>;
9251004
9261005template <class _KeyContainer, class _MappedContainer, class _Compare, class _Allocator>
927 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
928 !__is_allocator<_MappedContainer>::value && uses_allocator_v<_KeyContainer, _Allocator> &&
929 uses_allocator_v<_MappedContainer, _Allocator> &&
1006 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> && !__is_allocator_v<_MappedContainer> &&
1007 uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator> &&
9301008 is_invocable_v<const _Compare&,
9311009 const typename _KeyContainer::value_type&,
9321010 const typename _KeyContainer::value_type&>)
......@@ -938,19 +1016,19 @@ flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Compare, _A
9381016 _MappedContainer>;
9391017
9401018template <class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>>
941 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
1019 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
9421020flat_multimap(_InputIterator, _InputIterator, _Compare = _Compare())
9431021 -> flat_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare>;
9441022
9451023template <class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>>
946 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
1024 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
9471025flat_multimap(sorted_equivalent_t, _InputIterator, _InputIterator, _Compare = _Compare())
9481026 -> flat_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare>;
9491027
9501028template <ranges::input_range _Range,
9511029 class _Compare = less<__range_key_type<_Range>>,
9521030 class _Allocator = allocator<byte>,
953 class = __enable_if_t<!__is_allocator<_Compare>::value && __is_allocator<_Allocator>::value>>
1031 class = __enable_if_t<!__is_allocator_v<_Compare> && __is_allocator_v<_Allocator>>>
9541032flat_multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator()) -> flat_multimap<
9551033 __range_key_type<_Range>,
9561034 __range_mapped_type<_Range>,
......@@ -958,7 +1036,7 @@ flat_multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Alloc
9581036 vector<__range_key_type<_Range>, __allocator_traits_rebind_t<_Allocator, __range_key_type<_Range>>>,
9591037 vector<__range_mapped_type<_Range>, __allocator_traits_rebind_t<_Allocator, __range_mapped_type<_Range>>>>;
9601038
961template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator<_Allocator>::value>>
1039template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator_v<_Allocator>>>
9621040flat_multimap(from_range_t, _Range&&, _Allocator) -> flat_multimap<
9631041 __range_key_type<_Range>,
9641042 __range_mapped_type<_Range>,
......@@ -967,11 +1045,11 @@ flat_multimap(from_range_t, _Range&&, _Allocator) -> flat_multimap<
9671045 vector<__range_mapped_type<_Range>, __allocator_traits_rebind_t<_Allocator, __range_mapped_type<_Range>>>>;
9681046
9691047template <class _Key, class _Tp, class _Compare = less<_Key>>
970 requires(!__is_allocator<_Compare>::value)
1048 requires(!__is_allocator_v<_Compare>)
9711049flat_multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare()) -> flat_multimap<_Key, _Tp, _Compare>;
9721050
9731051template <class _Key, class _Tp, class _Compare = less<_Key>>
974 requires(!__is_allocator<_Compare>::value)
1052 requires(!__is_allocator_v<_Compare>)
9751053flat_multimap(sorted_equivalent_t, initializer_list<pair<_Key, _Tp>>, _Compare = _Compare())
9761054 -> flat_multimap<_Key, _Tp, _Compare>;
9771055
......@@ -980,8 +1058,9 @@ struct uses_allocator<flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedC
9801058 : bool_constant<uses_allocator_v<_KeyContainer, _Allocator> && uses_allocator_v<_MappedContainer, _Allocator>> {};
9811059
9821060template <class _Key, class _Tp, class _Compare, class _KeyContainer, class _MappedContainer, class _Predicate>
983_LIBCPP_HIDE_FROM_ABI typename flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>::size_type
984erase_if(flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>& __flat_multimap, _Predicate __pred) {
1061_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1062 typename flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>::size_type
1063 erase_if(flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>& __flat_multimap, _Predicate __pred) {
9851064 auto __zv = ranges::views::zip(__flat_multimap.__containers_.keys, __flat_multimap.__containers_.values);
9861065 auto __first = __zv.begin();
9871066 auto __last = __zv.end();
lib/libcxx/include/__flat_map/key_value_iterator.h-1
......@@ -20,7 +20,6 @@
2020#include <__type_traits/conditional.h>
2121#include <__utility/forward.h>
2222#include <__utility/move.h>
23#include <__utility/pair.h>
2423
2524#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2625# pragma GCC system_header
lib/libcxx/include/__flat_map/utils.h+1
......@@ -16,6 +16,7 @@
1616#include <__utility/exception_guard.h>
1717#include <__utility/forward.h>
1818#include <__utility/move.h>
19#include <__vector/container_traits.h>
1920
2021#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2122# pragma GCC system_header
lib/libcxx/include/__flat_set/flat_multiset.h+211-143
......@@ -13,54 +13,41 @@
1313#include <__algorithm/equal_range.h>
1414#include <__algorithm/lexicographical_compare_three_way.h>
1515#include <__algorithm/lower_bound.h>
16#include <__algorithm/min.h>
1716#include <__algorithm/ranges_equal.h>
1817#include <__algorithm/ranges_inplace_merge.h>
1918#include <__algorithm/ranges_is_sorted.h>
2019#include <__algorithm/ranges_sort.h>
21#include <__algorithm/ranges_unique.h>
2220#include <__algorithm/remove_if.h>
2321#include <__algorithm/upper_bound.h>
2422#include <__assert>
2523#include <__compare/synth_three_way.h>
26#include <__concepts/convertible_to.h>
2724#include <__concepts/swappable.h>
2825#include <__config>
29#include <__cstddef/byte.h>
30#include <__cstddef/ptrdiff_t.h>
31#include <__flat_map/key_value_iterator.h>
3226#include <__flat_map/sorted_equivalent.h>
3327#include <__flat_set/ra_iterator.h>
3428#include <__flat_set/utils.h>
35#include <__functional/invoke.h>
3629#include <__functional/is_transparent.h>
3730#include <__functional/operations.h>
3831#include <__fwd/vector.h>
3932#include <__iterator/concepts.h>
40#include <__iterator/distance.h>
4133#include <__iterator/iterator_traits.h>
4234#include <__iterator/prev.h>
43#include <__iterator/ranges_iterator_traits.h>
4435#include <__iterator/reverse_iterator.h>
4536#include <__memory/allocator_traits.h>
4637#include <__memory/uses_allocator.h>
4738#include <__memory/uses_allocator_construction.h>
48#include <__ranges/access.h>
4939#include <__ranges/concepts.h>
5040#include <__ranges/container_compatible_range.h>
5141#include <__ranges/drop_view.h>
5242#include <__ranges/from_range.h>
53#include <__ranges/ref_view.h>
43#include <__ranges/range_adaptor.h>
5444#include <__ranges/size.h>
5545#include <__ranges/subrange.h>
56#include <__ranges/zip_view.h>
57#include <__type_traits/conjunction.h>
5846#include <__type_traits/container_traits.h>
5947#include <__type_traits/invoke.h>
6048#include <__type_traits/is_allocator.h>
6149#include <__type_traits/is_nothrow_constructible.h>
6250#include <__type_traits/is_same.h>
63#include <__type_traits/maybe_const.h>
6451#include <__utility/as_const.h>
6552#include <__utility/exception_guard.h>
6653#include <__utility/move.h>
......@@ -108,16 +95,16 @@ public:
10895
10996public:
11097 // [flat.multiset.cons], constructors
111 _LIBCPP_HIDE_FROM_ABI flat_multiset() noexcept(is_nothrow_default_constructible_v<_KeyContainer> &&
112 is_nothrow_default_constructible_v<_Compare>)
98 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset() noexcept(
99 is_nothrow_default_constructible_v<_KeyContainer> && is_nothrow_default_constructible_v<_Compare>)
113100 : __keys_(), __compare_() {}
114101
115 _LIBCPP_HIDE_FROM_ABI flat_multiset(const flat_multiset&) = default;
102 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(const flat_multiset&) = default;
116103
117104 // The copy/move constructors are not specified in the spec, which means they should be defaulted.
118105 // However, the move constructor can potentially leave a moved-from object in an inconsistent
119106 // state if an exception is thrown.
120 _LIBCPP_HIDE_FROM_ABI flat_multiset(flat_multiset&& __other) noexcept(
107 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(flat_multiset&& __other) noexcept(
121108 is_nothrow_move_constructible_v<_KeyContainer> && is_nothrow_move_constructible_v<_Compare>)
122109# if _LIBCPP_HAS_EXCEPTIONS
123110 try
......@@ -134,14 +121,16 @@ public:
134121# endif // _LIBCPP_HAS_EXCEPTIONS
135122 }
136123
137 _LIBCPP_HIDE_FROM_ABI explicit flat_multiset(const key_compare& __comp) : __keys_(), __compare_(__comp) {}
124 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit flat_multiset(const key_compare& __comp)
125 : __keys_(), __compare_(__comp) {}
138126
139 _LIBCPP_HIDE_FROM_ABI explicit flat_multiset(container_type __keys, const key_compare& __comp = key_compare())
127 _LIBCPP_HIDE_FROM_ABI
128 _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit flat_multiset(container_type __keys, const key_compare& __comp = key_compare())
140129 : __keys_(std::move(__keys)), __compare_(__comp) {
141130 ranges::sort(__keys_, __compare_);
142131 }
143132
144 _LIBCPP_HIDE_FROM_ABI
133 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
145134 flat_multiset(sorted_equivalent_t, container_type __keys, const key_compare& __comp = key_compare())
146135 : __keys_(std::move(__keys)), __compare_(__comp) {
147136 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys_, __compare_), "Key container is not sorted");
......@@ -149,7 +138,7 @@ public:
149138
150139 template <class _InputIterator>
151140 requires __has_input_iterator_category<_InputIterator>::value
152 _LIBCPP_HIDE_FROM_ABI
141 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
153142 flat_multiset(_InputIterator __first, _InputIterator __last, const key_compare& __comp = key_compare())
154143 : __keys_(), __compare_(__comp) {
155144 insert(__first, __last);
......@@ -157,48 +146,53 @@ public:
157146
158147 template <class _InputIterator>
159148 requires __has_input_iterator_category<_InputIterator>::value
160 _LIBCPP_HIDE_FROM_ABI flat_multiset(
149 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(
161150 sorted_equivalent_t, _InputIterator __first, _InputIterator __last, const key_compare& __comp = key_compare())
162151 : __keys_(__first, __last), __compare_(__comp) {
163152 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys_, __compare_), "Key container is not sorted");
164153 }
165154
166155 template <_ContainerCompatibleRange<value_type> _Range>
167 _LIBCPP_HIDE_FROM_ABI flat_multiset(from_range_t __fr, _Range&& __rg)
156 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(from_range_t __fr, _Range&& __rg)
168157 : flat_multiset(__fr, std::forward<_Range>(__rg), key_compare()) {}
169158
170159 template <_ContainerCompatibleRange<value_type> _Range>
171 _LIBCPP_HIDE_FROM_ABI flat_multiset(from_range_t, _Range&& __rg, const key_compare& __comp) : flat_multiset(__comp) {
160 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
161 flat_multiset(from_range_t, _Range&& __rg, const key_compare& __comp)
162 : flat_multiset(__comp) {
172163 insert_range(std::forward<_Range>(__rg));
173164 }
174165
175 _LIBCPP_HIDE_FROM_ABI flat_multiset(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
166 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
167 flat_multiset(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
176168 : flat_multiset(__il.begin(), __il.end(), __comp) {}
177169
178 _LIBCPP_HIDE_FROM_ABI
170 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
179171 flat_multiset(sorted_equivalent_t, initializer_list<value_type> __il, const key_compare& __comp = key_compare())
180172 : flat_multiset(sorted_equivalent, __il.begin(), __il.end(), __comp) {}
181173
182174 template <class _Allocator>
183175 requires uses_allocator<container_type, _Allocator>::value
184 _LIBCPP_HIDE_FROM_ABI explicit flat_multiset(const _Allocator& __alloc)
176 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit flat_multiset(const _Allocator& __alloc)
185177 : __keys_(std::make_obj_using_allocator<container_type>(__alloc)), __compare_() {}
186178
187179 template <class _Allocator>
188180 requires uses_allocator<container_type, _Allocator>::value
189 _LIBCPP_HIDE_FROM_ABI flat_multiset(const key_compare& __comp, const _Allocator& __alloc)
181 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
182 flat_multiset(const key_compare& __comp, const _Allocator& __alloc)
190183 : __keys_(std::make_obj_using_allocator<container_type>(__alloc)), __compare_(__comp) {}
191184
192185 template <class _Allocator>
193186 requires uses_allocator<container_type, _Allocator>::value
194 _LIBCPP_HIDE_FROM_ABI flat_multiset(const container_type& __keys, const _Allocator& __alloc)
187 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
188 flat_multiset(const container_type& __keys, const _Allocator& __alloc)
195189 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __keys)), __compare_() {
196190 ranges::sort(__keys_, __compare_);
197191 }
198192
199193 template <class _Allocator>
200194 requires uses_allocator<container_type, _Allocator>::value
201 _LIBCPP_HIDE_FROM_ABI
195 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
202196 flat_multiset(const container_type& __keys, const key_compare& __comp, const _Allocator& __alloc)
203197 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __keys)), __compare_(__comp) {
204198 ranges::sort(__keys_, __compare_);
......@@ -206,14 +200,15 @@ public:
206200
207201 template <class _Allocator>
208202 requires uses_allocator<container_type, _Allocator>::value
209 _LIBCPP_HIDE_FROM_ABI flat_multiset(sorted_equivalent_t, const container_type& __keys, const _Allocator& __alloc)
203 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
204 flat_multiset(sorted_equivalent_t, const container_type& __keys, const _Allocator& __alloc)
210205 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __keys)), __compare_() {
211206 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys_, __compare_), "Key container is not sorted");
212207 }
213208
214209 template <class _Allocator>
215210 requires uses_allocator<container_type, _Allocator>::value
216 _LIBCPP_HIDE_FROM_ABI
211 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
217212 flat_multiset(sorted_equivalent_t, const container_type& __keys, const key_compare& __comp, const _Allocator& __alloc)
218213 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __keys)), __compare_(__comp) {
219214 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys_, __compare_), "Key container is not sorted");
......@@ -221,13 +216,14 @@ public:
221216
222217 template <class _Allocator>
223218 requires uses_allocator<container_type, _Allocator>::value
224 _LIBCPP_HIDE_FROM_ABI flat_multiset(const flat_multiset& __other, const _Allocator& __alloc)
219 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
220 flat_multiset(const flat_multiset& __other, const _Allocator& __alloc)
225221 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __other.__keys_)),
226222 __compare_(__other.__compare_) {}
227223
228224 template <class _Allocator>
229225 requires uses_allocator<container_type, _Allocator>::value
230 _LIBCPP_HIDE_FROM_ABI flat_multiset(flat_multiset&& __other, const _Allocator& __alloc)
226 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(flat_multiset&& __other, const _Allocator& __alloc)
231227# if _LIBCPP_HAS_EXCEPTIONS
232228 try
233229# endif // _LIBCPP_HAS_EXCEPTIONS
......@@ -243,14 +239,15 @@ public:
243239
244240 template <class _InputIterator, class _Allocator>
245241 requires(__has_input_iterator_category<_InputIterator>::value && uses_allocator<container_type, _Allocator>::value)
246 _LIBCPP_HIDE_FROM_ABI flat_multiset(_InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
242 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
243 flat_multiset(_InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
247244 : __keys_(std::make_obj_using_allocator<container_type>(__alloc)), __compare_() {
248245 insert(__first, __last);
249246 }
250247
251248 template <class _InputIterator, class _Allocator>
252249 requires(__has_input_iterator_category<_InputIterator>::value && uses_allocator<container_type, _Allocator>::value)
253 _LIBCPP_HIDE_FROM_ABI
250 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
254251 flat_multiset(_InputIterator __first, _InputIterator __last, const key_compare& __comp, const _Allocator& __alloc)
255252 : __keys_(std::make_obj_using_allocator<container_type>(__alloc)), __compare_(__comp) {
256253 insert(__first, __last);
......@@ -258,7 +255,7 @@ public:
258255
259256 template <class _InputIterator, class _Allocator>
260257 requires(__has_input_iterator_category<_InputIterator>::value && uses_allocator<container_type, _Allocator>::value)
261 _LIBCPP_HIDE_FROM_ABI
258 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
262259 flat_multiset(sorted_equivalent_t, _InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
263260 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __first, __last)), __compare_() {
264261 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys_, __compare_), "Key container is not sorted");
......@@ -266,53 +263,57 @@ public:
266263
267264 template <class _InputIterator, class _Allocator>
268265 requires(__has_input_iterator_category<_InputIterator>::value && uses_allocator<container_type, _Allocator>::value)
269 _LIBCPP_HIDE_FROM_ABI
270 flat_multiset(sorted_equivalent_t,
271 _InputIterator __first,
272 _InputIterator __last,
273 const key_compare& __comp,
274 const _Allocator& __alloc)
266 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(
267 sorted_equivalent_t,
268 _InputIterator __first,
269 _InputIterator __last,
270 const key_compare& __comp,
271 const _Allocator& __alloc)
275272 : __keys_(std::make_obj_using_allocator<container_type>(__alloc, __first, __last)), __compare_(__comp) {
276273 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys_, __compare_), "Key container is not sorted");
277274 }
278275
279276 template <_ContainerCompatibleRange<value_type> _Range, class _Allocator>
280277 requires uses_allocator<container_type, _Allocator>::value
281 _LIBCPP_HIDE_FROM_ABI flat_multiset(from_range_t, _Range&& __rg, const _Allocator& __alloc)
278 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
279 flat_multiset(from_range_t, _Range&& __rg, const _Allocator& __alloc)
282280 : __keys_(std::make_obj_using_allocator<container_type>(__alloc)), __compare_() {
283281 insert_range(std::forward<_Range>(__rg));
284282 }
285283
286284 template <_ContainerCompatibleRange<value_type> _Range, class _Allocator>
287285 requires uses_allocator<container_type, _Allocator>::value
288 _LIBCPP_HIDE_FROM_ABI flat_multiset(from_range_t, _Range&& __rg, const key_compare& __comp, const _Allocator& __alloc)
286 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
287 flat_multiset(from_range_t, _Range&& __rg, const key_compare& __comp, const _Allocator& __alloc)
289288 : __keys_(std::make_obj_using_allocator<container_type>(__alloc)), __compare_(__comp) {
290289 insert_range(std::forward<_Range>(__rg));
291290 }
292291
293292 template <class _Allocator>
294293 requires uses_allocator<container_type, _Allocator>::value
295 _LIBCPP_HIDE_FROM_ABI flat_multiset(initializer_list<value_type> __il, const _Allocator& __alloc)
294 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
295 flat_multiset(initializer_list<value_type> __il, const _Allocator& __alloc)
296296 : flat_multiset(__il.begin(), __il.end(), __alloc) {}
297297
298298 template <class _Allocator>
299299 requires uses_allocator<container_type, _Allocator>::value
300 _LIBCPP_HIDE_FROM_ABI
300 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
301301 flat_multiset(initializer_list<value_type> __il, const key_compare& __comp, const _Allocator& __alloc)
302302 : flat_multiset(__il.begin(), __il.end(), __comp, __alloc) {}
303303
304304 template <class _Allocator>
305305 requires uses_allocator<container_type, _Allocator>::value
306 _LIBCPP_HIDE_FROM_ABI flat_multiset(sorted_equivalent_t, initializer_list<value_type> __il, const _Allocator& __alloc)
306 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
307 flat_multiset(sorted_equivalent_t, initializer_list<value_type> __il, const _Allocator& __alloc)
307308 : flat_multiset(sorted_equivalent, __il.begin(), __il.end(), __alloc) {}
308309
309310 template <class _Allocator>
310311 requires uses_allocator<container_type, _Allocator>::value
311 _LIBCPP_HIDE_FROM_ABI flat_multiset(
312 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset(
312313 sorted_equivalent_t, initializer_list<value_type> __il, const key_compare& __comp, const _Allocator& __alloc)
313314 : flat_multiset(sorted_equivalent, __il.begin(), __il.end(), __comp, __alloc) {}
314315
315 _LIBCPP_HIDE_FROM_ABI flat_multiset& operator=(initializer_list<value_type> __il) {
316 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset& operator=(initializer_list<value_type> __il) {
316317 clear();
317318 insert(__il);
318319 return *this;
......@@ -321,9 +322,9 @@ public:
321322 // copy/move assignment are not specified in the spec (defaulted)
322323 // but move assignment can potentially leave moved from object in an inconsistent
323324 // state if an exception is thrown
324 _LIBCPP_HIDE_FROM_ABI flat_multiset& operator=(const flat_multiset&) = default;
325 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset& operator=(const flat_multiset&) = default;
325326
326 _LIBCPP_HIDE_FROM_ABI flat_multiset& operator=(flat_multiset&& __other) noexcept(
327 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 flat_multiset& operator=(flat_multiset&& __other) noexcept(
327328 is_nothrow_move_assignable_v<_KeyContainer> && is_nothrow_move_assignable_v<_Compare>) {
328329 auto __clear_other_guard = std::__make_scope_guard([&]() noexcept { __other.clear() /* noexcept */; });
329330 auto __clear_self_guard = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
......@@ -334,30 +335,60 @@ public:
334335 }
335336
336337 // iterators
337 _LIBCPP_HIDE_FROM_ABI iterator begin() noexcept { return iterator(std::as_const(__keys_).begin()); }
338 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const noexcept { return const_iterator(__keys_.begin()); }
339 _LIBCPP_HIDE_FROM_ABI iterator end() noexcept { return iterator(std::as_const(__keys_).end()); }
340 _LIBCPP_HIDE_FROM_ABI const_iterator end() const noexcept { return const_iterator(__keys_.end()); }
338 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
339 return iterator(std::as_const(__keys_).begin());
340 }
341 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
342 return const_iterator(__keys_.begin());
343 }
344 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
345 return iterator(std::as_const(__keys_).end());
346 }
347 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
348 return const_iterator(__keys_.end());
349 }
341350
342 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
343 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
344 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
345 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
351 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
352 return reverse_iterator(end());
353 }
354 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
355 return const_reverse_iterator(end());
356 }
357 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
358 return reverse_iterator(begin());
359 }
360 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
361 return const_reverse_iterator(begin());
362 }
346363
347 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const noexcept { return begin(); }
348 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const noexcept { return end(); }
349 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
350 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
364 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept {
365 return begin();
366 }
367 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept {
368 return end();
369 }
370 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
371 return const_reverse_iterator(end());
372 }
373 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
374 return const_reverse_iterator(begin());
375 }
351376
352377 // capacity
353 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __keys_.empty(); }
354 _LIBCPP_HIDE_FROM_ABI size_type size() const noexcept { return __keys_.size(); }
355 _LIBCPP_HIDE_FROM_ABI size_type max_size() const noexcept { return __keys_.max_size(); }
378 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const noexcept {
379 return __keys_.empty();
380 }
381 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
382 return __keys_.size();
383 }
384 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
385 return __keys_.max_size();
386 }
356387
357388 // [flat.multiset.modifiers], modifiers
358389 template <class... _Args>
359390 requires is_constructible_v<value_type, _Args...>
360 _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
391 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) {
361392 if constexpr (sizeof...(__args) == 1 && (is_same_v<remove_cvref_t<_Args>, _Key> && ...)) {
362393 return __emplace(std::forward<_Args>(__args)...);
363394 } else {
......@@ -367,7 +398,7 @@ public:
367398
368399 template <class... _Args>
369400 requires is_constructible_v<value_type, _Args...>
370 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __hint, _Args&&... __args) {
401 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __hint, _Args&&... __args) {
371402 if constexpr (sizeof...(__args) == 1 && (is_same_v<remove_cvref_t<_Args>, _Key> && ...)) {
372403 return __emplace_hint(std::move(__hint), std::forward<_Args>(__args)...);
373404 } else {
......@@ -375,21 +406,23 @@ public:
375406 }
376407 }
377408
378 _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return emplace(__x); }
409 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __x) { return emplace(__x); }
379410
380 _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __x) { return emplace(std::move(__x)); }
411 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __x) {
412 return emplace(std::move(__x));
413 }
381414
382 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, const value_type& __x) {
415 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, const value_type& __x) {
383416 return emplace_hint(__hint, __x);
384417 }
385418
386 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, value_type&& __x) {
419 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, value_type&& __x) {
387420 return emplace_hint(__hint, std::move(__x));
388421 }
389422
390423 template <class _InputIterator>
391424 requires __has_input_iterator_category<_InputIterator>::value
392 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
425 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
393426 if constexpr (sized_sentinel_for<_InputIterator, _InputIterator>) {
394427 __reserve(__last - __first);
395428 }
......@@ -398,7 +431,8 @@ public:
398431
399432 template <class _InputIterator>
400433 requires __has_input_iterator_category<_InputIterator>::value
401 _LIBCPP_HIDE_FROM_ABI void insert(sorted_equivalent_t, _InputIterator __first, _InputIterator __last) {
434 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
435 insert(sorted_equivalent_t, _InputIterator __first, _InputIterator __last) {
402436 if constexpr (sized_sentinel_for<_InputIterator, _InputIterator>) {
403437 __reserve(__last - __first);
404438 }
......@@ -407,7 +441,7 @@ public:
407441 }
408442
409443 template <_ContainerCompatibleRange<value_type> _Range>
410 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
444 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
411445 if constexpr (ranges::sized_range<_Range>) {
412446 __reserve(ranges::size(__range));
413447 }
......@@ -415,26 +449,38 @@ public:
415449 __append_sort_merge</*WasSorted = */ false>(std::forward<_Range>(__range));
416450 }
417451
418 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
452 template <_ContainerCompatibleRange<value_type> _Range>
453 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(sorted_equivalent_t, _Range&& __range) {
454 if constexpr (ranges::sized_range<_Range>) {
455 __reserve(ranges::size(__range));
456 }
419457
420 _LIBCPP_HIDE_FROM_ABI void insert(sorted_equivalent_t, initializer_list<value_type> __il) {
458 __append_sort_merge</*WasSorted = */ true>(std::forward<_Range>(__range));
459 }
460
461 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
462 insert(__il.begin(), __il.end());
463 }
464
465 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
466 insert(sorted_equivalent_t, initializer_list<value_type> __il) {
421467 insert(sorted_equivalent, __il.begin(), __il.end());
422468 }
423469
424 _LIBCPP_HIDE_FROM_ABI container_type extract() && {
470 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 container_type extract() && {
425471 auto __guard = std::__make_scope_guard([&]() noexcept { clear() /* noexcept */; });
426472 auto __ret = std::move(__keys_);
427473 return __ret;
428474 }
429475
430 _LIBCPP_HIDE_FROM_ABI void replace(container_type&& __keys) {
476 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void replace(container_type&& __keys) {
431477 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(ranges::is_sorted(__keys, __compare_), "Key container is not sorted");
432478 auto __guard = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
433479 __keys_ = std::move(__keys);
434480 __guard.__complete();
435481 }
436482
437 _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __position) {
483 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __position) {
438484 auto __on_failure = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
439485 auto __key_iter = __keys_.erase(__position.__base());
440486 __on_failure.__complete();
......@@ -444,7 +490,7 @@ public:
444490 // The following overload is the same as the iterator overload
445491 // iterator erase(const_iterator __position);
446492
447 _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __x) {
493 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __x) {
448494 auto [__first, __last] = equal_range(__x);
449495 auto __res = __last - __first;
450496 erase(__first, __last);
......@@ -454,149 +500,170 @@ public:
454500 template <class _Kp>
455501 requires(__is_transparent_v<_Compare> && !is_convertible_v<_Kp &&, iterator> &&
456502 !is_convertible_v<_Kp &&, const_iterator>)
457 _LIBCPP_HIDE_FROM_ABI size_type erase(_Kp&& __x) {
503 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(_Kp&& __x) {
458504 auto [__first, __last] = equal_range(__x);
459505 auto __res = __last - __first;
460506 erase(__first, __last);
461507 return __res;
462508 }
463509
464 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
510 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __first, const_iterator __last) {
465511 auto __on_failure = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
466512 auto __key_it = __keys_.erase(__first.__base(), __last.__base());
467513 __on_failure.__complete();
468514 return iterator(std::move(__key_it));
469515 }
470516
471 _LIBCPP_HIDE_FROM_ABI void swap(flat_multiset& __y) noexcept {
472 // warning: The spec has unconditional noexcept, which means that
473 // if any of the following functions throw an exception,
474 // std::terminate will be called
475 // This is discussed in P3567, which hasn't been voted on yet.
517 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
518 swap(flat_multiset& __y) noexcept(is_nothrow_swappable_v<container_type> && is_nothrow_swappable_v<key_compare>) {
519 auto __on_failure = std::__make_exception_guard([&]() noexcept {
520 clear() /* noexcept */;
521 __y.clear() /* noexcept */;
522 });
476523 ranges::swap(__compare_, __y.__compare_);
477524 ranges::swap(__keys_, __y.__keys_);
525 __on_failure.__complete();
478526 }
479527
480 _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __keys_.clear(); }
528 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() noexcept { __keys_.clear(); }
481529
482530 // observers
483 _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __compare_; }
484 _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __compare_; }
531 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
532 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
533 return __compare_;
534 }
485535
486536 // map operations
487 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __x) { return __find_impl(*this, __x); }
537 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
538 return __find_impl(*this, __x);
539 }
488540
489 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __x) const { return __find_impl(*this, __x); }
541 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
542 return __find_impl(*this, __x);
543 }
490544
491545 template <class _Kp>
492546 requires __is_transparent_v<_Compare>
493 _LIBCPP_HIDE_FROM_ABI iterator find(const _Kp& __x) {
547 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
494548 return __find_impl(*this, __x);
495549 }
496550
497551 template <class _Kp>
498552 requires __is_transparent_v<_Compare>
499 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Kp& __x) const {
553 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
500554 return __find_impl(*this, __x);
501555 }
502556
503 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __x) const {
557 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
504558 auto [__first, __last] = equal_range(__x);
505559 return __last - __first;
506560 }
507561
508562 template <class _Kp>
509563 requires __is_transparent_v<_Compare>
510 _LIBCPP_HIDE_FROM_ABI size_type count(const _Kp& __x) const {
564 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
511565 auto [__first, __last] = equal_range(__x);
512566 return __last - __first;
513567 }
514568
515 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __x) const { return find(__x) != end(); }
569 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
570 return find(__x) != end();
571 }
516572
517573 template <class _Kp>
518574 requires __is_transparent_v<_Compare>
519 _LIBCPP_HIDE_FROM_ABI bool contains(const _Kp& __x) const {
575 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
520576 return find(__x) != end();
521577 }
522578
523 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __x) {
579 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
524580 const auto& __keys = __keys_;
525581 return iterator(std::lower_bound(__keys.begin(), __keys.end(), __x, __compare_));
526582 }
527583
528 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __x) const {
584 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
585 lower_bound(const key_type& __x) const {
529586 return const_iterator(std::lower_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
530587 }
531588
532589 template <class _Kp>
533590 requires __is_transparent_v<_Compare>
534 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _Kp& __x) {
591 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
535592 const auto& __keys = __keys_;
536593 return iterator(std::lower_bound(__keys.begin(), __keys.end(), __x, __compare_));
537594 }
538595
539596 template <class _Kp>
540597 requires __is_transparent_v<_Compare>
541 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _Kp& __x) const {
598 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
542599 return const_iterator(std::lower_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
543600 }
544601
545 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __x) {
602 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
546603 const auto& __keys = __keys_;
547604 return iterator(std::upper_bound(__keys.begin(), __keys.end(), __x, __compare_));
548605 }
549606
550 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __x) const {
607 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
608 upper_bound(const key_type& __x) const {
551609 return const_iterator(std::upper_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
552610 }
553611
554612 template <class _Kp>
555613 requires __is_transparent_v<_Compare>
556 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _Kp& __x) {
614 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
557615 const auto& __keys = __keys_;
558616 return iterator(std::upper_bound(__keys.begin(), __keys.end(), __x, __compare_));
559617 }
560618
561619 template <class _Kp>
562620 requires __is_transparent_v<_Compare>
563 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _Kp& __x) const {
621 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
564622 return const_iterator(std::upper_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
565623 }
566624
567 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __x) {
625 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
626 equal_range(const key_type& __x) {
568627 return __equal_range_impl(*this, __x);
569628 }
570629
571 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __x) const {
630 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
631 equal_range(const key_type& __x) const {
572632 return __equal_range_impl(*this, __x);
573633 }
574634
575635 template <class _Kp>
576636 requires __is_transparent_v<_Compare>
577 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _Kp& __x) {
637 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
638 equal_range(const _Kp& __x) {
578639 return __equal_range_impl(*this, __x);
579640 }
580641 template <class _Kp>
581642 requires __is_transparent_v<_Compare>
582 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _Kp& __x) const {
643 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
644 equal_range(const _Kp& __x) const {
583645 return __equal_range_impl(*this, __x);
584646 }
585647
586 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const flat_multiset& __x, const flat_multiset& __y) {
648 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
649 operator==(const flat_multiset& __x, const flat_multiset& __y) {
587650 return ranges::equal(__x, __y);
588651 }
589652
590 friend _LIBCPP_HIDE_FROM_ABI auto operator<=>(const flat_multiset& __x, const flat_multiset& __y) {
653 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
654 operator<=>(const flat_multiset& __x, const flat_multiset& __y) {
591655 return std::lexicographical_compare_three_way(
592656 __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
593657 }
594658
595 friend _LIBCPP_HIDE_FROM_ABI void swap(flat_multiset& __x, flat_multiset& __y) noexcept { __x.swap(__y); }
659 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
660 swap(flat_multiset& __x, flat_multiset& __y) noexcept(noexcept(__x.swap(__y))) {
661 __x.swap(__y);
662 }
596663
597664private:
598665 template <bool _WasSorted, class... _Args>
599 _LIBCPP_HIDE_FROM_ABI void __append_sort_merge(_Args&&... __args) {
666 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __append_sort_merge(_Args&&... __args) {
600667 auto __on_failure = std::__make_exception_guard([&]() noexcept { clear() /* noexcept */; });
601668 size_type __old_size = size();
602669 __flat_set_utils::__append(*this, std::forward<_Args>(__args)...);
......@@ -604,20 +671,20 @@ private:
604671 ranges::sort(__keys_.begin() + __old_size, __keys_.end(), __compare_);
605672 } else {
606673 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
607 ranges::is_sorted(__keys_ | ranges::views::drop(__old_size)), "Key container is not sorted");
674 ranges::is_sorted(__keys_ | ranges::views::drop(__old_size), __compare_), "Key container is not sorted");
608675 }
609676 ranges::inplace_merge(__keys_.begin(), __keys_.begin() + __old_size, __keys_.end(), __compare_);
610677 __on_failure.__complete();
611678 }
612679
613680 template <class _Kp>
614 _LIBCPP_HIDE_FROM_ABI iterator __emplace(_Kp&& __key) {
681 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __emplace(_Kp&& __key) {
615682 auto __it = upper_bound(__key);
616683 return __flat_set_utils::__emplace_exact_pos(*this, __it, std::forward<_Kp>(__key));
617684 }
618685
619686 template <class _Kp>
620 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint(const_iterator __hint, _Kp&& __key) {
687 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __emplace_hint(const_iterator __hint, _Kp&& __key) {
621688 auto __prev_larger = __hint != cbegin() && __compare_(__key, *std::prev(__hint));
622689 auto __next_smaller = __hint != cend() && __compare_(*__hint, __key);
623690
......@@ -649,7 +716,7 @@ private:
649716 }
650717
651718 template <class _Self, class _Kp>
652 _LIBCPP_HIDE_FROM_ABI static auto __find_impl(_Self&& __self, const _Kp& __key) {
719 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto __find_impl(_Self&& __self, const _Kp& __key) {
653720 auto __it = __self.lower_bound(__key);
654721 auto __last = __self.end();
655722 if (__it == __last || __self.__compare_(__key, *__it)) {
......@@ -659,29 +726,30 @@ private:
659726 }
660727
661728 template <class _Self, class _Kp>
662 _LIBCPP_HIDE_FROM_ABI static auto __equal_range_impl(_Self&& __self, const _Kp& __key) {
729 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto __equal_range_impl(_Self&& __self, const _Kp& __key) {
663730 using __iter = _If<is_const_v<__libcpp_remove_reference_t<_Self>>, const_iterator, iterator>;
664731 auto [__key_first, __key_last] =
665732 std::equal_range(__self.__keys_.begin(), __self.__keys_.end(), __key, __self.__compare_);
666733 return std::make_pair(__iter(__key_first), __iter(__key_last));
667734 }
668735
669 _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __size) {
736 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __reserve(size_t __size) {
670737 if constexpr (__container_traits<_KeyContainer>::__reservable) {
671738 __keys_.reserve(__size);
672739 }
673740 }
674741
675742 template <class _Key2, class _Compare2, class _KeyContainer2, class _Predicate>
676 friend typename flat_multiset<_Key2, _Compare2, _KeyContainer2>::size_type
743 friend typename flat_multiset<_Key2, _Compare2, _KeyContainer2>::size_type _LIBCPP_CONSTEXPR_SINCE_CXX26
677744 erase_if(flat_multiset<_Key2, _Compare2, _KeyContainer2>&, _Predicate);
678745
679746 _KeyContainer __keys_;
680747 _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_;
681748
682749 struct __key_equiv {
683 _LIBCPP_HIDE_FROM_ABI __key_equiv(key_compare __c) : __comp_(__c) {}
684 _LIBCPP_HIDE_FROM_ABI bool operator()(const_reference __x, const_reference __y) const {
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 {
685753 return !__comp_(std::get<0>(__x), std::get<0>(__y)) && !__comp_(std::get<0>(__y), std::get<0>(__x));
686754 }
687755 key_compare __comp_;
......@@ -689,7 +757,7 @@ private:
689757};
690758
691759template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>>
692 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
760 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
693761 is_invocable_v<const _Compare&,
694762 const typename _KeyContainer::value_type&,
695763 const typename _KeyContainer::value_type&>)
......@@ -697,12 +765,12 @@ flat_multiset(_KeyContainer, _Compare = _Compare())
697765 -> flat_multiset<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
698766
699767template <class _KeyContainer, class _Allocator>
700 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator<_KeyContainer>::value)
768 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator_v<_KeyContainer>)
701769flat_multiset(_KeyContainer, _Allocator)
702770 -> flat_multiset<typename _KeyContainer::value_type, less<typename _KeyContainer::value_type>, _KeyContainer>;
703771
704772template <class _KeyContainer, class _Compare, class _Allocator>
705 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
773 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
706774 uses_allocator_v<_KeyContainer, _Allocator> &&
707775 is_invocable_v<const _Compare&,
708776 const typename _KeyContainer::value_type&,
......@@ -711,7 +779,7 @@ flat_multiset(_KeyContainer, _Compare, _Allocator)
711779 -> flat_multiset<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
712780
713781template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>>
714 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
782 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
715783 is_invocable_v<const _Compare&,
716784 const typename _KeyContainer::value_type&,
717785 const typename _KeyContainer::value_type&>)
......@@ -719,12 +787,12 @@ flat_multiset(sorted_equivalent_t, _KeyContainer, _Compare = _Compare())
719787 -> flat_multiset<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
720788
721789template <class _KeyContainer, class _Allocator>
722 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator<_KeyContainer>::value)
790 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator_v<_KeyContainer>)
723791flat_multiset(sorted_equivalent_t, _KeyContainer, _Allocator)
724792 -> flat_multiset<typename _KeyContainer::value_type, less<typename _KeyContainer::value_type>, _KeyContainer>;
725793
726794template <class _KeyContainer, class _Compare, class _Allocator>
727 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
795 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
728796 uses_allocator_v<_KeyContainer, _Allocator> &&
729797 is_invocable_v<const _Compare&,
730798 const typename _KeyContainer::value_type&,
......@@ -732,37 +800,37 @@ template <class _KeyContainer, class _Compare, class _Allocator>
732800flat_multiset(sorted_equivalent_t, _KeyContainer, _Compare, _Allocator)
733801 -> flat_multiset<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
734802
735template <class _InputIterator, class _Compare = less<__iter_value_type<_InputIterator>>>
736 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
803template <class _InputIterator, class _Compare = less<__iterator_value_type<_InputIterator>>>
804 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
737805flat_multiset(_InputIterator, _InputIterator, _Compare = _Compare())
738 -> flat_multiset<__iter_value_type<_InputIterator>, _Compare>;
806 -> flat_multiset<__iterator_value_type<_InputIterator>, _Compare>;
739807
740template <class _InputIterator, class _Compare = less<__iter_value_type<_InputIterator>>>
741 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
808template <class _InputIterator, class _Compare = less<__iterator_value_type<_InputIterator>>>
809 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
742810flat_multiset(sorted_equivalent_t, _InputIterator, _InputIterator, _Compare = _Compare())
743 -> flat_multiset<__iter_value_type<_InputIterator>, _Compare>;
811 -> flat_multiset<__iterator_value_type<_InputIterator>, _Compare>;
744812
745813template <ranges::input_range _Range,
746814 class _Compare = less<ranges::range_value_t<_Range>>,
747815 class _Allocator = allocator<ranges::range_value_t<_Range>>,
748 class = __enable_if_t<!__is_allocator<_Compare>::value && __is_allocator<_Allocator>::value>>
816 class = __enable_if_t<!__is_allocator_v<_Compare> && __is_allocator_v<_Allocator>>>
749817flat_multiset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator()) -> flat_multiset<
750818 ranges::range_value_t<_Range>,
751819 _Compare,
752820 vector<ranges::range_value_t<_Range>, __allocator_traits_rebind_t<_Allocator, ranges::range_value_t<_Range>>>>;
753821
754template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator<_Allocator>::value>>
822template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator_v<_Allocator>>>
755823flat_multiset(from_range_t, _Range&&, _Allocator) -> flat_multiset<
756824 ranges::range_value_t<_Range>,
757825 less<ranges::range_value_t<_Range>>,
758826 vector<ranges::range_value_t<_Range>, __allocator_traits_rebind_t<_Allocator, ranges::range_value_t<_Range>>>>;
759827
760828template <class _Key, class _Compare = less<_Key>>
761 requires(!__is_allocator<_Compare>::value)
829 requires(!__is_allocator_v<_Compare>)
762830flat_multiset(initializer_list<_Key>, _Compare = _Compare()) -> flat_multiset<_Key, _Compare>;
763831
764832template <class _Key, class _Compare = less<_Key>>
765 requires(!__is_allocator<_Compare>::value)
833 requires(!__is_allocator_v<_Compare>)
766834flat_multiset(sorted_equivalent_t, initializer_list<_Key>, _Compare = _Compare()) -> flat_multiset<_Key, _Compare>;
767835
768836template <class _Key, class _Compare, class _KeyContainer, class _Allocator>
......@@ -770,7 +838,7 @@ struct uses_allocator<flat_multiset<_Key, _Compare, _KeyContainer>, _Allocator>
770838 : bool_constant<uses_allocator_v<_KeyContainer, _Allocator> > {};
771839
772840template <class _Key, class _Compare, class _KeyContainer, class _Predicate>
773_LIBCPP_HIDE_FROM_ABI typename flat_multiset<_Key, _Compare, _KeyContainer>::size_type
841_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename flat_multiset<_Key, _Compare, _KeyContainer>::size_type
774842erase_if(flat_multiset<_Key, _Compare, _KeyContainer>& __flat_multiset, _Predicate __pred) {
775843 auto __guard = std::__make_exception_guard([&] { __flat_multiset.clear(); });
776844 auto __it =
lib/libcxx/include/__flat_set/flat_set.h+86-68
......@@ -12,7 +12,6 @@
1212
1313#include <__algorithm/lexicographical_compare_three_way.h>
1414#include <__algorithm/lower_bound.h>
15#include <__algorithm/min.h>
1615#include <__algorithm/ranges_adjacent_find.h>
1716#include <__algorithm/ranges_equal.h>
1817#include <__algorithm/ranges_inplace_merge.h>
......@@ -24,20 +23,16 @@
2423#include <__compare/synth_three_way.h>
2524#include <__concepts/swappable.h>
2625#include <__config>
27#include <__cstddef/ptrdiff_t.h>
2826#include <__flat_map/sorted_unique.h>
2927#include <__flat_set/ra_iterator.h>
3028#include <__flat_set/utils.h>
31#include <__functional/invoke.h>
3229#include <__functional/is_transparent.h>
3330#include <__functional/operations.h>
3431#include <__fwd/vector.h>
3532#include <__iterator/concepts.h>
36#include <__iterator/distance.h>
3733#include <__iterator/iterator_traits.h>
3834#include <__iterator/next.h>
3935#include <__iterator/prev.h>
40#include <__iterator/ranges_iterator_traits.h>
4136#include <__iterator/reverse_iterator.h>
4237#include <__memory/allocator_traits.h>
4338#include <__memory/uses_allocator.h>
......@@ -47,10 +42,7 @@
4742#include <__ranges/container_compatible_range.h>
4843#include <__ranges/drop_view.h>
4944#include <__ranges/from_range.h>
50#include <__ranges/ref_view.h>
5145#include <__ranges/size.h>
52#include <__ranges/subrange.h>
53#include <__type_traits/conjunction.h>
5446#include <__type_traits/container_traits.h>
5547#include <__type_traits/invoke.h>
5648#include <__type_traits/is_allocator.h>
......@@ -347,38 +339,42 @@ public:
347339 }
348340
349341 // iterators
350 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
342 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
351343 return iterator(std::as_const(__keys_).begin());
352344 }
353 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
345 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
354346 return const_iterator(__keys_.begin());
355347 }
356 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
348 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
357349 return iterator(std::as_const(__keys_).end());
358350 }
359 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
351 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
360352 return const_iterator(__keys_.end());
361353 }
362354
363 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
355 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
364356 return reverse_iterator(end());
365357 }
366 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
358 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
367359 return const_reverse_iterator(end());
368360 }
369 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
361 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
370362 return reverse_iterator(begin());
371363 }
372 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
364 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
373365 return const_reverse_iterator(begin());
374366 }
375367
376 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept { return begin(); }
377 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept { return end(); }
378 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
368 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept {
369 return begin();
370 }
371 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept {
372 return end();
373 }
374 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
379375 return const_reverse_iterator(end());
380376 }
381 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
377 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
382378 return const_reverse_iterator(begin());
383379 }
384380
......@@ -387,9 +383,13 @@ public:
387383 return __keys_.empty();
388384 }
389385
390 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept { return __keys_.size(); }
386 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
387 return __keys_.size();
388 }
391389
392 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept { return __keys_.max_size(); }
390 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
391 return __keys_.max_size();
392 }
393393
394394 // [flat.set.modifiers], modifiers
395395 template <class... _Args>
......@@ -466,6 +466,15 @@ public:
466466 __append_sort_merge_unique</*WasSorted = */ false>(std::forward<_Range>(__range));
467467 }
468468
469 template <_ContainerCompatibleRange<value_type> _Range>
470 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(std::sorted_unique_t, _Range&& __range) {
471 if constexpr (ranges::sized_range<_Range>) {
472 __reserve(ranges::size(__range));
473 }
474
475 __append_sort_merge_unique</*WasSorted = */ true>(std::forward<_Range>(__range));
476 }
477
469478 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
470479 insert(__il.begin(), __il.end());
471480 }
......@@ -474,7 +483,7 @@ public:
474483 insert(sorted_unique, __il.begin(), __il.end());
475484 }
476485
477 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 container_type extract() && {
486 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 container_type extract() && {
478487 auto __guard = std::__make_scope_guard([&]() noexcept { clear() /* noexcept */; });
479488 auto __ret = std::move(__keys_);
480489 return __ret;
......@@ -524,123 +533,131 @@ public:
524533 return iterator(std::move(__key_it));
525534 }
526535
527 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(flat_set& __y) noexcept {
528 // warning: The spec has unconditional noexcept, which means that
529 // if any of the following functions throw an exception,
530 // std::terminate will be called.
531 // This is discussed in P2767, which hasn't been voted on yet.
536 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
537 swap(flat_set& __y) noexcept(is_nothrow_swappable_v<container_type> && is_nothrow_swappable_v<key_compare>) {
538 auto __on_failure = std::__make_exception_guard([&]() noexcept {
539 clear() /* noexcept */;
540 __y.clear() /* noexcept */;
541 });
532542 ranges::swap(__compare_, __y.__compare_);
533543 ranges::swap(__keys_, __y.__keys_);
544 __on_failure.__complete();
534545 }
535546
536547 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() noexcept { __keys_.clear(); }
537548
538549 // observers
539 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
540 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const { return __compare_; }
550 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
551 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
552 return __compare_;
553 }
541554
542555 // set operations
543 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
556 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
544557 return __find_impl(*this, __x);
545558 }
546559
547 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
560 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
548561 return __find_impl(*this, __x);
549562 }
550563
551564 template <class _Kp>
552565 requires __is_transparent_v<_Compare>
553 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
566 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
554567 return __find_impl(*this, __x);
555568 }
556569
557570 template <class _Kp>
558571 requires __is_transparent_v<_Compare>
559 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
572 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
560573 return __find_impl(*this, __x);
561574 }
562575
563 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
576 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
564577 return contains(__x) ? 1 : 0;
565578 }
566579
567580 template <class _Kp>
568581 requires __is_transparent_v<_Compare>
569 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
582 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
570583 return contains(__x) ? 1 : 0;
571584 }
572585
573 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
586 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
574587 return find(__x) != end();
575588 }
576589
577590 template <class _Kp>
578591 requires __is_transparent_v<_Compare>
579 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
592 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
580593 return find(__x) != end();
581594 }
582595
583 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
596 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
584597 const auto& __keys = __keys_;
585598 return iterator(std::lower_bound(__keys.begin(), __keys.end(), __x, __compare_));
586599 }
587600
588 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const key_type& __x) const {
601 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
602 lower_bound(const key_type& __x) const {
589603 return const_iterator(std::lower_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
590604 }
591605
592606 template <class _Kp>
593607 requires __is_transparent_v<_Compare>
594 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
608 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
595609 const auto& __keys = __keys_;
596610 return iterator(std::lower_bound(__keys.begin(), __keys.end(), __x, __compare_));
597611 }
598612
599613 template <class _Kp>
600614 requires __is_transparent_v<_Compare>
601 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
615 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
602616 return const_iterator(std::lower_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
603617 }
604618
605 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
619 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
606620 const auto& __keys = __keys_;
607621 return iterator(std::upper_bound(__keys.begin(), __keys.end(), __x, __compare_));
608622 }
609623
610 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const key_type& __x) const {
624 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
625 upper_bound(const key_type& __x) const {
611626 return const_iterator(std::upper_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
612627 }
613628
614629 template <class _Kp>
615630 requires __is_transparent_v<_Compare>
616 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
631 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
617632 const auto& __keys = __keys_;
618633 return iterator(std::upper_bound(__keys.begin(), __keys.end(), __x, __compare_));
619634 }
620635
621636 template <class _Kp>
622637 requires __is_transparent_v<_Compare>
623 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
638 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
624639 return const_iterator(std::upper_bound(__keys_.begin(), __keys_.end(), __x, __compare_));
625640 }
626641
627 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __x) {
642 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
643 equal_range(const key_type& __x) {
628644 return __equal_range_impl(*this, __x);
629645 }
630646
631 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
647 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
632648 equal_range(const key_type& __x) const {
633649 return __equal_range_impl(*this, __x);
634650 }
635651
636652 template <class _Kp>
637653 requires __is_transparent_v<_Compare>
638 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _Kp& __x) {
654 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
655 equal_range(const _Kp& __x) {
639656 return __equal_range_impl(*this, __x);
640657 }
641658 template <class _Kp>
642659 requires __is_transparent_v<_Compare>
643 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
660 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
644661 equal_range(const _Kp& __x) const {
645662 return __equal_range_impl(*this, __x);
646663 }
......@@ -655,13 +672,14 @@ public:
655672 __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
656673 }
657674
658 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(flat_set& __x, flat_set& __y) noexcept {
675 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
676 swap(flat_set& __x, flat_set& __y) noexcept(noexcept(__x.swap(__y))) {
659677 __x.swap(__y);
660678 }
661679
662680private:
663681 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __is_sorted_and_unique(auto&& __key_container) const {
664 auto __greater_or_equal_to = [this](const auto& __x, const auto& __y) { return !__compare_(__x, __y); };
682 auto __greater_or_equal_to = [this](const auto& __x, const auto& __y) -> bool { return !__compare_(__x, __y); };
665683 return ranges::adjacent_find(__key_container, __greater_or_equal_to) == ranges::end(__key_container);
666684 }
667685
......@@ -774,19 +792,19 @@ private:
774792};
775793
776794template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>>
777 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
795 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
778796 is_invocable_v<const _Compare&,
779797 const typename _KeyContainer::value_type&,
780798 const typename _KeyContainer::value_type&>)
781799flat_set(_KeyContainer, _Compare = _Compare()) -> flat_set<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
782800
783801template <class _KeyContainer, class _Allocator>
784 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator<_KeyContainer>::value)
802 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator_v<_KeyContainer>)
785803flat_set(_KeyContainer, _Allocator)
786804 -> flat_set<typename _KeyContainer::value_type, less<typename _KeyContainer::value_type>, _KeyContainer>;
787805
788806template <class _KeyContainer, class _Compare, class _Allocator>
789 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
807 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
790808 uses_allocator_v<_KeyContainer, _Allocator> &&
791809 is_invocable_v<const _Compare&,
792810 const typename _KeyContainer::value_type&,
......@@ -794,7 +812,7 @@ template <class _KeyContainer, class _Compare, class _Allocator>
794812flat_set(_KeyContainer, _Compare, _Allocator) -> flat_set<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
795813
796814template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>>
797 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
815 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
798816 is_invocable_v<const _Compare&,
799817 const typename _KeyContainer::value_type&,
800818 const typename _KeyContainer::value_type&>)
......@@ -802,12 +820,12 @@ flat_set(sorted_unique_t, _KeyContainer, _Compare = _Compare())
802820 -> flat_set<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
803821
804822template <class _KeyContainer, class _Allocator>
805 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator<_KeyContainer>::value)
823 requires(uses_allocator_v<_KeyContainer, _Allocator> && !__is_allocator_v<_KeyContainer>)
806824flat_set(sorted_unique_t, _KeyContainer, _Allocator)
807825 -> flat_set<typename _KeyContainer::value_type, less<typename _KeyContainer::value_type>, _KeyContainer>;
808826
809827template <class _KeyContainer, class _Compare, class _Allocator>
810 requires(!__is_allocator<_Compare>::value && !__is_allocator<_KeyContainer>::value &&
828 requires(!__is_allocator_v<_Compare> && !__is_allocator_v<_KeyContainer> &&
811829 uses_allocator_v<_KeyContainer, _Allocator> &&
812830 is_invocable_v<const _Compare&,
813831 const typename _KeyContainer::value_type&,
......@@ -815,37 +833,37 @@ template <class _KeyContainer, class _Compare, class _Allocator>
815833flat_set(sorted_unique_t, _KeyContainer, _Compare, _Allocator)
816834 -> flat_set<typename _KeyContainer::value_type, _Compare, _KeyContainer>;
817835
818template <class _InputIterator, class _Compare = less<__iter_value_type<_InputIterator>>>
819 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
836template <class _InputIterator, class _Compare = less<__iterator_value_type<_InputIterator>>>
837 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
820838flat_set(_InputIterator, _InputIterator, _Compare = _Compare())
821 -> flat_set<__iter_value_type<_InputIterator>, _Compare>;
839 -> flat_set<__iterator_value_type<_InputIterator>, _Compare>;
822840
823template <class _InputIterator, class _Compare = less<__iter_value_type<_InputIterator>>>
824 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator<_Compare>::value)
841template <class _InputIterator, class _Compare = less<__iterator_value_type<_InputIterator>>>
842 requires(__has_input_iterator_category<_InputIterator>::value && !__is_allocator_v<_Compare>)
825843flat_set(sorted_unique_t, _InputIterator, _InputIterator, _Compare = _Compare())
826 -> flat_set<__iter_value_type<_InputIterator>, _Compare>;
844 -> flat_set<__iterator_value_type<_InputIterator>, _Compare>;
827845
828846template <ranges::input_range _Range,
829847 class _Compare = less<ranges::range_value_t<_Range>>,
830848 class _Allocator = allocator<ranges::range_value_t<_Range>>,
831 class = __enable_if_t<!__is_allocator<_Compare>::value && __is_allocator<_Allocator>::value>>
849 class = __enable_if_t<!__is_allocator_v<_Compare> && __is_allocator_v<_Allocator>>>
832850flat_set(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator()) -> flat_set<
833851 ranges::range_value_t<_Range>,
834852 _Compare,
835853 vector<ranges::range_value_t<_Range>, __allocator_traits_rebind_t<_Allocator, ranges::range_value_t<_Range>>>>;
836854
837template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator<_Allocator>::value>>
855template <ranges::input_range _Range, class _Allocator, class = __enable_if_t<__is_allocator_v<_Allocator>>>
838856flat_set(from_range_t, _Range&&, _Allocator) -> flat_set<
839857 ranges::range_value_t<_Range>,
840858 less<ranges::range_value_t<_Range>>,
841859 vector<ranges::range_value_t<_Range>, __allocator_traits_rebind_t<_Allocator, ranges::range_value_t<_Range>>>>;
842860
843861template <class _Key, class _Compare = less<_Key>>
844 requires(!__is_allocator<_Compare>::value)
862 requires(!__is_allocator_v<_Compare>)
845863flat_set(initializer_list<_Key>, _Compare = _Compare()) -> flat_set<_Key, _Compare>;
846864
847865template <class _Key, class _Compare = less<_Key>>
848 requires(!__is_allocator<_Compare>::value)
866 requires(!__is_allocator_v<_Compare>)
849867flat_set(sorted_unique_t, initializer_list<_Key>, _Compare = _Compare()) -> flat_set<_Key, _Compare>;
850868
851869template <class _Key, class _Compare, class _KeyContainer, class _Allocator>
lib/libcxx/include/__format/concepts.h-14
......@@ -15,12 +15,8 @@
1515#include <__config>
1616#include <__format/format_parse_context.h>
1717#include <__fwd/format.h>
18#include <__fwd/tuple.h>
19#include <__tuple/tuple_size.h>
20#include <__type_traits/is_specialization.h>
2118#include <__type_traits/remove_const.h>
2219#include <__type_traits/remove_reference.h>
23#include <__utility/pair.h>
2420
2521#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2622# pragma GCC system_header
......@@ -65,16 +61,6 @@ concept __formattable =
6561# if _LIBCPP_STD_VER >= 23
6662template <class _Tp, class _CharT>
6763concept formattable = __formattable<_Tp, _CharT>;
68
69// [tuple.like] defines a tuple-like exposition only concept. This concept is
70// not related to that. Therefore it uses a different name for the concept.
71//
72// TODO FMT Add a test to validate we fail when using that concept after P2165
73// has been implemented.
74template <class _Tp>
75concept __fmt_pair_like =
76 __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
77
7864# endif // _LIBCPP_STD_VER >= 23
7965#endif // _LIBCPP_STD_VER >= 20
8066
lib/libcxx/include/__format/extended_grapheme_cluster_table.h+3-2
......@@ -61,7 +61,7 @@
6161#ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
6262#define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_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>
6767#include <__iterator/access.h>
......@@ -1647,7 +1647,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[1501] = {
16471647 // size. Then the upper bound for code point 3 will return the entry after
16481648 // 0x1810. After moving to the previous entry the algorithm arrives at the
16491649 // correct entry.
1650 ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
1650 ptrdiff_t __i =
1651 std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
16511652 if (__i == 0)
16521653 return __property::__none;
16531654
lib/libcxx/include/__format/fmt_pair_like.h created+42
......@@ -0,0 +1,42 @@
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_FMT_PAIR_LIKE_H
11#define _LIBCPP___FORMAT_FMT_PAIR_LIKE_H
12
13#include <__config>
14#include <__fwd/pair.h>
15#include <__fwd/tuple.h>
16#include <__tuple/tuple_size.h>
17#include <__type_traits/is_specialization.h>
18
19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20# pragma GCC system_header
21#endif
22
23_LIBCPP_BEGIN_NAMESPACE_STD
24
25#if _LIBCPP_STD_VER >= 23
26
27// [tuple.like] defines a tuple-like exposition only concept. This concept is not related to that. Therefore it uses a
28// different name for the concept.
29//
30// TODO FMT Add a test to validate we fail when using that concept after P2165 has been implemented.
31
32// [format.range.fmtkind]/2.2.1 and [tab:formatter.range.type]:
33// "U is either a specialization of pair or a specialization of tuple such that tuple_size_v<U> is 2."
34template <class _Tp>
35concept __fmt_pair_like =
36 __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
37
38#endif // _LIBCPP_STD_VER >= 23
39
40_LIBCPP_END_NAMESPACE_STD
41
42#endif // _LIBCPP___FORMAT_FMT_PAIR_LIKE_H
lib/libcxx/include/__format/format_arg.h+7-10
......@@ -149,7 +149,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_
149149 __libcpp_unreachable();
150150}
151151
152# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
152# if _LIBCPP_STD_VER >= 26
153153
154154template <class _Rp, class _Visitor, class _Context>
155155_LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
......@@ -200,7 +200,7 @@ _LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<
200200 __libcpp_unreachable();
201201}
202202
203# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
203# endif // _LIBCPP_STD_VER >= 26
204204
205205/// Contains the values used in basic_format_arg.
206206///
......@@ -285,7 +285,7 @@ public:
285285
286286 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }
287287
288# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
288# if _LIBCPP_STD_VER >= 26
289289
290290 // This function is user facing, so it must wrap the non-standard types of
291291 // the "variant" in a handle to stay conforming. See __arg_t for more details.
......@@ -329,7 +329,7 @@ public:
329329 }
330330 }
331331
332# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
332# endif // _LIBCPP_STD_VER >= 26
333333
334334private:
335335 using char_type = typename _Context::char_type;
......@@ -371,11 +371,8 @@ private:
371371// This function is user facing, so it must wrap the non-standard types of
372372// the "variant" in a handle to stay conforming. See __arg_t for more details.
373373template <class _Visitor, class _Context>
374# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
375_LIBCPP_DEPRECATED_IN_CXX26
376# endif
377 _LIBCPP_HIDE_FROM_ABI decltype(auto)
378 visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
374_LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_HIDE_FROM_ABI decltype(auto)
375visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
379376 switch (__arg.__type_) {
380377# if _LIBCPP_HAS_INT128
381378 case __format::__arg_t::__i128: {
......@@ -387,7 +384,7 @@ _LIBCPP_DEPRECATED_IN_CXX26
387384 typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
388385 return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
389386 }
390# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
387# endif // _LIBCPP_HAS_INT128
391388 default:
392389 return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg);
393390 }
lib/libcxx/include/__format/format_args.h+1-1
......@@ -40,7 +40,7 @@ public:
4040 }
4141 }
4242
43 _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
43 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
4444 if (__id >= __size_)
4545 return basic_format_arg<_Context>{};
4646
lib/libcxx/include/__format/format_context.h+5-5
......@@ -80,17 +80,17 @@ public:
8080 template <class _Tp>
8181 using formatter_type = formatter<_Tp, _CharT>;
8282
83 _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
83 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
8484 return __args_.get(__id);
8585 }
8686# if _LIBCPP_HAS_LOCALIZATION
87 _LIBCPP_HIDE_FROM_ABI std::locale locale() {
87 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI std::locale locale() {
8888 if (!__loc_)
8989 __loc_ = std::locale{};
9090 return *__loc_;
9191 }
9292# endif
93 _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
93 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
9494 _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
9595
9696private:
......@@ -175,13 +175,13 @@ public:
175175 __format::__determine_arg_t<basic_format_context, decltype(__arg)>(),
176176 __basic_format_arg_value<basic_format_context>(__arg)};
177177 };
178# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
178# if _LIBCPP_STD_VER >= 26
179179 return static_cast<_Context*>(__c)->arg(__id).visit(std::move(__visitor));
180180# else
181181 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
182182 return std::visit_format_arg(std::move(__visitor), static_cast<_Context*>(__c)->arg(__id));
183183 _LIBCPP_SUPPRESS_DEPRECATED_POP
184# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
184# endif // _LIBCPP_STD_VER >= 26
185185 }) {
186186 }
187187
lib/libcxx/include/__format/format_parse_context.h+2-2
......@@ -41,8 +41,8 @@ public:
4141 basic_format_parse_context(const basic_format_parse_context&) = delete;
4242 basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
4343
44 _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { return __begin_; }
45 _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { return __end_; }
44 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { return __begin_; }
45 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { return __end_; }
4646 _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(const_iterator __it) { __begin_ = __it; }
4747
4848 _LIBCPP_HIDE_FROM_ABI constexpr size_t next_arg_id() {
lib/libcxx/include/__format/formatter_output.h+30-34
......@@ -45,7 +45,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4545
4646namespace __formatter {
4747
48struct _LIBCPP_EXPORTED_FROM_ABI __padding_size_result {
48struct __padding_size_result {
4949 size_t __before_;
5050 size_t __after_;
5151};
......@@ -151,45 +151,41 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value)
151151 }
152152}
153153
154# if _LIBCPP_HAS_UNICODE
155154template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
156 requires(same_as<_CharT, char>)
157155_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
158 std::size_t __bytes = std::countl_one(static_cast<unsigned char>(__value.__data[0]));
159 if (__bytes == 0)
160 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
161
162 for (size_t __i = 0; __i < __n; ++__i)
163 __out_it = __formatter::__copy(
164 std::addressof(__value.__data[0]), std::addressof(__value.__data[0]) + __bytes, std::move(__out_it));
165 return __out_it;
166}
167
156# if _LIBCPP_HAS_UNICODE
157 if constexpr (same_as<_CharT, char>) {
158 std::size_t __bytes = std::countl_one(static_cast<unsigned char>(__value.__data[0]));
159 if (__bytes == 0)
160 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
161
162 for (size_t __i = 0; __i < __n; ++__i)
163 __out_it = __formatter::__copy(
164 std::addressof(__value.__data[0]), std::addressof(__value.__data[0]) + __bytes, std::move(__out_it));
165 return __out_it;
168166# if _LIBCPP_HAS_WIDE_CHARACTERS
169template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
170 requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
171_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
172 if (!__unicode::__is_high_surrogate(__value.__data[0]))
173 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
174
175 for (size_t __i = 0; __i < __n; ++__i)
176 __out_it = __formatter::__copy(
177 std::addressof(__value.__data[0]), std::addressof(__value.__data[0]) + 2, std::move(__out_it));
178 return __out_it;
179}
180
181template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
182 requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
183_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
184 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
185}
167 } else if constexpr (same_as<_CharT, wchar_t>) {
168 if constexpr (sizeof(wchar_t) == 2) {
169 if (!__unicode::__is_high_surrogate(__value.__data[0]))
170 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
171
172 for (size_t __i = 0; __i < __n; ++__i)
173 __out_it = __formatter::__copy(
174 std::addressof(__value.__data[0]), std::addressof(__value.__data[0]) + 2, std::move(__out_it));
175 return __out_it;
176 } else if constexpr (sizeof(wchar_t) == 4) {
177 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
178 } else {
179 static_assert(false, "expected sizeof(wchar_t) to be 2 or 4");
180 }
186181# endif // _LIBCPP_HAS_WIDE_CHARACTERS
187# else // _LIBCPP_HAS_UNICODE
188template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
189_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
182 } else {
183 static_assert(false, "Unexpected CharT");
184 }
185# else // _LIBCPP_HAS_UNICODE
190186 return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
187# endif // _LIBCPP_HAS_UNICODE
191188}
192# endif // _LIBCPP_HAS_UNICODE
193189
194190/// Writes the input to the output with the required padding.
195191///
lib/libcxx/include/__format/indic_conjunct_break_table.h+3-2
......@@ -61,7 +61,7 @@
6161#ifndef _LIBCPP___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
6262#define _LIBCPP___FORMAT_INDIC_CONJUNCT_BREAK_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>
6767#include <__iterator/access.h>
......@@ -531,7 +531,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[403] = {
531531 // size. Then the upper bound for code point 3 will return the entry after
532532 // 0x1810. After moving to the previous entry the algorithm arrives at the
533533 // correct entry.
534 ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
534 ptrdiff_t __i =
535 std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
535536 if (__i == 0)
536537 return __property::__none;
537538
lib/libcxx/include/__format/range_default_formatter.h+2-41
......@@ -16,10 +16,11 @@
1616
1717#include <__algorithm/ranges_copy.h>
1818#include <__chrono/statically_widen.h>
19#include <__concepts/same_as.h>
2019#include <__config>
2120#include <__format/concepts.h>
21#include <__format/fmt_pair_like.h>
2222#include <__format/formatter.h>
23#include <__format/range_format.h>
2324#include <__format/range_formatter.h>
2425#include <__iterator/back_insert_iterator.h>
2526#include <__ranges/concepts.h>
......@@ -42,51 +43,11 @@ concept __const_formattable_range =
4243template <class _Rp, class _CharT>
4344using __fmt_maybe_const _LIBCPP_NODEBUG = conditional_t<__const_formattable_range<_Rp, _CharT>, const _Rp, _Rp>;
4445
45_LIBCPP_DIAGNOSTIC_PUSH
46_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow")
47_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow")
48// This shadows map, set, and string.
49enum class range_format { disabled, map, set, sequence, string, debug_string };
50_LIBCPP_DIAGNOSTIC_POP
51
5246// There is no definition of this struct, it's purely intended to be used to
5347// generate diagnostics.
5448template <class _Rp>
5549struct __instantiated_the_primary_template_of_format_kind;
5650
57template <class _Rp>
58constexpr range_format format_kind = [] {
59 // [format.range.fmtkind]/1
60 // A program that instantiates the primary template of format_kind is ill-formed.
61 static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type");
62 return range_format::disabled;
63}();
64
65template <ranges::input_range _Rp>
66 requires same_as<_Rp, remove_cvref_t<_Rp>>
67inline constexpr range_format format_kind<_Rp> = [] {
68 // [format.range.fmtkind]/2
69
70 // 2.1 If same_as<remove_cvref_t<ranges::range_reference_t<R>>, R> is true,
71 // Otherwise format_kind<R> is range_format::disabled.
72 if constexpr (same_as<remove_cvref_t<ranges::range_reference_t<_Rp>>, _Rp>)
73 return range_format::disabled;
74 // 2.2 Otherwise, if the qualified-id R::key_type is valid and denotes a type:
75 else if constexpr (requires { typename _Rp::key_type; }) {
76 // 2.2.1 If the qualified-id R::mapped_type is valid and denotes a type ...
77 if constexpr (requires { typename _Rp::mapped_type; } &&
78 // 2.2.1 ... If either U is a specialization of pair or U is a specialization
79 // of tuple and tuple_size_v<U> == 2
80 __fmt_pair_like<remove_cvref_t<ranges::range_reference_t<_Rp>>>)
81 return range_format::map;
82 else
83 // 2.2.2 Otherwise format_kind<R> is range_format::set.
84 return range_format::set;
85 } else
86 // 2.3 Otherwise, format_kind<R> is range_format::sequence.
87 return range_format::sequence;
88}();
89
9051template <range_format _Kp, ranges::input_range _Rp, class _CharT>
9152struct __range_default_formatter;
9253
lib/libcxx/include/__format/range_format.h created+71
......@@ -0,0 +1,71 @@
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_RANGE_FORMAT_H
11#define _LIBCPP___FORMAT_RANGE_FORMAT_H
12
13#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
14# pragma GCC system_header
15#endif
16
17#include <__concepts/same_as.h>
18#include <__config>
19#include <__format/fmt_pair_like.h>
20#include <__ranges/concepts.h>
21#include <__type_traits/remove_cvref.h>
22
23_LIBCPP_BEGIN_NAMESPACE_STD
24
25#if _LIBCPP_STD_VER >= 23
26
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}();
41
42template <ranges::input_range _Rp>
43 requires same_as<_Rp, remove_cvref_t<_Rp>>
44inline constexpr range_format format_kind<_Rp> = [] {
45 // [format.range.fmtkind]/2
46
47 // 2.1 If same_as<remove_cvref_t<ranges::range_reference_t<R>>, R> is true,
48 // Otherwise format_kind<R> is range_format::disabled.
49 if constexpr (same_as<remove_cvref_t<ranges::range_reference_t<_Rp>>, _Rp>)
50 return range_format::disabled;
51 // 2.2 Otherwise, if the qualified-id R::key_type is valid and denotes a type:
52 else if constexpr (requires { typename _Rp::key_type; }) {
53 // 2.2.1 If the qualified-id R::mapped_type is valid and denotes a type ...
54 if constexpr (requires { typename _Rp::mapped_type; } &&
55 // 2.2.1 ... If either U is a specialization of pair or U is a specialization
56 // of tuple and tuple_size_v<U> == 2
57 __fmt_pair_like<remove_cvref_t<ranges::range_reference_t<_Rp>>>)
58 return range_format::map;
59 else
60 // 2.2.2 Otherwise format_kind<R> is range_format::set.
61 return range_format::set;
62 } else
63 // 2.3 Otherwise, format_kind<R> is range_format::sequence.
64 return range_format::sequence;
65}();
66
67#endif // _LIBCPP_STD_VER >= 23
68
69_LIBCPP_END_NAMESPACE_STD
70
71#endif
lib/libcxx/include/__format/range_formatter.h+1
......@@ -20,6 +20,7 @@
2020#include <__config>
2121#include <__format/buffer.h>
2222#include <__format/concepts.h>
23#include <__format/fmt_pair_like.h>
2324#include <__format/format_context.h>
2425#include <__format/format_error.h>
2526#include <__format/formatter.h>
lib/libcxx/include/__format/width_estimation_table.h+4-2
......@@ -61,9 +61,10 @@
6161#ifndef _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H
6262#define _LIBCPP___FORMAT_WIDTH_ESTIMATION_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)
......@@ -255,7 +256,8 @@ inline constexpr uint32_t __table_upper_bound = 0x0003fffd;
255256 if (__code_point < (__entries[0] >> 14))
256257 return 1;
257258
258 ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries;
259 ptrdiff_t __i =
260 std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 14) | 0x3fffu) - __entries;
259261 if (__i == 0)
260262 return 1;
261263
lib/libcxx/include/__functional/bind.h+10-15
......@@ -81,17 +81,12 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_w
8181 return __t.get();
8282}
8383
84template <class _Ti, class... _Uj, size_t... _Indx>
85inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __invoke_result_t<_Ti&, _Uj...>
86__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) {
87 return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
88}
89
9084template <class _Ti, class... _Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
9185inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __invoke_result_t<_Ti&, _Uj...>
9286__mu(_Ti& __ti, tuple<_Uj...>& __uj) {
93 typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
94 return std::__mu_expand(__ti, __uj, __indices());
87 return [&]<size_t... _Indices>(__index_sequence<_Indices...>) -> __invoke_result_t<_Ti&, _Uj...> {
88 return __ti(std::forward<_Uj>(std::get<_Indices>(__uj))...);
89 }(__index_sequence_for<_Uj...>{});
9590}
9691
9792template <bool _IsPh, class _Ti, class _Uj>
......@@ -191,7 +186,7 @@ struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> {
191186
192187template <class _Fp, class _BoundArgs, size_t... _Indx, class _Args>
193188inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fp, _BoundArgs, _Args>::type
194__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) {
189__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __index_sequence<_Indx...>, _Args&& __args) {
195190 return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
196191}
197192
......@@ -205,8 +200,6 @@ private:
205200 _Fd __f_;
206201 _Td __bound_args_;
207202
208 typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
209
210203public:
211204 template <
212205 class _Gp,
......@@ -219,14 +212,16 @@ public:
219212 template <class... _Args>
220213 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
221214 operator()(_Args&&... __args) {
222 return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
215 return std::__apply_functor(
216 __f_, __bound_args_, __index_sequence_for<_BoundArgs...>(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
223217 }
224218
225219 template <class... _Args>
226220 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
227221 typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
228222 operator()(_Args&&... __args) const {
229 return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
223 return std::__apply_functor(
224 __f_, __bound_args_, __index_sequence_for<_BoundArgs...>(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
230225 }
231226};
232227
......@@ -273,14 +268,14 @@ template <class _Rp, class _Fp, class... _BoundArgs>
273268struct is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
274269
275270template <class _Fp, class... _BoundArgs>
276inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind<_Fp, _BoundArgs...>
271[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind<_Fp, _BoundArgs...>
277272bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
278273 typedef __bind<_Fp, _BoundArgs...> type;
279274 return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
280275}
281276
282277template <class _Rp, class _Fp, class... _BoundArgs>
283inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind_r<_Rp, _Fp, _BoundArgs...>
278[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind_r<_Rp, _Fp, _BoundArgs...>
284279bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
285280 typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
286281 return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
lib/libcxx/include/__functional/bind_back.h+1-1
......@@ -64,7 +64,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) n
6464
6565# if _LIBCPP_STD_VER >= 23
6666template <class _Fn, class... _Args>
67_LIBCPP_HIDE_FROM_ABI constexpr auto bind_back(_Fn&& __f, _Args&&... __args) {
67[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto bind_back(_Fn&& __f, _Args&&... __args) {
6868 static_assert(is_constructible_v<decay_t<_Fn>, _Fn>, "bind_back requires decay_t<F> to be constructible from F");
6969 static_assert(is_move_constructible_v<decay_t<_Fn>>, "bind_back requires decay_t<F> to be move constructible");
7070 static_assert((is_constructible_v<decay_t<_Args>, _Args> && ...),
lib/libcxx/include/__functional/bind_front.h+1-1
......@@ -43,7 +43,7 @@ struct __bind_front_t : __perfect_forward<__bind_front_op, _Fn, _BoundArgs...> {
4343template <class _Fn, class... _Args>
4444 requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
4545 (is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
46_LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
46[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
4747 return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
4848}
4949
lib/libcxx/include/__functional/function.h+57-75
......@@ -15,16 +15,14 @@
1515#include <__cstddef/nullptr_t.h>
1616#include <__exception/exception.h>
1717#include <__functional/binary_function.h>
18#include <__functional/invoke.h>
1918#include <__functional/unary_function.h>
2019#include <__memory/addressof.h>
2120#include <__type_traits/aligned_storage.h>
2221#include <__type_traits/decay.h>
23#include <__type_traits/is_core_convertible.h>
22#include <__type_traits/invoke.h>
2423#include <__type_traits/is_scalar.h>
2524#include <__type_traits/is_trivially_constructible.h>
2625#include <__type_traits/is_trivially_destructible.h>
27#include <__type_traits/is_void.h>
2826#include <__type_traits/strip_signature.h>
2927#include <__utility/forward.h>
3028#include <__utility/move.h>
......@@ -95,29 +93,29 @@ template <class _Rp, class _A1, class _A2>
9593struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
9694
9795template <class _Fp>
98_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp const&) {
99 return true;
96_LIBCPP_HIDE_FROM_ABI bool __is_null(_Fp const&) {
97 return false;
10098}
10199
102100template <class _Fp>
103_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp* __ptr) {
104 return __ptr;
101_LIBCPP_HIDE_FROM_ABI bool __is_null(_Fp* __ptr) {
102 return !__ptr;
105103}
106104
107105template <class _Ret, class _Class>
108_LIBCPP_HIDE_FROM_ABI bool __not_null(_Ret _Class::*__ptr) {
109 return __ptr;
106_LIBCPP_HIDE_FROM_ABI bool __is_null(_Ret _Class::* __ptr) {
107 return !__ptr;
110108}
111109
112110template <class _Fp>
113_LIBCPP_HIDE_FROM_ABI bool __not_null(function<_Fp> const& __f) {
114 return !!__f;
111_LIBCPP_HIDE_FROM_ABI bool __is_null(function<_Fp> const& __f) {
112 return !__f;
115113}
116114
117115# if __has_extension(blocks)
118116template <class _Rp, class... _Args>
119_LIBCPP_HIDE_FROM_ABI bool __not_null(_Rp (^__p)(_Args...)) {
120 return __p;
117_LIBCPP_HIDE_FROM_ABI bool __is_null(_Rp (^__p)(_Args...)) {
118 return !__p;
121119}
122120# endif
123121
......@@ -206,12 +204,13 @@ public:
206204 _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f) : __f_(nullptr) {
207205 typedef __function::__func<_Fp, _Rp(_ArgTypes...)> _Fun;
208206
209 if (__function::__not_null(__f)) {
210 if (sizeof(_Fun) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value) {
211 __f_ = ::new (std::addressof(__buf_)) _Fun(std::move(__f));
212 } else {
213 __f_ = new _Fun(std::move(__f));
214 }
207 if (__function::__is_null(__f))
208 return;
209
210 if (sizeof(_Fun) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value) {
211 __f_ = ::new (std::addressof(__buf_)) _Fun(std::move(__f));
212 } else {
213 __f_ = new _Fun(std::move(__f));
215214 }
216215 }
217216
......@@ -356,7 +355,31 @@ struct __policy {
356355 // type.
357356 template <typename _Fun>
358357 _LIBCPP_HIDE_FROM_ABI static const __policy* __create() {
359 return __choose_policy<_Fun>(__use_small_storage<_Fun>());
358 if constexpr (__use_small_storage<_Fun>::value) {
359 static constexpr __policy __policy = {
360 nullptr,
361 nullptr,
362 false,
363# if _LIBCPP_HAS_RTTI
364 &typeid(_Fun)
365# else
366 nullptr
367# endif
368 };
369 return &__policy;
370 } else {
371 static constexpr __policy __policy = {
372 std::addressof(__large_clone<_Fun>),
373 std::addressof(__large_destroy<_Fun>),
374 false,
375# if _LIBCPP_HAS_RTTI
376 &typeid(_Fun)
377# else
378 nullptr
379# endif
380 };
381 return &__policy;
382 }
360383 }
361384
362385 _LIBCPP_HIDE_FROM_ABI static const __policy* __create_empty() {
......@@ -384,36 +407,6 @@ private:
384407 _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) {
385408 delete static_cast<_Fun*>(__s);
386409 }
387
388 template <typename _Fun>
389 _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ false_type) {
390 static constexpr __policy __policy = {
391 std::addressof(__large_clone<_Fun>),
392 std::addressof(__large_destroy<_Fun>),
393 false,
394# if _LIBCPP_HAS_RTTI
395 &typeid(_Fun)
396# else
397 nullptr
398# endif
399 };
400 return &__policy;
401 }
402
403 template <typename _Fun>
404 _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ true_type) {
405 static constexpr __policy __policy = {
406 nullptr,
407 nullptr,
408 false,
409# if _LIBCPP_HAS_RTTI
410 &typeid(_Fun)
411# else
412 nullptr
413# endif
414 };
415 return &__policy;
416 }
417410};
418411
419412// Used to choose between perfect forwarding or pass-by-value. Pass-by-value is
......@@ -455,14 +448,15 @@ public:
455448
456449 template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
457450 _LIBCPP_HIDE_FROM_ABI explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) {
458 if (__function::__not_null(__f)) {
459 __func_ = __call_func<_Fp>;
460 __policy_ = __policy::__create<_Fp>();
461 if (__use_small_storage<_Fp>()) {
462 ::new ((void*)&__buf_.__small) _Fp(std::move(__f));
463 } else {
464 __buf_.__large = ::new _Fp(std::move(__f));
465 }
451 if (__function::__is_null(__f))
452 return;
453
454 __func_ = __call_func<_Fp>;
455 __policy_ = __policy::__create<_Fp>();
456 if (__use_small_storage<_Fp>()) {
457 ::new ((void*)&__buf_.__small) _Fp(std::move(__f));
458 } else {
459 __buf_.__large = ::new _Fp(std::move(__f));
466460 }
467461 }
468462
......@@ -615,21 +609,9 @@ class function<_Rp(_ArgTypes...)>
615609
616610 __func __f_;
617611
618 template <class _Fp,
619 bool = _And<_IsNotSame<__remove_cvref_t<_Fp>, function>, __is_invocable<_Fp, _ArgTypes...> >::value>
620 struct __callable;
621 template <class _Fp>
622 struct __callable<_Fp, true> {
623 static const bool value =
624 is_void<_Rp>::value || __is_core_convertible<__invoke_result_t<_Fp, _ArgTypes...>, _Rp>::value;
625 };
626 template <class _Fp>
627 struct __callable<_Fp, false> {
628 static const bool value = false;
629 };
630
631612 template <class _Fp>
632 using _EnableIfLValueCallable _LIBCPP_NODEBUG = __enable_if_t<__callable<_Fp&>::value>;
613 using _EnableIfLValueCallable _LIBCPP_NODEBUG = __enable_if_t<
614 _And<_IsNotSame<__remove_cvref_t<_Fp>, function>, __is_invocable_r<_Rp, _Fp&, _ArgTypes...>>::value>;
633615
634616public:
635617 typedef _Rp result_type;
......@@ -690,11 +672,11 @@ public:
690672
691673# if _LIBCPP_HAS_RTTI
692674 // function target access:
693 _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
675 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
694676 template <typename _Tp>
695 _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
677 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
696678 template <typename _Tp>
697 _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
679 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
698680# endif // _LIBCPP_HAS_RTTI
699681};
700682
lib/libcxx/include/__functional/hash.h+1-10
......@@ -433,13 +433,10 @@ struct __hash_impl<long double> : __scalar_hash<long double> {
433433template <class _Tp>
434434struct hash : public __hash_impl<_Tp> {};
435435
436#if _LIBCPP_STD_VER >= 17
437
438436template <>
439437struct hash<nullptr_t> : public __unary_function<nullptr_t, size_t> {
440 _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
438 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
441439};
442#endif
443440
444441#ifndef _LIBCPP_CXX03_LANG
445442template <class _Key, class _Hash>
......@@ -452,18 +449,12 @@ template <class _Key, class _Hash = hash<_Key> >
452449using __has_enabled_hash _LIBCPP_NODEBUG =
453450 integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >;
454451
455# if _LIBCPP_STD_VER >= 17
456452template <class _Type, class>
457453using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
458454
459455template <class _Type, class... _Keys>
460456using __enable_hash_helper _LIBCPP_NODEBUG =
461457 __enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >;
462# else
463template <class _Type, class...>
464using __enable_hash_helper _LIBCPP_NODEBUG = _Type;
465# endif
466
467458#endif // !_LIBCPP_CXX03_LANG
468459
469460_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__functional/identity.h+1-1
......@@ -44,7 +44,7 @@ struct __is_identity<reference_wrapper<const __identity> > : true_type {};
4444
4545struct identity {
4646 template <class _Tp>
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept {
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_LIBCPP_LIFETIMEBOUND _Tp&& __t) const noexcept {
4848 return std::forward<_Tp>(__t);
4949 }
5050
lib/libcxx/include/__functional/is_transparent.h+8
......@@ -29,6 +29,14 @@ inline const bool __is_transparent_v<_Tp, _Key, __void_t<typename _Tp::is_transp
2929
3030#endif
3131
32// Two types are considered transparently comparable if `comparator(key, arg)` is equivalent to `comparator(key,
33// <implicit cast to KeyT>(arg))`.
34//
35// This is different from `__is_transparent_v`, which is only a property of the comparator and doesn't provide
36// additional semantic guarantees.
37template <class _Comparator, class _KeyT, class _Arg, class = void>
38inline const bool __is_transparently_comparable_v = false;
39
3240_LIBCPP_END_NAMESPACE_STD
3341
3442#endif // _LIBCPP___FUNCTIONAL_IS_TRANSPARENT
lib/libcxx/include/__functional/mem_fn.h+2-1
......@@ -43,7 +43,8 @@ public:
4343};
4444
4545template <class _Rp, class _Tp>
46inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::*__pm) _NOEXCEPT {
46[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*>
47mem_fn(_Rp _Tp::* __pm) _NOEXCEPT {
4748 return __mem_fn<_Rp _Tp::*>(__pm);
4849}
4950
lib/libcxx/include/__functional/operations.h+18
......@@ -15,7 +15,9 @@
1515#include <__functional/unary_function.h>
1616#include <__fwd/functional.h>
1717#include <__type_traits/desugars_to.h>
18#include <__type_traits/is_generic_transparent_comparator.h>
1819#include <__type_traits/is_integral.h>
20#include <__type_traits/make_transparent.h>
1921#include <__utility/forward.h>
2022
2123#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -377,6 +379,14 @@ struct less<void> {
377379 typedef void is_transparent;
378380};
379381
382template <class _Tp>
383struct __make_transparent<_Tp, less<_Tp> > {
384 using type _LIBCPP_NODEBUG = less<>;
385};
386
387template <>
388inline const bool __is_generic_transparent_comparator_v<less<>> = true;
389
380390template <class _Tp, class _Up>
381391inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Up> = true;
382392
......@@ -466,6 +476,14 @@ struct greater<void> {
466476
467477template <class _Tp, class _Up>
468478inline const bool __desugars_to_v<__greater_tag, greater<>, _Tp, _Up> = true;
479
480template <class _Tp>
481struct __make_transparent<_Tp, greater<_Tp>> {
482 using type _LIBCPP_NODEBUG = greater<>;
483};
484
485template <>
486inline const bool __is_generic_transparent_comparator_v<greater<>> = true;
469487#endif
470488
471489// Logical operations
lib/libcxx/include/__functional/ranges_operations.h+7
......@@ -14,6 +14,7 @@
1414#include <__concepts/totally_ordered.h>
1515#include <__config>
1616#include <__type_traits/desugars_to.h>
17#include <__type_traits/is_generic_transparent_comparator.h>
1718#include <__utility/forward.h>
1819
1920#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -108,6 +109,12 @@ inline const bool __desugars_to_v<__less_tag, ranges::less, _Tp, _Up> = true;
108109template <class _Tp, class _Up>
109110inline const bool __desugars_to_v<__greater_tag, ranges::greater, _Tp, _Up> = true;
110111
112template <>
113inline const bool __is_generic_transparent_comparator_v<ranges::less> = true;
114
115template <>
116inline const bool __is_generic_transparent_comparator_v<ranges::greater> = true;
117
111118#endif // _LIBCPP_STD_VER >= 20
112119
113120_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__functional/reference_wrapper.h+7-5
......@@ -58,7 +58,7 @@ public:
5858
5959 // access
6060 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator type&() const _NOEXCEPT { return *__f_; }
61 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 type& get() const _NOEXCEPT { return *__f_; }
61 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 type& get() const _NOEXCEPT { return *__f_; }
6262
6363 // invoke
6464 template <class... _ArgTypes>
......@@ -128,23 +128,25 @@ reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
128128#endif
129129
130130template <class _Tp>
131inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp> ref(_Tp& __t) _NOEXCEPT {
131[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
132_LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp> ref(_Tp& __t) _NOEXCEPT {
132133 return reference_wrapper<_Tp>(__t);
133134}
134135
135136template <class _Tp>
136inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp>
137[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp>
137138ref(reference_wrapper<_Tp> __t) _NOEXCEPT {
138139 return __t;
139140}
140141
141142template <class _Tp>
142inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp> cref(const _Tp& __t) _NOEXCEPT {
143[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp>
144cref(const _Tp& __t) _NOEXCEPT {
143145 return reference_wrapper<const _Tp>(__t);
144146}
145147
146148template <class _Tp>
147inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp>
149[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp>
148150cref(reference_wrapper<_Tp> __t) _NOEXCEPT {
149151 return __t;
150152}
lib/libcxx/include/__functional/weak_result_type.h+14-28
......@@ -13,9 +13,9 @@
1313#include <__config>
1414#include <__functional/binary_function.h>
1515#include <__functional/unary_function.h>
16#include <__type_traits/integral_constant.h>
1716#include <__type_traits/invoke.h>
1817#include <__type_traits/is_same.h>
18#include <__type_traits/void_t.h>
1919#include <__utility/declval.h>
2020
2121#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -24,50 +24,36 @@
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
2626
27template <class _Tp>
28struct __has_result_type {
29private:
30 template <class _Up>
31 static false_type __test(...);
32 template <class _Up>
33 static true_type __test(typename _Up::result_type* = 0);
27template <class _Tp, class = void>
28inline const bool __has_result_type_v = false;
3429
35public:
36 static const bool value = decltype(__test<_Tp>(0))::value;
37};
30template <class _Tp>
31inline const bool __has_result_type_v<_Tp, __void_t<typename _Tp::result_type*> > = true;
3832
3933// __weak_result_type
4034
4135template <class _Tp>
4236struct __derives_from_unary_function {
4337private:
44 struct __two {
45 char __lx;
46 char __lxx;
47 };
48 static __two __test(...);
38 static void __find_base(...);
4939 template <class _Ap, class _Rp>
50 static __unary_function<_Ap, _Rp> __test(const volatile __unary_function<_Ap, _Rp>*);
40 static __unary_function<_Ap, _Rp> __find_base(const volatile __unary_function<_Ap, _Rp>*);
5141
5242public:
53 static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
54 typedef decltype(__test((_Tp*)0)) type;
43 using type = decltype(__find_base(static_cast<_Tp*>(nullptr)));
44 static const bool value = !is_same<type, void>::value;
5545};
5646
5747template <class _Tp>
5848struct __derives_from_binary_function {
5949private:
60 struct __two {
61 char __lx;
62 char __lxx;
63 };
64 static __two __test(...);
50 static void __find_base(...);
6551 template <class _A1, class _A2, class _Rp>
66 static __binary_function<_A1, _A2, _Rp> __test(const volatile __binary_function<_A1, _A2, _Rp>*);
52 static __binary_function<_A1, _A2, _Rp> __find_base(const volatile __binary_function<_A1, _A2, _Rp>*);
6753
6854public:
69 static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
70 typedef decltype(__test((_Tp*)0)) type;
55 using type = decltype(__find_base(static_cast<_Tp*>(nullptr)));
56 static const bool value = !is_same<type, void>::value;
7157};
7258
7359template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
......@@ -85,7 +71,7 @@ struct __maybe_derive_from_binary_function // bool is true
8571template <class _Tp>
8672struct __maybe_derive_from_binary_function<_Tp, false> {};
8773
88template <class _Tp, bool = __has_result_type<_Tp>::value>
74template <class _Tp, bool = __has_result_type_v<_Tp> >
8975struct __weak_result_type_imp // bool is true
9076 : public __maybe_derive_from_unary_function<_Tp>,
9177 public __maybe_derive_from_binary_function<_Tp> {
lib/libcxx/include/__fwd/ios.h+1-1
......@@ -31,7 +31,7 @@ using wios = basic_ios<wchar_t>;
3131template <class _CharT, class _Traits>
3232class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
3333
34#if defined(_NEWLIB_VERSION)
34#if _LIBCPP_LIBC_NEWLIB
3535// On newlib, off_t is 'long int'
3636using streamoff = long int; // for char_traits in <string>
3737#else
lib/libcxx/include/__fwd/tuple.h+14
......@@ -21,11 +21,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121template <size_t, class>
2222struct tuple_element;
2323
24template <size_t _Np, class _Tp>
25using __tuple_element_t _LIBCPP_NODEBUG = typename tuple_element<_Np, _Tp>::type;
26
2427#ifndef _LIBCPP_CXX03_LANG
2528
2629template <class...>
2730class tuple;
2831
32template <class>
33inline const bool __is_tuple_v = false;
34
35template <class... _Tp>
36inline const bool __is_tuple_v<tuple<_Tp...>> = true;
37
38template <size_t _Ip, class... _Tp>
39struct tuple_element<_Ip, tuple<_Tp...> > {
40 using type _LIBCPP_NODEBUG = __type_pack_element<_Ip, _Tp...>;
41};
42
2943template <class>
3044struct tuple_size;
3145
lib/libcxx/include/__hash_table+371-357
......@@ -10,6 +10,7 @@
1010#ifndef _LIBCPP___HASH_TABLE
1111#define _LIBCPP___HASH_TABLE
1212
13#include <__algorithm/fill_n.h>
1314#include <__algorithm/max.h>
1415#include <__algorithm/min.h>
1516#include <__assert>
......@@ -28,7 +29,6 @@
2829#include <__memory/swap_allocator.h>
2930#include <__memory/unique_ptr.h>
3031#include <__new/launder.h>
31#include <__type_traits/can_extract_key.h>
3232#include <__type_traits/copy_cvref.h>
3333#include <__type_traits/enable_if.h>
3434#include <__type_traits/invoke.h>
......@@ -44,7 +44,9 @@
4444#include <__utility/forward.h>
4545#include <__utility/move.h>
4646#include <__utility/pair.h>
47#include <__utility/scope_guard.h>
4748#include <__utility/swap.h>
49#include <__utility/try_key_extraction.h>
4850#include <limits>
4951
5052#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -81,18 +83,6 @@ struct __hash_node_base {
8183 typedef _NodePtr __node_pointer;
8284 typedef __node_base_pointer __next_pointer;
8385
84// TODO(LLVM 22): Remove this check
85#ifndef _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
86 static_assert(sizeof(__node_base_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) ==
87 _LIBCPP_ALIGNOF(__node_pointer),
88 "It looks like you are using std::__hash_table (an implementation detail for the unordered containers) "
89 "with a fancy pointer type that thas a different representation depending on whether it points to a "
90 "__hash_table base pointer or a __hash_table node pointer (both of which are implementation details of "
91 "the standard library). This means that your ABI is being broken between LLVM 19 and LLVM 20. If you "
92 "don't care about your ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to "
93 "silence this diagnostic.");
94#endif
95
9686 __next_pointer __next_;
9787
9888 _LIBCPP_HIDE_FROM_ABI __next_pointer __ptr() _NOEXCEPT {
......@@ -122,6 +112,19 @@ struct __get_hash_node_value_type<__hash_value_type<_Key, _Tp> > {
122112template <class _Tp>
123113using __get_hash_node_value_type_t _LIBCPP_NODEBUG = typename __get_hash_node_value_type<_Tp>::type;
124114
115template <class _Tp>
116struct __get_hash_node_key_type {
117 using type _LIBCPP_NODEBUG = _Tp;
118};
119
120template <class _Key, class _Tp>
121struct __get_hash_node_key_type<__hash_value_type<_Key, _Tp> > {
122 using type _LIBCPP_NODEBUG = _Key;
123};
124
125template <class _Tp>
126using __get_hash_node_key_type_t _LIBCPP_NODEBUG = typename __get_hash_node_key_type<_Tp>::type;
127
125128template <class _Tp, class _VoidPtr>
126129struct __hash_node : public __hash_node_base< __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > > {
127130 using __node_value_type _LIBCPP_NODEBUG = __get_hash_node_value_type_t<_Tp>;
......@@ -152,7 +155,12 @@ public:
152155 }
153156#endif
154157
155 _LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {}
158 template <class _Alloc, class... _Args>
159 _LIBCPP_HIDE_FROM_ABI explicit __hash_node(size_t __hash, _Alloc& __na, _Args&&... __args)
160 : _Base(nullptr), __hash_(__hash) {
161 allocator_traits<_Alloc>::construct(__na, std::addressof(__get_value()), std::forward<_Args>(__args)...);
162 }
163
156164 _LIBCPP_HIDE_FROM_ABI ~__hash_node() {}
157165};
158166
......@@ -182,85 +190,16 @@ class __hash_map_iterator;
182190template <class _HashIterator>
183191class __hash_map_const_iterator;
184192
185template <class _Tp>
186struct __hash_key_value_types {
187 static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, "");
188 typedef _Tp key_type;
189 typedef _Tp __node_value_type;
190 typedef _Tp __container_value_type;
191 static const bool __is_map = false;
192
193 _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Tp const& __v) { return __v; }
194 _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; }
195 _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) { return std::addressof(__n); }
196 _LIBCPP_HIDE_FROM_ABI static __container_value_type&& __move(__node_value_type& __v) { return std::move(__v); }
197};
198
199template <class _Key, class _Tp>
200struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
201 typedef _Key key_type;
202 typedef _Tp mapped_type;
203 typedef __hash_value_type<_Key, _Tp> __node_value_type;
204 typedef pair<const _Key, _Tp> __container_value_type;
205 typedef __container_value_type __map_value_type;
206 static const bool __is_map = true;
207
208 _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(__container_value_type const& __v) { return __v.first; }
209
210 template <class _Up, __enable_if_t<is_same<__remove_cvref_t<_Up>, __node_value_type>::value, int> = 0>
211 _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
212 return __t.__get_value();
213 }
214
215 template <class _Up, __enable_if_t<is_same<__remove_cvref_t<_Up>, __container_value_type>::value, int> = 0>
216 _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
217 return __t;
218 }
219
220 _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__container_value_type& __n) {
221 return std::addressof(__n);
222 }
223 _LIBCPP_HIDE_FROM_ABI static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); }
224};
225
226template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>, bool = _KVTypes::__is_map>
227struct __hash_map_pointer_types {};
228
229template <class _Tp, class _AllocPtr, class _KVTypes>
230struct __hash_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> {
231 typedef typename _KVTypes::__map_value_type _Mv;
232 typedef __rebind_pointer_t<_AllocPtr, _Mv> __map_value_type_pointer;
233 typedef __rebind_pointer_t<_AllocPtr, const _Mv> __const_map_value_type_pointer;
234};
235
236193template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type>
237194struct __hash_node_types;
238195
239196template <class _NodePtr, class _Tp, class _VoidPtr>
240struct __hash_node_types<_NodePtr, __hash_node<_Tp, _VoidPtr> >
241 : public __hash_key_value_types<_Tp>,
242 __hash_map_pointer_types<_Tp, _VoidPtr>
243
244{
245 typedef __hash_key_value_types<_Tp> __base;
246
247public:
248 typedef ptrdiff_t difference_type;
249 typedef size_t size_type;
250
251 typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
252
197struct __hash_node_types<_NodePtr, __hash_node<_Tp, _VoidPtr> > {
253198 typedef typename pointer_traits<_NodePtr>::element_type __node_type;
254 typedef _NodePtr __node_pointer;
255199
256 typedef __hash_node_base<__node_pointer> __node_base_type;
257 typedef __rebind_pointer_t<_NodePtr, __node_base_type> __node_base_pointer;
258
259 typedef typename __node_base_type::__next_pointer __next_pointer;
200 typedef typename __hash_node_base<_NodePtr>::__next_pointer __next_pointer;
260201
261202 using __node_value_type _LIBCPP_NODEBUG = __get_hash_node_value_type_t<_Tp>;
262 typedef __rebind_pointer_t<_VoidPtr, __node_value_type> __node_value_type_pointer;
263 typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> __const_node_value_type_pointer;
264203
265204private:
266205 static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
......@@ -281,13 +220,6 @@ struct __hash_node_types_from_iterator<__hash_local_iterator<_NodePtr> > : __has
281220template <class _NodePtr>
282221struct __hash_node_types_from_iterator<__hash_const_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {};
283222
284template <class _NodeValueTp, class _VoidPtr>
285struct __make_hash_node_types {
286 typedef __hash_node<_NodeValueTp, _VoidPtr> _NodeTp;
287 typedef __rebind_pointer_t<_VoidPtr, _NodeTp> _NodePtr;
288 typedef __hash_node_types<_NodePtr> type;
289};
290
291223template <class _NodePtr>
292224class __hash_iterator {
293225 typedef __hash_node_types<_NodePtr> _NodeTypes;
......@@ -299,9 +231,9 @@ class __hash_iterator {
299231public:
300232 typedef forward_iterator_tag iterator_category;
301233 typedef typename _NodeTypes::__node_value_type value_type;
302 typedef typename _NodeTypes::difference_type difference_type;
234 using difference_type = ptrdiff_t;
303235 typedef value_type& reference;
304 typedef typename _NodeTypes::__node_value_type_pointer pointer;
236 using pointer = __rebind_pointer_t<_NodePtr, value_type>;
305237
306238 _LIBCPP_HIDE_FROM_ABI __hash_iterator() _NOEXCEPT : __node_(nullptr) {}
307239
......@@ -366,9 +298,9 @@ public:
366298
367299 typedef forward_iterator_tag iterator_category;
368300 typedef typename _NodeTypes::__node_value_type value_type;
369 typedef typename _NodeTypes::difference_type difference_type;
301 using difference_type = ptrdiff_t;
370302 typedef const value_type& reference;
371 typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
303 using pointer = __rebind_pointer_t<_NodePtr, const value_type>;
372304
373305 _LIBCPP_HIDE_FROM_ABI __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {}
374306
......@@ -431,9 +363,9 @@ class __hash_local_iterator {
431363public:
432364 typedef forward_iterator_tag iterator_category;
433365 typedef typename _NodeTypes::__node_value_type value_type;
434 typedef typename _NodeTypes::difference_type difference_type;
366 using difference_type = ptrdiff_t;
435367 typedef value_type& reference;
436 typedef typename _NodeTypes::__node_value_type_pointer pointer;
368 using pointer = __rebind_pointer_t<_NodePtr, value_type>;
437369
438370 _LIBCPP_HIDE_FROM_ABI __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {}
439371
......@@ -509,9 +441,9 @@ public:
509441
510442 typedef forward_iterator_tag iterator_category;
511443 typedef typename _NodeTypes::__node_value_type value_type;
512 typedef typename _NodeTypes::difference_type difference_type;
444 using difference_type = ptrdiff_t;
513445 typedef const value_type& reference;
514 typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
446 using pointer = __rebind_pointer_t<_ConstNodePtr, const value_type>;
515447
516448 _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {}
517449
......@@ -617,8 +549,6 @@ public:
617549 typedef typename __alloc_traits::pointer pointer;
618550
619551private:
620 typedef __hash_node_types<pointer> _NodeTypes;
621
622552 allocator_type& __na_;
623553
624554public:
......@@ -633,7 +563,7 @@ public:
633563
634564 _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
635565 if (__value_constructed) {
636 __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__get_value()));
566 __alloc_traits::destroy(__na_, std::addressof(__p->__get_value()));
637567 std::__destroy_at(std::addressof(*__p));
638568 }
639569 if (__p)
......@@ -684,18 +614,16 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
684614class __hash_table {
685615public:
686616 using value_type = __get_hash_node_value_type_t<_Tp>;
617 using key_type = __get_hash_node_key_type_t<_Tp>;
618
687619 typedef _Hash hasher;
688620 typedef _Equal key_equal;
689621 typedef _Alloc allocator_type;
690622
691623private:
692624 typedef allocator_traits<allocator_type> __alloc_traits;
693 typedef typename __make_hash_node_types<_Tp, typename __alloc_traits::void_pointer>::type _NodeTypes;
694625
695626public:
696 typedef typename _NodeTypes::__node_value_type __node_value_type;
697 typedef typename _NodeTypes::__container_value_type __container_value_type;
698 typedef typename _NodeTypes::key_type key_type;
699627 typedef value_type& reference;
700628 typedef const value_type& const_reference;
701629 typedef typename __alloc_traits::pointer pointer;
......@@ -703,22 +631,23 @@ public:
703631#ifndef _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
704632 typedef typename __alloc_traits::size_type size_type;
705633#else
706 typedef typename _NodeTypes::size_type size_type;
634 using size_type = size_t;
707635#endif
708 typedef typename _NodeTypes::difference_type difference_type;
636 using difference_type = ptrdiff_t;
709637
710638public:
711639 // Create __node
712640
713 typedef typename _NodeTypes::__node_type __node;
714 typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
715 typedef allocator_traits<__node_allocator> __node_traits;
716 typedef typename _NodeTypes::__void_pointer __void_pointer;
717 typedef typename _NodeTypes::__node_pointer __node_pointer;
718 typedef typename _NodeTypes::__node_pointer __node_const_pointer;
719 typedef typename _NodeTypes::__node_base_type __first_node;
720 typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
721 typedef typename _NodeTypes::__next_pointer __next_pointer;
641 using __void_pointer _LIBCPP_NODEBUG = typename __alloc_traits::void_pointer;
642
643 using __node _LIBCPP_NODEBUG = __hash_node<_Tp, __void_pointer>;
644 using __node_allocator _LIBCPP_NODEBUG = __rebind_alloc<__alloc_traits, __node>;
645 using __node_traits _LIBCPP_NODEBUG = allocator_traits<__node_allocator>;
646 using __node_pointer _LIBCPP_NODEBUG = __rebind_pointer_t<__void_pointer, __node>;
647
648 using __first_node _LIBCPP_NODEBUG = __hash_node_base<__node_pointer>;
649 using __node_base_pointer _LIBCPP_NODEBUG = __rebind_pointer_t<__void_pointer, __first_node>;
650 using __next_pointer _LIBCPP_NODEBUG = __node_base_pointer;
722651
723652private:
724653 // check for sane allocator pointer rebinding semantics. Rebinding the
......@@ -747,6 +676,38 @@ private:
747676
748677 _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; }
749678
679 _LIBCPP_HIDE_FROM_ABI void
680 __copy_construct(__next_pointer __other_iter, __next_pointer __own_iter, size_t __current_chash) {
681 auto __bucket_count = bucket_count();
682
683 for (; __other_iter; __other_iter = __other_iter->__next_) {
684 __node_holder __new_node = __construct_node_hash(__other_iter->__hash(), __other_iter->__upcast()->__get_value());
685
686 size_t __new_chash = std::__constrain_hash(__new_node->__hash(), __bucket_count);
687 if (__new_chash != __current_chash) {
688 __bucket_list_[__new_chash] = __own_iter;
689 __current_chash = __new_chash;
690 }
691
692 __own_iter->__next_ = static_cast<__next_pointer>(__new_node.release());
693 __own_iter = __own_iter->__next_;
694 }
695 }
696
697 _LIBCPP_HIDE_FROM_ABI void __copy_construct(__next_pointer __other_iter) {
698 __next_pointer __own_iter = __first_node_.__ptr();
699 {
700 __node_holder __new_node = __construct_node_hash(__other_iter->__hash(), __other_iter->__upcast()->__get_value());
701 __own_iter->__next_ = static_cast<__next_pointer>(__new_node.release());
702 }
703
704 size_t __current_chash = std::__constrain_hash(__own_iter->__next_->__hash(), bucket_count());
705 __bucket_list_[__current_chash] = __own_iter;
706 __other_iter = __other_iter->__next_;
707 __own_iter = __own_iter->__next_;
708 __copy_construct(__other_iter, __own_iter, __current_chash);
709 }
710
750711public:
751712 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
752713
......@@ -811,40 +772,66 @@ public:
811772 _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
812773 _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
813774
814 template <class _Key, class... _Args>
815 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
816
817 template <class... _Args>
818 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
819
820 template <class _Pp>
821 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Pp&& __x) {
822 return __emplace_unique_extract_key(std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
823 }
824
825 template <class _First,
826 class _Second,
827 __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
828 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_First&& __f, _Second&& __s) {
829 return __emplace_unique_key_args(__f, std::forward<_First>(__f), std::forward<_Second>(__s));
830 }
831
832775 template <class... _Args>
833776 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
834 return __emplace_unique_impl(std::forward<_Args>(__args)...);
835 }
836
837 template <class _Pp>
838 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
839 return __emplace_unique_impl(std::forward<_Pp>(__x));
840 }
841 template <class _Pp>
842 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
843 return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
844 }
845 template <class _Pp>
846 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
847 return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
777 return std::__try_key_extraction<key_type>(
778 [this](const key_type& __key, _Args&&... __args2) {
779 size_t __hash = hash_function()(__key);
780 size_type __bc = bucket_count();
781 bool __inserted = false;
782 __next_pointer __nd;
783 size_t __chash;
784 if (__bc != 0) {
785 __chash = std::__constrain_hash(__hash, __bc);
786 __nd = __bucket_list_[__chash];
787 if (__nd != nullptr) {
788 for (__nd = __nd->__next_;
789 __nd != nullptr &&
790 (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
791 __nd = __nd->__next_) {
792 if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __key))
793 goto __done;
794 }
795 }
796 }
797 {
798 __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args2)...);
799 if (size() + 1 > __bc * max_load_factor()) {
800 __rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
801 size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
802 __bc = bucket_count();
803 __chash = std::__constrain_hash(__hash, __bc);
804 }
805 // insert_after __bucket_list_[__chash], or __first_node if bucket is null
806 __next_pointer __pn = __bucket_list_[__chash];
807 if (__pn == nullptr) {
808 __pn = __first_node_.__ptr();
809 __h->__next_ = __pn->__next_;
810 __pn->__next_ = __h.get()->__ptr();
811 // fix up __bucket_list_
812 __bucket_list_[__chash] = __pn;
813 if (__h->__next_ != nullptr)
814 __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)] = __h.get()->__ptr();
815 } else {
816 __h->__next_ = __pn->__next_;
817 __pn->__next_ = static_cast<__next_pointer>(__h.get());
818 }
819 __nd = static_cast<__next_pointer>(__h.release());
820 // increment size
821 ++size();
822 __inserted = true;
823 }
824 __done:
825 return pair<iterator, bool>(iterator(__nd), __inserted);
826 },
827 [this](_Args&&... __args2) {
828 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
829 pair<iterator, bool> __r = __node_insert_unique(__h.get());
830 if (__r.second)
831 __h.release();
832 return __r;
833 },
834 std::forward<_Args>(__args)...);
848835 }
849836
850837 template <class... _Args>
......@@ -854,9 +841,7 @@ public:
854841
855842 template <class _ValueT = _Tp, __enable_if_t<__is_hash_value_type<_ValueT>::value, int> = 0>
856843 _LIBCPP_HIDE_FROM_ABI void __insert_unique_from_orphaned_node(value_type&& __value) {
857 using __key_type = typename _NodeTypes::key_type;
858
859 __node_holder __h = __construct_node(const_cast<__key_type&&>(__value.first), std::move(__value.second));
844 __node_holder __h = __construct_node(const_cast<key_type&&>(__value.first), std::move(__value.second));
860845 __node_insert_unique(__h.get());
861846 __h.release();
862847 }
......@@ -870,9 +855,7 @@ public:
870855
871856 template <class _ValueT = _Tp, __enable_if_t<__is_hash_value_type<_ValueT>::value, int> = 0>
872857 _LIBCPP_HIDE_FROM_ABI void __insert_multi_from_orphaned_node(value_type&& __value) {
873 using __key_type = typename _NodeTypes::key_type;
874
875 __node_holder __h = __construct_node(const_cast<__key_type&&>(__value.first), std::move(__value.second));
858 __node_holder __h = __construct_node(const_cast<key_type&&>(__value.first), std::move(__value.second));
876859 __node_insert_multi(__h.get());
877860 __h.release();
878861 }
......@@ -1017,8 +1000,8 @@ private:
10171000 template <class... _Args>
10181001 _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
10191002
1020 template <class _First, class... _Rest>
1021 _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
1003 template <class... _Args>
1004 _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_hash(size_t __hash, _Args&&... __args);
10221005
10231006 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u) {
10241007 __copy_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
......@@ -1042,17 +1025,29 @@ private:
10421025 }
10431026 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
10441027
1045 _LIBCPP_HIDE_FROM_ABI void __deallocate_node(__next_pointer __np) _NOEXCEPT;
1028 _LIBCPP_HIDE_FROM_ABI void __deallocate_node(__node_pointer __nd) _NOEXCEPT {
1029 auto& __alloc = __node_alloc();
1030 __node_traits::destroy(__alloc, std::addressof(__nd->__get_value()));
1031 std::__destroy_at(std::__to_address(__nd));
1032 __node_traits::deallocate(__alloc, __nd, 1);
1033 }
1034
1035 _LIBCPP_HIDE_FROM_ABI void __deallocate_node_list(__next_pointer __np) _NOEXCEPT {
1036 while (__np != nullptr) {
1037 __next_pointer __next = __np->__next_;
1038 __deallocate_node(__np->__upcast());
1039 __np = __next;
1040 }
1041 }
1042
10461043 _LIBCPP_HIDE_FROM_ABI __next_pointer __detach() _NOEXCEPT;
10471044
10481045 template <class _From, class _ValueT = _Tp, __enable_if_t<__is_hash_value_type<_ValueT>::value, int> = 0>
10491046 _LIBCPP_HIDE_FROM_ABI void __assign_value(__get_hash_node_value_type_t<_Tp>& __lhs, _From&& __rhs) {
1050 using __key_type = typename _NodeTypes::key_type;
1051
10521047 // This is technically UB, since the object was constructed as `const`.
10531048 // Clang doesn't optimize on this currently though.
1054 const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first);
1055 __lhs.second = std::forward<_From>(__rhs).second;
1049 const_cast<key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, key_type>&&>(__rhs.first);
1050 __lhs.second = std::forward<_From>(__rhs).second;
10561051 }
10571052
10581053 template <class _From, class _ValueT = _Tp, __enable_if_t<!__is_hash_value_type<_ValueT>::value, int> = 0>
......@@ -1101,16 +1096,29 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a
11011096 __max_load_factor_(1.0f) {}
11021097
11031098template <class _Tp, class _Hash, class _Equal, class _Alloc>
1104__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
1099__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __other)
11051100 : __bucket_list_(nullptr,
1106 __bucket_list_deleter(allocator_traits<__pointer_allocator>::select_on_container_copy_construction(
1107 __u.__bucket_list_.get_deleter().__alloc()),
1101 __bucket_list_deleter(__pointer_alloc_traits::select_on_container_copy_construction(
1102 __other.__bucket_list_.get_deleter().__alloc()),
11081103 0)),
1109 __node_alloc_(allocator_traits<__node_allocator>::select_on_container_copy_construction(__u.__node_alloc())),
1104 __node_alloc_(__node_traits::select_on_container_copy_construction(__other.__node_alloc())),
11101105 __size_(0),
1111 __hasher_(__u.hash_function()),
1112 __max_load_factor_(__u.__max_load_factor_),
1113 __key_eq_(__u.__key_eq_) {}
1106 __hasher_(__other.hash_function()),
1107 __max_load_factor_(__other.__max_load_factor_),
1108 __key_eq_(__other.__key_eq_) {
1109 if (__other.size() == 0)
1110 return;
1111
1112 auto& __bucket_list_del = __bucket_list_.get_deleter();
1113 auto __bucket_count = __other.bucket_count();
1114 __bucket_list_.reset(__pointer_alloc_traits::allocate(__bucket_list_del.__alloc(), __bucket_count));
1115 __bucket_list_del.size() = __bucket_count;
1116
1117 std::fill_n(__bucket_list_.get(), __bucket_count, nullptr);
1118
1119 __copy_construct(__other.__first_node_.__next_);
1120 __size_ = __other.size();
1121}
11141122
11151123template <class _Tp, class _Hash, class _Equal, class _Alloc>
11161124__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a)
......@@ -1169,7 +1177,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() {
11691177 static_assert(is_copy_constructible<hasher>::value, "Hasher must be copy-constructible.");
11701178#endif
11711179
1172 __deallocate_node(__first_node_.__next_);
1180 __deallocate_node_list(__first_node_.__next_);
11731181}
11741182
11751183template <class _Tp, class _Hash, class _Equal, class _Alloc>
......@@ -1184,28 +1192,76 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc(const __hash_
11841192}
11851193
11861194template <class _Tp, class _Hash, class _Equal, class _Alloc>
1187__hash_table<_Tp, _Hash, _Equal, _Alloc>& __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u) {
1188 if (this != std::addressof(__u)) {
1189 __copy_assign_alloc(__u);
1190 hash_function() = __u.hash_function();
1191 key_eq() = __u.key_eq();
1192 max_load_factor() = __u.max_load_factor();
1193 __assign_multi(__u.begin(), __u.end());
1195__hash_table<_Tp, _Hash, _Equal, _Alloc>&
1196__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __other) {
1197 if (this == std::addressof(__other))
1198 return *this;
1199
1200 __copy_assign_alloc(__other);
1201 hash_function() = __other.hash_function();
1202 key_eq() = __other.key_eq();
1203 max_load_factor() = __other.max_load_factor();
1204
1205 if (__other.size() == 0) {
1206 clear();
1207 return *this;
11941208 }
1195 return *this;
1196}
11971209
1198template <class _Tp, class _Hash, class _Equal, class _Alloc>
1199void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) _NOEXCEPT {
1200 __node_allocator& __na = __node_alloc();
1201 while (__np != nullptr) {
1202 __next_pointer __next = __np->__next_;
1203 __node_pointer __real_np = __np->__upcast();
1204 __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__get_value()));
1205 std::__destroy_at(std::addressof(*__real_np));
1206 __node_traits::deallocate(__na, __real_np, 1);
1207 __np = __next;
1210 auto __bucket_count = __other.bucket_count();
1211 if (__bucket_count != bucket_count()) {
1212 auto& __bucket_list_del = __bucket_list_.get_deleter();
1213 __bucket_list_.reset(__pointer_alloc_traits::allocate(__bucket_list_del.__alloc(), __bucket_count));
1214 __bucket_list_del.size() = __bucket_count;
1215 }
1216 std::fill_n(__bucket_list_.get(), __bucket_count, nullptr);
1217
1218 if (!__first_node_.__next_) {
1219 __copy_construct(__other.__first_node_.__next_);
1220 __size_ = __other.size();
1221 return *this;
1222 }
1223
1224 __next_pointer __other_iter = __other.__first_node_.__next_;
1225 __next_pointer __own_iter = __first_node_.__ptr();
1226 {
1227 __node_pointer __next = __own_iter->__next_->__upcast();
1228 __assign_value(__next->__get_value(), __other_iter->__upcast()->__get_value());
1229 __next->__hash_ = __other_iter->__hash();
1230 }
1231 size_t __current_chash = std::__constrain_hash(__own_iter->__next_->__hash(), __bucket_count);
1232 __bucket_list_[__current_chash] = __own_iter;
1233 __other_iter = __other_iter->__next_;
1234 __own_iter = __own_iter->__next_;
1235
1236 // Go through the nodes of the incoming hash table and copy then into the destination hash table, reusing as many
1237 // existing nodes as posssible in the destination.
1238 while (__other_iter && __own_iter->__next_) {
1239 __node_pointer __next = __own_iter->__next_->__upcast();
1240 __assign_value(__next->__get_value(), __other_iter->__upcast()->__get_value());
1241 __next->__hash_ = __other_iter->__hash();
1242
1243 size_t __new_chash = std::__constrain_hash(__next->__hash_, __bucket_count);
1244 if (__new_chash != __current_chash) {
1245 __bucket_list_[__new_chash] = __own_iter;
1246 __current_chash = __new_chash;
1247 }
1248
1249 __other_iter = __other_iter->__next_;
1250 __own_iter = __own_iter->__next_;
12081251 }
1252
1253 // At this point we either have consumed the whole incoming hash table, or we don't have any more nodes to reuse in
1254 // the destination. Either continue with constructing new nodes, or deallocate the left over nodes.
1255 if (__own_iter->__next_) {
1256 __deallocate_node_list(__own_iter->__next_);
1257 __own_iter->__next_ = nullptr;
1258 } else {
1259 __copy_construct(__other_iter, __own_iter, __current_chash);
1260 }
1261
1262 __size_ = __other.size();
1263
1264 return *this;
12091265}
12101266
12111267template <class _Tp, class _Hash, class _Equal, class _Alloc>
......@@ -1251,23 +1307,14 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u,
12511307 max_load_factor() = __u.max_load_factor();
12521308 if (bucket_count() != 0) {
12531309 __next_pointer __cache = __detach();
1254#if _LIBCPP_HAS_EXCEPTIONS
1255 try {
1256#endif // _LIBCPP_HAS_EXCEPTIONS
1257 const_iterator __i = __u.begin();
1258 while (__cache != nullptr && __u.size() != 0) {
1259 __assign_value(__cache->__upcast()->__get_value(), std::move(__u.remove(__i++)->__get_value()));
1260 __next_pointer __next = __cache->__next_;
1261 __node_insert_multi(__cache->__upcast());
1262 __cache = __next;
1263 }
1264#if _LIBCPP_HAS_EXCEPTIONS
1265 } catch (...) {
1266 __deallocate_node(__cache);
1267 throw;
1310 auto __guard = std::__make_scope_guard([&] { __deallocate_node_list(__cache); });
1311 const_iterator __i = __u.begin();
1312 while (__cache != nullptr && __u.size() != 0) {
1313 __assign_value(__cache->__upcast()->__get_value(), std::move(__u.remove(__i++)->__get_value()));
1314 __next_pointer __next = __cache->__next_;
1315 __node_insert_multi(__cache->__upcast());
1316 __cache = __next;
12681317 }
1269#endif // _LIBCPP_HAS_EXCEPTIONS
1270 __deallocate_node(__cache);
12711318 }
12721319 const_iterator __i = __u.begin();
12731320 while (__u.size() != 0)
......@@ -1290,27 +1337,18 @@ template <class _InputIterator>
12901337void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, _InputIterator __last) {
12911338 typedef iterator_traits<_InputIterator> _ITraits;
12921339 typedef typename _ITraits::value_type _ItValueType;
1293 static_assert(is_same<_ItValueType, __container_value_type>::value,
1294 "__assign_unique may only be called with the containers value type");
1340 static_assert(
1341 is_same<_ItValueType, value_type>::value, "__assign_unique may only be called with the containers value type");
12951342
12961343 if (bucket_count() != 0) {
12971344 __next_pointer __cache = __detach();
1298#if _LIBCPP_HAS_EXCEPTIONS
1299 try {
1300#endif // _LIBCPP_HAS_EXCEPTIONS
1301 for (; __cache != nullptr && __first != __last; ++__first) {
1302 __assign_value(__cache->__upcast()->__get_value(), *__first);
1303 __next_pointer __next = __cache->__next_;
1304 __node_insert_unique(__cache->__upcast());
1305 __cache = __next;
1306 }
1307#if _LIBCPP_HAS_EXCEPTIONS
1308 } catch (...) {
1309 __deallocate_node(__cache);
1310 throw;
1345 auto __guard = std::__make_scope_guard([&] { __deallocate_node_list(__cache); });
1346 for (; __cache != nullptr && __first != __last; ++__first) {
1347 __assign_value(__cache->__upcast()->__get_value(), *__first);
1348 __next_pointer __next = __cache->__next_;
1349 __node_insert_unique(__cache->__upcast());
1350 __cache = __next;
13111351 }
1312#endif // _LIBCPP_HAS_EXCEPTIONS
1313 __deallocate_node(__cache);
13141352 }
13151353 for (; __first != __last; ++__first)
13161354 __emplace_unique(*__first);
......@@ -1321,31 +1359,20 @@ template <class _InputIterator>
13211359void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first, _InputIterator __last) {
13221360 typedef iterator_traits<_InputIterator> _ITraits;
13231361 typedef typename _ITraits::value_type _ItValueType;
1324 static_assert(
1325 (is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value),
1326 "__assign_multi may only be called with the containers value type"
1327 " or the nodes value type");
1362 static_assert(is_same<_ItValueType, value_type>::value,
1363 "__assign_multi may only be called with the containers value type or the nodes value type");
13281364 if (bucket_count() != 0) {
13291365 __next_pointer __cache = __detach();
1330#if _LIBCPP_HAS_EXCEPTIONS
1331 try {
1332#endif // _LIBCPP_HAS_EXCEPTIONS
1333 for (; __cache != nullptr && __first != __last; ++__first) {
1334 __assign_value(__cache->__upcast()->__get_value(), *__first);
1335 __next_pointer __next = __cache->__next_;
1336 __node_insert_multi(__cache->__upcast());
1337 __cache = __next;
1338 }
1339#if _LIBCPP_HAS_EXCEPTIONS
1340 } catch (...) {
1341 __deallocate_node(__cache);
1342 throw;
1366 auto __guard = std::__make_scope_guard([&] { __deallocate_node_list(__cache); });
1367 for (; __cache != nullptr && __first != __last; ++__first) {
1368 __assign_value(__cache->__upcast()->__get_value(), *__first);
1369 __next_pointer __next = __cache->__next_;
1370 __node_insert_multi(__cache->__upcast());
1371 __cache = __next;
13431372 }
1344#endif // _LIBCPP_HAS_EXCEPTIONS
1345 __deallocate_node(__cache);
13461373 }
13471374 for (; __first != __last; ++__first)
1348 __emplace_multi(_NodeTypes::__get_value(*__first));
1375 __emplace_multi(*__first);
13491376}
13501377
13511378template <class _Tp, class _Hash, class _Equal, class _Alloc>
......@@ -1375,7 +1402,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT {
13751402template <class _Tp, class _Hash, class _Equal, class _Alloc>
13761403void __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT {
13771404 if (size() > 0) {
1378 __deallocate_node(__first_node_.__next_);
1405 __deallocate_node_list(__first_node_.__next_);
13791406 __first_node_.__next_ = nullptr;
13801407 size_type __bc = bucket_count();
13811408 for (size_type __i = 0; __i < __bc; ++__i)
......@@ -1561,69 +1588,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(const_iterator __p
15611588 return __node_insert_multi(__cp);
15621589}
15631590
1564template <class _Tp, class _Hash, class _Equal, class _Alloc>
1565template <class _Key, class... _Args>
1566pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
1567__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) {
1568 size_t __hash = hash_function()(__k);
1569 size_type __bc = bucket_count();
1570 bool __inserted = false;
1571 __next_pointer __nd;
1572 size_t __chash;
1573 if (__bc != 0) {
1574 __chash = std::__constrain_hash(__hash, __bc);
1575 __nd = __bucket_list_[__chash];
1576 if (__nd != nullptr) {
1577 for (__nd = __nd->__next_;
1578 __nd != nullptr && (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
1579 __nd = __nd->__next_) {
1580 if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
1581 goto __done;
1582 }
1583 }
1584 }
1585 {
1586 __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
1587 if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
1588 __rehash_unique(std::max<size_type>(
1589 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
1590 __bc = bucket_count();
1591 __chash = std::__constrain_hash(__hash, __bc);
1592 }
1593 // insert_after __bucket_list_[__chash], or __first_node if bucket is null
1594 __next_pointer __pn = __bucket_list_[__chash];
1595 if (__pn == nullptr) {
1596 __pn = __first_node_.__ptr();
1597 __h->__next_ = __pn->__next_;
1598 __pn->__next_ = __h.get()->__ptr();
1599 // fix up __bucket_list_
1600 __bucket_list_[__chash] = __pn;
1601 if (__h->__next_ != nullptr)
1602 __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)] = __h.get()->__ptr();
1603 } else {
1604 __h->__next_ = __pn->__next_;
1605 __pn->__next_ = static_cast<__next_pointer>(__h.get());
1606 }
1607 __nd = static_cast<__next_pointer>(__h.release());
1608 // increment size
1609 ++size();
1610 __inserted = true;
1611 }
1612__done:
1613 return pair<iterator, bool>(iterator(__nd), __inserted);
1614}
1615
1616template <class _Tp, class _Hash, class _Equal, class _Alloc>
1617template <class... _Args>
1618pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
1619__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args) {
1620 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
1621 pair<iterator, bool> __r = __node_insert_unique(__h.get());
1622 if (__r.second)
1623 __h.release();
1624 return __r;
1625}
1626
16271591template <class _Tp, class _Hash, class _Equal, class _Alloc>
16281592template <class... _Args>
16291593typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
......@@ -1764,41 +1728,45 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_D
17641728
17651729template <class _Tp, class _Hash, class _Equal, class _Alloc>
17661730template <bool _UniqueKeys>
1767void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc) {
1768 __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
1769 __bucket_list_.reset(__nbc > 0 ? __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
1770 __bucket_list_.get_deleter().size() = __nbc;
1771 if (__nbc > 0) {
1772 for (size_type __i = 0; __i < __nbc; ++__i)
1773 __bucket_list_[__i] = nullptr;
1774 __next_pointer __pp = __first_node_.__ptr();
1775 __next_pointer __cp = __pp->__next_;
1776 if (__cp != nullptr) {
1777 size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc);
1778 __bucket_list_[__chash] = __pp;
1779 size_type __phash = __chash;
1780 for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) {
1781 __chash = std::__constrain_hash(__cp->__hash(), __nbc);
1782 if (__chash == __phash)
1783 __pp = __cp;
1784 else {
1785 if (__bucket_list_[__chash] == nullptr) {
1786 __bucket_list_[__chash] = __pp;
1787 __pp = __cp;
1788 __phash = __chash;
1789 } else {
1790 __next_pointer __np = __cp;
1791 if _LIBCPP_CONSTEXPR_SINCE_CXX17 (!_UniqueKeys) {
1792 for (; __np->__next_ != nullptr &&
1793 key_eq()(__cp->__upcast()->__get_value(), __np->__next_->__upcast()->__get_value());
1794 __np = __np->__next_)
1795 ;
1796 }
1797 __pp->__next_ = __np->__next_;
1798 __np->__next_ = __bucket_list_[__chash]->__next_;
1799 __bucket_list_[__chash]->__next_ = __cp;
1800 }
1731void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __bucket_count) {
1732 __pointer_allocator& __ptr_alloc = __bucket_list_.get_deleter().__alloc();
1733 __bucket_list_.reset(__bucket_count > 0 ? __pointer_alloc_traits::allocate(__ptr_alloc, __bucket_count) : nullptr);
1734 __bucket_list_.get_deleter().size() = __bucket_count;
1735
1736 if (__bucket_count == 0)
1737 return;
1738
1739 for (size_type __i = 0; __i < __bucket_count; ++__i)
1740 __bucket_list_[__i] = nullptr;
1741 __next_pointer __pp = __first_node_.__ptr();
1742 __next_pointer __cp = __pp->__next_;
1743
1744 if (!__cp)
1745 return;
1746
1747 size_type __chash = std::__constrain_hash(__cp->__hash(), __bucket_count);
1748 __bucket_list_[__chash] = __pp;
1749 size_type __phash = __chash;
1750 for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) {
1751 __chash = std::__constrain_hash(__cp->__hash(), __bucket_count);
1752 if (__chash == __phash)
1753 __pp = __cp;
1754 else {
1755 if (__bucket_list_[__chash] == nullptr) {
1756 __bucket_list_[__chash] = __pp;
1757 __pp = __cp;
1758 __phash = __chash;
1759 } else {
1760 __next_pointer __np = __cp;
1761 if _LIBCPP_CONSTEXPR (!_UniqueKeys) {
1762 for (; __np->__next_ != nullptr &&
1763 key_eq()(__cp->__upcast()->__get_value(), __np->__next_->__upcast()->__get_value());
1764 __np = __np->__next_)
1765 ;
18011766 }
1767 __pp->__next_ = __np->__next_;
1768 __np->__next_ = __bucket_list_[__chash]->__next_;
1769 __bucket_list_[__chash]->__next_ = __cp;
18021770 }
18031771 }
18041772 }
......@@ -1854,16 +1822,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&&... __args) {
18541822 __node_allocator& __na = __node_alloc();
18551823 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
18561824
1857 // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
1858 // held inside the node, since we need to use the allocator's construct() method for that.
1825 // Begin the lifetime of the node itself and the value_type contained within.
18591826 //
18601827 // We don't use the allocator's construct() method to construct the node itself since the
18611828 // Cpp17FooInsertable named requirements don't require the allocator's construct() method
18621829 // to work on anything other than the value_type.
1863 std::__construct_at(std::addressof(*__h), /* next = */ nullptr, /* hash = */ 0);
1830 std::__construct_at(std::addressof(*__h), /* hash = */ 0, __na, std::forward<_Args>(__args)...);
18641831
1865 // Now construct the value_type using the allocator's construct() method.
1866 __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_Args>(__args)...);
18671832 __h.get_deleter().__value_constructed = true;
18681833
18691834 __h->__hash_ = hash_function()(__h->__get_value());
......@@ -1871,15 +1836,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&&... __args) {
18711836}
18721837
18731838template <class _Tp, class _Hash, class _Equal, class _Alloc>
1874template <class _First, class... _Rest>
1839template <class... _Args>
18751840typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
1876__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest) {
1877 static_assert(!__is_hash_value_type<_First, _Rest...>::value, "Construct cannot be called with a hash value type");
1841__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash, _Args&&... __args) {
1842 static_assert(!__is_hash_value_type<_Args...>::value, "Construct cannot be called with a hash value type");
18781843 __node_allocator& __na = __node_alloc();
18791844 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1880 std::__construct_at(std::addressof(*__h), /* next = */ nullptr, /* hash = */ __hash);
1881 __node_traits::construct(
1882 __na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_First>(__f), std::forward<_Rest>(__rest)...);
1845 std::__construct_at(std::addressof(*__h), /* hash = */ __hash, __na, std::forward<_Args>(__args)...);
18831846 __h.get_deleter().__value_constructed = true;
18841847 return __h;
18851848}
......@@ -1899,12 +1862,63 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) {
18991862template <class _Tp, class _Hash, class _Equal, class _Alloc>
19001863typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
19011864__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, const_iterator __last) {
1902 for (const_iterator __p = __first; __first != __last; __p = __first) {
1903 ++__first;
1904 erase(__p);
1865 if (__first == __last)
1866 return iterator(__last.__node_);
1867
1868 // current node
1869 __next_pointer __current = __first.__node_;
1870 size_type __bucket_count = bucket_count();
1871 size_t __chash = std::__constrain_hash(__current->__hash(), __bucket_count);
1872 // find previous node
1873 __next_pointer __before_first = __bucket_list_[__chash];
1874 for (; __before_first->__next_ != __current; __before_first = __before_first->__next_)
1875 ;
1876
1877 __next_pointer __last_node = __last.__node_;
1878
1879 // If __before_first is in the same bucket (i.e. the first element we erase is not the first in the bucket), clear
1880 // this bucket first without re-linking it
1881 if (__before_first != __first_node_.__ptr() &&
1882 std::__constrain_hash(__before_first->__hash(), __bucket_count) == __chash) {
1883 while (__current != __last_node) {
1884 auto __next = __current->__next_;
1885 __deallocate_node(__current->__upcast());
1886 __current = __next;
1887 --__size_;
1888
1889 if (__next) {
1890 if (auto __next_chash = std::__constrain_hash(__next->__hash(), __bucket_count); __next_chash != __chash) {
1891 __bucket_list_[__next_chash] = __before_first;
1892 __chash = __next_chash;
1893 break;
1894 }
1895 }
1896 }
19051897 }
1906 __next_pointer __np = __last.__node_;
1907 return iterator(__np);
1898
1899 while (__current != __last_node) {
1900 auto __next = __current->__next_;
1901 __deallocate_node(__current->__upcast());
1902 __current = __next;
1903 --__size_;
1904
1905 // When switching buckets, set the old bucket to be empty and update the next bucket to have __before_first as its
1906 // before-first element
1907 if (__next) {
1908 if (auto __next_chash = std::__constrain_hash(__next->__hash(), __bucket_count); __next_chash != __chash) {
1909 __bucket_list_[__chash] = nullptr;
1910 __bucket_list_[__next_chash] = __before_first;
1911 __chash = __next_chash;
1912 }
1913 } else { // When __next is a nullptr we've fully erased the last bucket. Update the bucket list accordingly.
1914 __bucket_list_[__chash] = nullptr;
1915 }
1916 }
1917
1918 // re-link __before_first with __last
1919 __before_first->__next_ = __current;
1920
1921 return iterator(__last.__node_);
19081922}
19091923
19101924template <class _Tp, class _Hash, class _Equal, class _Alloc>
lib/libcxx/include/__ios/fpos.h+4-4
......@@ -30,7 +30,7 @@ public:
3030
3131 _LIBCPP_HIDE_FROM_ABI operator streamoff() const { return __off_; }
3232
33 _LIBCPP_HIDE_FROM_ABI _StateT state() const { return __st_; }
33 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _StateT state() const { return __st_; }
3434 _LIBCPP_HIDE_FROM_ABI void state(_StateT __st) { __st_ = __st; }
3535
3636 _LIBCPP_HIDE_FROM_ABI fpos& operator+=(streamoff __off) {
......@@ -38,7 +38,7 @@ public:
3838 return *this;
3939 }
4040
41 _LIBCPP_HIDE_FROM_ABI fpos operator+(streamoff __off) const {
41 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI fpos operator+(streamoff __off) const {
4242 fpos __t(*this);
4343 __t += __off;
4444 return __t;
......@@ -49,7 +49,7 @@ public:
4949 return *this;
5050 }
5151
52 _LIBCPP_HIDE_FROM_ABI fpos operator-(streamoff __off) const {
52 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI fpos operator-(streamoff __off) const {
5353 fpos __t(*this);
5454 __t -= __off;
5555 return __t;
......@@ -57,7 +57,7 @@ public:
5757};
5858
5959template <class _StateT>
60inline _LIBCPP_HIDE_FROM_ABI streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
60[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
6161 return streamoff(__x) - streamoff(__y);
6262}
6363
lib/libcxx/include/__iterator/back_insert_iterator.h+1-7
......@@ -26,15 +26,9 @@ _LIBCPP_PUSH_MACROS
2626
2727_LIBCPP_BEGIN_NAMESPACE_STD
2828
29_LIBCPP_SUPPRESS_DEPRECATED_PUSH
3029template <class _Container>
3130class back_insert_iterator
32#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
33 : public iterator<output_iterator_tag, void, void, void, void>
34#endif
35{
36 _LIBCPP_SUPPRESS_DEPRECATED_POP
37
31 : public __iterator_base<back_insert_iterator<_Container>, output_iterator_tag, void, void, void, void> {
3832protected:
3933 _Container* container;
4034
lib/libcxx/include/__iterator/bounded_iter.h+7-8
......@@ -74,12 +74,12 @@ struct __bounded_iter {
7474 _LIBCPP_HIDE_FROM_ABI __bounded_iter(__bounded_iter const&) = default;
7575 _LIBCPP_HIDE_FROM_ABI __bounded_iter(__bounded_iter&&) = default;
7676
77 template < class _OtherIterator,
78 __enable_if_t<
79 _And< is_convertible<const _OtherIterator&, _Iterator>,
80 _Or<is_same<reference, __iter_reference<_OtherIterator> >,
81 is_same<reference, __make_const_lvalue_ref<__iter_reference<_OtherIterator> > > > >::value,
82 int> = 0>
77 template <class _OtherIterator,
78 __enable_if_t<
79 _And<is_convertible<const _OtherIterator&, _Iterator>,
80 _Or<is_same<reference, __iterator_reference<_OtherIterator> >,
81 is_same<reference, __make_const_lvalue_ref<__iterator_reference<_OtherIterator> > > > >::value,
82 int> = 0>
8383 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bounded_iter(__bounded_iter<_OtherIterator> const& __other) _NOEXCEPT
8484 : __current_(__other.__current_),
8585 __begin_(__other.__begin_),
......@@ -116,8 +116,7 @@ public:
116116 // These operations check that the iterator is dereferenceable. Since the class invariant is
117117 // that the iterator is always within `[begin, end]`, we only need to check it's not pointing to
118118 // `end`. This is easier for the optimizer because it aligns with the `iter != container.end()`
119 // checks that typical callers already use (see
120 // https://github.com/llvm/llvm-project/issues/78829).
119 // checks that typical callers already use (see https://llvm.org/PR78829).
121120 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT {
122121 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
123122 __current_ != __end_, "__bounded_iter::operator*: Attempt to dereference an iterator at the end");
lib/libcxx/include/__iterator/concepts.h+6-9
......@@ -117,15 +117,12 @@ template <class _Tp>
117117concept __signed_integer_like = signed_integral<_Tp>;
118118
119119template <class _Ip>
120concept weakly_incrementable =
121 // TODO: remove this once the clang bug is fixed (bugs.llvm.org/PR48173).
122 !same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
123 movable<_Ip> && requires(_Ip __i) {
124 typename iter_difference_t<_Ip>;
125 requires __signed_integer_like<iter_difference_t<_Ip>>;
126 { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
127 __i++; // not required to be equality-preserving
128 };
120concept weakly_incrementable = movable<_Ip> && requires(_Ip __i) {
121 typename iter_difference_t<_Ip>;
122 requires __signed_integer_like<iter_difference_t<_Ip>>;
123 { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
124 __i++; // not required to be equality-preserving
125};
129126
130127// [iterator.concept.inc]
131128template <class _Ip>
lib/libcxx/include/__iterator/cpp17_iterator_concepts.h+13-12
......@@ -68,7 +68,8 @@ concept __cpp17_default_constructible = is_default_constructible_v<_Tp>;
6868template <class _Iter>
6969concept __cpp17_iterator =
7070 __cpp17_copy_constructible<_Iter> && __cpp17_copy_assignable<_Iter> && __cpp17_destructible<_Iter> &&
71 (is_signed_v<__iter_diff_t<_Iter>> || is_void_v<__iter_diff_t<_Iter>>) && requires(_Iter __iter) {
71 (is_signed_v<__iterator_difference_type<_Iter>> || is_void_v<__iterator_difference_type<_Iter>>) &&
72 requires(_Iter __iter) {
7273 { *__iter };
7374 { ++__iter } -> same_as<_Iter&>;
7475 };
......@@ -81,8 +82,8 @@ concept __cpp17_input_iterator =
8182 { __lhs != std::as_const(__rhs) } -> __boolean_testable;
8283 { std::as_const(__lhs) != std::as_const(__rhs) } -> __boolean_testable;
8384
84 { *__lhs } -> same_as<__iter_reference<_Iter>>;
85 { *std::as_const(__lhs) } -> same_as<__iter_reference<_Iter>>;
85 { *__lhs } -> same_as<__iterator_reference<_Iter>>;
86 { *std::as_const(__lhs) } -> same_as<__iterator_reference<_Iter>>;
8687
8788 { ++__lhs } -> same_as<_Iter&>;
8889 { (void)__lhs++ };
......@@ -101,19 +102,19 @@ template <class _Iter>
101102concept __cpp17_forward_iterator =
102103 __cpp17_input_iterator<_Iter> && __cpp17_default_constructible<_Iter> && requires(_Iter __iter) {
103104 { __iter++ } -> convertible_to<const _Iter&>;
104 { *__iter++ } -> same_as<__iter_reference<_Iter>>;
105 { *__iter++ } -> same_as<__iterator_reference<_Iter>>;
105106 };
106107
107108template <class _Iter>
108109concept __cpp17_bidirectional_iterator = __cpp17_forward_iterator<_Iter> && requires(_Iter __iter) {
109110 { --__iter } -> same_as<_Iter&>;
110111 { __iter-- } -> convertible_to<const _Iter&>;
111 { *__iter-- } -> same_as<__iter_reference<_Iter>>;
112 { *__iter-- } -> same_as<__iterator_reference<_Iter>>;
112113};
113114
114115template <class _Iter>
115116concept __cpp17_random_access_iterator =
116 __cpp17_bidirectional_iterator<_Iter> && requires(_Iter __iter, __iter_diff_t<_Iter> __n) {
117 __cpp17_bidirectional_iterator<_Iter> && requires(_Iter __iter, __iterator_difference_type<_Iter> __n) {
117118 { __iter += __n } -> same_as<_Iter&>;
118119
119120 { __iter + __n } -> same_as<_Iter>;
......@@ -125,13 +126,13 @@ concept __cpp17_random_access_iterator =
125126 { __iter - __n } -> same_as<_Iter>;
126127 { std::as_const(__iter) - __n } -> same_as<_Iter>;
127128
128 { __iter - __iter } -> same_as<__iter_diff_t<_Iter>>;
129 { std::as_const(__iter) - __iter } -> same_as<__iter_diff_t<_Iter>>;
130 { __iter - std::as_const(__iter) } -> same_as<__iter_diff_t<_Iter>>;
131 { std::as_const(__iter) - std::as_const(__iter) } -> same_as<__iter_diff_t<_Iter>>;
129 { __iter - __iter } -> same_as<__iterator_difference_type<_Iter>>;
130 { std::as_const(__iter) - __iter } -> same_as<__iterator_difference_type<_Iter>>;
131 { __iter - std::as_const(__iter) } -> same_as<__iterator_difference_type<_Iter>>;
132 { std::as_const(__iter) - std::as_const(__iter) } -> same_as<__iterator_difference_type<_Iter>>;
132133
133 { __iter[__n] } -> convertible_to<__iter_reference<_Iter>>;
134 { std::as_const(__iter)[__n] } -> convertible_to<__iter_reference<_Iter>>;
134 { __iter[__n] } -> convertible_to<__iterator_reference<_Iter>>;
135 { std::as_const(__iter)[__n] } -> convertible_to<__iterator_reference<_Iter>>;
135136
136137 { __iter < __iter } -> __boolean_testable;
137138 { std::as_const(__iter) < __iter } -> __boolean_testable;
lib/libcxx/include/__iterator/distance.h+40-18
......@@ -10,41 +10,66 @@
1010#ifndef _LIBCPP___ITERATOR_DISTANCE_H
1111#define _LIBCPP___ITERATOR_DISTANCE_H
1212
13#include <__algorithm/for_each_segment.h>
14#include <__concepts/same_as.h>
1315#include <__config>
1416#include <__iterator/concepts.h>
1517#include <__iterator/incrementable_traits.h>
1618#include <__iterator/iterator_traits.h>
19#include <__iterator/segmented_iterator.h>
1720#include <__ranges/access.h>
1821#include <__ranges/concepts.h>
1922#include <__ranges/size.h>
2023#include <__type_traits/decay.h>
24#include <__type_traits/enable_if.h>
2125#include <__type_traits/remove_cvref.h>
26#include <__utility/move.h>
2227
2328#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2429# pragma GCC system_header
2530#endif
2631
32_LIBCPP_PUSH_MACROS
33#include <__undef_macros>
34
2735_LIBCPP_BEGIN_NAMESPACE_STD
2836
29template <class _InputIter>
30inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
31__distance(_InputIter __first, _InputIter __last, input_iterator_tag) {
32 typename iterator_traits<_InputIter>::difference_type __r(0);
33 for (; __first != __last; ++__first)
34 ++__r;
35 return __r;
36}
37#if _LIBCPP_STD_VER >= 20
38template <class _Iter>
39using __iter_distance_t _LIBCPP_NODEBUG = std::iter_difference_t<_Iter>;
40#else
41template <class _Iter>
42using __iter_distance_t _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::difference_type;
43#endif
3744
38template <class _RandIter>
39inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_RandIter>::difference_type
40__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) {
45template <class _RandIter, __enable_if_t<__has_random_access_iterator_category<_RandIter>::value, int> = 0>
46inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __iter_distance_t<_RandIter>
47__distance(_RandIter __first, _RandIter __last) {
4148 return __last - __first;
4249}
4350
51template <class _InputIter, class _Sent>
52inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __iter_distance_t<_InputIter>
53__distance(_InputIter __first, _Sent __last) {
54 __iter_distance_t<_InputIter> __r(0);
55#if _LIBCPP_STD_VER >= 20
56 if constexpr (same_as<_InputIter, _Sent> && __is_segmented_iterator_v<_InputIter>) {
57 std::__for_each_segment(__first, __last, [&__r](auto __lfirst, auto __llast) {
58 __r += std::__distance(__lfirst, __llast);
59 });
60 } else
61#endif
62 {
63 for (; __first != __last; ++__first)
64 ++__r;
65 }
66 return __r;
67}
68
4469template <class _InputIter>
4570inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
4671distance(_InputIter __first, _InputIter __last) {
47 return std::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
72 return std::__distance(__first, __last);
4873}
4974
5075#if _LIBCPP_STD_VER >= 20
......@@ -56,12 +81,7 @@ struct __distance {
5681 template <class _Ip, sentinel_for<_Ip> _Sp>
5782 requires(!sized_sentinel_for<_Sp, _Ip>)
5883 _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
59 iter_difference_t<_Ip> __n = 0;
60 while (__first != __last) {
61 ++__first;
62 ++__n;
63 }
64 return __n;
84 return std::__distance(std::move(__first), std::move(__last));
6585 }
6686
6787 template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
......@@ -92,4 +112,6 @@ inline constexpr auto distance = __distance{};
92112
93113_LIBCPP_END_NAMESPACE_STD
94114
115_LIBCPP_POP_MACROS
116
95117#endif // _LIBCPP___ITERATOR_DISTANCE_H
lib/libcxx/include/__iterator/front_insert_iterator.h+1-7
......@@ -26,15 +26,9 @@ _LIBCPP_PUSH_MACROS
2626
2727_LIBCPP_BEGIN_NAMESPACE_STD
2828
29_LIBCPP_SUPPRESS_DEPRECATED_PUSH
3029template <class _Container>
3130class front_insert_iterator
32#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
33 : public iterator<output_iterator_tag, void, void, void, void>
34#endif
35{
36 _LIBCPP_SUPPRESS_DEPRECATED_POP
37
31 : public __iterator_base<front_insert_iterator<_Container>, output_iterator_tag, void, void, void, void> {
3832protected:
3933 _Container* container;
4034
lib/libcxx/include/__iterator/insert_iterator.h+1-7
......@@ -35,15 +35,9 @@ template <class _Container>
3535using __insert_iterator_iter_t _LIBCPP_NODEBUG = typename _Container::iterator;
3636#endif
3737
38_LIBCPP_SUPPRESS_DEPRECATED_PUSH
3938template <class _Container>
4039class insert_iterator
41#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
42 : public iterator<output_iterator_tag, void, void, void, void>
43#endif
44{
45 _LIBCPP_SUPPRESS_DEPRECATED_POP
46
40 : public __iterator_base<insert_iterator<_Container>, output_iterator_tag, void, void, void, void> {
4741protected:
4842 _Container* container;
4943 __insert_iterator_iter_t<_Container> iter;
lib/libcxx/include/__iterator/istream_iterator.h+6-7
......@@ -25,15 +25,14 @@
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
2727
28_LIBCPP_SUPPRESS_DEPRECATED_PUSH
2928template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
3029class istream_iterator
31#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
32 : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
33#endif
34{
35 _LIBCPP_SUPPRESS_DEPRECATED_POP
36
30 : public __iterator_base<istream_iterator<_Tp, _CharT, _Traits, _Distance>,
31 input_iterator_tag,
32 _Tp,
33 _Distance,
34 const _Tp*,
35 const _Tp&> {
3736public:
3837 typedef input_iterator_tag iterator_category;
3938 typedef _Tp value_type;
lib/libcxx/include/__iterator/istreambuf_iterator.h+6-7
......@@ -25,15 +25,14 @@
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
2727
28_LIBCPP_SUPPRESS_DEPRECATED_PUSH
2928template <class _CharT, class _Traits>
3029class istreambuf_iterator
31#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
32 : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT>
33#endif
34{
35 _LIBCPP_SUPPRESS_DEPRECATED_POP
36
30 : public __iterator_base<istreambuf_iterator<_CharT, _Traits>,
31 input_iterator_tag,
32 _CharT,
33 typename _Traits::off_type,
34 _CharT*,
35 _CharT> {
3736public:
3837 typedef input_iterator_tag iterator_category;
3938 typedef _CharT value_type;
lib/libcxx/include/__iterator/iter_move.h+1-1
......@@ -40,7 +40,7 @@ void iter_move() = delete;
4040
4141template <class _Tp>
4242concept __unqualified_iter_move = __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
43 // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
43 // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_move ADL calls should only be made through ranges::iter_move
4444 iter_move(std::forward<_Tp>(__t));
4545};
4646
lib/libcxx/include/__iterator/iterator.h+13
......@@ -28,6 +28,19 @@ struct _LIBCPP_DEPRECATED_IN_CXX17 iterator {
2828 typedef _Category iterator_category;
2929};
3030
31_LIBCPP_SUPPRESS_DEPRECATED_PUSH
32#ifdef _LIBCPP_ABI_NO_ITERATOR_BASES
33template <class _Derived>
34struct __no_iterator_base {};
35
36template <class _Derived, class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
37using __iterator_base _LIBCPP_NODEBUG = __no_iterator_base<_Derived>;
38#else
39template <class _Derived, class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
40using __iterator_base _LIBCPP_NODEBUG = iterator<_Category, _Tp, _Distance, _Pointer, _Reference>;
41#endif
42_LIBCPP_SUPPRESS_DEPRECATED_POP
43
3144_LIBCPP_END_NAMESPACE_STD
3245
3346#endif // _LIBCPP___ITERATOR_ITERATOR_H
lib/libcxx/include/__iterator/iterator_traits.h+13-14
......@@ -420,44 +420,43 @@ using __has_exactly_bidirectional_iterator_category _LIBCPP_NODEBUG =
420420 !__has_iterator_category_convertible_to<_Tp, random_access_iterator_tag>::value>;
421421
422422template <class _InputIterator>
423using __iter_value_type _LIBCPP_NODEBUG = typename iterator_traits<_InputIterator>::value_type;
423using __iterator_value_type _LIBCPP_NODEBUG = typename iterator_traits<_InputIterator>::value_type;
424424
425425#if _LIBCPP_STD_VER >= 23
426426template <class _InputIterator>
427using __iter_key_type _LIBCPP_NODEBUG = remove_const_t<tuple_element_t<0, __iter_value_type<_InputIterator>>>;
427using __iter_key_type _LIBCPP_NODEBUG = remove_const_t<tuple_element_t<0, __iterator_value_type<_InputIterator>>>;
428428
429429template <class _InputIterator>
430using __iter_mapped_type _LIBCPP_NODEBUG = tuple_element_t<1, __iter_value_type<_InputIterator>>;
430using __iter_mapped_type _LIBCPP_NODEBUG = tuple_element_t<1, __iterator_value_type<_InputIterator>>;
431431
432432template <class _InputIterator>
433433using __iter_to_alloc_type _LIBCPP_NODEBUG =
434 pair<const tuple_element_t<0, __iter_value_type<_InputIterator>>,
435 tuple_element_t<1, __iter_value_type<_InputIterator>>>;
434 pair<const tuple_element_t<0, __iterator_value_type<_InputIterator>>,
435 tuple_element_t<1, __iterator_value_type<_InputIterator>>>;
436436#else
437437template <class _InputIterator>
438using __iter_key_type _LIBCPP_NODEBUG =
439 __remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;
438using __iter_key_type _LIBCPP_NODEBUG = __remove_const_t<typename __iterator_value_type<_InputIterator>::first_type>;
440439
441440template <class _InputIterator>
442using __iter_mapped_type _LIBCPP_NODEBUG = typename iterator_traits<_InputIterator>::value_type::second_type;
441using __iter_mapped_type _LIBCPP_NODEBUG = typename __iterator_value_type<_InputIterator>::second_type;
443442
444443template <class _InputIterator>
445444using __iter_to_alloc_type _LIBCPP_NODEBUG =
446 pair<const typename iterator_traits<_InputIterator>::value_type::first_type,
447 typename iterator_traits<_InputIterator>::value_type::second_type>;
445 pair<const typename __iterator_value_type<_InputIterator>::first_type,
446 typename __iterator_value_type<_InputIterator>::second_type>;
448447#endif // _LIBCPP_STD_VER >= 23
449448
450449template <class _Iter>
451using __iterator_category_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::iterator_category;
450using __iterator_iterator_category _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::iterator_category;
452451
453452template <class _Iter>
454using __iterator_pointer_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::pointer;
453using __iterator_pointer _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::pointer;
455454
456455template <class _Iter>
457using __iter_diff_t _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::difference_type;
456using __iterator_difference_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::difference_type;
458457
459458template <class _Iter>
460using __iter_reference _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::reference;
459using __iterator_reference _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::reference;
461460
462461#if _LIBCPP_STD_VER >= 20
463462
lib/libcxx/include/__iterator/ostream_iterator.h+1-7
......@@ -24,15 +24,9 @@
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
2626
27_LIBCPP_SUPPRESS_DEPRECATED_PUSH
2827template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
2928class ostream_iterator
30#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
31 : public iterator<output_iterator_tag, void, void, void, void>
32#endif
33{
34 _LIBCPP_SUPPRESS_DEPRECATED_POP
35
29 : public __iterator_base<ostream_iterator<_Tp, _CharT, _Traits>, output_iterator_tag, void, void, void, void> {
3630public:
3731 typedef output_iterator_tag iterator_category;
3832 typedef void value_type;
lib/libcxx/include/__iterator/ostreambuf_iterator.h+1-7
......@@ -25,15 +25,9 @@
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
2727
28_LIBCPP_SUPPRESS_DEPRECATED_PUSH
2928template <class _CharT, class _Traits>
3029class ostreambuf_iterator
31#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
32 : public iterator<output_iterator_tag, void, void, void, void>
33#endif
34{
35 _LIBCPP_SUPPRESS_DEPRECATED_POP
36
30 : public __iterator_base<ostreambuf_iterator<_CharT, _Traits>, output_iterator_tag, void, void, void, void> {
3731public:
3832 typedef output_iterator_tag iterator_category;
3933 typedef void value_type;
lib/libcxx/include/__iterator/reverse_iterator.h+8-13
......@@ -46,21 +46,16 @@
4646
4747_LIBCPP_BEGIN_NAMESPACE_STD
4848
49_LIBCPP_SUPPRESS_DEPRECATED_PUSH
5049template <class _Iter>
5150class reverse_iterator
52#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
53 : public iterator<typename iterator_traits<_Iter>::iterator_category,
54 typename iterator_traits<_Iter>::value_type,
55 typename iterator_traits<_Iter>::difference_type,
56 typename iterator_traits<_Iter>::pointer,
57 typename iterator_traits<_Iter>::reference>
58#endif
59{
60 _LIBCPP_SUPPRESS_DEPRECATED_POP
61
51 : public __iterator_base<reverse_iterator<_Iter>,
52 typename iterator_traits<_Iter>::iterator_category,
53 typename iterator_traits<_Iter>::value_type,
54 typename iterator_traits<_Iter>::difference_type,
55 typename iterator_traits<_Iter>::pointer,
56 typename iterator_traits<_Iter>::reference> {
6257private:
63#ifndef _LIBCPP_ABI_NO_ITERATOR_BASES
58#ifndef _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER
6459 _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break
6560#endif
6661
......@@ -91,7 +86,7 @@ public:
9186 using reference = typename iterator_traits<_Iter>::reference;
9287#endif
9388
94#ifndef _LIBCPP_ABI_NO_ITERATOR_BASES
89#ifndef _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER
9590 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator() : __t_(), current() {}
9691
9792 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {}
lib/libcxx/include/__iterator/segmented_iterator.h+3-8
......@@ -67,18 +67,13 @@ struct __segmented_iterator_traits;
6767*/
6868
6969template <class _Tp, size_t = 0>
70struct __has_specialization : false_type {};
70inline const bool __has_specialization_v = false;
7171
7272template <class _Tp>
73struct __has_specialization<_Tp, sizeof(_Tp) * 0> : true_type {};
73inline const bool __has_specialization_v<_Tp, sizeof(_Tp) * 0> = true;
7474
7575template <class _Iterator>
76using __is_segmented_iterator _LIBCPP_NODEBUG = __has_specialization<__segmented_iterator_traits<_Iterator> >;
77
78template <class _SegmentedIterator>
79struct __has_random_access_local_iterator
80 : __has_random_access_iterator_category<
81 typename __segmented_iterator_traits< _SegmentedIterator >::__local_iterator > {};
76inline const bool __is_segmented_iterator_v = __has_specialization_v<__segmented_iterator_traits<_Iterator> >;
8277
8378_LIBCPP_END_NAMESPACE_STD
8479
lib/libcxx/include/__iterator/static_bounded_iter.h+3-3
......@@ -99,9 +99,9 @@ struct __static_bounded_iter {
9999
100100 template <class _OtherIterator,
101101 __enable_if_t<
102 _And< is_convertible<const _OtherIterator&, _Iterator>,
103 _Or<is_same<reference, __iter_reference<_OtherIterator> >,
104 is_same<reference, __make_const_lvalue_ref<__iter_reference<_OtherIterator> > > > >::value,
102 _And<is_convertible<const _OtherIterator&, _Iterator>,
103 _Or<is_same<reference, __iterator_reference<_OtherIterator> >,
104 is_same<reference, __make_const_lvalue_ref<__iterator_reference<_OtherIterator> > > > >::value,
105105 int> = 0>
106106 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
107107 __static_bounded_iter(__static_bounded_iter<_OtherIterator, _Size> const& __other) _NOEXCEPT
lib/libcxx/include/__iterator/wrap_iter.h+8-6
......@@ -49,12 +49,12 @@ private:
4949
5050public:
5151 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT : __i_() {}
52 template <
53 class _OtherIter,
54 __enable_if_t< _And< is_convertible<const _OtherIter&, _Iter>,
55 _Or<is_same<reference, __iter_reference<_OtherIter> >,
56 is_same<reference, __make_const_lvalue_ref<__iter_reference<_OtherIter> > > > >::value,
57 int> = 0>
52 template <class _OtherIter,
53 __enable_if_t<
54 _And<is_convertible<const _OtherIter&, _Iter>,
55 _Or<is_same<reference, __iterator_reference<_OtherIter> >,
56 is_same<reference, __make_const_lvalue_ref<__iterator_reference<_OtherIter> > > > >::value,
57 int> = 0>
5858 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_OtherIter>& __u) _NOEXCEPT
5959 : __i_(__u.__i_) {}
6060 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { return *__i_; }
......@@ -117,6 +117,8 @@ private:
117117 friend class span;
118118 template <class _Tp, size_t _Size>
119119 friend struct array;
120 template <class _Tp, class>
121 friend struct __optional_iterator;
120122};
121123
122124template <class _Iter1>
lib/libcxx/include/__locale+3-10
......@@ -57,9 +57,8 @@ _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale&);
5757class _LIBCPP_EXPORTED_FROM_ABI locale {
5858public:
5959 // locale is essentially a shared_ptr that doesn't support weak_ptrs and never got a move constructor,
60 // so it is trivially relocatable. Like shared_ptr, it is also replaceable.
60 // so it is trivially relocatable.
6161 using __trivially_relocatable _LIBCPP_NODEBUG = locale;
62 using __replaceable _LIBCPP_NODEBUG = locale;
6362
6463 // types:
6564 class _LIBCPP_EXPORTED_FROM_ABI facet;
......@@ -389,7 +388,7 @@ public:
389388 static const mask xdigit = _ISXDIGIT;
390389 static const mask blank = _ISBLANK;
391390 static const mask __regex_word = 0x8000;
392# elif defined(_NEWLIB_VERSION)
391# elif _LIBCPP_LIBC_NEWLIB
393392 // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
394393 typedef char mask;
395394 // In case char is signed, static_cast is needed to avoid warning on
......@@ -585,7 +584,7 @@ public:
585584# ifdef _CACHED_RUNES
586585 static const size_t table_size = _CACHED_RUNES;
587586# else
588 static const size_t table_size = 256; // FIXME: Don't hardcode this.
587 static const size_t table_size = 256;
589588# endif
590589 _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
591590 static const mask* classic_table() _NOEXCEPT;
......@@ -1478,9 +1477,6 @@ public:
14781477
14791478protected:
14801479 ~numpunct_byname() override;
1481
1482private:
1483 void __init(const char*);
14841480};
14851481
14861482# if _LIBCPP_HAS_WIDE_CHARACTERS
......@@ -1495,9 +1491,6 @@ public:
14951491
14961492protected:
14971493 ~numpunct_byname() override;
1498
1499private:
1500 void __init(const char*);
15011494};
15021495# endif // _LIBCPP_HAS_WIDE_CHARACTERS
15031496
lib/libcxx/include/__locale_dir/locale_base_api.h+5-28
......@@ -57,15 +57,11 @@
5757// float __strtof(const char*, char**, __locale_t);
5858// double __strtod(const char*, char**, __locale_t);
5959// long double __strtold(const char*, char**, __locale_t);
60// long long __strtoll(const char*, char**, __locale_t);
61// unsigned long long __strtoull(const char*, char**, __locale_t);
6260// }
6361//
6462// Character manipulation functions
6563// --------------------------------
6664// namespace __locale {
67// int __isdigit(int, __locale_t); // required by the headers
68// int __isxdigit(int, __locale_t); // required by the headers
6965// int __toupper(int, __locale_t);
7066// int __tolower(int, __locale_t);
7167// int __strcoll(const char*, const char*, __locale_t);
......@@ -106,7 +102,6 @@
106102//
107103// int __snprintf(char*, size_t, __locale_t, const char*, ...); // required by the headers
108104// int __asprintf(char**, __locale_t, const char*, ...); // required by the headers
109// int __sscanf(const char*, __locale_t, const char*, ...); // required by the headers
110105// }
111106
112107#if _LIBCPP_HAS_LOCALIZATION
......@@ -115,7 +110,6 @@
115110# include <__locale_dir/support/apple.h>
116111# elif defined(__FreeBSD__)
117112# include <__locale_dir/support/freebsd.h>
118/* zig patch: https://github.com/llvm/llvm-project/pull/143055 */
119113# elif defined(__NetBSD__)
120114# include <__locale_dir/support/netbsd.h>
121115# elif defined(_LIBCPP_MSVCRT_LIKE)
......@@ -124,20 +118,20 @@
124118# include <__locale_dir/support/fuchsia.h>
125119# elif defined(__linux__)
126120# include <__locale_dir/support/linux.h>
121# elif _LIBCPP_LIBC_NEWLIB
122# include <__locale_dir/support/newlib.h>
123# elif defined(_AIX)
124# include <__locale_dir/support/aix.h>
127125# else
128126
129127// TODO: This is a temporary definition to bridge between the old way we defined the locale base API
130128// (by providing global non-reserved names) and the new API. As we move individual platforms
131129// towards the new way of defining the locale base API, this should disappear since each platform
132130// will define those directly.
133# if defined(_AIX) || defined(__MVS__)
131# if defined(__MVS__)
134132# include <__locale_dir/locale_base_api/ibm.h>
135# elif defined(__ANDROID__)
136# include <__locale_dir/locale_base_api/android.h>
137133# elif defined(__OpenBSD__)
138134# include <__locale_dir/locale_base_api/openbsd.h>
139# elif defined(__wasi__) || _LIBCPP_HAS_MUSL_LIBC
140# include <__locale_dir/locale_base_api/musl.h>
141135# endif
142136
143137# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h>
......@@ -197,21 +191,9 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
197191 return strtold_l(__nptr, __endptr, __loc);
198192}
199193
200inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
201 return strtoll_l(__nptr, __endptr, __base, __loc);
202}
203
204inline _LIBCPP_HIDE_FROM_ABI unsigned long long
205__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
206 return strtoull_l(__nptr, __endptr, __base, __loc);
207}
208
209194//
210195// Character manipulation functions
211196//
212inline _LIBCPP_HIDE_FROM_ABI int __isdigit(int __ch, __locale_t __loc) { return isdigit_l(__ch, __loc); }
213inline _LIBCPP_HIDE_FROM_ABI int __isxdigit(int __ch, __locale_t __loc) { return isxdigit_l(__ch, __loc); }
214
215197# if defined(_LIBCPP_BUILDING_LIBRARY)
216198inline _LIBCPP_HIDE_FROM_ABI int __strcoll(const char* __s1, const char* __s2, __locale_t __loc) {
217199 return strcoll_l(__s1, __s2, __loc);
......@@ -307,11 +289,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __
307289 char** __s, __locale_t __loc, const char* __format, _Args&&... __args) {
308290 return std::__libcpp_asprintf_l(__s, __loc, __format, std::forward<_Args>(__args)...);
309291}
310template <class... _Args>
311_LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(
312 const char* __s, __locale_t __loc, const char* __format, _Args&&... __args) {
313 return std::__libcpp_sscanf_l(__s, __loc, __format, std::forward<_Args>(__args)...);
314}
315292_LIBCPP_DIAGNOSTIC_POP
316293# undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
317294
lib/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h-10
......@@ -125,16 +125,6 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __libcpp_asprintf_l(
125125 return __res;
126126}
127127
128inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __libcpp_sscanf_l(
129 const char* __s, locale_t __l, const char* __format, ...) {
130 va_list __va;
131 va_start(__va, __format);
132 __locale_guard __current(__l);
133 int __res = vsscanf(__s, __format, __va);
134 va_end(__va);
135 return __res;
136}
137
138128_LIBCPP_END_NAMESPACE_STD
139129
140130#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_BSD_LOCALE_FALLBACKS_H
lib/libcxx/include/__locale_dir/messages.h+1-1
......@@ -22,7 +22,7 @@
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__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
25# if !defined(__BIONIC__) && !_LIBCPP_LIBC_NEWLIB && !defined(__EMSCRIPTEN__)
2626# define _LIBCPP_HAS_CATOPEN 1
2727# include <nl_types.h>
2828# else
lib/libcxx/include/__locale_dir/money.h+2-2
......@@ -433,7 +433,7 @@ bool money_get<_CharT, _InputIterator>::__do_get(
433433 __err |= ios_base::failbit;
434434 return false;
435435 }
436 for (++__b; __fd > 0; --__fd, ++__b) {
436 for (++__b; __fd > 0; --__fd, (void)++__b) {
437437 if (__b == __e || !__ct.is(ctype_base::digit, *__b)) {
438438 __err |= ios_base::failbit;
439439 return false;
......@@ -451,7 +451,7 @@ bool money_get<_CharT, _InputIterator>::__do_get(
451451 }
452452 }
453453 if (__trailing_sign) {
454 for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b) {
454 for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, (void)++__b) {
455455 if (__b == __e || *__b != (*__trailing_sign)[__i]) {
456456 __err |= ios_base::failbit;
457457 return false;
lib/libcxx/include/__locale_dir/num.h+190-243
......@@ -9,8 +9,10 @@
99#ifndef _LIBCPP___LOCALE_DIR_NUM_H
1010#define _LIBCPP___LOCALE_DIR_NUM_H
1111
12#include <__algorithm/copy.h>
1213#include <__algorithm/find.h>
1314#include <__algorithm/reverse.h>
15#include <__algorithm/simd_utils.h>
1416#include <__charconv/to_chars_integral.h>
1517#include <__charconv/traits.h>
1618#include <__config>
......@@ -22,6 +24,7 @@
2224#include <__locale_dir/scan_keyword.h>
2325#include <__memory/unique_ptr.h>
2426#include <__system_error/errc.h>
27#include <__type_traits/is_signed.h>
2528#include <cerrno>
2629#include <ios>
2730#include <streambuf>
......@@ -46,9 +49,9 @@ struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base {
4649 static int __get_base(ios_base&);
4750 static const char __src[33]; // "0123456789abcdefABCDEFxX+-pPiInN"
4851 // count of leading characters in __src used for parsing integers ("012..X+-")
49 static const size_t __int_chr_cnt = 26;
52 static inline const size_t __int_chr_cnt = 26;
5053 // count of leading characters in __src used for parsing floating-point values ("012..-pP")
51 static const size_t __fp_chr_cnt = 28;
54 static inline const size_t __fp_chr_cnt = 28;
5255};
5356
5457template <class _CharT>
......@@ -71,7 +74,8 @@ struct __num_get : protected __num_get_base {
7174
7275 [[__deprecated__("This exists only for ABI compatibility")]] static string
7376 __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
74 static int __stage2_int_loop(
77
78 [[__deprecated__("This exists only for ABI compatibility")]] static int __stage2_int_loop(
7579 _CharT __ct,
7680 int __base,
7781 char* __a,
......@@ -83,11 +87,24 @@ struct __num_get : protected __num_get_base {
8387 unsigned*& __g_end,
8488 _CharT* __atoms);
8589
86 _LIBCPP_HIDE_FROM_ABI static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) {
87 locale __loc = __iob.getloc();
88 const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
89 __thousands_sep = __np.thousands_sep();
90 return __np.grouping();
90 _LIBCPP_HIDE_FROM_ABI static ptrdiff_t __atoms_offset(const _CharT* __atoms, _CharT __val) {
91 // TODO: Remove the manual vectorization once https://llvm.org/PR168551 is resolved
92# if _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS
93 if constexpr (is_same<_CharT, char>::value) {
94 // TODO(LLVM 24): This can be removed, since -Wpsabi doesn't warn on [[gnu::always_inline]] functions anymore.
95 _LIBCPP_DIAGNOSTIC_PUSH
96 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi")
97 using __vec = __simd_vector<char, 32>;
98 __vec __chars = std::__broadcast<__vec>(__val);
99 __vec __cmp = std::__partial_load<__vec, __int_chr_cnt>(__atoms);
100 auto __res = __chars == __cmp;
101 if (std::__none_of(__res))
102 return __int_chr_cnt;
103 return std::min(__int_chr_cnt, std::__find_first_set(__res));
104 _LIBCPP_DIAGNOSTIC_POP
105 }
106# endif
107 return std::find(__atoms, __atoms + __int_chr_cnt, __val) - __atoms;
91108 }
92109
93110 _LIBCPP_HIDE_FROM_ABI const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const {
......@@ -120,54 +137,6 @@ string __num_get<_CharT>::__stage2_float_prep(
120137 return __np.grouping();
121138}
122139
123template <class _CharT>
124int __num_get<_CharT>::__stage2_int_loop(
125 _CharT __ct,
126 int __base,
127 char* __a,
128 char*& __a_end,
129 unsigned& __dc,
130 _CharT __thousands_sep,
131 const string& __grouping,
132 unsigned* __g,
133 unsigned*& __g_end,
134 _CharT* __atoms) {
135 if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) {
136 *__a_end++ = __ct == __atoms[24] ? '+' : '-';
137 __dc = 0;
138 return 0;
139 }
140 if (__grouping.size() != 0 && __ct == __thousands_sep) {
141 if (__g_end - __g < __num_get_buf_sz) {
142 *__g_end++ = __dc;
143 __dc = 0;
144 }
145 return 0;
146 }
147 ptrdiff_t __f = std::find(__atoms, __atoms + __int_chr_cnt, __ct) - __atoms;
148 if (__f >= 24)
149 return -1;
150 switch (__base) {
151 case 8:
152 case 10:
153 if (__f >= __base)
154 return -1;
155 break;
156 case 16:
157 if (__f < 22)
158 break;
159 if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0') {
160 __dc = 0;
161 *__a_end++ = __src[__f];
162 return 0;
163 }
164 return -1;
165 }
166 *__a_end++ = __src[__f];
167 ++__dc;
168 return 0;
169}
170
171140template <class _CharT>
172141int __num_get<_CharT>::__stage2_float_loop(
173142 _CharT __ct,
......@@ -272,65 +241,6 @@ _LIBCPP_HIDE_FROM_ABI _Tp __num_get_float(const char* __a, const char* __a_end,
272241 return 0;
273242}
274243
275template <class _Tp>
276_LIBCPP_HIDE_FROM_ABI _Tp
277__num_get_signed_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) {
278 if (__a != __a_end) {
279 __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
280 errno = 0;
281 char* __p2;
282 long long __ll = __locale::__strtoll(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
283 __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
284 if (__current_errno == 0)
285 errno = __save_errno;
286 if (__p2 != __a_end) {
287 __err = ios_base::failbit;
288 return 0;
289 } else if (__current_errno == ERANGE || __ll < numeric_limits<_Tp>::min() || numeric_limits<_Tp>::max() < __ll) {
290 __err = ios_base::failbit;
291 if (__ll > 0)
292 return numeric_limits<_Tp>::max();
293 else
294 return numeric_limits<_Tp>::min();
295 }
296 return static_cast<_Tp>(__ll);
297 }
298 __err = ios_base::failbit;
299 return 0;
300}
301
302template <class _Tp>
303_LIBCPP_HIDE_FROM_ABI _Tp
304__num_get_unsigned_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) {
305 if (__a != __a_end) {
306 const bool __negate = *__a == '-';
307 if (__negate && ++__a == __a_end) {
308 __err = ios_base::failbit;
309 return 0;
310 }
311 __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
312 errno = 0;
313 char* __p2;
314 unsigned long long __ll = __locale::__strtoull(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
315 __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
316 if (__current_errno == 0)
317 errno = __save_errno;
318 if (__p2 != __a_end) {
319 __err = ios_base::failbit;
320 return 0;
321 } else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) {
322 __err = ios_base::failbit;
323 return numeric_limits<_Tp>::max();
324 }
325 _Tp __res = static_cast<_Tp>(__ll);
326 if (__negate)
327 __res = -__res;
328 return __res;
329 }
330 __err = ios_base::failbit;
331 return 0;
332}
333
334244template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
335245class num_get : public locale::facet, private __num_get<_CharT> {
336246public:
......@@ -468,137 +378,196 @@ protected:
468378 return __b;
469379 }
470380
471 template <class _Signed>
472 _LIBCPP_HIDE_FROM_ABI iter_type
473 __do_get_signed(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const {
381 template <class _MaybeSigned>
382 iter_type __do_get_integral(
383 iter_type __first, iter_type __last, ios_base& __iob, ios_base::iostate& __err, _MaybeSigned& __v) const {
384 using _Unsigned = __make_unsigned_t<_MaybeSigned>;
385
474386 // Stage 1
475387 int __base = this->__get_base(__iob);
476 // Stage 2
477 char_type __thousands_sep;
478 const int __atoms_size = __num_get_base::__int_chr_cnt;
479 char_type __atoms1[__atoms_size];
480 const char_type* __atoms = this->__do_widen(__iob, __atoms1);
481 string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
482 string __buf;
483 __buf.resize(__buf.capacity());
484 char* __a = &__buf[0];
485 char* __a_end = __a;
388
389 // Stages 2 & 3
390 // These are combined into a single step where we parse the characters and calculate the value in one go instead of
391 // storing the relevant characters first (in an allocated buffer) and parse the characters after we extracted them.
392 // This makes the whole process significantly faster, since we avoid potential allocations and copies.
393
394 const auto& __numpunct = use_facet<numpunct<_CharT> >(__iob.getloc());
395 char_type __thousands_sep = __numpunct.thousands_sep();
396 string __grouping = __numpunct.grouping();
397
398 char_type __atoms_buffer[__num_get_base::__int_chr_cnt];
399 const char_type* __atoms = this->__do_widen(__iob, __atoms_buffer);
486400 unsigned __g[__num_get_base::__num_get_buf_sz];
487401 unsigned* __g_end = __g;
488402 unsigned __dc = 0;
489 for (; __b != __e; ++__b) {
490 if (__a_end == __a + __buf.size()) {
491 size_t __tmp = __buf.size();
492 __buf.resize(2 * __buf.size());
493 __buf.resize(__buf.capacity());
494 __a = &__buf[0];
495 __a_end = __a + __tmp;
403
404 if (__first == __last) {
405 __err |= ios_base::eofbit | ios_base::failbit;
406 __v = 0;
407 return __first;
408 }
409
410 while (!__grouping.empty() && *__first == __thousands_sep) {
411 ++__first;
412 if (__g_end - __g < this->__num_get_buf_sz)
413 *__g_end++ = 0;
414 }
415
416 bool __negate = false;
417 // __c == '+' || __c == '-'
418 if (auto __c = *__first; __c == __atoms[24] || __c == __atoms[25]) {
419 __negate = __c == __atoms[25];
420 ++__first;
421 }
422
423 if (__first == __last) {
424 __err |= ios_base::eofbit | ios_base::failbit;
425 __v = 0;
426 return __first;
427 }
428
429 bool __parsed_num = false;
430
431 // If we don't have a pre-set base, figure it out and swallow any prefix
432 if (__base == 0) {
433 auto __c = *__first;
434 // __c == '0'
435 if (__c == __atoms[0]) {
436 ++__first;
437 if (__first == __last) {
438 __err |= ios_base::eofbit;
439 __v = 0;
440 return __first;
441 }
442 // __c2 == 'x' || __c2 == 'X'
443 if (auto __c2 = *__first; __c2 == __atoms[22] || __c2 == __atoms[23]) {
444 __base = 16;
445 ++__first;
446 } else {
447 __base = 8;
448 __parsed_num = true; // We only swallowed '0', so we've started to parse a number
449 }
450 } else {
451 __base = 10;
452 }
453
454 // If the base has been specified explicitly, try to swallow the appropriate prefix. We only need to do something
455 // special for hex, since decimal has no prefix and octal's prefix is '0', which doesn't change the value that
456 // we'll parse if we don't swallow it.
457 } else if (__base == 16) {
458 // Try to swallow '0x'
459
460 // *__first == '0'
461 if (*__first == __atoms[0]) {
462 ++__first;
463 if (__first == __last) {
464 __err |= ios_base::eofbit;
465 __v = 0;
466 return __first;
467 }
468 // __c == 'x' || __c == 'X'
469 if (auto __c = *__first; __c == __atoms[22] || __c == __atoms[23])
470 ++__first;
471 else
472 __parsed_num = true; // We only swallowed '0', so we've started to parse a number
496473 }
497 if (this->__stage2_int_loop(
498 *__b,
499 __base,
500 __a,
501 __a_end,
502 __dc,
503 __thousands_sep,
504 __grouping,
505 __g,
506 __g_end,
507 const_cast<char_type*>(__atoms)))
508 break;
509474 }
510 if (__grouping.size() != 0 && __g_end - __g < __num_get_base::__num_get_buf_sz)
511 *__g_end++ = __dc;
512 // Stage 3
513 __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
514 // Digit grouping checked
515 __check_grouping(__grouping, __g, __g_end, __err);
516 // EOF checked
517 if (__b == __e)
518 __err |= ios_base::eofbit;
519 return __b;
520 }
521475
522 template <class _Unsigned>
523 _LIBCPP_HIDE_FROM_ABI iter_type
524 __do_get_unsigned(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const {
525 // Stage 1
526 int __base = this->__get_base(__iob);
527 // Stage 2
528 char_type __thousands_sep;
529 const int __atoms_size = __num_get_base::__int_chr_cnt;
530 char_type __atoms1[__atoms_size];
531 const char_type* __atoms = this->__do_widen(__iob, __atoms1);
532 string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
533 string __buf;
534 __buf.resize(__buf.capacity());
535 char* __a = &__buf[0];
536 char* __a_end = __a;
537 unsigned __g[__num_get_base::__num_get_buf_sz];
538 unsigned* __g_end = __g;
539 unsigned __dc = 0;
540 for (; __b != __e; ++__b) {
541 if (__a_end == __a + __buf.size()) {
542 size_t __tmp = __buf.size();
543 __buf.resize(2 * __buf.size());
544 __buf.resize(__buf.capacity());
545 __a = &__buf[0];
546 __a_end = __a + __tmp;
476 // Calculate the actual number
477 _Unsigned __val = 0;
478 bool __overflowed = false;
479 for (; __first != __last; ++__first) {
480 auto __c = *__first;
481 if (!__grouping.empty() && __c == __thousands_sep) {
482 if (__g_end - __g < this->__num_get_buf_sz) {
483 *__g_end++ = __dc;
484 __dc = 0;
485 }
486 continue;
547487 }
548 if (this->__stage2_int_loop(
549 *__b,
550 __base,
551 __a,
552 __a_end,
553 __dc,
554 __thousands_sep,
555 __grouping,
556 __g,
557 __g_end,
558 const_cast<char_type*>(__atoms)))
488 auto __offset = this->__atoms_offset(__atoms, __c);
489 if (__offset >= 22) // Not a valid integer character
490 break;
491
492 if (__base == 16 && __offset >= 16)
493 __offset -= 6;
494 if (__offset >= __base)
559495 break;
496 // __val = (__val * __base) + __offset
497 __overflowed |= __builtin_mul_overflow(__val, __base, std::addressof(__val)) ||
498 __builtin_add_overflow(__val, __offset, std::addressof(__val));
499 __parsed_num = true;
500 ++__dc;
501 }
502
503 if (!__parsed_num) {
504 __err |= ios_base::failbit;
505 __v = 0;
506 } else if (__overflowed) {
507 __err |= ios_base::failbit;
508 __v = is_signed<_MaybeSigned>::value && __negate
509 ? numeric_limits<_MaybeSigned>::min()
510 : numeric_limits<_MaybeSigned>::max();
511 } else if (!__negate) {
512 if (__val > static_cast<_Unsigned>(numeric_limits<_MaybeSigned>::max())) {
513 __err |= ios_base::failbit;
514 __v = numeric_limits<_MaybeSigned>::max();
515 } else {
516 __v = __val;
517 }
518 } else if (is_signed<_MaybeSigned>::value) {
519 if (__val > static_cast<_Unsigned>(numeric_limits<_MaybeSigned>::max()) + 1) {
520 __err |= ios_base::failbit;
521 __v = numeric_limits<_MaybeSigned>::min();
522 } else if (__val == static_cast<_Unsigned>(numeric_limits<_MaybeSigned>::max()) + 1) {
523 __v = numeric_limits<_MaybeSigned>::min();
524 } else {
525 __v = -__val;
526 }
527 } else {
528 __v = -__val;
560529 }
530
561531 if (__grouping.size() != 0 && __g_end - __g < __num_get_base::__num_get_buf_sz)
562532 *__g_end++ = __dc;
563 // Stage 3
564 __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
533
565534 // Digit grouping checked
566535 __check_grouping(__grouping, __g, __g_end, __err);
567536 // EOF checked
568 if (__b == __e)
537 if (__first == __last)
569538 __err |= ios_base::eofbit;
570 return __b;
539 return __first;
571540 }
572541
573542 virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const;
574543
575544 virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const {
576 return this->__do_get_signed(__b, __e, __iob, __err, __v);
545 return this->__do_get_integral(__b, __e, __iob, __err, __v);
577546 }
578547
579548 virtual iter_type
580549 do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const {
581 return this->__do_get_signed(__b, __e, __iob, __err, __v);
550 return this->__do_get_integral(__b, __e, __iob, __err, __v);
582551 }
583552
584553 virtual iter_type
585554 do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const {
586 return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
555 return this->__do_get_integral(__b, __e, __iob, __err, __v);
587556 }
588557
589558 virtual iter_type
590559 do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const {
591 return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
560 return this->__do_get_integral(__b, __e, __iob, __err, __v);
592561 }
593562
594563 virtual iter_type
595564 do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const {
596 return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
565 return this->__do_get_integral(__b, __e, __iob, __err, __v);
597566 }
598567
599568 virtual iter_type
600569 do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const {
601 return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
570 return this->__do_get_integral(__b, __e, __iob, __err, __v);
602571 }
603572
604573 virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const {
......@@ -652,40 +621,13 @@ _InputIterator num_get<_CharT, _InputIterator>::do_get(
652621template <class _CharT, class _InputIterator>
653622_InputIterator num_get<_CharT, _InputIterator>::do_get(
654623 iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const {
655 // Stage 1
656 int __base = 16;
657 // Stage 2
658 char_type __atoms[__num_get_base::__int_chr_cnt];
659 char_type __thousands_sep = char_type();
660 string __grouping;
661 std::use_facet<ctype<_CharT> >(__iob.getloc())
662 .widen(__num_get_base::__src, __num_get_base::__src + __num_get_base::__int_chr_cnt, __atoms);
663 string __buf;
664 __buf.resize(__buf.capacity());
665 char* __a = &__buf[0];
666 char* __a_end = __a;
667 unsigned __g[__num_get_base::__num_get_buf_sz];
668 unsigned* __g_end = __g;
669 unsigned __dc = 0;
670 for (; __b != __e; ++__b) {
671 if (__a_end == __a + __buf.size()) {
672 size_t __tmp = __buf.size();
673 __buf.resize(2 * __buf.size());
674 __buf.resize(__buf.capacity());
675 __a = &__buf[0];
676 __a_end = __a + __tmp;
677 }
678 if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
679 break;
680 }
681 // Stage 3
682 __buf.resize(__a_end - __a);
683 if (__locale::__sscanf(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
684 __err = ios_base::failbit;
685 // EOF checked
686 if (__b == __e)
687 __err |= ios_base::eofbit;
688 return __b;
624 auto __flags = __iob.flags();
625 __iob.flags((__flags & ~ios_base::basefield & ~ios_base::uppercase) | ios_base::hex);
626 uintptr_t __ptr;
627 auto __res = __do_get_integral(__b, __e, __iob, __err, __ptr);
628 __iob.flags(__flags);
629 __v = reinterpret_cast<void*>(__ptr);
630 return __res;
689631}
690632
691633extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>;
......@@ -748,6 +690,13 @@ void __num_put<_CharT>::__widen_and_group_int(
748690 __op = __ob + (__np - __nb);
749691}
750692
693_LIBCPP_HIDE_FROM_ABI inline bool __isdigit(char __c) { return __c >= '0' && __c <= '9'; }
694
695_LIBCPP_HIDE_FROM_ABI inline bool __isxdigit(char __c) {
696 auto __lower = __c | 0x20;
697 return std::__isdigit(__c) || (__lower >= 'a' && __lower <= 'f');
698}
699
751700template <class _CharT>
752701void __num_put<_CharT>::__widen_and_group_float(
753702 char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) {
......@@ -763,11 +712,11 @@ void __num_put<_CharT>::__widen_and_group_float(
763712 *__oe++ = __ct.widen(*__nf++);
764713 *__oe++ = __ct.widen(*__nf++);
765714 for (__ns = __nf; __ns < __ne; ++__ns)
766 if (!__locale::__isxdigit(*__ns, _LIBCPP_GET_C_LOCALE))
715 if (!std::__isxdigit(*__ns))
767716 break;
768717 } else {
769718 for (__ns = __nf; __ns < __ne; ++__ns)
770 if (!__locale::__isdigit(*__ns, _LIBCPP_GET_C_LOCALE))
719 if (!std::__isdigit(*__ns))
771720 break;
772721 }
773722 if (__grouping.empty()) {
......@@ -885,9 +834,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_ty
885834 const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
886835 typedef typename numpunct<char_type>::string_type string_type;
887836 string_type __nm = __v ? __np.truename() : __np.falsename();
888 for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
889 *__s = *__i;
890 return __s;
837 return std::copy(__nm.begin(), __nm.end(), __s);
891838}
892839
893840template <class _CharT, class _OutputIterator>
lib/libcxx/include/__locale_dir/pad_and_output.h+5-6
......@@ -13,6 +13,8 @@
1313
1414#if _LIBCPP_HAS_LOCALIZATION
1515
16# include <__algorithm/copy.h>
17# include <__algorithm/fill_n.h>
1618# include <ios>
1719
1820# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -30,12 +32,9 @@ _LIBCPP_HIDE_FROM_ABI _OutputIterator __pad_and_output(
3032 __ns -= __sz;
3133 else
3234 __ns = 0;
33 for (; __ob < __op; ++__ob, ++__s)
34 *__s = *__ob;
35 for (; __ns; --__ns, ++__s)
36 *__s = __fl;
37 for (; __ob < __oe; ++__ob, ++__s)
38 *__s = *__ob;
35 __s = std::copy(__ob, __op, __s);
36 __s = std::fill_n(__s, __ns, __fl);
37 __s = std::copy(__op, __oe, __s);
3938 __iob.width(0);
4039 return __s;
4140}
lib/libcxx/include/__locale_dir/support/bsd_like.h-20
......@@ -24,7 +24,6 @@
2424# include <wctype.h>
2525#endif
2626
27/* zig patch: https://github.com/llvm/llvm-project/pull/143055 */
2827#if __has_include(<xlocale.h>)
2928# include <xlocale.h>
3029#endif
......@@ -80,22 +79,9 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
8079 return ::strtold_l(__nptr, __endptr, __loc);
8180}
8281
83inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
84 return ::strtoll_l(__nptr, __endptr, __base, __loc);
85}
86
87inline _LIBCPP_HIDE_FROM_ABI unsigned long long
88__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
89 return ::strtoull_l(__nptr, __endptr, __base, __loc);
90}
91
9282//
9383// Character manipulation functions
9484//
95inline _LIBCPP_HIDE_FROM_ABI int __isdigit(int __c, __locale_t __loc) { return ::isdigit_l(__c, __loc); }
96
97inline _LIBCPP_HIDE_FROM_ABI int __isxdigit(int __c, __locale_t __loc) { return ::isxdigit_l(__c, __loc); }
98
9985#if defined(_LIBCPP_BUILDING_LIBRARY)
10086inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t __loc) { return ::toupper_l(__c, __loc); }
10187
......@@ -216,12 +202,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __
216202 char** __s, __locale_t __loc, const char* __format, _Args&&... __args) {
217203 return ::asprintf_l(__s, __loc, __format, std::forward<_Args>(__args)...); // non-standard
218204}
219
220template <class... _Args>
221_LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(
222 const char* __s, __locale_t __loc, const char* __format, _Args&&... __args) {
223 return ::sscanf_l(__s, __loc, __format, std::forward<_Args>(__args)...);
224}
225205_LIBCPP_DIAGNOSTIC_POP
226206#undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
227207
lib/libcxx/include/__locale_dir/support/fuchsia.h-7
......@@ -141,13 +141,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __
141141 __locale_guard __current(__loc);
142142 return ::asprintf(__s, __format, std::forward<_Args>(__args)...); // non-standard
143143}
144template <class... _Args>
145_LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(
146 const char* __s, __locale_t __loc, const char* __format, _Args&&... __args) {
147 __locale_guard __current(__loc);
148 return std::sscanf(__s, __format, std::forward<_Args>(__args)...);
149}
150
151144_LIBCPP_DIAGNOSTIC_POP
152145#undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
153146
lib/libcxx/include/__locale_dir/support/linux.h-37
......@@ -94,32 +94,9 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
9494 return ::strtold_l(__nptr, __endptr, __loc);
9595}
9696
97inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
98#if !_LIBCPP_HAS_MUSL_LIBC
99 return ::strtoll_l(__nptr, __endptr, __base, __loc);
100#else
101 (void)__loc;
102 return ::strtoll(__nptr, __endptr, __base);
103#endif
104}
105
106inline _LIBCPP_HIDE_FROM_ABI unsigned long long
107__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
108#if !_LIBCPP_HAS_MUSL_LIBC
109 return ::strtoull_l(__nptr, __endptr, __base, __loc);
110#else
111 (void)__loc;
112 return ::strtoull(__nptr, __endptr, __base);
113#endif
114}
115
11697//
11798// Character manipulation functions
11899//
119inline _LIBCPP_HIDE_FROM_ABI int __isdigit(int __c, __locale_t __loc) { return isdigit_l(__c, __loc); }
120
121inline _LIBCPP_HIDE_FROM_ABI int __isxdigit(int __c, __locale_t __loc) { return isxdigit_l(__c, __loc); }
122
123100#if defined(_LIBCPP_BUILDING_LIBRARY)
124101inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t __loc) { return toupper_l(__c, __loc); }
125102
......@@ -261,20 +238,6 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(
261238 va_end(__va);
262239 return __res;
263240}
264
265#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
266_LIBCPP_HIDE_FROM_ABI
267#endif
268inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(
269 const char* __s, __locale_t __loc, const char* __format, ...) {
270 va_list __va;
271 va_start(__va, __format);
272 __locale_guard __current(__loc);
273 int __res = std::vsscanf(__s, __format, __va);
274 va_end(__va);
275 return __res;
276}
277
278241} // namespace __locale
279242_LIBCPP_END_NAMESPACE_STD
280243
lib/libcxx/include/__locale_dir/support/netbsd.h-2
......@@ -6,8 +6,6 @@
66//
77//===----------------------------------------------------------------------===//
88
9/* zig patch: https://github.com/llvm/llvm-project/pull/143055 */
10
119#ifndef _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
1210#define _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
1311
lib/libcxx/include/__locale_dir/support/newlib.h created+243
......@@ -0,0 +1,243 @@
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_NEWLIB_H
10#define _LIBCPP___LOCALE_DIR_SUPPORT_NEWLIB_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__std_mbstate_t.h>
15#include <clocale> // std::lconv
16#include <cstdio>
17#include <cstdlib>
18#include <ctype.h>
19#include <stdarg.h>
20#include <string.h>
21#include <time.h>
22#if _LIBCPP_HAS_WIDE_CHARACTERS
23# include <cwchar>
24# include <wctype.h>
25#endif
26
27#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
28# pragma GCC system_header
29#endif
30
31_LIBCPP_BEGIN_NAMESPACE_STD
32namespace __locale {
33
34struct __locale_guard {
35 _LIBCPP_HIDE_FROM_ABI __locale_guard(locale_t& __loc) : __old_loc_(::uselocale(__loc)) {}
36
37 _LIBCPP_HIDE_FROM_ABI ~__locale_guard() {
38 if (__old_loc_)
39 ::uselocale(__old_loc_);
40 }
41
42 locale_t __old_loc_;
43
44 __locale_guard(__locale_guard const&) = delete;
45 __locale_guard& operator=(__locale_guard const&) = delete;
46};
47
48//
49// Locale management
50//
51#define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK
52#define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK
53#define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK
54#define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK
55#define _LIBCPP_TIME_MASK LC_TIME_MASK
56#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
57#define _LIBCPP_ALL_MASK LC_ALL_MASK
58#define _LIBCPP_LC_ALL LC_ALL
59
60using __locale_t _LIBCPP_NODEBUG = ::locale_t;
61
62#if defined(_LIBCPP_BUILDING_LIBRARY)
63using __lconv_t _LIBCPP_NODEBUG = std::lconv;
64
65inline _LIBCPP_HIDE_FROM_ABI __locale_t __newlocale(int __category_mask, const char* __locale, __locale_t __base) {
66 return ::newlocale(__category_mask, __locale, __base);
67}
68
69inline _LIBCPP_HIDE_FROM_ABI void __freelocale(__locale_t __loc) { ::freelocale(__loc); }
70
71inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, char const* __locale) {
72 return ::setlocale(__category, __locale);
73}
74
75inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
76 __locale_guard __current(__loc);
77 return std::localeconv();
78}
79#endif // _LIBCPP_BUILDING_LIBRARY
80
81//
82// Strtonum functions
83//
84inline _LIBCPP_HIDE_FROM_ABI float __strtof(const char* __nptr, char** __endptr, __locale_t __loc) {
85 return ::strtof_l(__nptr, __endptr, __loc);
86}
87
88inline _LIBCPP_HIDE_FROM_ABI double __strtod(const char* __nptr, char** __endptr, __locale_t __loc) {
89 return ::strtod_l(__nptr, __endptr, __loc);
90}
91
92inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __endptr, __locale_t __loc) {
93 return ::strtold_l(__nptr, __endptr, __loc);
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
151size_t __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_NEWLIB_H
lib/libcxx/include/__locale_dir/support/no_locale/characters.h-4
......@@ -29,10 +29,6 @@ namespace __locale {
2929//
3030// Character manipulation functions
3131//
32inline _LIBCPP_HIDE_FROM_ABI int __isdigit(int __c, __locale_t) { return std::isdigit(__c); }
33
34inline _LIBCPP_HIDE_FROM_ABI int __isxdigit(int __c, __locale_t) { return std::isxdigit(__c); }
35
3632#if defined(_LIBCPP_BUILDING_LIBRARY)
3733inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t) { return std::toupper(__c); }
3834
lib/libcxx/include/__locale_dir/support/no_locale/strtonum.h-9
......@@ -34,15 +34,6 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
3434 return std::strtold(__nptr, __endptr);
3535}
3636
37inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t) {
38 return std::strtoll(__nptr, __endptr, __base);
39}
40
41inline _LIBCPP_HIDE_FROM_ABI unsigned long long
42__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t) {
43 return std::strtoull(__nptr, __endptr, __base);
44}
45
4637} // namespace __locale
4738_LIBCPP_END_NAMESPACE_STD
4839
lib/libcxx/include/__locale_dir/support/windows.h-29
......@@ -186,21 +186,9 @@ inline _LIBCPP_HIDE_FROM_ABI double __strtod(const char* __nptr, char** __endptr
186186 return ::_strtod_l(__nptr, __endptr, __loc);
187187}
188188
189inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
190 return ::_strtoi64_l(__nptr, __endptr, __base, __loc);
191}
192inline _LIBCPP_HIDE_FROM_ABI unsigned long long
193__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
194 return ::_strtoui64_l(__nptr, __endptr, __base, __loc);
195}
196
197189//
198190// Character manipulation functions
199191//
200inline _LIBCPP_HIDE_FROM_ABI int __isdigit(int __c, __locale_t __loc) { return _isdigit_l(__c, __loc); }
201
202inline _LIBCPP_HIDE_FROM_ABI int __isxdigit(int __c, __locale_t __loc) { return _isxdigit_l(__c, __loc); }
203
204192#if defined(_LIBCPP_BUILDING_LIBRARY)
205193inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t __loc) { return ::_toupper_l(__c, __loc); }
206194
......@@ -280,23 +268,6 @@ _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snpri
280268_LIBCPP_EXPORTED_FROM_ABI
281269_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(char** __ret, __locale_t __loc, const char* __format, ...);
282270
283_LIBCPP_DIAGNOSTIC_PUSH
284_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
285_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") // GCC doesn't support [[gnu::format]] on variadic templates
286#ifdef _LIBCPP_COMPILER_CLANG_BASED
287# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) _LIBCPP_ATTRIBUTE_FORMAT(__VA_ARGS__)
288#else
289# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) /* nothing */
290#endif
291
292template <class... _Args>
293_LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(
294 const char* __dest, __locale_t __loc, const char* __format, _Args&&... __args) {
295 return ::_sscanf_l(__dest, __format, __loc, std::forward<_Args>(__args)...);
296}
297_LIBCPP_DIAGNOSTIC_POP
298#undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
299
300271#if defined(_LIBCPP_BUILDING_LIBRARY)
301272struct __locale_guard {
302273 _LIBCPP_HIDE_FROM_ABI __locale_guard(__locale_t __l) : __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
lib/libcxx/include/__locale_dir/time.h+3-7
......@@ -601,17 +601,13 @@ private:
601601 template <> \
602602 _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
603603 template <> \
604 _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
604 void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
605605 template <> \
606 _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze( \
607 char, const ctype<_CharT>&); \
606 __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
608607 extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() \
609608 const; \
610609 extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
611 extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
612 extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
613 extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type \
614 __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&);
610 extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&);
615611
616612_LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char)
617613# if _LIBCPP_HAS_WIDE_CHARACTERS
lib/libcxx/include/__math/hypot.h+1-1
......@@ -53,7 +53,7 @@ inline _LIBCPP_HIDE_FROM_ABI __promote_t<_A1, _A2> hypot(_A1 __x, _A2 __y) _NOEX
5353// Computes the three-dimensional hypotenuse: `std::hypot(x,y,z)`.
5454// The naive implementation might over-/underflow which is why this implementation is more involved:
5555// If the square of an argument might run into issues, we scale the arguments appropriately.
56// See https://github.com/llvm/llvm-project/issues/92782 for a detailed discussion and summary.
56// See https://llvm.org/PR92782 for a detailed discussion and summary.
5757template <class _Real>
5858_LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) {
5959 // Factors needed to determine if over-/underflow might happen
lib/libcxx/include/__math/logarithms.h+1-1
......@@ -58,7 +58,7 @@ inline _LIBCPP_HIDE_FROM_ABI double log10(_A1 __x) _NOEXCEPT {
5858inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT { return __builtin_ilogbf(__x); }
5959
6060template <class = int>
61_LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT {
61_LIBCPP_HIDE_FROM_ABI int ilogb(double __x) _NOEXCEPT {
6262 return __builtin_ilogb(__x);
6363}
6464
lib/libcxx/include/__math/traits.h+80-11
......@@ -25,33 +25,26 @@ namespace __math {
2525
2626// signbit
2727
28// TODO(LLVM 22): Remove conditional once support for Clang 19 is dropped.
29#if defined(_LIBCPP_COMPILER_GCC) || __has_constexpr_builtin(__builtin_signbit)
30# define _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_CONSTEXPR_SINCE_CXX23
31#else
32# define _LIBCPP_SIGNBIT_CONSTEXPR
33#endif
34
3528// The universal C runtime (UCRT) in the WinSDK provides floating point overloads
3629// for std::signbit(). By defining our overloads as templates, we can work around
3730// this issue as templates are less preferred than non-template functions.
3831template <class = void>
39[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT {
32[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT {
4033 return __builtin_signbit(__x);
4134}
4235
4336template <class = void>
44[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT {
37[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT {
4538 return __builtin_signbit(__x);
4639}
4740
4841template <class = void>
49[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT {
42[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT {
5043 return __builtin_signbit(__x);
5144}
5245
5346template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
54[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
47[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
5548 return __x < 0;
5649}
5750
......@@ -189,6 +182,82 @@ template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_ar
189182 return __builtin_isunordered((type)__x, (type)__y);
190183}
191184
185// MS UCRT incorrectly defines some functions in a way not working with integer types. Until C++20, this was worked
186// around by -fdelayed-template-parsing. Since C++20, we can use standard feature "requires" instead.
187
188// TODO: Remove the workaround once UCRT fixes these functions. Note that this doesn't seem planned as of 2025-07 per
189// https://developercommunity.visualstudio.com/t/10294165.
190
191#if defined(_LIBCPP_MSVCRT) && _LIBCPP_STD_VER >= 20
192namespace __ucrt {
193template <class _A1>
194 requires is_integral_v<_A1>
195[[nodiscard]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) noexcept {
196 return true;
197}
198
199template <class _A1>
200 requires is_integral_v<_A1>
201[[nodiscard]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1) noexcept {
202 return false;
203}
204
205template <class _A1>
206 requires is_integral_v<_A1>
207[[nodiscard]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) noexcept {
208 return false;
209}
210
211template <class _A1>
212 requires is_integral_v<_A1>
213[[nodiscard]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) noexcept {
214 return __x != 0;
215}
216
217template <class _A1, class _A2>
218 requires is_arithmetic_v<_A1> && is_arithmetic_v<_A2>
219[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) noexcept {
220 using type = __promote_t<_A1, _A2>;
221 return __builtin_isgreater((type)__x, (type)__y);
222}
223
224template <class _A1, class _A2>
225 requires is_arithmetic_v<_A1> && is_arithmetic_v<_A2>
226[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) noexcept {
227 using type = __promote_t<_A1, _A2>;
228 return __builtin_isgreaterequal((type)__x, (type)__y);
229}
230
231template <class _A1, class _A2>
232 requires is_arithmetic_v<_A1> && is_arithmetic_v<_A2>
233[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) noexcept {
234 using type = __promote_t<_A1, _A2>;
235 return __builtin_isless((type)__x, (type)__y);
236}
237
238template <class _A1, class _A2>
239 requires is_arithmetic_v<_A1> && is_arithmetic_v<_A2>
240[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) noexcept {
241 using type = __promote_t<_A1, _A2>;
242 return __builtin_islessequal((type)__x, (type)__y);
243}
244
245template <class _A1, class _A2>
246 requires is_arithmetic_v<_A1> && is_arithmetic_v<_A2>
247[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) noexcept {
248 using type = __promote_t<_A1, _A2>;
249 return __builtin_islessgreater((type)__x, (type)__y);
250}
251
252template <class _A1, class _A2>
253 requires is_arithmetic_v<_A1> && is_arithmetic_v<_A2>
254[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) noexcept {
255 using type = __promote_t<_A1, _A2>;
256 return __builtin_isunordered((type)__x, (type)__y);
257}
258} // namespace __ucrt
259#endif
260
192261} // namespace __math
193262
194263_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__mdspan/extents.h+7-4
......@@ -25,6 +25,7 @@
2525#include <__type_traits/integer_traits.h>
2626#include <__type_traits/is_convertible.h>
2727#include <__type_traits/is_nothrow_constructible.h>
28#include <__type_traits/is_signed.h>
2829#include <__type_traits/make_unsigned.h>
2930#include <__utility/integer_sequence.h>
3031#include <__utility/unreachable.h>
......@@ -298,11 +299,13 @@ private:
298299
299300public:
300301 // [mdspan.extents.obs], observers of multidimensional index space
301 _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return __rank_; }
302 _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { return __rank_dynamic_; }
302 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return __rank_; }
303 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { return __rank_dynamic_; }
303304
304 _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept { return __vals_.__value(__r); }
305 _LIBCPP_HIDE_FROM_ABI static constexpr size_t static_extent(rank_type __r) noexcept {
305 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept {
306 return __vals_.__value(__r);
307 }
308 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr size_t static_extent(rank_type __r) noexcept {
306309 return _Values::__static_value(__r);
307310 }
308311
lib/libcxx/include/__mdspan/layout_stride.h+4-5
......@@ -272,11 +272,10 @@ public:
272272 return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
273273 if ((__extents_.extent(_Pos) * ... * 1) == 0)
274274 return static_cast<index_type>(0);
275 else
276 return static_cast<index_type>(
277 static_cast<index_type>(1) +
278 (((__extents_.extent(_Pos) - static_cast<index_type>(1)) * __strides_[_Pos]) + ... +
279 static_cast<index_type>(0)));
275
276 return static_cast<index_type>(
277 static_cast<index_type>(1) + (((__extents_.extent(_Pos) - static_cast<index_type>(1)) * __strides_[_Pos]) +
278 ... + static_cast<index_type>(0)));
280279 }(make_index_sequence<__rank_>());
281280 }
282281 }
lib/libcxx/include/__mdspan/mdspan.h+29-23
......@@ -87,16 +87,17 @@ public:
8787 using data_handle_type = typename accessor_type::data_handle_type;
8888 using reference = typename accessor_type::reference;
8989
90 _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return extents_type::rank(); }
91 _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); }
92 _LIBCPP_HIDE_FROM_ABI static constexpr size_t static_extent(rank_type __r) noexcept {
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return extents_type::rank(); }
91 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept {
92 return extents_type::rank_dynamic();
93 }
94 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr size_t static_extent(rank_type __r) noexcept {
9395 return extents_type::static_extent(__r);
9496 }
95 _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept {
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept {
9698 return __map_.extents().extent(__r);
97 };
99 }
98100
99public:
100101 //--------------------------------------------------------------------------------
101102 // [mdspan.mdspan.cons], mdspan constructors, assignment, and destructor
102103
......@@ -185,7 +186,7 @@ public:
185186 requires((is_convertible_v<_OtherIndexTypes, index_type> && ...) &&
186187 (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
187188 (sizeof...(_OtherIndexTypes) == rank()))
188 _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const {
189 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const {
189190 // Note the standard layouts would also check this, but user provided ones may not, so we
190191 // check the precondition here
191192 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __indices...),
......@@ -196,7 +197,8 @@ public:
196197 template <class _OtherIndexType>
197198 requires(is_convertible_v<const _OtherIndexType&, index_type> &&
198199 is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
199 _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](const array< _OtherIndexType, rank()>& __indices) const {
200 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference
201 operator[](const array< _OtherIndexType, rank()>& __indices) const {
200202 return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
201203 return __map_(__indices[_Idxs]...);
202204 }(make_index_sequence<rank()>()));
......@@ -205,13 +207,13 @@ public:
205207 template <class _OtherIndexType>
206208 requires(is_convertible_v<const _OtherIndexType&, index_type> &&
207209 is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
208 _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](span<_OtherIndexType, rank()> __indices) const {
210 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](span<_OtherIndexType, rank()> __indices) const {
209211 return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
210212 return __map_(__indices[_Idxs]...);
211213 }(make_index_sequence<rank()>()));
212214 }
213215
214 _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept {
216 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept {
215217 // Could leave this as only checked in debug mode: semantically size() is never
216218 // guaranteed to be related to any accessible range
217219 _LIBCPP_ASSERT_UNCATEGORIZED(
......@@ -237,24 +239,28 @@ public:
237239 swap(__x.__acc_, __y.__acc_);
238240 }
239241
240 _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept { return __map_.extents(); };
241 _LIBCPP_HIDE_FROM_ABI constexpr const data_handle_type& data_handle() const noexcept { return __ptr_; };
242 _LIBCPP_HIDE_FROM_ABI constexpr const mapping_type& mapping() const noexcept { return __map_; };
243 _LIBCPP_HIDE_FROM_ABI constexpr const accessor_type& accessor() const noexcept { return __acc_; };
242 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept {
243 return __map_.extents();
244 }
245 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const data_handle_type& data_handle() const noexcept { return __ptr_; }
246 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const mapping_type& mapping() const noexcept { return __map_; }
247 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const accessor_type& accessor() const noexcept { return __acc_; }
244248
245249 // per LWG-4021 "mdspan::is_always_meow() should be noexcept"
246 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); };
247 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept {
250 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept {
251 return mapping_type::is_always_unique();
252 }
253 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept {
248254 return mapping_type::is_always_exhaustive();
249 };
250 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept {
255 }
256 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept {
251257 return mapping_type::is_always_strided();
252 };
258 }
253259
254 _LIBCPP_HIDE_FROM_ABI constexpr bool is_unique() const { return __map_.is_unique(); };
255 _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const { return __map_.is_exhaustive(); };
256 _LIBCPP_HIDE_FROM_ABI constexpr bool is_strided() const { return __map_.is_strided(); };
257 _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const { return __map_.stride(__r); };
260 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_unique() const { return __map_.is_unique(); }
261 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const { return __map_.is_exhaustive(); }
262 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_strided() const { return __map_.is_strided(); }
263 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const { return __map_.stride(__r); }
258264
259265private:
260266 _LIBCPP_NO_UNIQUE_ADDRESS data_handle_type __ptr_{};
lib/libcxx/include/__memory/addressof.h+7-5
......@@ -19,7 +19,8 @@
1919_LIBCPP_BEGIN_NAMESPACE_STD
2020
2121template <class _Tp>
22inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* addressof(_Tp& __x) _NOEXCEPT {
22[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp*
23addressof(_Tp& __x) _NOEXCEPT {
2324 return __builtin_addressof(__x);
2425}
2526
......@@ -27,24 +28,25 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* a
2728// Objective-C++ Automatic Reference Counting uses qualified pointers
2829// that require special addressof() signatures.
2930template <class _Tp>
30inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT {
31[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT {
3132 return &__x;
3233}
3334
3435# if __has_feature(objc_arc_weak)
3536template <class _Tp>
36inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
37[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
3738 return &__x;
3839}
3940# endif
4041
4142template <class _Tp>
42inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT {
43[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT {
4344 return &__x;
4445}
4546
4647template <class _Tp>
47inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT {
48[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp*
49addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT {
4850 return &__x;
4951}
5052#endif
lib/libcxx/include/__memory/align.h+18-1
......@@ -11,6 +11,7 @@
1111
1212#include <__config>
1313#include <__cstddef/size_t.h>
14#include <cstdint>
1415
1516#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1617# pragma GCC system_header
......@@ -18,7 +19,23 @@
1819
1920_LIBCPP_BEGIN_NAMESPACE_STD
2021
21_LIBCPP_EXPORTED_FROM_ABI void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
22inline namespace __align_inline {
23_LIBCPP_HIDE_FROM_ABI inline void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space) {
24 void* __r = nullptr;
25 if (__sz <= __space) {
26 char* __p1 = static_cast<char*>(__ptr);
27 char* __p2 = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(__p1 + (__align - 1)) & -__align);
28 size_t __d = static_cast<size_t>(__p2 - __p1);
29 if (__d <= __space - __sz) {
30 __r = __p2;
31 __ptr = __r;
32 __space -= __d;
33 }
34 }
35 return __r;
36}
37
38} // namespace __align_inline
2239
2340_LIBCPP_END_NAMESPACE_STD
2441
lib/libcxx/include/__memory/allocate_at_least.h+15-10
......@@ -19,26 +19,31 @@
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
2121
22template <class _Pointer, class _SizeT = size_t>
23struct __allocation_result {
24 _Pointer ptr;
25 _SizeT count;
26
27 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __allocation_result(_Pointer __ptr, _SizeT __count)
28 : ptr(__ptr), count(__count) {}
29};
30_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__allocation_result);
31
2232#if _LIBCPP_STD_VER >= 23
2333
2434template <class _Alloc>
2535[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n) {
26 return std::allocator_traits<_Alloc>::allocate_at_least(__alloc, __n);
36 auto __res = std::allocator_traits<_Alloc>::allocate_at_least(__alloc, __n);
37 return __allocation_result{__res.ptr, __res.count};
2738}
2839
2940#else
3041
31template <class _Pointer>
32struct __allocation_result {
33 _Pointer ptr;
34 size_t count;
35};
36
37template <class _Alloc>
42template <class _Alloc, class _Traits = allocator_traits<_Alloc> >
3843[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
39_LIBCPP_CONSTEXPR __allocation_result<typename allocator_traits<_Alloc>::pointer>
44_LIBCPP_CONSTEXPR __allocation_result<typename _Traits::pointer, typename _Traits::size_type>
4045__allocate_at_least(_Alloc& __alloc, size_t __n) {
41 return {__alloc.allocate(__n), __n};
46 return __allocation_result<typename _Traits::pointer, typename _Traits::size_type>(__alloc.allocate(__n), __n);
4247}
4348
4449#endif // _LIBCPP_STD_VER >= 23
lib/libcxx/include/__memory/allocator.h+14-26
......@@ -14,7 +14,6 @@
1414#include <__cstddef/ptrdiff_t.h>
1515#include <__cstddef/size_t.h>
1616#include <__memory/addressof.h>
17#include <__memory/allocate_at_least.h>
1817#include <__memory/allocator_traits.h>
1918#include <__new/allocate.h>
2019#include <__new/exceptions.h>
......@@ -51,33 +50,21 @@ public:
5150};
5251#endif // _LIBCPP_STD_VER <= 17
5352
54// This class provides a non-trivial default constructor to the class that derives from it
55// if the condition is satisfied.
56//
57// The second template parameter exists to allow giving a unique type to __non_trivial_if,
58// which makes it possible to avoid breaking the ABI when making this a base class of an
59// existing class. Without that, imagine we have classes D1 and D2, both of which used to
60// have no base classes, but which now derive from __non_trivial_if. The layout of a class
61// that inherits from both D1 and D2 will change because the two __non_trivial_if base
62// classes are not allowed to share the same address.
63//
64// By making those __non_trivial_if base classes unique, we work around this problem and
65// it is safe to start deriving from __non_trivial_if in existing classes.
66template <bool _Cond, class _Unique>
67struct __non_trivial_if {};
53template <bool, class _Unique>
54struct __non_trivially_default_constructible_if {};
6855
6956template <class _Unique>
70struct __non_trivial_if<true, _Unique> {
71 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT {}
57struct __non_trivially_default_constructible_if<true, _Unique> {
58 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __non_trivially_default_constructible_if() {}
7259};
7360
74// allocator
75//
76// Note: For ABI compatibility between C++20 and previous standards, we make
77// allocator<void> trivial in C++20.
78
7961template <class _Tp>
80class allocator : private __non_trivial_if<!is_void<_Tp>::value, allocator<_Tp> > {
62class allocator
63// TODO(LLVM 24): Remove the opt-out
64#ifdef _LIBCPP_DEPRECATED_ABI_NON_TRIVIAL_ALLOCATOR
65 : __non_trivially_default_constructible_if<!is_void<_Tp>::value, allocator<_Tp> >
66#endif
67{
8168 static_assert(!is_const<_Tp>::value, "std::allocator does not support const types");
8269 static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
8370
......@@ -133,10 +120,11 @@ public:
133120 typedef allocator<_Up> other;
134121 };
135122
136 _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI pointer address(reference __x) const _NOEXCEPT {
123 [[__nodiscard__]] _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI pointer address(reference __x) const _NOEXCEPT {
137124 return std::addressof(__x);
138125 }
139 _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT {
126 [[__nodiscard__]] _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer
127 address(const_reference __x) const _NOEXCEPT {
140128 return std::addressof(__x);
141129 }
142130
......@@ -144,7 +132,7 @@ public:
144132 return allocate(__n);
145133 }
146134
147 _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
135 [[__nodiscard__]] _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
148136 return size_type(~0) / sizeof(_Tp);
149137 }
150138
lib/libcxx/include/__memory/allocator_traits.h+6-4
......@@ -314,23 +314,25 @@ struct allocator_traits {
314314 }
315315
316316 template <class _Ap = _Alloc, __enable_if_t<__has_max_size_v<const _Ap>, int> = 0>
317 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type& __a) _NOEXCEPT {
317 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
318 max_size(const allocator_type& __a) _NOEXCEPT {
318319 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
319320 return __a.max_size();
320321 _LIBCPP_SUPPRESS_DEPRECATED_POP
321322 }
322323 template <class _Ap = _Alloc, __enable_if_t<!__has_max_size_v<const _Ap>, int> = 0>
323 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type&) _NOEXCEPT {
324 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
325 max_size(const allocator_type&) _NOEXCEPT {
324326 return numeric_limits<size_type>::max() / sizeof(value_type);
325327 }
326328
327329 template <class _Ap = _Alloc, __enable_if_t<__has_select_on_container_copy_construction_v<const _Ap>, int> = 0>
328 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
330 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
329331 select_on_container_copy_construction(const allocator_type& __a) {
330332 return __a.select_on_container_copy_construction();
331333 }
332334 template <class _Ap = _Alloc, __enable_if_t<!__has_select_on_container_copy_construction_v<const _Ap>, int> = 0>
333 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
335 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
334336 select_on_container_copy_construction(const allocator_type& __a) {
335337 return __a;
336338 }
lib/libcxx/include/__memory/compressed_pair.h+15-9
......@@ -28,8 +28,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2828// understand how it works). //
2929// ================================================================================================================== //
3030
31// The first member is aligned to the alignment of the second member to force padding in front of the compressed pair
32// in case there are members before it.
31// On GCC, the first member is aligned to the alignment of the second member to force padding in front of the compressed
32// pair in case there are members before it.
3333//
3434// For example:
3535// (assuming x86-64 linux)
......@@ -52,7 +52,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5252//
5353// Furthermore, that alignment must be the same as what was used in the old __compressed_pair layout, so we must
5454// handle reference types specially since alignof(T&) == alignof(T).
55// See https://github.com/llvm/llvm-project/issues/118559.
55// See https://llvm.org/PR118559.
56//
57// On Clang, this is unnecessary, since we use anonymous structs instead, which automatically handle the alignment
58// correctly.
5659
5760#ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING
5861
......@@ -64,7 +67,7 @@ inline const size_t __compressed_pair_alignment<_Tp&> = _LIBCPP_ALIGNOF(void*);
6467
6568template <class _ToPad>
6669inline const bool __is_reference_or_unpadded_object =
67 (is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) || sizeof(_ToPad) == __datasizeof_v<_ToPad>;
70 (is_empty<_ToPad>::value && !__is_final_v<_ToPad>) || sizeof(_ToPad) == __datasizeof_v<_ToPad>;
6871
6972template <class _Tp>
7073inline const bool __is_reference_or_unpadded_object<_Tp&> = true;
......@@ -80,6 +83,10 @@ class __compressed_pair_padding {
8083template <class _ToPad>
8184class __compressed_pair_padding<_ToPad, true> {};
8285
86# define _LIBCPP_COMPRESSED_ELEMENT(T1, Initializer1) \
87 _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1; \
88 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding_, __LINE__, _)
89
8390// TODO: Fix the ABI for GCC as well once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121637 is fixed
8491# ifdef _LIBCPP_COMPILER_GCC
8592# define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
......@@ -100,8 +107,7 @@ class __compressed_pair_padding<_ToPad, true> {};
100107# else
101108# define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
102109 struct { \
103 _LIBCPP_NO_UNIQUE_ADDRESS \
104 __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>))) T1 Initializer1; \
110 _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1; \
105111 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \
106112 _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \
107113 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \
......@@ -109,9 +115,7 @@ class __compressed_pair_padding<_ToPad, true> {};
109115
110116# define _LIBCPP_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, Initializer3) \
111117 struct { \
112 _LIBCPP_NO_UNIQUE_ADDRESS \
113 __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>), \
114 __aligned__(::std::__compressed_pair_alignment<T3>))) T1 Initializer1; \
118 _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1; \
115119 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \
116120 _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \
117121 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \
......@@ -121,6 +125,8 @@ class __compressed_pair_padding<_ToPad, true> {};
121125# endif
122126
123127#else
128# define _LIBCPP_COMPRESSED_ELEMENT(T1, Initializer1) _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1
129
124130# define _LIBCPP_COMPRESSED_PAIR(T1, Name1, T2, Name2) \
125131 _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \
126132 _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2
lib/libcxx/include/__memory/construct_at.h+12-23
......@@ -14,7 +14,6 @@
1414#include <__config>
1515#include <__memory/addressof.h>
1616#include <__new/placement_new_delete.h>
17#include <__type_traits/enable_if.h>
1817#include <__type_traits/is_array.h>
1918#include <__utility/declval.h>
2019#include <__utility/forward.h>
......@@ -33,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3332#if _LIBCPP_STD_VER >= 20
3433
3534template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
36_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) {
35_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* _LIBCPP_DIAGNOSE_NULLPTR __location, _Args&&... __args) {
3736 _LIBCPP_ASSERT_NON_NULL(__location != nullptr, "null pointer given to construct_at");
3837 return ::new (static_cast<void*>(__location)) _Tp(std::forward<_Args>(__args)...);
3938}
......@@ -55,35 +54,25 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __construct_at(_Tp* __l
5554// The internal functions are available regardless of the language version (with the exception of the `__destroy_at`
5655// taking an array).
5756
58template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
57template <class _Tp>
5958_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) {
6059 _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
61 __loc->~_Tp();
62}
63
6460#if _LIBCPP_STD_VER >= 20
65template <class _Tp, __enable_if_t<is_array<_Tp>::value, int> = 0>
66_LIBCPP_HIDE_FROM_ABI constexpr void __destroy_at(_Tp* __loc) {
67 _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
68 for (auto&& __val : *__loc)
69 std::__destroy_at(std::addressof(__val));
70}
61 if constexpr (is_array_v<_Tp>) {
62 for (auto&& __val : *__loc)
63 std::__destroy_at(std::addressof(__val));
64 } else
7165#endif
72
73#if _LIBCPP_STD_VER >= 17
74
75template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0>
76_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) {
77 std::__destroy_at(__loc);
66 {
67 __loc->~_Tp();
68 }
7869}
7970
80# if _LIBCPP_STD_VER >= 20
81template <class _Tp, enable_if_t<is_array_v<_Tp>, int> = 0>
82_LIBCPP_HIDE_FROM_ABI constexpr void destroy_at(_Tp* __loc) {
71#if _LIBCPP_STD_VER >= 17
72template <class _Tp>
73_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* _LIBCPP_DIAGNOSE_NULLPTR __loc) {
8374 std::__destroy_at(__loc);
8475}
85# endif
86
8776#endif // _LIBCPP_STD_VER >= 17
8877
8978_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__memory/inout_ptr.h+1-1
......@@ -96,7 +96,7 @@ private:
9696};
9797
9898template <class _Pointer = void, class _Smart, class... _Args>
99_LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
99[[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
100100 using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
101101 return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
102102}
lib/libcxx/include/__memory/is_sufficiently_aligned.h+1-1
......@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2323#if _LIBCPP_STD_VER >= 26
2424
2525template <size_t _Alignment, class _Tp>
26_LIBCPP_HIDE_FROM_ABI bool is_sufficiently_aligned(_Tp* __ptr) {
26[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_sufficiently_aligned(_Tp* __ptr) {
2727 return reinterpret_cast<uintptr_t>(__ptr) % _Alignment == 0;
2828}
2929
lib/libcxx/include/__memory/out_ptr.h+1-1
......@@ -88,7 +88,7 @@ private:
8888};
8989
9090template <class _Pointer = void, class _Smart, class... _Args>
91_LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) {
91[[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) {
9292 using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
9393 return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
9494}
lib/libcxx/include/__memory/pointer_traits.h+1-1
......@@ -255,7 +255,7 @@ concept __resettable_smart_pointer_with_args = requires(_Smart __s, _Pointer __p
255255// This function ensures safe conversions between fancy pointers at compile-time, where we avoid casts from/to
256256// `__void_pointer` by obtaining the underlying raw pointer from the fancy pointer using `std::to_address`,
257257// then dereferencing it to retrieve the pointed-to object, and finally constructing the target fancy pointer
258// to that object using the `std::pointer_traits<>::pinter_to` function.
258// to that object using the `std::pointer_traits<>::pointer_to` function.
259259template <class _PtrTo, class _PtrFrom>
260260_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _PtrTo __static_fancy_pointer_cast(const _PtrFrom& __p) {
261261 using __ptr_traits = pointer_traits<_PtrTo>;
lib/libcxx/include/__memory/raw_storage_iterator.h+3-9
......@@ -28,15 +28,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2828
2929#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
3030
31_LIBCPP_SUPPRESS_DEPRECATED_PUSH
3231template <class _OutputIterator, class _Tp>
3332class _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
34# if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
35 : public iterator<output_iterator_tag, void, void, void, void>
36# endif
37{
38 _LIBCPP_SUPPRESS_DEPRECATED_POP
39
33 : public __iterator_base<raw_storage_iterator<_OutputIterator, _Tp>, output_iterator_tag, void, void, void, void> {
4034private:
4135 _OutputIterator __x_;
4236
......@@ -52,7 +46,7 @@ public:
5246 typedef void reference;
5347
5448 _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
55 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; }
49 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; }
5650 _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) {
5751 ::new ((void*)std::addressof(*__x_)) _Tp(__element);
5852 return *this;
......@@ -73,7 +67,7 @@ public:
7367 return __t;
7468 }
7569# if _LIBCPP_STD_VER >= 14
76 _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
70 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
7771# endif
7872};
7973
lib/libcxx/include/__memory/shared_count.h+9-30
......@@ -22,37 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
2323// should be sufficient for thread safety.
2424// See https://llvm.org/PR22803
25#if (defined(__clang__) && __has_builtin(__atomic_add_fetch) && defined(__ATOMIC_RELAXED) && \
26 defined(__ATOMIC_ACQ_REL)) || \
27 defined(_LIBCPP_COMPILER_GCC)
28# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT 1
29#else
30# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT 0
31#endif
32
33template <class _ValueType>
34inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
35#if _LIBCPP_HAS_THREADS && defined(__ATOMIC_RELAXED) && \
36 (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
37 return __atomic_load_n(__value, __ATOMIC_RELAXED);
38#else
39 return *__value;
40#endif
41}
42
43template <class _ValueType>
44inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) {
45#if _LIBCPP_HAS_THREADS && defined(__ATOMIC_ACQUIRE) && \
46 (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
47 return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
48#else
49 return *__value;
50#endif
51}
5225
5326template <class _Tp>
5427inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT {
55#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && _LIBCPP_HAS_THREADS
28#if _LIBCPP_HAS_THREADS
5629 return __atomic_add_fetch(std::addressof(__t), 1, __ATOMIC_RELAXED);
5730#else
5831 return __t += 1;
......@@ -61,7 +34,7 @@ inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _N
6134
6235template <class _Tp>
6336inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT {
64#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && _LIBCPP_HAS_THREADS
37#if _LIBCPP_HAS_THREADS
6538 return __atomic_add_fetch(std::addressof(__t), -1, __ATOMIC_ACQ_REL);
6639#else
6740 return __t -= 1;
......@@ -95,7 +68,13 @@ public:
9568 return false;
9669 }
9770#endif
98 _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __libcpp_relaxed_load(&__shared_owners_) + 1; }
71 _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT {
72#if _LIBCPP_HAS_THREADS
73 return __atomic_load_n(&__shared_owners_, __ATOMIC_RELAXED) + 1;
74#else
75 return __shared_owners_ + 1;
76#endif
77 }
9978};
10079
10180class _LIBCPP_EXPORTED_FROM_ABI __shared_weak_count : private __shared_count {
lib/libcxx/include/__memory/shared_ptr.h+100-145
......@@ -41,19 +41,18 @@
4141#include <__type_traits/enable_if.h>
4242#include <__type_traits/integral_constant.h>
4343#include <__type_traits/is_array.h>
44#include <__type_traits/is_bounded_array.h>
4544#include <__type_traits/is_constructible.h>
4645#include <__type_traits/is_convertible.h>
4746#include <__type_traits/is_function.h>
4847#include <__type_traits/is_reference.h>
4948#include <__type_traits/is_same.h>
50#include <__type_traits/is_unbounded_array.h>
5149#include <__type_traits/nat.h>
5250#include <__type_traits/negation.h>
5351#include <__type_traits/remove_cv.h>
5452#include <__type_traits/remove_extent.h>
5553#include <__type_traits/remove_reference.h>
5654#include <__utility/declval.h>
55#include <__utility/exception_guard.h>
5756#include <__utility/forward.h>
5857#include <__utility/move.h>
5958#include <__utility/swap.h>
......@@ -78,7 +77,7 @@ public:
7877 _LIBCPP_HIDE_FROM_ABI bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
7978 _LIBCPP_HIDE_FROM_ABI bad_weak_ptr& operator=(const bad_weak_ptr&) _NOEXCEPT = default;
8079 ~bad_weak_ptr() _NOEXCEPT override;
81 const char* what() const _NOEXCEPT override;
80 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
8281};
8382
8483[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
......@@ -316,10 +315,8 @@ public:
316315#endif
317316
318317 // A shared_ptr contains only two raw pointers which point to the heap and move constructing already doesn't require
319 // any bookkeeping, so it's always trivially relocatable. It is also replaceable because assignment just rebinds the
320 // shared_ptr to manage a different object.
318 // any bookkeeping, so it's always trivially relocatable.
321319 using __trivially_relocatable _LIBCPP_NODEBUG = shared_ptr;
322 using __replaceable _LIBCPP_NODEBUG = shared_ptr;
323320
324321private:
325322 element_type* __ptr_;
......@@ -352,23 +349,16 @@ public:
352349
353350 template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
354351 _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) {
355#if _LIBCPP_HAS_EXCEPTIONS
356 try {
357#endif // _LIBCPP_HAS_EXCEPTIONS
358 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
359 typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
352 auto __guard = std::__make_exception_guard([&] { __d(__p); });
353 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
354 typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
360355#ifndef _LIBCPP_CXX03_LANG
361 __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
356 __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
362357#else
363358 __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
364359#endif // not _LIBCPP_CXX03_LANG
365 __enable_weak_this(__p, __p);
366#if _LIBCPP_HAS_EXCEPTIONS
367 } catch (...) {
368 __d(__p);
369 throw;
370 }
371#endif // _LIBCPP_HAS_EXCEPTIONS
360 __enable_weak_this(__p, __p);
361 __guard.__complete();
372362 }
373363
374364 template <class _Yp,
......@@ -376,28 +366,21 @@ public:
376366 class _Alloc,
377367 __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
378368 _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) {
379#if _LIBCPP_HAS_EXCEPTIONS
380 try {
381#endif // _LIBCPP_HAS_EXCEPTIONS
382 typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
383 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
384 typedef __allocator_destructor<_A2> _D2;
385 _A2 __a2(__a);
386 unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
387 ::new ((void*)std::addressof(*__hold2.get()))
369 auto __guard = std::__make_exception_guard([&] { __d(__p); });
370 typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
371 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
372 typedef __allocator_destructor<_A2> _D2;
373 _A2 __a2(__a);
374 unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
375 ::new ((void*)std::addressof(*__hold2.get()))
388376#ifndef _LIBCPP_CXX03_LANG
389 _CntrlBlk(__p, std::move(__d), __a);
377 _CntrlBlk(__p, std::move(__d), __a);
390378#else
391379 _CntrlBlk(__p, __d, __a);
392380#endif // not _LIBCPP_CXX03_LANG
393 __cntrl_ = std::addressof(*__hold2.release());
394 __enable_weak_this(__p, __p);
395#if _LIBCPP_HAS_EXCEPTIONS
396 } catch (...) {
397 __d(__p);
398 throw;
399 }
400#endif // _LIBCPP_HAS_EXCEPTIONS
381 __cntrl_ = std::addressof(*__hold2.release());
382 __enable_weak_this(__p, __p);
383 __guard.__complete();
401384 }
402385
403386 template <class _Dp>
......@@ -406,22 +389,15 @@ public:
406389 _Dp __d,
407390 __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
408391 : __ptr_(nullptr) {
409#if _LIBCPP_HAS_EXCEPTIONS
410 try {
411#endif // _LIBCPP_HAS_EXCEPTIONS
412 typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
413 typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
392 auto __guard = std::__make_exception_guard([&] { __d(__p); });
393 typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
394 typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
414395#ifndef _LIBCPP_CXX03_LANG
415 __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
396 __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
416397#else
417398 __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
418399#endif // not _LIBCPP_CXX03_LANG
419#if _LIBCPP_HAS_EXCEPTIONS
420 } catch (...) {
421 __d(__p);
422 throw;
423 }
424#endif // _LIBCPP_HAS_EXCEPTIONS
400 __guard.__complete();
425401 }
426402
427403 template <class _Dp, class _Alloc>
......@@ -431,27 +407,20 @@ public:
431407 _Alloc __a,
432408 __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
433409 : __ptr_(nullptr) {
434#if _LIBCPP_HAS_EXCEPTIONS
435 try {
436#endif // _LIBCPP_HAS_EXCEPTIONS
437 typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
438 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
439 typedef __allocator_destructor<_A2> _D2;
440 _A2 __a2(__a);
441 unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
442 ::new ((void*)std::addressof(*__hold2.get()))
410 auto __guard = std::__make_exception_guard([&] { __d(__p); });
411 typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
412 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
413 typedef __allocator_destructor<_A2> _D2;
414 _A2 __a2(__a);
415 unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
416 ::new ((void*)std::addressof(*__hold2.get()))
443417#ifndef _LIBCPP_CXX03_LANG
444 _CntrlBlk(__p, std::move(__d), __a);
418 _CntrlBlk(__p, std::move(__d), __a);
445419#else
446420 _CntrlBlk(__p, __d, __a);
447421#endif // not _LIBCPP_CXX03_LANG
448 __cntrl_ = std::addressof(*__hold2.release());
449#if _LIBCPP_HAS_EXCEPTIONS
450 } catch (...) {
451 __d(__p);
452 throw;
453 }
454#endif // _LIBCPP_HAS_EXCEPTIONS
422 __cntrl_ = std::addressof(*__hold2.release());
423 __guard.__complete();
455424 }
456425
457426 template <class _Yp>
......@@ -514,45 +483,16 @@ public:
514483
515484 template <class _Yp,
516485 class _Dp,
517 __enable_if_t<!is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value &&
486 __enable_if_t<__compatible_with<_Yp, _Tp>::value &&
518487 is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
519488 int> = 0>
520489 _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
521#if _LIBCPP_STD_VER >= 14
522 if (__ptr_ == nullptr)
523 __cntrl_ = nullptr;
524 else
525#endif
526 {
527 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
528 typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT> _CntrlBlk;
529 __cntrl_ = new _CntrlBlk(__r.get(), std::move(__r.get_deleter()), _AllocT());
530 __enable_weak_this(__r.get(), __r.get());
531 }
532 __r.release();
533 }
490 using _AllocT = typename __shared_ptr_default_allocator<_Yp>::type;
491 using _Deleter = _If<is_lvalue_reference<_Dp>::value, reference_wrapper<__libcpp_remove_reference_t<_Dp> >, _Dp>;
492 using _CntrlBlk = __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Deleter, _AllocT>;
534493
535 template <class _Yp,
536 class _Dp,
537 class = void,
538 __enable_if_t<is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value &&
539 is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
540 int> = 0>
541 _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
542#if _LIBCPP_STD_VER >= 14
543 if (__ptr_ == nullptr)
544 __cntrl_ = nullptr;
545 else
546#endif
547 {
548 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
549 typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer,
550 reference_wrapper<__libcpp_remove_reference_t<_Dp> >,
551 _AllocT>
552 _CntrlBlk;
553 __cntrl_ = new _CntrlBlk(__r.get(), std::ref(__r.get_deleter()), _AllocT());
554 __enable_weak_this(__r.get(), __r.get());
555 }
494 __cntrl_ = __ptr_ ? new _CntrlBlk(__r.get(), std::forward<_Dp>(__r.get_deleter()), _AllocT()) : nullptr;
495 __enable_weak_this(__r.get(), __r.get());
556496 __r.release();
557497 }
558498
......@@ -628,37 +568,43 @@ public:
628568 shared_ptr(__p, __d, __a).swap(*this);
629569 }
630570
631 _LIBCPP_HIDE_FROM_ABI element_type* get() const _NOEXCEPT { return __ptr_; }
571 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI element_type* get() const _NOEXCEPT { return __ptr_; }
632572
633 _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT { return *__ptr_; }
573 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT {
574 return *__ptr_;
575 }
634576
635577 _LIBCPP_HIDE_FROM_ABI element_type* operator->() const _NOEXCEPT {
636578 static_assert(!is_array<_Tp>::value, "std::shared_ptr<T>::operator-> is only valid when T is not an array type.");
637579 return __ptr_;
638580 }
639581
640 _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; }
582 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT {
583 return __cntrl_ ? __cntrl_->use_count() : 0;
584 }
641585
642586#if _LIBCPP_STD_VER < 20 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE)
643 _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI bool unique() const _NOEXCEPT { return use_count() == 1; }
587 [[__nodiscard__]] _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI bool unique() const _NOEXCEPT {
588 return use_count() == 1;
589 }
644590#endif
645591
646592 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return get() != nullptr; }
647593
648594 template <class _Up>
649 _LIBCPP_HIDE_FROM_ABI bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT {
595 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT {
650596 return __cntrl_ < __p.__cntrl_;
651597 }
652598
653599 template <class _Up>
654 _LIBCPP_HIDE_FROM_ABI bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT {
600 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT {
655601 return __cntrl_ < __p.__cntrl_;
656602 }
657603
658604 _LIBCPP_HIDE_FROM_ABI bool __owner_equivalent(const shared_ptr& __p) const { return __cntrl_ == __p.__cntrl_; }
659605
660606#if _LIBCPP_STD_VER >= 17
661 _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const {
607 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const {
662608 static_assert(is_array<_Tp>::value, "std::shared_ptr<T>::operator[] is only valid when T is an array type.");
663609 return __ptr_[__i];
664610 }
......@@ -729,7 +675,7 @@ shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>;
729675// std::allocate_shared and std::make_shared
730676//
731677template <class _Tp, class _Alloc, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0>
732_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) {
678[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) {
733679 using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
734680 using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
735681 __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);
......@@ -740,21 +686,21 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&
740686}
741687
742688template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0>
743_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&&... __args) {
689[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&&... __args) {
744690 return std::allocate_shared<_Tp>(allocator<__remove_cv_t<_Tp> >(), std::forward<_Args>(__args)...);
745691}
746692
747693#if _LIBCPP_STD_VER >= 20
748694
749695template <class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0>
750_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
696[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
751697 using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
752698 _ForOverwriteAllocator __alloc(__a);
753699 return std::allocate_shared<_Tp>(__alloc);
754700}
755701
756702template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
757_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
703[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
758704 return std::allocate_shared_for_overwrite<_Tp>(allocator<__remove_cv_t<_Tp>>());
759705}
760706
......@@ -946,67 +892,69 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Array> __allocate_shared_bounded_array(const _
946892
947893// bounded array variants
948894template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
949_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a) {
895[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a) {
950896 return std::__allocate_shared_bounded_array<_Tp>(__a);
951897}
952898
953899template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
954_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) {
900[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
901allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) {
955902 return std::__allocate_shared_bounded_array<_Tp>(__a, __u);
956903}
957904
958905template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
959_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
906[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
960907 using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
961908 _ForOverwriteAllocator __alloc(__a);
962909 return std::__allocate_shared_bounded_array<_Tp>(__alloc);
963910}
964911
965912template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
966_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared() {
913[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared() {
967914 return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>());
968915}
969916
970917template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
971_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u) {
918[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u) {
972919 return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u);
973920}
974921
975922template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
976_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
923[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
977924 return std::__allocate_shared_bounded_array<_Tp>(allocator<__for_overwrite_tag>());
978925}
979926
980927// unbounded array variants
981928template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
982_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) {
929[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) {
983930 return std::__allocate_shared_unbounded_array<_Tp>(__a, __n);
984931}
985932
986933template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
987_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) {
934[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
935allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) {
988936 return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u);
989937}
990938
991939template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
992_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) {
940[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) {
993941 using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
994942 _ForOverwriteAllocator __alloc(__a);
995943 return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n);
996944}
997945
998946template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
999_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n) {
947[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n) {
1000948 return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n);
1001949}
1002950
1003951template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
1004_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u) {
952[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u) {
1005953 return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u);
1006954}
1007955
1008956template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
1009_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) {
957[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) {
1010958 return std::__allocate_shared_unbounded_array<_Tp>(allocator<__for_overwrite_tag>(), __n);
1011959}
1012960
......@@ -1135,7 +1083,8 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __
11351083}
11361084
11371085template <class _Tp, class _Up>
1138inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
1086[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
1087static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
11391088 return shared_ptr<_Tp>(__r, static_cast< typename shared_ptr<_Tp>::element_type*>(__r.get()));
11401089}
11411090
......@@ -1143,13 +1092,14 @@ inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(const shared_pt
11431092// We don't backport because it is an evolutionary change.
11441093#if _LIBCPP_STD_VER >= 20
11451094template <class _Tp, class _Up>
1146_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
1095[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
11471096 return shared_ptr<_Tp>(std::move(__r), static_cast<typename shared_ptr<_Tp>::element_type*>(__r.get()));
11481097}
11491098#endif
11501099
11511100template <class _Tp, class _Up>
1152inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
1101[[__nodiscard__]] inline
1102 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
11531103 typedef typename shared_ptr<_Tp>::element_type _ET;
11541104 _ET* __p = dynamic_cast<_ET*>(__r.get());
11551105 return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();
......@@ -1159,14 +1109,14 @@ inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(const shared_p
11591109// We don't backport because it is an evolutionary change.
11601110#if _LIBCPP_STD_VER >= 20
11611111template <class _Tp, class _Up>
1162_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
1112[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
11631113 auto* __p = dynamic_cast<typename shared_ptr<_Tp>::element_type*>(__r.get());
11641114 return __p ? shared_ptr<_Tp>(std::move(__r), __p) : shared_ptr<_Tp>();
11651115}
11661116#endif
11671117
11681118template <class _Tp, class _Up>
1169_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
1119[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
11701120 typedef typename shared_ptr<_Tp>::element_type _RTp;
11711121 return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
11721122}
......@@ -1175,13 +1125,13 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Up>&
11751125// We don't backport because it is an evolutionary change.
11761126#if _LIBCPP_STD_VER >= 20
11771127template <class _Tp, class _Up>
1178_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
1128[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
11791129 return shared_ptr<_Tp>(std::move(__r), const_cast<typename shared_ptr<_Tp>::element_type*>(__r.get()));
11801130}
11811131#endif
11821132
11831133template <class _Tp, class _Up>
1184_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
1134[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
11851135 return shared_ptr<_Tp>(__r, reinterpret_cast< typename shared_ptr<_Tp>::element_type*>(__r.get()));
11861136}
11871137
......@@ -1189,7 +1139,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(const shared_ptr<
11891139// We don't backport because it is an evolutionary change.
11901140#if _LIBCPP_STD_VER >= 20
11911141template <class _Tp, class _Up>
1192_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
1142[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&& __r) noexcept {
11931143 return shared_ptr<_Tp>(std::move(__r), reinterpret_cast<typename shared_ptr<_Tp>::element_type*>(__r.get()));
11941144}
11951145#endif
......@@ -1197,7 +1147,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&&
11971147#if _LIBCPP_HAS_RTTI
11981148
11991149template <class _Dp, class _Tp>
1200inline _LIBCPP_HIDE_FROM_ABI _Dp* get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT {
1150[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _Dp* get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT {
12011151 return __p.template __get_deleter<_Dp>();
12021152}
12031153
......@@ -1213,9 +1163,8 @@ public:
12131163#endif
12141164
12151165 // A weak_ptr contains only two raw pointers which point to the heap and move constructing already doesn't require
1216 // any bookkeeping, so it's always trivially relocatable. It's also replaceable for the same reason.
1166 // any bookkeeping, so it's always trivially relocatable.
12171167 using __trivially_relocatable _LIBCPP_NODEBUG = weak_ptr;
1218 using __replaceable _LIBCPP_NODEBUG = weak_ptr;
12191168
12201169private:
12211170 element_type* __ptr_;
......@@ -1253,15 +1202,19 @@ public:
12531202 _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT;
12541203 _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT;
12551204
1256 _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; }
1257 _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT { return __cntrl_ == nullptr || __cntrl_->use_count() == 0; }
1258 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
1205 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT {
1206 return __cntrl_ ? __cntrl_->use_count() : 0;
1207 }
1208 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT {
1209 return __cntrl_ == nullptr || __cntrl_->use_count() == 0;
1210 }
1211 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
12591212 template <class _Up>
1260 _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {
1213 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {
12611214 return __cntrl_ < __r.__cntrl_;
12621215 }
12631216 template <class _Up>
1264 _LIBCPP_HIDE_FROM_ABI bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {
1217 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {
12651218 return __cntrl_ < __r.__cntrl_;
12661219 }
12671220
......@@ -1445,13 +1398,15 @@ protected:
14451398 _LIBCPP_HIDE_FROM_ABI ~enable_shared_from_this() {}
14461399
14471400public:
1448 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> shared_from_this() { return shared_ptr<_Tp>(__weak_this_); }
1449 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp const> shared_from_this() const { return shared_ptr<const _Tp>(__weak_this_); }
1401 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> shared_from_this() { return shared_ptr<_Tp>(__weak_this_); }
1402 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp const> shared_from_this() const {
1403 return shared_ptr<const _Tp>(__weak_this_);
1404 }
14501405
14511406#if _LIBCPP_STD_VER >= 17
1452 _LIBCPP_HIDE_FROM_ABI weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; }
1407 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; }
14531408
1454 _LIBCPP_HIDE_FROM_ABI weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; }
1409 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; }
14551410#endif // _LIBCPP_STD_VER >= 17
14561411
14571412 template <class _Up>
......@@ -1468,7 +1423,7 @@ struct hash<shared_ptr<_Tp> > {
14681423 _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
14691424#endif
14701425
1471 _LIBCPP_HIDE_FROM_ABI size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT {
1426 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT {
14721427 return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get());
14731428 }
14741429};
lib/libcxx/include/__memory/temp_value.h+1-2
......@@ -12,7 +12,6 @@
1212#include <__config>
1313#include <__memory/addressof.h>
1414#include <__memory/allocator_traits.h>
15#include <__type_traits/aligned_storage.h>
1615#include <__utility/forward.h>
1716
1817#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -26,7 +25,7 @@ struct __temp_value {
2625 typedef allocator_traits<_Alloc> _Traits;
2726
2827#ifdef _LIBCPP_CXX03_LANG
29 typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
28 _ALIGNAS_TYPE(_Tp) char __v[sizeof(_Tp)];
3029#else
3130 union {
3231 _Tp __v;
lib/libcxx/include/__memory/uninitialized_algorithms.h+44-115
......@@ -32,7 +32,6 @@
3232#include <__type_traits/is_trivially_assignable.h>
3333#include <__type_traits/is_trivially_constructible.h>
3434#include <__type_traits/is_trivially_relocatable.h>
35#include <__type_traits/is_unbounded_array.h>
3635#include <__type_traits/remove_const.h>
3736#include <__type_traits/remove_extent.h>
3837#include <__utility/exception_guard.h>
......@@ -61,17 +60,10 @@ template <class _ValueType, class _InputIterator, class _Sentinel1, class _Forwa
6160inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy(
6261 _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
6362 _ForwardIterator __idx = __ofirst;
64#if _LIBCPP_HAS_EXCEPTIONS
65 try {
66#endif
67 for (; __ifirst != __ilast && !__stop_copying(__idx); ++__ifirst, (void)++__idx)
68 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
69#if _LIBCPP_HAS_EXCEPTIONS
70 } catch (...) {
71 std::__destroy(__ofirst, __idx);
72 throw;
73 }
74#endif
63 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
64 for (; __ifirst != __ilast && !__stop_copying(__idx); ++__ifirst, (void)++__idx)
65 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
66 __guard.__complete();
7567
7668 return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx));
7769}
......@@ -91,17 +83,10 @@ template <class _ValueType, class _InputIterator, class _Size, class _ForwardIte
9183inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
9284__uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
9385 _ForwardIterator __idx = __ofirst;
94#if _LIBCPP_HAS_EXCEPTIONS
95 try {
96#endif
97 for (; __n > 0 && !__stop_copying(__idx); ++__ifirst, (void)++__idx, (void)--__n)
98 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
99#if _LIBCPP_HAS_EXCEPTIONS
100 } catch (...) {
101 std::__destroy(__ofirst, __idx);
102 throw;
103 }
104#endif
86 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
87 for (; __n > 0 && !__stop_copying(__idx); ++__ifirst, (void)++__idx, (void)--__n)
88 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
89 __guard.__complete();
10590
10691 return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx));
10792}
......@@ -121,17 +106,10 @@ template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp>
121106inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
122107__uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) {
123108 _ForwardIterator __idx = __first;
124#if _LIBCPP_HAS_EXCEPTIONS
125 try {
126#endif
127 for (; __idx != __last; ++__idx)
128 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
129#if _LIBCPP_HAS_EXCEPTIONS
130 } catch (...) {
131 std::__destroy(__first, __idx);
132 throw;
133 }
134#endif
109 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
110 for (; __idx != __last; ++__idx)
111 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
112 __guard.__complete();
135113
136114 return __idx;
137115}
......@@ -149,17 +127,10 @@ template <class _ValueType, class _ForwardIterator, class _Size, class _Tp>
149127inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
150128__uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
151129 _ForwardIterator __idx = __first;
152#if _LIBCPP_HAS_EXCEPTIONS
153 try {
154#endif
155 for (; __n > 0; ++__idx, (void)--__n)
156 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
157#if _LIBCPP_HAS_EXCEPTIONS
158 } catch (...) {
159 std::__destroy(__first, __idx);
160 throw;
161 }
162#endif
130 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
131 for (; __n > 0; ++__idx, (void)--__n)
132 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
133 __guard.__complete();
163134
164135 return __idx;
165136}
......@@ -178,18 +149,11 @@ uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
178149template <class _ValueType, class _ForwardIterator, class _Sentinel>
179150inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
180151__uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
181 auto __idx = __first;
182# if _LIBCPP_HAS_EXCEPTIONS
183 try {
184# endif
185 for (; __idx != __last; ++__idx)
186 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType;
187# if _LIBCPP_HAS_EXCEPTIONS
188 } catch (...) {
189 std::__destroy(__first, __idx);
190 throw;
191 }
192# endif
152 auto __idx = __first;
153 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
154 for (; __idx != __last; ++__idx)
155 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType;
156 __guard.__complete();
193157
194158 return __idx;
195159}
......@@ -205,17 +169,10 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterat
205169template <class _ValueType, class _ForwardIterator, class _Size>
206170inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
207171 auto __idx = __first;
208# if _LIBCPP_HAS_EXCEPTIONS
209 try {
210# endif
211 for (; __n > 0; ++__idx, (void)--__n)
212 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType;
213# if _LIBCPP_HAS_EXCEPTIONS
214 } catch (...) {
215 std::__destroy(__first, __idx);
216 throw;
217 }
218# endif
172 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
173 for (; __n > 0; ++__idx, (void)--__n)
174 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType;
175 __guard.__complete();
219176
220177 return __idx;
221178}
......@@ -231,18 +188,11 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(
231188template <class _ValueType, class _ForwardIterator, class _Sentinel>
232189inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
233190__uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
234 auto __idx = __first;
235# if _LIBCPP_HAS_EXCEPTIONS
236 try {
237# endif
238 for (; __idx != __last; ++__idx)
239 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType();
240# if _LIBCPP_HAS_EXCEPTIONS
241 } catch (...) {
242 std::__destroy(__first, __idx);
243 throw;
244 }
245# endif
191 auto __idx = __first;
192 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
193 for (; __idx != __last; ++__idx)
194 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType();
195 __guard.__complete();
246196
247197 return __idx;
248198}
......@@ -258,17 +208,10 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator
258208template <class _ValueType, class _ForwardIterator, class _Size>
259209inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
260210 auto __idx = __first;
261# if _LIBCPP_HAS_EXCEPTIONS
262 try {
263# endif
264 for (; __n > 0; ++__idx, (void)--__n)
265 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType();
266# if _LIBCPP_HAS_EXCEPTIONS
267 } catch (...) {
268 std::__destroy(__first, __idx);
269 throw;
270 }
271# endif
211 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
212 for (; __n > 0; ++__idx, (void)--__n)
213 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType();
214 __guard.__complete();
272215
273216 return __idx;
274217}
......@@ -293,19 +236,12 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
293236 _ForwardIterator __ofirst,
294237 _EndPredicate __stop_moving,
295238 _IterMove __iter_move) {
296 auto __idx = __ofirst;
297# if _LIBCPP_HAS_EXCEPTIONS
298 try {
299# endif
300 for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) {
301 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__iter_move(__ifirst));
302 }
303# if _LIBCPP_HAS_EXCEPTIONS
304 } catch (...) {
305 std::__destroy(__ofirst, __idx);
306 throw;
239 auto __idx = __ofirst;
240 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
241 for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) {
242 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__iter_move(__ifirst));
307243 }
308# endif
244 __guard.__complete();
309245
310246 return {std::move(__ifirst), std::move(__idx)};
311247}
......@@ -331,18 +267,11 @@ template <class _ValueType,
331267 class _IterMove>
332268inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n(
333269 _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) {
334 auto __idx = __ofirst;
335# if _LIBCPP_HAS_EXCEPTIONS
336 try {
337# endif
338 for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void)++__ifirst, --__n)
339 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__iter_move(__ifirst));
340# if _LIBCPP_HAS_EXCEPTIONS
341 } catch (...) {
342 std::__destroy(__ofirst, __idx);
343 throw;
344 }
345# endif
270 auto __idx = __ofirst;
271 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
272 for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void)++__ifirst, --__n)
273 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__iter_move(__ifirst));
274 __guard.__complete();
346275
347276 return {std::move(__ifirst), std::move(__idx)};
348277}
lib/libcxx/include/__memory/unique_ptr.h+14-16
......@@ -32,18 +32,15 @@
3232#include <__type_traits/integral_constant.h>
3333#include <__type_traits/is_array.h>
3434#include <__type_traits/is_assignable.h>
35#include <__type_traits/is_bounded_array.h>
3635#include <__type_traits/is_constant_evaluated.h>
3736#include <__type_traits/is_constructible.h>
3837#include <__type_traits/is_convertible.h>
3938#include <__type_traits/is_function.h>
4039#include <__type_traits/is_pointer.h>
4140#include <__type_traits/is_reference.h>
42#include <__type_traits/is_replaceable.h>
4341#include <__type_traits/is_same.h>
4442#include <__type_traits/is_swappable.h>
4543#include <__type_traits/is_trivially_relocatable.h>
46#include <__type_traits/is_unbounded_array.h>
4744#include <__type_traits/is_void.h>
4845#include <__type_traits/remove_extent.h>
4946#include <__type_traits/type_identity.h>
......@@ -145,8 +142,6 @@ public:
145142 __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<deleter_type>::value,
146143 unique_ptr,
147144 void>;
148 using __replaceable _LIBCPP_NODEBUG =
149 __conditional_t<__is_replaceable_v<pointer> && __is_replaceable_v<deleter_type>, unique_ptr, void>;
150145
151146private:
152147 _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);
......@@ -263,14 +258,17 @@ public:
263258 return *this;
264259 }
265260
266 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const
261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const
267262 _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>())) {
268263 return *__ptr_;
269264 }
270265 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_; }
271 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_; }
272 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __deleter_; }
273 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT {
266 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_; }
267 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT {
268 return __deleter_;
269 }
270 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type&
271 get_deleter() const _NOEXCEPT {
274272 return __deleter_;
275273 }
276274 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT {
......@@ -413,8 +411,6 @@ public:
413411 __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<deleter_type>::value,
414412 unique_ptr,
415413 void>;
416 using __replaceable _LIBCPP_NODEBUG =
417 __conditional_t<__is_replaceable_v<pointer> && __is_replaceable_v<deleter_type>, unique_ptr, void>;
418414
419415private:
420416 template <class _Up, class _OtherDeleter>
......@@ -755,12 +751,13 @@ operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
755751#if _LIBCPP_STD_VER >= 14
756752
757753template <class _Tp, class... _Args, enable_if_t<!is_array<_Tp>::value, int> = 0>
758inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique(_Args&&... __args) {
754[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
755_LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique(_Args&&... __args) {
759756 return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...));
760757}
761758
762759template <class _Tp, enable_if_t<__is_unbounded_array_v<_Tp>, int> = 0>
763inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique(size_t __n) {
760[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique(size_t __n) {
764761 typedef __remove_extent_t<_Tp> _Up;
765762 return unique_ptr<_Tp>(__private_constructor_tag(), new _Up[__n](), __n);
766763}
......@@ -773,12 +770,13 @@ void make_unique(_Args&&...) = delete;
773770#if _LIBCPP_STD_VER >= 20
774771
775772template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0>
776_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique_for_overwrite() {
773[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique_for_overwrite() {
777774 return unique_ptr<_Tp>(new _Tp);
778775}
779776
780777template <class _Tp, enable_if_t<is_unbounded_array_v<_Tp>, int> = 0>
781_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp> make_unique_for_overwrite(size_t __n) {
778[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr<_Tp>
779make_unique_for_overwrite(size_t __n) {
782780 return unique_ptr<_Tp>(__private_constructor_tag(), new __remove_extent_t<_Tp>[__n], __n);
783781}
784782
......@@ -802,7 +800,7 @@ struct hash<__enable_hash_helper< unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp,
802800 _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
803801#endif
804802
805 _LIBCPP_HIDE_FROM_ABI size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const {
803 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const {
806804 typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
807805 return hash<pointer>()(__ptr.get());
808806 }
lib/libcxx/include/__memory/uses_allocator_construction.h+1
......@@ -17,6 +17,7 @@
1717#include <__type_traits/remove_cv.h>
1818#include <__utility/declval.h>
1919#include <__utility/pair.h>
20#include <__utility/piecewise_construct.h>
2021#include <tuple>
2122
2223#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/__memory_resource/memory_resource.h+4-2
......@@ -42,7 +42,9 @@ public:
4242 do_deallocate(__p, __bytes, __align);
4343 }
4444
45 _LIBCPP_HIDE_FROM_ABI bool is_equal(const memory_resource& __other) const noexcept { return do_is_equal(__other); }
45 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_equal(const memory_resource& __other) const noexcept {
46 return do_is_equal(__other);
47 }
4648
4749private:
4850 virtual void* do_allocate(size_t, size_t) = 0;
......@@ -68,7 +70,7 @@ operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept
6870
6971// [mem.res.global]
7072
71[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
73[[nodiscard, __gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
7274get_default_resource() noexcept;
7375
7476[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
lib/libcxx/include/__memory_resource/monotonic_buffer_resource.h+1-1
......@@ -93,7 +93,7 @@ public:
9393 }
9494 }
9595
96 _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; }
96 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; }
9797
9898protected:
9999 void* do_allocate(size_t __bytes, size_t __alignment) override; // key function
lib/libcxx/include/__memory_resource/polymorphic_allocator.h+13-8
......@@ -18,6 +18,7 @@
1818#include <__new/exceptions.h>
1919#include <__new/placement_new_delete.h>
2020#include <__utility/exception_guard.h>
21#include <__utility/piecewise_construct.h>
2122#include <limits>
2223#include <tuple>
2324
......@@ -50,7 +51,9 @@ public:
5051
5152 _LIBCPP_HIDE_FROM_ABI polymorphic_allocator() noexcept : __res_(std::pmr::get_default_resource()) {}
5253
53 _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(memory_resource* __r) noexcept : __res_(__r) {}
54 _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(memory_resource* _LIBCPP_DIAGNOSE_NULLPTR __r) noexcept : __res_(__r) {
55 _LIBCPP_ASSERT_NON_NULL(__r, "Attempted to pass a nullptr resource to polymorphic_alloator");
56 }
5457
5558 _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(const polymorphic_allocator&) = default;
5659
......@@ -133,10 +136,10 @@ public:
133136 piecewise_construct,
134137 __transform_tuple(typename __uses_alloc_ctor< _T1, polymorphic_allocator&, _Args1... >::type(),
135138 std::move(__x),
136 typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
139 make_index_sequence<sizeof...(_Args1)>()),
137140 __transform_tuple(typename __uses_alloc_ctor< _T2, polymorphic_allocator&, _Args2... >::type(),
138141 std::move(__y),
139 typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
142 make_index_sequence<sizeof...(_Args2)>()));
140143 }
141144
142145 template <class _T1, class _T2>
......@@ -170,11 +173,13 @@ public:
170173 __p->~_Tp();
171174 }
172175
173 _LIBCPP_HIDE_FROM_ABI polymorphic_allocator select_on_container_copy_construction() const noexcept {
176 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI polymorphic_allocator select_on_container_copy_construction() const noexcept {
174177 return polymorphic_allocator();
175178 }
176179
177 _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept { return __res_; }
180 [[nodiscard, __gnu__::__returns_nonnull__]] _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept {
181 return __res_;
182 }
178183
179184 _LIBCPP_HIDE_FROM_ABI friend bool
180185 operator==(const polymorphic_allocator& __lhs, const polymorphic_allocator& __rhs) noexcept {
......@@ -192,20 +197,20 @@ public:
192197private:
193198 template <class... _Args, size_t... _Is>
194199 _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
195 __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
200 __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
196201 return std::forward_as_tuple(std::get<_Is>(std::move(__t))...);
197202 }
198203
199204 template <class... _Args, size_t... _Is>
200205 _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>
201 __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
206 __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
202207 using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>;
203208 return _Tup(allocator_arg, *this, std::get<_Is>(std::move(__t))...);
204209 }
205210
206211 template <class... _Args, size_t... _Is>
207212 _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., polymorphic_allocator&>
208 __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
213 __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
209214 using _Tup = tuple<_Args&&..., polymorphic_allocator&>;
210215 return _Tup(std::get<_Is>(std::move(__t))..., *this);
211216 }
lib/libcxx/include/__memory_resource/pool_options.h+1-1
......@@ -24,7 +24,7 @@ namespace pmr {
2424
2525// [mem.res.pool.options]
2626
27struct _LIBCPP_EXPORTED_FROM_ABI pool_options {
27struct pool_options {
2828 size_t max_blocks_per_chunk = 0;
2929 size_t largest_required_pool_block = 0;
3030};
lib/libcxx/include/__memory_resource/synchronized_pool_resource.h+4-2
......@@ -56,9 +56,11 @@ public:
5656 __unsync_.release();
5757 }
5858
59 _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __unsync_.upstream_resource(); }
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const {
60 return __unsync_.upstream_resource();
61 }
6062
61 _LIBCPP_HIDE_FROM_ABI pool_options options() const { return __unsync_.options(); }
63 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pool_options options() const { return __unsync_.options(); }
6264
6365protected:
6466 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void* do_allocate(size_t __bytes, size_t __align) override {
lib/libcxx/include/__memory_resource/unsynchronized_pool_resource.h+1-1
......@@ -76,7 +76,7 @@ public:
7676
7777 void release();
7878
79 _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; }
79 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; }
8080
8181 [[__gnu__::__pure__]] pool_options options() const;
8282
lib/libcxx/include/__mutex/mutex.h+2-2
......@@ -37,11 +37,11 @@ public:
3737# endif
3838
3939 _LIBCPP_ACQUIRE_CAPABILITY() void lock();
40 _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock() _NOEXCEPT;
40 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock() _NOEXCEPT;
4141 _LIBCPP_RELEASE_CAPABILITY void unlock() _NOEXCEPT;
4242
4343 typedef __libcpp_mutex_t* native_handle_type;
44 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
44 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
4545};
4646
4747static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow");
lib/libcxx/include/__mutex/once_flag.h+14-11
......@@ -10,12 +10,11 @@
1010#define _LIBCPP___MUTEX_ONCE_FLAG_H
1111
1212#include <__config>
13#include <__functional/invoke.h>
1413#include <__memory/addressof.h>
15#include <__memory/shared_count.h> // __libcpp_acquire_load
16#include <__tuple/tuple_indices.h>
1714#include <__tuple/tuple_size.h>
15#include <__type_traits/invoke.h>
1816#include <__utility/forward.h>
17#include <__utility/integer_sequence.h>
1918#include <__utility/move.h>
2019#include <cstdint>
2120#ifndef _LIBCPP_CXX03_LANG
......@@ -88,14 +87,9 @@ public:
8887 _LIBCPP_HIDE_FROM_ABI explicit __call_once_param(_Fp& __f) : __f_(__f) {}
8988
9089 _LIBCPP_HIDE_FROM_ABI void operator()() {
91 typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
92 __execute(_Index());
93 }
94
95private:
96 template <size_t... _Indices>
97 _LIBCPP_HIDE_FROM_ABI void __execute(__tuple_indices<_Indices...>) {
98 std::__invoke(std::get<0>(std::move(__f_)), std::get<_Indices>(std::move(__f_))...);
90 [&]<size_t... _Indices>(__index_sequence<_Indices...>) -> void {
91 std::__invoke(std::get<_Indices>(std::move(__f_))...);
92 }(__make_index_sequence<tuple_size<_Fp>::value>());
9993 }
10094};
10195
......@@ -121,6 +115,15 @@ void _LIBCPP_HIDE_FROM_ABI __call_once_proxy(void* __vp) {
121115
122116_LIBCPP_EXPORTED_FROM_ABI void __call_once(volatile once_flag::_State_type&, void*, void (*)(void*));
123117
118template <class _ValueType>
119inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) {
120#if _LIBCPP_HAS_THREADS
121 return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
122#else
123 return *__value;
124#endif
125}
126
124127#ifndef _LIBCPP_CXX03_LANG
125128
126129template <class _Callable, class... _Args>
lib/libcxx/include/__mutex/tag_types.h+3-3
......@@ -17,15 +17,15 @@
1717
1818_LIBCPP_BEGIN_NAMESPACE_STD
1919
20struct _LIBCPP_EXPORTED_FROM_ABI defer_lock_t {
20struct defer_lock_t {
2121 explicit defer_lock_t() = default;
2222};
2323
24struct _LIBCPP_EXPORTED_FROM_ABI try_to_lock_t {
24struct try_to_lock_t {
2525 explicit try_to_lock_t() = default;
2626};
2727
28struct _LIBCPP_EXPORTED_FROM_ABI adopt_lock_t {
28struct adopt_lock_t {
2929 explicit adopt_lock_t() = default;
3030};
3131
lib/libcxx/include/__mutex/unique_lock.h+8-7
......@@ -15,6 +15,7 @@
1515#include <__memory/addressof.h>
1616#include <__mutex/tag_types.h>
1717#include <__system_error/throw_system_error.h>
18#include <__utility/move.h>
1819#include <__utility/swap.h>
1920#include <cerrno>
2021
......@@ -22,6 +23,9 @@
2223# pragma GCC system_header
2324#endif
2425
26_LIBCPP_PUSH_MACROS
27#include <__undef_macros>
28
2529_LIBCPP_BEGIN_NAMESPACE_STD
2630
2731template <class _Mutex>
......@@ -74,13 +78,8 @@ public:
7478 }
7579
7680 _LIBCPP_HIDE_FROM_ABI unique_lock& operator=(unique_lock&& __u) _NOEXCEPT {
77 if (__owns_)
78 __m_->unlock();
79
80 __m_ = __u.__m_;
81 __owns_ = __u.__owns_;
82 __u.__m_ = nullptr;
83 __u.__owns_ = false;
81 if (this != std::addressof(__u))
82 unique_lock(std::move(__u)).swap(*this);
8483 return *this;
8584 }
8685
......@@ -170,4 +169,6 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(unique_lock<_Mutex>& __x, unique_lock<_Mu
170169
171170_LIBCPP_END_NAMESPACE_STD
172171
172_LIBCPP_POP_MACROS
173
173174#endif // _LIBCPP___MUTEX_UNIQUE_LOCK_H
lib/libcxx/include/__new/align_val_t.h+6
......@@ -16,6 +16,12 @@
1616# pragma GCC system_header
1717#endif
1818
19// <vcruntime_exception.h> defines its own std::align_val_t type,
20// which we use in order to be ABI-compatible with other STLs on Windows.
21#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION && defined(_LIBCPP_ABI_VCRUNTIME)
22# include <vcruntime_new.h>
23#endif
24
1925_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
2026#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION && !defined(_LIBCPP_ABI_VCRUNTIME)
2127# ifndef _LIBCPP_CXX03_LANG
lib/libcxx/include/__new/allocate.h+1-2
......@@ -13,7 +13,6 @@
1313#include <__cstddef/max_align_t.h>
1414#include <__cstddef/size_t.h>
1515#include <__new/align_val_t.h>
16#include <__new/global_new_delete.h> // for _LIBCPP_HAS_SIZED_DEALLOCATION
1716#include <__type_traits/type_identity.h>
1817#include <__utility/element_count.h>
1918
......@@ -43,7 +42,7 @@ __libcpp_allocate(__element_count __n, [[__maybe_unused__]] size_t __align = _LI
4342 return static_cast<_Tp*>(__builtin_operator_new(__size));
4443}
4544
46#if _LIBCPP_HAS_SIZED_DEALLOCATION
45#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
4746# define _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(...) __VA_ARGS__
4847#else
4948# define _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(...) /* nothing */
lib/libcxx/include/__new/exceptions.h+8-2
......@@ -17,6 +17,12 @@
1717# pragma GCC system_header
1818#endif
1919
20// <vcruntime_exception.h> defines its own std::bad_alloc type,
21// which we use in order to be ABI-compatible with other STLs on Windows.
22#if defined(_LIBCPP_ABI_VCRUNTIME)
23# include <vcruntime_exception.h>
24#endif
25
2026_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
2127#if !defined(_LIBCPP_ABI_VCRUNTIME)
2228
......@@ -26,7 +32,7 @@ public:
2632 _LIBCPP_HIDE_FROM_ABI bad_alloc(const bad_alloc&) _NOEXCEPT = default;
2733 _LIBCPP_HIDE_FROM_ABI bad_alloc& operator=(const bad_alloc&) _NOEXCEPT = default;
2834 ~bad_alloc() _NOEXCEPT override;
29 const char* what() const _NOEXCEPT override;
35 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
3036};
3137
3238class _LIBCPP_EXPORTED_FROM_ABI bad_array_new_length : public bad_alloc {
......@@ -35,7 +41,7 @@ public:
3541 _LIBCPP_HIDE_FROM_ABI bad_array_new_length(const bad_array_new_length&) _NOEXCEPT = default;
3642 _LIBCPP_HIDE_FROM_ABI bad_array_new_length& operator=(const bad_array_new_length&) _NOEXCEPT = default;
3743 ~bad_array_new_length() _NOEXCEPT override;
38 const char* what() const _NOEXCEPT override;
44 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
3945};
4046
4147#elif defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 // !_LIBCPP_ABI_VCRUNTIME
lib/libcxx/include/__new/global_new_delete.h+4-11
......@@ -12,7 +12,6 @@
1212#include <__config>
1313#include <__cstddef/size_t.h>
1414#include <__new/align_val_t.h>
15#include <__new/exceptions.h>
1615#include <__new/nothrow_t.h>
1716
1817#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -25,12 +24,6 @@
2524# define _THROW_BAD_ALLOC
2625#endif
2726
28#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
29# define _LIBCPP_HAS_SIZED_DEALLOCATION 1
30#else
31# define _LIBCPP_HAS_SIZED_DEALLOCATION 0
32#endif
33
3427#if defined(_LIBCPP_ABI_VCRUNTIME)
3528# include <new.h>
3629#else
......@@ -39,7 +32,7 @@
3932 _LIBCPP_NOALIAS;
4033_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
4134_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
42# if _LIBCPP_HAS_SIZED_DEALLOCATION
35# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
4336_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
4437# endif
4538
......@@ -48,7 +41,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _
4841 _LIBCPP_NOALIAS;
4942_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
5043_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
51# if _LIBCPP_HAS_SIZED_DEALLOCATION
44# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
5245_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
5346# endif
5447
......@@ -58,7 +51,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz)
5851operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
5952_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
6053_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
61# if _LIBCPP_HAS_SIZED_DEALLOCATION
54# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
6255_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
6356# endif
6457
......@@ -68,7 +61,7 @@ operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
6861operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
6962_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
7063_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
71# if _LIBCPP_HAS_SIZED_DEALLOCATION
64# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
7265_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
7366# endif
7467# endif
lib/libcxx/include/__new/interference_size.h-4
......@@ -20,13 +20,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2020
2121#if _LIBCPP_STD_VER >= 17
2222
23# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
24
2523inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
2624inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE;
2725
28# endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
29
3026#endif // _LIBCPP_STD_VER >= 17
3127
3228_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__new/launder.h+3-5
......@@ -10,8 +10,6 @@
1010#define _LIBCPP___NEW_LAUNDER_H
1111
1212#include <__config>
13#include <__type_traits/is_function.h>
14#include <__type_traits/is_void.h>
1513
1614#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1715# pragma GCC system_header
......@@ -20,15 +18,15 @@
2018_LIBCPP_BEGIN_NAMESPACE_STD
2119template <class _Tp>
2220[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT {
23 static_assert(!(is_function<_Tp>::value), "can't launder functions");
24 static_assert(!is_void<_Tp>::value, "can't launder cv-void");
21 // The compiler diagnoses misuses of __builtin_launder, so we don't need to add any static_asserts
22 // to implement the Mandates.
2523 return __builtin_launder(__p);
2624}
2725
2826#if _LIBCPP_STD_VER >= 17
2927template <class _Tp>
3028[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept {
31 return std::__launder(__p);
29 return __builtin_launder(__p);
3230}
3331#endif
3432_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__new/nothrow_t.h+1-1
......@@ -19,7 +19,7 @@
1919# include <new.h>
2020#else
2121_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
22struct _LIBCPP_EXPORTED_FROM_ABI nothrow_t {
22struct nothrow_t {
2323 explicit nothrow_t() = default;
2424};
2525extern _LIBCPP_EXPORTED_FROM_ABI const nothrow_t nothrow;
lib/libcxx/include/__numeric/gcd_lcm.h+24-34
......@@ -33,28 +33,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3333
3434#if _LIBCPP_STD_VER >= 17
3535
36template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value>
37struct __ct_abs;
38
39template <typename _Result, typename _Source>
40struct __ct_abs<_Result, _Source, true> {
41 constexpr _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept {
36template <class _Result, class _Source>
37constexpr _LIBCPP_HIDE_FROM_ABI _Result __abs_in_type(_Source __t) noexcept {
38 if constexpr (is_signed_v<_Source>) {
4239 if (__t >= 0)
4340 return __t;
4441 if (__t == numeric_limits<_Source>::min())
4542 return -static_cast<_Result>(__t);
4643 return -__t;
44 } else {
45 return __t;
4746 }
48};
49
50template <typename _Result, typename _Source>
51struct __ct_abs<_Result, _Source, false> {
52 constexpr _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept { return __t; }
53};
47}
5448
55template <class _Tp>
56constexpr _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
57 static_assert(!is_signed<_Tp>::value, "");
49template <class _Tp, class _Up>
50constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
51 static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types");
52 static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool");
53 static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool");
54 using _Rp = common_type_t<_Tp, _Up>;
55 using _Wp = make_unsigned_t<_Rp>;
5856
5957 // Using Binary GCD algorithm https://en.wikipedia.org/wiki/Binary_GCD_algorithm, based on an implementation
6058 // from https://lemire.me/blog/2024/04/13/greatest-common-divisor-the-extended-euclidean-algorithm-and-speed/
......@@ -67,22 +65,25 @@ constexpr _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
6765 //
6866 // And standard gcd algorithm where instead of modulo, minus is used.
6967
68 auto __a = static_cast<_Wp>(std::__abs_in_type<_Rp>(__m));
69 auto __b = static_cast<_Wp>(std::__abs_in_type<_Rp>(__n));
70
7071 if (__a < __b) {
71 _Tp __tmp = __b;
72 _Wp __tmp = __b;
7273 __b = __a;
7374 __a = __tmp;
7475 }
7576 if (__b == 0)
76 return __a;
77 return static_cast<_Rp>(__a);
7778 __a %= __b; // Make both argument of the same size, and early result in the easy case.
7879 if (__a == 0)
79 return __b;
80 return static_cast<_Rp>(__b);
8081
81 _Tp __c = __a | __b;
82 _Wp __c = __a | __b;
8283 int __shift = std::__countr_zero(__c);
8384 __a >>= std::__countr_zero(__a);
8485 do {
85 _Tp __t = __b >> std::__countr_zero(__b);
86 _Wp __t = __b >> std::__countr_zero(__b);
8687 if (__a > __t) {
8788 __b = __a - __t;
8889 __a = __t;
......@@ -90,18 +91,7 @@ constexpr _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
9091 __b = __t - __a;
9192 }
9293 } while (__b != 0);
93 return __a << __shift;
94}
95
96template <class _Tp, class _Up>
97constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
98 static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types");
99 static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool");
100 static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool");
101 using _Rp = common_type_t<_Tp, _Up>;
102 using _Wp = make_unsigned_t<_Rp>;
103 return static_cast<_Rp>(
104 std::__gcd(static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)), static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
94 return static_cast<_Rp>(__a << __shift);
10595}
10696
10797template <class _Tp, class _Up>
......@@ -113,8 +103,8 @@ constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
113103 return 0;
114104
115105 using _Rp = common_type_t<_Tp, _Up>;
116 _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
117 _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
106 _Rp __val1 = std::__abs_in_type<_Rp>(__m) / std::gcd(__m, __n);
107 _Rp __val2 = std::__abs_in_type<_Rp>(__n);
118108 _Rp __res;
119109 [[maybe_unused]] bool __overflow = __builtin_mul_overflow(__val1, __val2, std::addressof(__res));
120110 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__overflow, "Overflow in lcm");
lib/libcxx/include/__numeric/midpoint.h+9-14
......@@ -12,16 +12,13 @@
1212
1313#include <__config>
1414#include <__cstddef/ptrdiff_t.h>
15#include <__type_traits/enable_if.h>
1615#include <__type_traits/is_floating_point.h>
1716#include <__type_traits/is_integral.h>
18#include <__type_traits/is_null_pointer.h>
1917#include <__type_traits/is_object.h>
20#include <__type_traits/is_pointer.h>
2118#include <__type_traits/is_same.h>
2219#include <__type_traits/is_void.h>
2320#include <__type_traits/make_unsigned.h>
24#include <__type_traits/remove_pointer.h>
21#include <__type_traits/remove_cv.h>
2522#include <limits>
2623
2724#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -35,8 +32,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3532
3633#if _LIBCPP_STD_VER >= 20
3734template <class _Tp>
38_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
39midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
35 requires(is_integral_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, bool>)
36[[nodiscard]]
37_LIBCPP_HIDE_FROM_ABI constexpr _Tp midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
4038 using _Up = make_unsigned_t<_Tp>;
4139 constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
4240
......@@ -48,23 +46,20 @@ midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
4846 return __a + __half_diff;
4947}
5048
51template <class _Tp, enable_if_t<is_object_v<_Tp> && !is_void_v<_Tp> && (sizeof(_Tp) > 0), int> = 0>
52_LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept {
49template <class _Tp>
50 requires(is_object_v<_Tp> && (sizeof(_Tp) > 0))
51[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept {
5352 return __a + std::midpoint(ptrdiff_t(0), __b - __a);
5453}
5554
56template <typename _Tp>
57_LIBCPP_HIDE_FROM_ABI constexpr int __sign(_Tp __val) {
58 return (_Tp(0) < __val) - (__val < _Tp(0));
59}
60
6155template <typename _Fp>
6256_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) {
6357 return __f >= 0 ? __f : -__f;
6458}
6559
6660template <class _Fp>
67_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_floating_point_v<_Fp>, _Fp> midpoint(_Fp __a, _Fp __b) noexcept {
61 requires(is_floating_point_v<_Fp>)
62[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Fp midpoint(_Fp __a, _Fp __b) noexcept {
6863 constexpr _Fp __lo = numeric_limits<_Fp>::min() * 2;
6964 constexpr _Fp __hi = numeric_limits<_Fp>::max() / 2;
7065
lib/libcxx/include/__numeric/pstl.h+2-2
......@@ -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 __iter_value_type<_ForwardIterator>
73_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>;
......@@ -78,7 +78,7 @@ reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator _
7878 std::forward<_ExecutionPolicy>(__policy),
7979 std::move(__first),
8080 std::move(__last),
81 __iter_value_type<_ForwardIterator>(),
81 __iterator_value_type<_ForwardIterator>(),
8282 plus{});
8383}
8484
lib/libcxx/include/__numeric/saturation_arithmetic.h+13-5
......@@ -30,6 +30,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3030
3131template <__signed_or_unsigned_integer _Tp>
3232_LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept {
33# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101
34 return __builtin_elementwise_add_sat(__x, __y);
35# else
3336 if (_Tp __sum; !__builtin_add_overflow(__x, __y, std::addressof(__sum)))
3437 return __sum;
3538 // Handle overflow
......@@ -44,10 +47,14 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept {
4447 // Overflows if (x < 0 && y < 0)
4548 return std::numeric_limits<_Tp>::min();
4649 }
50# endif
4751}
4852
4953template <__signed_or_unsigned_integer _Tp>
5054_LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept {
55# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101
56 return __builtin_elementwise_sub_sat(__x, __y);
57# else
5158 if (_Tp __sub; !__builtin_sub_overflow(__x, __y, std::addressof(__sub)))
5259 return __sub;
5360 // Handle overflow
......@@ -63,6 +70,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept {
6370 // Overflows if (x < 0 && y > 0)
6471 return std::numeric_limits<_Tp>::min();
6572 }
73# endif
6674}
6775
6876template <__signed_or_unsigned_integer _Tp>
......@@ -113,27 +121,27 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept {
113121#if _LIBCPP_STD_VER >= 26
114122
115123template <__signed_or_unsigned_integer _Tp>
116_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
124[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
117125 return std::__add_sat(__x, __y);
118126}
119127
120128template <__signed_or_unsigned_integer _Tp>
121_LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept {
129[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept {
122130 return std::__sub_sat(__x, __y);
123131}
124132
125133template <__signed_or_unsigned_integer _Tp>
126_LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept {
134[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept {
127135 return std::__mul_sat(__x, __y);
128136}
129137
130138template <__signed_or_unsigned_integer _Tp>
131_LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept {
139[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept {
132140 return std::__div_sat(__x, __y);
133141}
134142
135143template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp>
136_LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept {
144[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept {
137145 return std::__saturate_cast<_Rp>(__x);
138146}
139147
lib/libcxx/include/__ostream/basic_ostream.h+8-8
......@@ -53,7 +53,7 @@ public:
5353 typedef typename traits_type::off_type off_type;
5454
5555 // 27.7.2.2 Constructor/destructor:
56 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) {
56 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) {
5757 this->init(__sb);
5858 }
5959 ~basic_ostream() override;
......@@ -67,7 +67,7 @@ protected:
6767 // 27.7.2.3 Assign/swap
6868 inline _LIBCPP_HIDE_FROM_ABI basic_ostream& operator=(basic_ostream&& __rhs);
6969
70 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_ostream& __rhs) {
70 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void swap(basic_ostream& __rhs) {
7171 basic_ios<char_type, traits_type>::swap(__rhs);
7272 }
7373
......@@ -76,17 +76,17 @@ public:
7676 class sentry;
7777
7878 // 27.7.2.6 Formatted output:
79 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) {
79 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) {
8080 return __pf(*this);
8181 }
8282
83 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream&
83 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_ostream&
8484 operator<<(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
8585 __pf(*this);
8686 return *this;
8787 }
8888
89 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) {
89 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) {
9090 __pf(*this);
9191 return *this;
9292 }
......@@ -174,9 +174,9 @@ public:
174174 basic_ostream& flush();
175175
176176 // 27.7.2.5 seeks:
177 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type tellp();
178 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(pos_type __pos);
179 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
177 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 pos_type tellp();
178 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_ostream& seekp(pos_type __pos);
179 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
180180
181181protected:
182182 _LIBCPP_HIDE_FROM_ABI basic_ostream() {} // extension, intentially does not initialize
lib/libcxx/include/__pstl/backends/default.h+14-14
......@@ -102,7 +102,7 @@ struct __find<__default_backend_tag, _ExecutionPolicy> {
102102 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept {
103103 using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
104104 return _FindIf()(
105 __policy, std::move(__first), std::move(__last), [&](__iter_reference<_ForwardIterator> __element) {
105 __policy, std::move(__first), std::move(__last), [&](__iterator_reference<_ForwardIterator> __element) {
106106 return __element == __value;
107107 });
108108 }
......@@ -137,7 +137,7 @@ struct __all_of<__default_backend_tag, _ExecutionPolicy> {
137137 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
138138 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
139139 using _AnyOf = __dispatch<__any_of, __current_configuration, _ExecutionPolicy>;
140 auto __res = _AnyOf()(__policy, __first, __last, [&](__iter_reference<_ForwardIterator> __value) {
140 auto __res = _AnyOf()(__policy, __first, __last, [&](__iterator_reference<_ForwardIterator> __value) {
141141 return !__pred(__value);
142142 });
143143 if (!__res)
......@@ -204,7 +204,7 @@ struct __fill<__default_backend_tag, _ExecutionPolicy> {
204204 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
205205 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept {
206206 using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
207 using _Ref = __iter_reference<_ForwardIterator>;
207 using _Ref = __iterator_reference<_ForwardIterator>;
208208 return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) { __element = __value; });
209209 }
210210};
......@@ -233,7 +233,7 @@ struct __replace<__default_backend_tag, _ExecutionPolicy> {
233233 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __old, _Tp const& __new)
234234 const noexcept {
235235 using _ReplaceIf = __dispatch<__replace_if, __current_configuration, _ExecutionPolicy>;
236 using _Ref = __iter_reference<_ForwardIterator>;
236 using _Ref = __iterator_reference<_ForwardIterator>;
237237 return _ReplaceIf()(
238238 __policy, std::move(__first), std::move(__last), [&](_Ref __element) { return __element == __old; }, __new);
239239 }
......@@ -246,7 +246,7 @@ struct __replace_if<__default_backend_tag, _ExecutionPolicy> {
246246 _Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred, _Tp const& __new_value)
247247 const noexcept {
248248 using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
249 using _Ref = __iter_reference<_ForwardIterator>;
249 using _Ref = __iterator_reference<_ForwardIterator>;
250250 return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) {
251251 if (__pred(__element))
252252 __element = __new_value;
......@@ -260,7 +260,7 @@ struct __generate<__default_backend_tag, _ExecutionPolicy> {
260260 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
261261 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Generator&& __gen) const noexcept {
262262 using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
263 using _Ref = __iter_reference<_ForwardIterator>;
263 using _Ref = __iterator_reference<_ForwardIterator>;
264264 return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) { __element = __gen(); });
265265 }
266266};
......@@ -271,7 +271,7 @@ struct __generate_n<__default_backend_tag, _ExecutionPolicy> {
271271 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
272272 operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _Generator&& __gen) const noexcept {
273273 using _ForEachN = __dispatch<__for_each_n, __current_configuration, _ExecutionPolicy>;
274 using _Ref = __iter_reference<_ForwardIterator>;
274 using _Ref = __iterator_reference<_ForwardIterator>;
275275 return _ForEachN()(__policy, std::move(__first), __n, [&](_Ref __element) { __element = __gen(); });
276276 }
277277};
......@@ -295,11 +295,11 @@ struct __sort<__default_backend_tag, _ExecutionPolicy> {
295295template <class _ExecutionPolicy>
296296struct __count_if<__default_backend_tag, _ExecutionPolicy> {
297297 template <class _Policy, class _ForwardIterator, class _Predicate>
298 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>> operator()(
298 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iterator_difference_type<_ForwardIterator>> operator()(
299299 _Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred) const noexcept {
300300 using _TransformReduce = __dispatch<__transform_reduce, __current_configuration, _ExecutionPolicy>;
301 using _DiffT = __iter_diff_t<_ForwardIterator>;
302 using _Ref = __iter_reference<_ForwardIterator>;
301 using _DiffT = __iterator_difference_type<_ForwardIterator>;
302 using _Ref = __iterator_reference<_ForwardIterator>;
303303 return _TransformReduce()(
304304 __policy, std::move(__first), std::move(__last), _DiffT{}, std::plus{}, [&](_Ref __element) -> _DiffT {
305305 return __pred(__element) ? _DiffT(1) : _DiffT(0);
......@@ -310,10 +310,10 @@ struct __count_if<__default_backend_tag, _ExecutionPolicy> {
310310template <class _ExecutionPolicy>
311311struct __count<__default_backend_tag, _ExecutionPolicy> {
312312 template <class _Policy, class _ForwardIterator, class _Tp>
313 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>>
313 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iterator_difference_type<_ForwardIterator>>
314314 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept {
315315 using _CountIf = __dispatch<__count_if, __current_configuration, _ExecutionPolicy>;
316 using _Ref = __iter_reference<_ForwardIterator>;
316 using _Ref = __iterator_reference<_ForwardIterator>;
317317 return _CountIf()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) -> bool {
318318 return __element == __value;
319319 });
......@@ -402,7 +402,7 @@ struct __replace_copy_if<__default_backend_tag, _ExecutionPolicy> {
402402 _Pred&& __pred,
403403 _Tp const& __new_value) const noexcept {
404404 using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
405 using _Ref = __iter_reference<_ForwardIterator>;
405 using _Ref = __iterator_reference<_ForwardIterator>;
406406 auto __res =
407407 _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), [&](_Ref __element) {
408408 return __pred(__element) ? __new_value : __element;
......@@ -424,7 +424,7 @@ struct __replace_copy<__default_backend_tag, _ExecutionPolicy> {
424424 _Tp const& __old_value,
425425 _Tp const& __new_value) const noexcept {
426426 using _ReplaceCopyIf = __dispatch<__replace_copy_if, __current_configuration, _ExecutionPolicy>;
427 using _Ref = __iter_reference<_ForwardIterator>;
427 using _Ref = __iterator_reference<_ForwardIterator>;
428428 return _ReplaceCopyIf()(
429429 __policy,
430430 std::move(__first),
lib/libcxx/include/__pstl/backends/libdispatch.h+2-2
......@@ -269,7 +269,7 @@ struct __cpu_traits<__libdispatch_backend_tag> {
269269 return __empty{};
270270 }
271271
272 using _Value = __iter_value_type<_RandomAccessIterator>;
272 using _Value = __iterator_value_type<_RandomAccessIterator>;
273273
274274 auto __destroy = [__size](_Value* __ptr) {
275275 std::destroy_n(__ptr, __size);
......@@ -282,7 +282,7 @@ struct __cpu_traits<__libdispatch_backend_tag> {
282282 // Initialize all elements to a moved-from state
283283 // TODO: Don't do this - this can be done in the first merge - see https://llvm.org/PR63928
284284 std::__construct_at(__values.get(), std::move(*__first));
285 for (__iter_diff_t<_RandomAccessIterator> __i = 1; __i != __size; ++__i) {
285 for (__iterator_difference_type<_RandomAccessIterator> __i = 1; __i != __size; ++__i) {
286286 std::__construct_at(__values.get() + __i, std::move(__values.get()[__i - 1]));
287287 }
288288 *__first = std::move(__values.get()[__size - 1]);
lib/libcxx/include/__pstl/cpu_algos/find_if.h+1-1
......@@ -119,7 +119,7 @@ struct __cpu_parallel_find_if {
119119 true);
120120 } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
121121 __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
122 using __diff_t = __iter_diff_t<_ForwardIterator>;
122 using __diff_t = __iterator_difference_type<_ForwardIterator>;
123123 return __pstl::__simd_first<_Backend>(
124124 __first, __diff_t(0), __last - __first, [&__pred](_ForwardIterator __iter, __diff_t __i) {
125125 return __pred(__iter[__i]);
lib/libcxx/include/__pstl/cpu_algos/transform.h+5-6
......@@ -84,9 +84,8 @@ struct __cpu_parallel_transform {
8484 __first,
8585 __last - __first,
8686 __result,
87 [&](__iter_reference<_ForwardIterator> __in_value, __iter_reference<_ForwardOutIterator> __out_value) {
88 __out_value = __op(__in_value);
89 });
87 [&](__iterator_reference<_ForwardIterator> __in_value,
88 __iterator_reference<_ForwardOutIterator> __out_value) { __out_value = __op(__in_value); });
9089 } else {
9190 return std::transform(__first, __last, __result, __op);
9291 }
......@@ -138,9 +137,9 @@ struct __cpu_parallel_transform_binary {
138137 __last1 - __first1,
139138 __first2,
140139 __result,
141 [&](__iter_reference<_ForwardIterator1> __in1,
142 __iter_reference<_ForwardIterator2> __in2,
143 __iter_reference<_ForwardOutIterator> __out_value) { __out_value = __op(__in1, __in2); });
140 [&](__iterator_reference<_ForwardIterator1> __in1,
141 __iterator_reference<_ForwardIterator2> __in2,
142 __iterator_reference<_ForwardOutIterator> __out_value) { __out_value = __op(__in1, __in2); });
144143 } else {
145144 return std::transform(__first1, __last1, __first2, __result, __op);
146145 }
lib/libcxx/include/__pstl/cpu_algos/transform_reduce.h+5-4
......@@ -148,9 +148,10 @@ struct __cpu_parallel_transform_reduce_binary {
148148 __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
149149 __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
150150 return __pstl::__simd_transform_reduce<_Backend>(
151 __last1 - __first1, std::move(__init), std::move(__reduce), [&](__iter_diff_t<_ForwardIterator1> __i) {
152 return __transform(__first1[__i], __first2[__i]);
153 });
151 __last1 - __first1,
152 std::move(__init),
153 std::move(__reduce),
154 [&](__iterator_difference_type<_ForwardIterator1> __i) { return __transform(__first1[__i], __first2[__i]); });
154155 } else {
155156 return std::transform_reduce(
156157 std::move(__first1),
......@@ -200,7 +201,7 @@ struct __cpu_parallel_transform_reduce {
200201 __last - __first,
201202 std::move(__init),
202203 std::move(__reduce),
203 [=, &__transform](__iter_diff_t<_ForwardIterator> __i) { return __transform(__first[__i]); });
204 [=, &__transform](__iterator_difference_type<_ForwardIterator> __i) { return __transform(__first[__i]); });
204205 } else {
205206 return std::transform_reduce(
206207 std::move(__first), std::move(__last), std::move(__init), std::move(__reduce), std::move(__transform));
lib/libcxx/include/__random/binomial_distribution.h+10-4
......@@ -97,13 +97,19 @@ public:
9797 }
9898};
9999
100// The LLVM C library provides this with conflicting `noexcept` attributes.
101#if !defined(_LIBCPP_MSVCRT_LIKE) && !defined(__LLVM_LIBC__)
102extern "C" double lgamma_r(double, int*);
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;
103109#endif
104110
105111inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
106#if defined(_LIBCPP_MSVCRT_LIKE) || defined(__LLVM_LIBC__)
112#if defined(_LIBCPP_MSVCRT_LIKE)
107113 return lgamma(__d);
108114#else
109115 int __sign;
lib/libcxx/include/__random/mersenne_twister_engine.h+50-154
......@@ -62,24 +62,6 @@ _LIBCPP_HIDE_FROM_ABI bool
6262operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
6363 const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
6464
65template <class _UInt,
66 size_t _Wp,
67 size_t _Np,
68 size_t _Mp,
69 size_t _Rp,
70 _UInt _Ap,
71 size_t _Up,
72 _UInt _Dp,
73 size_t _Sp,
74 _UInt _Bp,
75 size_t _Tp,
76 _UInt _Cp,
77 size_t _Lp,
78 _UInt _Fp>
79_LIBCPP_HIDE_FROM_ABI bool
80operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
81 const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
82
8365template <class _CharT,
8466 class _Traits,
8567 class _UInt,
......@@ -194,14 +176,31 @@ public:
194176 _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(_Sseq& __q) {
195177 seed(__q);
196178 }
197 _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed);
179 _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
180 __x_[0] = __sd & _Max;
181 for (size_t __i = 1; __i < __n; ++__i)
182 __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max;
183 __i_ = 0;
184 }
198185 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
199186 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
200187 __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
201188 }
202189
203190 // generating functions
204 _LIBCPP_HIDE_FROM_ABI result_type operator()();
191 _LIBCPP_HIDE_FROM_ABI result_type operator()() {
192 const size_t __j = (__i_ + 1) % __n;
193 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;
199 __z ^= __lshift<__s>(__z) & __b;
200 __z ^= __lshift<__t>(__z) & __c;
201 return __z ^ __rshift<__l>(__z);
202 }
203
205204 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
206205 for (; __z; --__z)
207206 operator()();
......@@ -225,24 +224,6 @@ public:
225224 const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
226225 const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
227226
228 template <class _UInt,
229 size_t _Wp,
230 size_t _Np,
231 size_t _Mp,
232 size_t _Rp,
233 _UInt _Ap,
234 size_t _Up,
235 _UInt _Dp,
236 size_t _Sp,
237 _UInt _Bp,
238 size_t _Tp,
239 _UInt _Cp,
240 size_t _Lp,
241 _UInt _Fp>
242 friend bool operator!=(
243 const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
244 const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
245
246227 template <class _CharT,
247228 class _Traits,
248229 class _UInt,
......@@ -285,9 +266,38 @@ public:
285266
286267private:
287268 template <class _Sseq>
288 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
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);
282 }
283 }
284
289285 template <class _Sseq>
290 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
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);
299 }
300 }
291301
292302 template <size_t __count,
293303 __enable_if_t<__count< __w, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
......@@ -310,120 +320,6 @@ private:
310320 }
311321};
312322
313template <class _UIntType,
314 size_t __w,
315 size_t __n,
316 size_t __m,
317 size_t __r,
318 _UIntType __a,
319 size_t __u,
320 _UIntType __d,
321 size_t __s,
322 _UIntType __b,
323 size_t __t,
324 _UIntType __c,
325 size_t __l,
326 _UIntType __f>
327void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::seed(
328 result_type __sd) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { // __w >= 2
329 __x_[0] = __sd & _Max;
330 for (size_t __i = 1; __i < __n; ++__i)
331 __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max;
332 __i_ = 0;
333}
334
335template <class _UIntType,
336 size_t __w,
337 size_t __n,
338 size_t __m,
339 size_t __r,
340 _UIntType __a,
341 size_t __u,
342 _UIntType __d,
343 size_t __s,
344 _UIntType __b,
345 size_t __t,
346 _UIntType __c,
347 size_t __l,
348 _UIntType __f>
349template <class _Sseq>
350void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::__seed(
351 _Sseq& __q, integral_constant<unsigned, 1>) {
352 const unsigned __k = 1;
353 uint32_t __ar[__n * __k];
354 __q.generate(__ar, __ar + __n * __k);
355 for (size_t __i = 0; __i < __n; ++__i)
356 __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
357 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
358 __i_ = 0;
359 if ((__x_[0] & ~__mask) == 0) {
360 for (size_t __i = 1; __i < __n; ++__i)
361 if (__x_[__i] != 0)
362 return;
363 __x_[0] = result_type(1) << (__w - 1);
364 }
365}
366
367template <class _UIntType,
368 size_t __w,
369 size_t __n,
370 size_t __m,
371 size_t __r,
372 _UIntType __a,
373 size_t __u,
374 _UIntType __d,
375 size_t __s,
376 _UIntType __b,
377 size_t __t,
378 _UIntType __c,
379 size_t __l,
380 _UIntType __f>
381template <class _Sseq>
382void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::__seed(
383 _Sseq& __q, integral_constant<unsigned, 2>) {
384 const unsigned __k = 2;
385 uint32_t __ar[__n * __k];
386 __q.generate(__ar, __ar + __n * __k);
387 for (size_t __i = 0; __i < __n; ++__i)
388 __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
389 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
390 __i_ = 0;
391 if ((__x_[0] & ~__mask) == 0) {
392 for (size_t __i = 1; __i < __n; ++__i)
393 if (__x_[__i] != 0)
394 return;
395 __x_[0] = result_type(1) << (__w - 1);
396 }
397}
398
399template <class _UIntType,
400 size_t __w,
401 size_t __n,
402 size_t __m,
403 size_t __r,
404 _UIntType __a,
405 size_t __u,
406 _UIntType __d,
407 size_t __s,
408 _UIntType __b,
409 size_t __t,
410 _UIntType __c,
411 size_t __l,
412 _UIntType __f>
413_UIntType
414mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() {
415 const size_t __j = (__i_ + 1) % __n;
416 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
417 const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
418 const size_t __k = (__i_ + __m) % __n;
419 __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
420 result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
421 __i_ = __j;
422 __z ^= __lshift<__s>(__z) & __b;
423 __z ^= __lshift<__t>(__z) & __c;
424 return __z ^ __rshift<__l>(__z);
425}
426
427323template <class _UInt,
428324 size_t _Wp,
429325 size_t _Np,
lib/libcxx/include/__random/piecewise_constant_distribution.h+3-2
......@@ -9,9 +9,11 @@
99#ifndef _LIBCPP___RANDOM_PIECEWISE_CONSTANT_DISTRIBUTION_H
1010#define _LIBCPP___RANDOM_PIECEWISE_CONSTANT_DISTRIBUTION_H
1111
12#include <__algorithm/copy_n.h>
1213#include <__algorithm/upper_bound.h>
1314#include <__config>
1415#include <__cstddef/ptrdiff_t.h>
16#include <__iterator/back_insert_iterator.h>
1517#include <__random/is_valid.h>
1618#include <__random/uniform_real_distribution.h>
1719#include <__vector/vector.h>
......@@ -190,8 +192,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type(
190192 __areas_.assign(1, 0.0);
191193 } else {
192194 __densities_.reserve(__b_.size() - 1);
193 for (size_t __i = 0; __i < __b_.size() - 1; ++__i, ++__f_w)
194 __densities_.push_back(*__f_w);
195 std::copy_n(__f_w, __b_.size() - 1, std::back_inserter(__densities_));
195196 __init();
196197 }
197198}
lib/libcxx/include/__random/piecewise_linear_distribution.h+3-2
......@@ -9,9 +9,11 @@
99#ifndef _LIBCPP___RANDOM_PIECEWISE_LINEAR_DISTRIBUTION_H
1010#define _LIBCPP___RANDOM_PIECEWISE_LINEAR_DISTRIBUTION_H
1111
12#include <__algorithm/copy_n.h>
1213#include <__algorithm/upper_bound.h>
1314#include <__config>
1415#include <__cstddef/ptrdiff_t.h>
16#include <__iterator/back_insert_iterator.h>
1517#include <__random/is_valid.h>
1618#include <__random/uniform_real_distribution.h>
1719#include <__vector/comparison.h>
......@@ -194,8 +196,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type(
194196 __areas_.assign(1, 0.0);
195197 } else {
196198 __densities_.reserve(__b_.size());
197 for (size_t __i = 0; __i < __b_.size(); ++__i, ++__f_w)
198 __densities_.push_back(*__f_w);
199 std::copy_n(__f_w, __b_.size(), std::back_inserter(__densities_));
199200 __init();
200201 }
201202}
lib/libcxx/include/__ranges/adjacent_transform_view.h created+406
......@@ -0,0 +1,406 @@
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_ADJACENT_TRANSFORM_VIEW_H
11#define _LIBCPP___RANGES_ADJACENT_TRANSFORM_VIEW_H
12
13#include <__config>
14
15#include <__algorithm/min.h>
16#include <__compare/three_way_comparable.h>
17#include <__concepts/constructible.h>
18#include <__concepts/convertible_to.h>
19#include <__concepts/derived_from.h>
20#include <__concepts/equality_comparable.h>
21#include <__concepts/invocable.h>
22#include <__cstddef/size_t.h>
23#include <__functional/bind_back.h>
24#include <__functional/invoke.h>
25#include <__functional/operations.h>
26#include <__iterator/concepts.h>
27#include <__iterator/incrementable_traits.h>
28#include <__iterator/iter_move.h>
29#include <__iterator/iter_swap.h>
30#include <__iterator/iterator_traits.h>
31#include <__iterator/next.h>
32#include <__iterator/prev.h>
33#include <__memory/addressof.h>
34#include <__ranges/access.h>
35#include <__ranges/adjacent_view.h>
36#include <__ranges/all.h>
37#include <__ranges/concepts.h>
38#include <__ranges/empty_view.h>
39#include <__ranges/movable_box.h>
40#include <__ranges/range_adaptor.h>
41#include <__ranges/size.h>
42#include <__ranges/view_interface.h>
43#include <__ranges/zip_transform_view.h>
44#include <__type_traits/common_type.h>
45#include <__type_traits/decay.h>
46#include <__type_traits/is_nothrow_constructible.h>
47#include <__type_traits/is_object.h>
48#include <__type_traits/is_referenceable.h>
49#include <__type_traits/make_unsigned.h>
50#include <__type_traits/maybe_const.h>
51#include <__utility/declval.h>
52#include <__utility/forward.h>
53#include <__utility/in_place.h>
54#include <__utility/integer_sequence.h>
55#include <__utility/move.h>
56
57#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
58# pragma GCC system_header
59#endif
60
61_LIBCPP_PUSH_MACROS
62#include <__undef_macros>
63
64_LIBCPP_BEGIN_NAMESPACE_STD
65
66#if _LIBCPP_STD_VER >= 23
67
68namespace ranges {
69
70template <class _Fn, size_t _Np>
71struct __apply_n {
72 template <class _Tp, size_t... _Is>
73 static auto __apply(index_sequence<_Is...>) -> invoke_result_t<_Fn, decltype((void)_Is, std::declval<_Tp>())...>;
74
75 template <class _Tp>
76 static auto operator()(_Tp&&) -> decltype(__apply<_Tp>(make_index_sequence<_Np>{}));
77};
78
79template <forward_range _View, move_constructible _Fn, size_t _Np>
80 requires view<_View> && (_Np > 0) && is_object_v<_Fn> &&
81 regular_invocable<__apply_n<_Fn&, _Np>, range_reference_t<_View>> &&
82 __referenceable<invoke_result_t<__apply_n<_Fn&, _Np>, range_reference_t<_View>>>
83class adjacent_transform_view : public view_interface<adjacent_transform_view<_View, _Fn, _Np>> {
84private:
85 _LIBCPP_NO_UNIQUE_ADDRESS adjacent_view<_View, _Np> __inner_;
86 _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Fn> __fun_;
87
88 using _InnerView _LIBCPP_NODEBUG = adjacent_view<_View, _Np>;
89
90 template <bool _Const>
91 using __inner_iterator _LIBCPP_NODEBUG = iterator_t<__maybe_const<_Const, _InnerView>>;
92
93 template <bool _Const>
94 using __inner_sentinel _LIBCPP_NODEBUG = sentinel_t<__maybe_const<_Const, _InnerView>>;
95
96 template <bool>
97 class __iterator;
98
99 template <bool>
100 class __sentinel;
101
102public:
103 _LIBCPP_HIDE_FROM_ABI adjacent_transform_view() = default;
104
105 _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_transform_view(_View __base, _Fn __fun)
106 : __inner_(std::move(__base)), __fun_(std::in_place, std::move(__fun)) {}
107
108 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
109 requires copy_constructible<_View>
110 {
111 return __inner_.base();
112 }
113 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__inner_).base(); }
114
115 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __inner_.begin()); }
116
117 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
118 requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>>
119 {
120 return __iterator<true>(*this, __inner_.begin());
121 }
122
123 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
124 if constexpr (common_range<_InnerView>) {
125 return __iterator<false>(*this, __inner_.end());
126 } else {
127 return __sentinel<false>(__inner_.end());
128 }
129 }
130
131 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
132 requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>>
133 {
134 if constexpr (common_range<const _InnerView>) {
135 return __iterator<true>(*this, __inner_.end());
136 } else {
137 return __sentinel<true>(__inner_.end());
138 }
139 }
140
141 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
142 requires sized_range<_InnerView>
143 {
144 return __inner_.size();
145 }
146
147 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
148 requires sized_range<const _InnerView>
149 {
150 return __inner_.size();
151 }
152};
153
154template <forward_range _View, move_constructible _Fn, size_t _Np>
155 requires view<_View> && (_Np > 0) && is_object_v<_Fn> &&
156 regular_invocable<__apply_n<_Fn&, _Np>, range_reference_t<_View>> &&
157 __referenceable<invoke_result_t<__apply_n<_Fn&, _Np>, range_reference_t<_View>>>
158template <bool _Const>
159class adjacent_transform_view<_View, _Fn, _Np>::__iterator {
160 friend adjacent_transform_view;
161
162 using _Parent _LIBCPP_NODEBUG = __maybe_const<_Const, adjacent_transform_view>;
163 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
164
165 _Parent* __parent_ = nullptr;
166 __inner_iterator<_Const> __inner_;
167
168 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, __inner_iterator<_Const> __inner)
169 : __parent_(std::addressof(__parent)), __inner_(std::move(__inner)) {}
170
171 static consteval auto __get_iterator_category() {
172 using _Cat = iterator_traits<iterator_t<_Base>>::iterator_category;
173 if constexpr (!is_reference_v<
174 invoke_result_t<__apply_n<__maybe_const<_Const, _Fn>&, _Np>, range_reference_t<_Base>>>)
175 return input_iterator_tag{};
176 else if constexpr (derived_from<_Cat, random_access_iterator_tag>)
177 return random_access_iterator_tag{};
178 else if constexpr (derived_from<_Cat, bidirectional_iterator_tag>)
179 return bidirectional_iterator_tag{};
180 else if constexpr (derived_from<_Cat, forward_iterator_tag>)
181 return forward_iterator_tag{};
182 else
183 return input_iterator_tag{};
184 }
185
186 template <size_t... _Is>
187 static consteval bool __noexcept_dereference(index_sequence<_Is...>) {
188 return noexcept(std::invoke(
189 std::declval<__maybe_const<_Const, _Fn>&>(), ((void)_Is, *std::declval<iterator_t<_Base> const&>())...));
190 }
191
192public:
193 using iterator_category = decltype(__get_iterator_category());
194 using iterator_concept = typename __inner_iterator<_Const>::iterator_concept;
195 using value_type =
196 remove_cvref_t<invoke_result_t<__apply_n<__maybe_const<_Const, _Fn>&, _Np>, range_reference_t<_Base>>>;
197 using difference_type = range_difference_t<_Base>;
198
199 _LIBCPP_HIDE_FROM_ABI __iterator() = default;
200
201 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
202 requires _Const && convertible_to<__inner_iterator<false>, __inner_iterator<true>>
203 : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {}
204
205 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
206 noexcept(__noexcept_dereference(make_index_sequence<_Np>{})) {
207 return std::apply(
208 [&](const auto&... __iters) -> decltype(auto) { return std::invoke(*__parent_->__fun_, *__iters...); },
209 __adjacent_view_iter_access::__get_current(__inner_));
210 }
211
212 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
213 ++__inner_;
214 return *this;
215 }
216
217 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
218 auto __tmp = *this;
219 ++*this;
220 return __tmp;
221 }
222
223 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
224 requires bidirectional_range<_Base>
225 {
226 --__inner_;
227 return *this;
228 }
229
230 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
231 requires bidirectional_range<_Base>
232 {
233 auto __tmp = *this;
234 --*this;
235 return __tmp;
236 }
237
238 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __x)
239 requires random_access_range<_Base>
240 {
241 __inner_ += __x;
242 return *this;
243 }
244
245 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
246 requires random_access_range<_Base>
247 {
248 __inner_ -= __x;
249 return *this;
250 }
251
252 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
253 requires random_access_range<_Base>
254 {
255 return std::apply(
256 [&](const auto&... __iters) -> decltype(auto) { return std::invoke(*__parent_->__fun_, __iters[__n]...); },
257 __adjacent_view_iter_access::__get_current(__inner_));
258 }
259
260 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
261 return __x.__inner_ == __y.__inner_;
262 }
263
264 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
265 requires random_access_range<_Base>
266 {
267 return __x.__inner_ < __y.__inner_;
268 }
269
270 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
271 requires random_access_range<_Base>
272 {
273 return __x.__inner_ > __y.__inner_;
274 }
275
276 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
277 requires random_access_range<_Base>
278 {
279 return __x.__inner_ <= __y.__inner_;
280 }
281
282 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
283 requires random_access_range<_Base>
284 {
285 return __x.__inner_ >= __y.__inner_;
286 }
287
288 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
289 requires random_access_range<_Base> && three_way_comparable<__inner_iterator<_Const>>
290 {
291 return __x.__inner_ <=> __y.__inner_;
292 }
293
294 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
295 requires random_access_range<_Base>
296 {
297 return __iterator(*__i.__parent_, __i.__inner_ + __n);
298 }
299
300 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
301 requires random_access_range<_Base>
302 {
303 return __iterator(*__i.__parent_, __i.__inner_ + __n);
304 }
305
306 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
307 requires random_access_range<_Base>
308 {
309 return __iterator(*__i.__parent_, __i.__inner_ - __n);
310 }
311
312 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
313 requires sized_sentinel_for<__inner_iterator<_Const>, __inner_iterator<_Const>>
314 {
315 return __x.__inner_ - __y.__inner_;
316 }
317};
318
319template <forward_range _View, move_constructible _Fn, size_t _Np>
320 requires view<_View> && (_Np > 0) && is_object_v<_Fn> &&
321 regular_invocable<__apply_n<_Fn&, _Np>, range_reference_t<_View>> &&
322 __referenceable<invoke_result_t<__apply_n<_Fn&, _Np>, range_reference_t<_View>>>
323template <bool _Const>
324class adjacent_transform_view<_View, _Fn, _Np>::__sentinel {
325 friend adjacent_transform_view;
326
327 __inner_sentinel<_Const> __inner_;
328
329 _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(__inner_sentinel<_Const> __inner)
330 : __inner_(std::move(__inner)) {}
331
332public:
333 _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
334
335 _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
336 requires _Const && convertible_to<__inner_sentinel<false>, __inner_sentinel<_Const>>
337 : __inner_(std::move(__i.__inner_)) {}
338
339 template <bool _OtherConst>
340 requires sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>>
341 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
342 return __x.__inner_ == __y.__inner_;
343 }
344
345 template <bool _OtherConst>
346 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 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
349 return __x.__inner_ - __y.__inner_;
350 }
351
352 template <bool _OtherConst>
353 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 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
356 return __x.__inner_ - __y.__inner_;
357 }
358};
359
360namespace views {
361namespace __adjacent_transform {
362
363template <size_t _Np>
364struct __fn : __range_adaptor_closure<__fn<_Np>> {
365 template <class _Range, class _Fn>
366 requires(_Np == 0 && forward_range<_Range &&>)
367 _LIBCPP_HIDE_FROM_ABI static constexpr auto
368 operator()(_Range&&, _Fn&& __fn) noexcept(noexcept(views::zip_transform(std::forward<_Fn>(__fn))))
369 -> decltype(views::zip_transform(std::forward<_Fn>(__fn))) {
370 return views::zip_transform(std::forward<_Fn>(__fn));
371 }
372
373 template <class _Range, class _Fn>
374 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Fn&& __fn) noexcept(
375 noexcept(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>(
376 std::forward<_Range>(__range), std::forward<_Fn>(__fn))))
377 -> decltype(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>(
378 std::forward<_Range>(__range), std::forward<_Fn>(__fn))) {
379 return adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>(
380 std::forward<_Range>(__range), std::forward<_Fn>(__fn));
381 }
382
383 template <class _Fn>
384 requires constructible_from<decay_t<_Fn>, _Fn>
385 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const
386 noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) {
387 return __pipeable(std::__bind_back(*this, std::forward<_Fn>(__f)));
388 }
389};
390
391} // namespace __adjacent_transform
392inline namespace __cpo {
393template <size_t _Np>
394inline constexpr auto adjacent_transform = __adjacent_transform::__fn<_Np>{};
395inline constexpr auto pairwise_transform = adjacent_transform<2>;
396} // namespace __cpo
397} // namespace views
398} // namespace ranges
399
400#endif // _LIBCPP_STD_VER >= 23
401
402_LIBCPP_END_NAMESPACE_STD
403
404_LIBCPP_POP_MACROS
405
406#endif // _LIBCPP___RANGES_ADJACENT_TRANSFORM_VIEW_H
lib/libcxx/include/__ranges/adjacent_view.h created+419
......@@ -0,0 +1,419 @@
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_ADJACENT_VIEW_H
11#define _LIBCPP___RANGES_ADJACENT_VIEW_H
12
13#include <__config>
14
15#include <__algorithm/min.h>
16#include <__compare/three_way_comparable.h>
17#include <__concepts/constructible.h>
18#include <__concepts/convertible_to.h>
19#include <__concepts/equality_comparable.h>
20#include <__cstddef/size_t.h>
21#include <__functional/invoke.h>
22#include <__functional/operations.h>
23#include <__iterator/concepts.h>
24#include <__iterator/incrementable_traits.h>
25#include <__iterator/iter_move.h>
26#include <__iterator/iter_swap.h>
27#include <__iterator/iterator_traits.h>
28#include <__iterator/next.h>
29#include <__iterator/prev.h>
30#include <__ranges/access.h>
31#include <__ranges/all.h>
32#include <__ranges/concepts.h>
33#include <__ranges/empty_view.h>
34#include <__ranges/enable_borrowed_range.h>
35#include <__ranges/range_adaptor.h>
36#include <__ranges/size.h>
37#include <__ranges/view_interface.h>
38#include <__tuple/tuple_transform.h>
39#include <__type_traits/common_type.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/declval.h>
44#include <__utility/forward.h>
45#include <__utility/integer_sequence.h>
46#include <__utility/move.h>
47#include <array>
48#include <tuple>
49
50#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
51# pragma GCC system_header
52#endif
53
54_LIBCPP_PUSH_MACROS
55#include <__undef_macros>
56
57_LIBCPP_BEGIN_NAMESPACE_STD
58
59#if _LIBCPP_STD_VER >= 23
60
61namespace ranges {
62
63template <forward_range _View, size_t _Np>
64 requires view<_View> && (_Np > 0)
65class adjacent_view : public view_interface<adjacent_view<_View, _Np>> {
66private:
67 _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
68
69 template <bool>
70 class __iterator;
71
72 template <bool>
73 class __sentinel;
74
75 struct __as_sentinel {};
76
77public:
78 _LIBCPP_HIDE_FROM_ABI adjacent_view()
79 requires default_initializable<_View>
80 = default;
81
82 _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_view(_View __base) : __base_(std::move(__base)) {}
83
84 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
85 requires copy_constructible<_View>
86 {
87 return __base_;
88 }
89 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
90
91 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
92 requires(!__simple_view<_View>)
93 {
94 return __iterator<false>(ranges::begin(__base_), ranges::end(__base_));
95 }
96
97 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
98 requires range<const _View> // LWG4482 This is under-constrained.
99 {
100 return __iterator<true>(ranges::begin(__base_), ranges::end(__base_));
101 }
102
103 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
104 requires(!__simple_view<_View>)
105 {
106 if constexpr (common_range<_View>) {
107 return __iterator<false>(__as_sentinel{}, ranges::begin(__base_), ranges::end(__base_));
108 } else {
109 return __sentinel<false>(ranges::end(__base_));
110 }
111 }
112
113 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
114 requires range<const _View> // LWG4482 This is under-constrained.
115 {
116 if constexpr (common_range<const _View>) {
117 return __iterator<true>(__as_sentinel{}, ranges::begin(__base_), ranges::end(__base_));
118 } else {
119 return __sentinel<true>(ranges::end(__base_));
120 }
121 }
122
123 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
124 requires sized_range<_View>
125 {
126 using _ST = decltype(ranges::size(__base_));
127 using _CT = common_type_t<_ST, size_t>;
128 auto __sz = static_cast<_CT>(ranges::size(__base_));
129 __sz -= std::min<_CT>(__sz, _Np - 1);
130 return static_cast<_ST>(__sz);
131 }
132
133 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
134 requires sized_range<const _View>
135 {
136 using _ST = decltype(ranges::size(__base_));
137 using _CT = common_type_t<_ST, size_t>;
138 auto __sz = static_cast<_CT>(ranges::size(__base_));
139 __sz -= std::min<_CT>(__sz, _Np - 1);
140 return static_cast<_ST>(__sz);
141 }
142};
143
144struct __adjacent_view_iter_access {
145 template <class _Iter>
146 _LIBCPP_HIDE_FROM_ABI constexpr static auto& __get_current(_Iter& __it) noexcept {
147 return __it.__current_;
148 }
149};
150
151template <forward_range _View, size_t _Np>
152 requires view<_View> && (_Np > 0)
153template <bool _Const>
154class adjacent_view<_View, _Np>::__iterator {
155 friend __adjacent_view_iter_access;
156 friend adjacent_view;
157 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
158 array<iterator_t<_Base>, _Np> __current_ = array<iterator_t<_Base>, _Np>();
159
160 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(iterator_t<_Base> __first, sentinel_t<_Base> __last) {
161 __current_[0] = __first;
162 for (size_t __i = 1; __i < _Np; ++__i) {
163 __current_[__i] = ranges::next(__current_[__i - 1], 1, __last);
164 }
165 }
166
167 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__as_sentinel, iterator_t<_Base> __first, iterator_t<_Base> __last) {
168 if constexpr (!bidirectional_range<_Base>) {
169 __current_.fill(__last);
170 } else {
171 __current_[_Np - 1] = __last;
172 for (int __i = static_cast<int>(_Np) - 2; __i >= 0; --__i) {
173 __current_[__i] = ranges::prev(__current_[__i + 1], 1, __first);
174 }
175 }
176 }
177
178 template <class _Iter, size_t... _Is>
179 _LIBCPP_HIDE_FROM_ABI explicit constexpr __iterator(_Iter&& __i, index_sequence<_Is...>)
180 : __current_{std::move(__i.__current_[_Is])...} {}
181
182 static consteval auto __get_iterator_concept() {
183 if constexpr (random_access_range<_Base>)
184 return random_access_iterator_tag{};
185 else if constexpr (bidirectional_range<_Base>)
186 return bidirectional_iterator_tag{};
187 else
188 return forward_iterator_tag{};
189 }
190
191 template <class _Tp, size_t _Index>
192 using __always _LIBCPP_NODEBUG = _Tp;
193
194 template <class _Tp, size_t... _Is>
195 static auto __repeat_tuple_helper(index_sequence<_Is...>) -> tuple<__always<_Tp, _Is>...>;
196
197public:
198 using iterator_category = input_iterator_tag;
199 using iterator_concept = decltype(__get_iterator_concept());
200 using value_type = decltype(__repeat_tuple_helper<range_value_t<_Base>>(make_index_sequence<_Np>{}));
201 using difference_type = range_difference_t<_Base>;
202
203 _LIBCPP_HIDE_FROM_ABI __iterator() = default;
204 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
205 requires _Const && convertible_to<iterator_t<_View>, iterator_t<const _View>>
206 : __iterator(std::move(__i), make_index_sequence<_Np>{}) {}
207
208 _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
209 return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
210 }
211
212 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
213 for (auto& __i : __current_) {
214 ++__i;
215 }
216 return *this;
217 }
218
219 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
220 auto __tmp = *this;
221 ++*this;
222 return __tmp;
223 }
224
225 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
226 requires bidirectional_range<_Base>
227 {
228 for (auto& __i : __current_) {
229 --__i;
230 }
231 return *this;
232 }
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 __x)
243 requires random_access_range<_Base>
244 {
245 for (auto& __i : __current_) {
246 __i += __x;
247 }
248 return *this;
249 }
250
251 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
252 requires random_access_range<_Base>
253 {
254 for (auto& __i : __current_) {
255 __i -= __x;
256 }
257 return *this;
258 }
259
260 _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
261 requires random_access_range<_Base>
262 {
263 return std::__tuple_transform([&](auto& __i) -> decltype(auto) { return __i[__n]; }, __current_);
264 }
265
266 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
267 return __x.__current_.back() == __y.__current_.back();
268 }
269
270 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
271 requires random_access_range<_Base>
272 {
273 return __x.__current_.back() < __y.__current_.back();
274 }
275
276 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
277 requires random_access_range<_Base>
278 {
279 return __y < __x;
280 }
281
282 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
283 requires random_access_range<_Base>
284 {
285 return !(__y < __x);
286 }
287
288 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
289 requires random_access_range<_Base>
290 {
291 return !(__x < __y);
292 }
293
294 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
295 requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
296 {
297 return __x.__current_.back() <=> __y.__current_.back();
298 }
299
300 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
301 requires random_access_range<_Base>
302 {
303 auto __r = __i;
304 __r += __n;
305 return __r;
306 }
307
308 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
309 requires random_access_range<_Base>
310 {
311 return __i + __n;
312 }
313
314 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
315 requires random_access_range<_Base>
316 {
317 auto __r = __i;
318 __r -= __n;
319 return __r;
320 }
321
322 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
323 requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
324 {
325 return __x.__current_.back() - __y.__current_.back();
326 }
327
328 _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
329 noexcept(ranges::iter_move(std::declval<const iterator_t<_Base>&>())) &&
330 is_nothrow_move_constructible_v<range_rvalue_reference_t<_Base>>) {
331 return std::__tuple_transform(ranges::iter_move, __i.__current_);
332 }
333
334 _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
335 noexcept(ranges::iter_swap(std::declval<iterator_t<_Base>>(), std::declval<iterator_t<_Base>>())))
336 requires indirectly_swappable<iterator_t<_Base>>
337 {
338 for (size_t __i = 0; __i < _Np; ++__i) {
339 ranges::iter_swap(__l.__current_[__i], __r.__current_[__i]);
340 }
341 }
342};
343
344template <forward_range _View, size_t _Np>
345 requires view<_View> && (_Np > 0)
346template <bool _Const>
347class adjacent_view<_View, _Np>::__sentinel {
348 friend adjacent_view;
349 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
350 sentinel_t<_Base> __end_ = sentinel_t<_Base>();
351
352 _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) { __end_ = std::move(__end); }
353
354public:
355 _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
356
357 _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
358 requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
359 : __end_(std::move(__i.__end_)) {}
360
361 template <bool _OtherConst>
362 requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
363 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
364 return __x.__current_.back() == __y.__end_;
365 }
366
367 template <bool _OtherConst>
368 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 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
371 return __x.__current_.back() - __y.__end_;
372 }
373
374 template <bool _OtherConst>
375 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 operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) {
378 return __y.__end_ - __x.__current_.back();
379 }
380};
381
382template <class _View, size_t _Np>
383constexpr bool enable_borrowed_range<adjacent_view<_View, _Np>> = enable_borrowed_range<_View>;
384
385namespace views {
386namespace __adjacent {
387
388template <size_t _Np>
389struct __fn : __range_adaptor_closure<__fn<_Np>> {
390 template <class _Range>
391 requires(_Np == 0 && forward_range<_Range &&>)
392 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&&) noexcept {
393 return empty_view<tuple<>>{};
394 }
395
396 template <class _Ranges>
397 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ranges&& __range) noexcept(
398 noexcept(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range))))
399 -> decltype(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range))) {
400 return adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range));
401 }
402};
403
404} // namespace __adjacent
405inline namespace __cpo {
406template <size_t _Np>
407inline constexpr auto adjacent = __adjacent::__fn<_Np>{};
408inline constexpr auto pairwise = adjacent<2>;
409} // namespace __cpo
410} // namespace views
411} // namespace ranges
412
413#endif // _LIBCPP_STD_VER >= 23
414
415_LIBCPP_END_NAMESPACE_STD
416
417_LIBCPP_POP_MACROS
418
419#endif // _LIBCPP___RANGES_ADJACENT_VIEW_H
lib/libcxx/include/__ranges/as_rvalue_view.h+9-9
......@@ -48,27 +48,27 @@ public:
4848
4949 _LIBCPP_HIDE_FROM_ABI constexpr explicit as_rvalue_view(_View __base) : __base_(std::move(__base)) {}
5050
51 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
51 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
5252 requires copy_constructible<_View>
5353 {
5454 return __base_;
5555 }
5656
57 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
57 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
5858
59 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
6060 requires(!__simple_view<_View>)
6161 {
6262 return move_iterator(ranges::begin(__base_));
6363 }
6464
65 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
65 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
6666 requires range<const _View>
6767 {
6868 return move_iterator(ranges::begin(__base_));
6969 }
7070
71 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
71 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
7272 requires(!__simple_view<_View>)
7373 {
7474 if constexpr (common_range<_View>) {
......@@ -78,7 +78,7 @@ public:
7878 }
7979 }
8080
81 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
81 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
8282 requires range<const _View>
8383 {
8484 if constexpr (common_range<const _View>) {
......@@ -88,13 +88,13 @@ public:
8888 }
8989 }
9090
91 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
91 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
9292 requires sized_range<_View>
9393 {
9494 return ranges::size(__base_);
9595 }
9696
97 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
9898 requires sized_range<const _View>
9999 {
100100 return ranges::size(__base_);
......@@ -117,7 +117,7 @@ struct __fn : __range_adaptor_closure<__fn> {
117117 return /*---------------------------------*/ as_rvalue_view(std::forward<_Range>(__range));
118118 }
119119
120 template <class _Range>
120 template <input_range _Range>
121121 requires same_as<range_rvalue_reference_t<_Range>, range_reference_t<_Range>>
122122 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
123123 operator()(_Range&& __range) noexcept(noexcept(views::all(std::forward<_Range>(__range))))
lib/libcxx/include/__ranges/chunk_by_view.h+6-6
......@@ -100,17 +100,17 @@ public:
100100 _LIBCPP_HIDE_FROM_ABI constexpr explicit chunk_by_view(_View __base, _Pred __pred)
101101 : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
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 const _Pred& pred() const { return *__pred_; }
111 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
112112
113 _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
113 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
114114 // Note: this duplicates a check in `optional` but provides a better error message.
115115 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
116116 __pred_.__has_value(), "Trying to call begin() on a chunk_by_view that does not have a valid predicate.");
......@@ -122,7 +122,7 @@ public:
122122 return {*this, std::move(__first), *__cached_begin_};
123123 }
124124
125 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
125 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
126126 if constexpr (common_range<_View>) {
127127 return __iterator{*this, ranges::end(__base_), ranges::end(__base_)};
128128 } else {
......@@ -155,7 +155,7 @@ public:
155155
156156 _LIBCPP_HIDE_FROM_ABI __iterator() = default;
157157
158 _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const {
158 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const {
159159 // If the iterator is at end, this would return an empty range which can be checked by the calling code and doesn't
160160 // necessarily lead to a bad access.
161161 _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to dereference past-the-end chunk_by_view iterator.");
lib/libcxx/include/__ranges/common_view.h+7-7
......@@ -56,16 +56,16 @@ public:
5656 return __base_;
5757 }
5858
59 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
6060
61 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
61 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
6262 if constexpr (random_access_range<_View> && sized_range<_View>)
6363 return ranges::begin(__base_);
6464 else
6565 return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::begin(__base_));
6666 }
6767
68 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
6969 requires range<const _View>
7070 {
7171 if constexpr (random_access_range<const _View> && sized_range<const _View>)
......@@ -74,14 +74,14 @@ public:
7474 return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_));
7575 }
7676
77 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
77 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
7878 if constexpr (random_access_range<_View> && sized_range<_View>)
7979 return ranges::begin(__base_) + ranges::size(__base_);
8080 else
8181 return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::end(__base_));
8282 }
8383
84 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
8585 requires range<const _View>
8686 {
8787 if constexpr (random_access_range<const _View> && sized_range<const _View>)
......@@ -90,13 +90,13 @@ public:
9090 return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::end(__base_));
9191 }
9292
93 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
93 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
9494 requires sized_range<_View>
9595 {
9696 return ranges::size(__base_);
9797 }
9898
99 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
99 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
100100 requires sized_range<const _View>
101101 {
102102 return ranges::size(__base_);
lib/libcxx/include/__ranges/drop_view.h+8-8
......@@ -80,14 +80,14 @@ public:
8080 _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
8181 }
8282
83 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
83 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
8484 requires copy_constructible<_View>
8585 {
8686 return __base_;
8787 }
88 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
88 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
8989
90 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
9191 requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>))
9292 {
9393 if constexpr (random_access_range<_View> && sized_range<_View>) {
......@@ -104,20 +104,20 @@ public:
104104 return __tmp;
105105 }
106106
107 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
107 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
108108 requires random_access_range<const _View> && sized_range<const _View>
109109 {
110110 const auto __dist = std::min(ranges::distance(__base_), __count_);
111111 return ranges::begin(__base_) + __dist;
112112 }
113113
114 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
114 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
115115 requires(!__simple_view<_View>)
116116 {
117117 return ranges::end(__base_);
118118 }
119119
120 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
120 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
121121 requires range<const _View>
122122 {
123123 return ranges::end(__base_);
......@@ -129,13 +129,13 @@ public:
129129 return __s < __c ? 0 : __s - __c;
130130 }
131131
132 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
132 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
133133 requires sized_range<_View>
134134 {
135135 return __size(*this);
136136 }
137137
138 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
138 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
139139 requires sized_range<const _View>
140140 {
141141 return __size(*this);
lib/libcxx/include/__ranges/drop_while_view.h+5-5
......@@ -57,17 +57,17 @@ public:
5757 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred)
5858 : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
5959
60 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
60 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
6161 requires copy_constructible<_View>
6262 {
6363 return __base_;
6464 }
6565
66 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
66 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
6767
68 _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
6969
70 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
70 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
7171 // Note: this duplicates a check in `optional` but provides a better error message.
7272 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
7373 __pred_.__has_value(),
......@@ -83,7 +83,7 @@ public:
8383 }
8484 }
8585
86 _LIBCPP_HIDE_FROM_ABI constexpr auto end() { return ranges::end(__base_); }
86 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() { return ranges::end(__base_); }
8787
8888private:
8989 _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
lib/libcxx/include/__ranges/elements_of.h created+49
......@@ -0,0 +1,49 @@
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_ELEMENTS_OF_H
11#define _LIBCPP___RANGES_ELEMENTS_OF_H
12
13#include <__config>
14#include <__cstddef/byte.h>
15#include <__memory/allocator.h>
16#include <__ranges/concepts.h>
17#include <__utility/forward.h>
18
19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20# pragma GCC system_header
21#endif
22
23_LIBCPP_PUSH_MACROS
24#include <__undef_macros>
25
26_LIBCPP_BEGIN_NAMESPACE_STD
27
28#if _LIBCPP_STD_VER >= 23
29
30namespace ranges {
31
32template <range _Range, class _Allocator = allocator<byte>>
33struct elements_of {
34 _LIBCPP_NO_UNIQUE_ADDRESS _Range range;
35 _LIBCPP_NO_UNIQUE_ADDRESS _Allocator allocator = _Allocator();
36};
37
38template <class _Range, class _Allocator = allocator<byte>>
39elements_of(_Range&&, _Allocator = _Allocator()) -> elements_of<_Range&&, _Allocator>;
40
41} // namespace ranges
42
43#endif // _LIBCPP_STD_VER >= 23
44
45_LIBCPP_END_NAMESPACE_STD
46
47_LIBCPP_POP_MACROS
48
49#endif // _LIBCPP___RANGES_ELEMENTS_OF_H
lib/libcxx/include/__ranges/empty_view.h+5-5
......@@ -29,11 +29,11 @@ template <class _Tp>
2929 requires is_object_v<_Tp>
3030class empty_view : public view_interface<empty_view<_Tp>> {
3131public:
32 _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
33 _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
34 _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
35 _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
36 _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
32 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
33 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
34 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
35 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
36 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
3737};
3838
3939template <class _Tp>
lib/libcxx/include/__ranges/filter_view.h+10-10
......@@ -76,16 +76,16 @@ public:
7676 : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
7777
7878 template <class _Vp = _View>
79 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
79 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
8080 requires copy_constructible<_Vp>
8181 {
8282 return __base_;
8383 }
84 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
8585
86 _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; }
86 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; }
8787
88 _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
88 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
8989 // Note: this duplicates a check in `optional` but provides a better error message.
9090 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
9191 __pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate.");
......@@ -99,7 +99,7 @@ public:
9999 }
100100 }
101101
102 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
102 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
103103 if constexpr (common_range<_View>)
104104 return __iterator{*this, ranges::end(__base_)};
105105 else
......@@ -148,10 +148,10 @@ public:
148148 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(filter_view& __parent, iterator_t<_View> __current)
149149 : __current_(std::move(__current)), __parent_(std::addressof(__parent)) {}
150150
151 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
152 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() && { return std::move(__current_); }
151 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
152 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() && { return std::move(__current_); }
153153
154 _LIBCPP_HIDE_FROM_ABI constexpr range_reference_t<_View> operator*() const { return *__current_; }
154 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_reference_t<_View> operator*() const { return *__current_; }
155155 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> operator->() const
156156 requires __has_arrow<iterator_t<_View>> && copyable<iterator_t<_View>>
157157 {
......@@ -194,7 +194,7 @@ public:
194194 return __x.__current_ == __y.__current_;
195195 }
196196
197 _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_View>
197 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_View>
198198 iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) {
199199 return ranges::iter_move(__it.__current_);
200200 }
......@@ -218,7 +218,7 @@ public:
218218
219219 _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) {}
220220
221 _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_View> base() const { return __end_; }
221 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_View> base() const { return __end_; }
222222
223223 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) {
224224 return __x.__current_ == __y.__end_;
lib/libcxx/include/__ranges/iota_view.h+41-22
......@@ -30,6 +30,7 @@
3030#include <__ranges/movable_box.h>
3131#include <__ranges/view_interface.h>
3232#include <__type_traits/conditional.h>
33#include <__type_traits/decay.h>
3334#include <__type_traits/is_nothrow_constructible.h>
3435#include <__type_traits/make_unsigned.h>
3536#include <__type_traits/type_identity.h>
......@@ -57,11 +58,17 @@ struct __get_wider_signed {
5758 return type_identity<int>{};
5859 else if constexpr (sizeof(_Int) < sizeof(long))
5960 return type_identity<long>{};
60 else
61 else if constexpr (sizeof(_Int) < sizeof(long long))
6162 return type_identity<long long>{};
62
63 static_assert(
64 sizeof(_Int) <= sizeof(long long), "Found integer-like type that is bigger than largest integer like type.");
63# if _LIBCPP_HAS_INT128
64 else if constexpr (sizeof(_Int) <= sizeof(__int128))
65 return type_identity<__int128>{};
66# else
67 else if constexpr (sizeof(_Int) <= sizeof(long long))
68 return type_identity<long long>{};
69# endif
70 else
71 static_assert(false, "Found integer-like type that is bigger than the largest integer like type.");
6572 }
6673
6774 using type = typename decltype(__call())::type;
......@@ -125,7 +132,8 @@ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
125132
126133 _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
127134
128 _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
135 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const
136 noexcept(is_nothrow_copy_constructible_v<_Start>) {
129137 return __value_;
130138 }
131139
......@@ -189,7 +197,7 @@ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
189197 return *this;
190198 }
191199
192 _LIBCPP_HIDE_FROM_ABI constexpr _Start operator[](difference_type __n) const
200 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Start operator[](difference_type __n) const
193201 requires __advanceable<_Start>
194202 {
195203 return _Start(__value_ + __n);
......@@ -231,27 +239,28 @@ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
231239 return __x.__value_ <=> __y.__value_;
232240 }
233241
234 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
242 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
235243 requires __advanceable<_Start>
236244 {
237245 __i += __n;
238246 return __i;
239247 }
240248
241 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
249 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
242250 requires __advanceable<_Start>
243251 {
244252 return __i + __n;
245253 }
246254
247 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
255 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
248256 requires __advanceable<_Start>
249257 {
250258 __i -= __n;
251259 return __i;
252260 }
253261
254 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
262 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
263 operator-(const __iterator& __x, const __iterator& __y)
255264 requires __advanceable<_Start>
256265 {
257266 if constexpr (__integer_like<_Start>) {
......@@ -282,14 +291,14 @@ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
282291 return __x.__value_ == __y.__bound_sentinel_;
283292 }
284293
285 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
294 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
286295 operator-(const __iterator& __x, const __sentinel& __y)
287296 requires sized_sentinel_for<_BoundSentinel, _Start>
288297 {
289298 return __x.__value_ - __y.__bound_sentinel_;
290299 }
291300
292 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
301 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
293302 operator-(const __sentinel& __x, const __iterator& __y)
294303 requires sized_sentinel_for<_BoundSentinel, _Start>
295304 {
......@@ -329,24 +338,24 @@ public:
329338 requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
330339 : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
331340
332 _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; }
341 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; }
333342
334 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
343 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
335344 if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
336345 return unreachable_sentinel;
337346 else
338347 return __sentinel{__bound_sentinel_};
339348 }
340349
341 _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
350 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
342351 requires same_as<_Start, _BoundSentinel>
343352 {
344353 return __iterator{__bound_sentinel_};
345354 }
346355
347 _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __value_ == __bound_sentinel_; }
356 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __value_ == __bound_sentinel_; }
348357
349 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
358 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
350359 requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
351360 (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
352361 {
......@@ -374,14 +383,15 @@ namespace views {
374383namespace __iota {
375384struct __fn {
376385 template <class _Start>
377 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const
378 noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start))))
379 -> decltype(ranges::iota_view(std::forward<_Start>(__start))) {
380 return ranges::iota_view(std::forward<_Start>(__start));
386 requires(requires(_Start __s) { ranges::iota_view<decay_t<_Start>>(std::forward<_Start>(__s)); })
387 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const
388 noexcept(noexcept(ranges::iota_view<decay_t<_Start>>(std::forward<_Start>(__start)))) {
389 return ranges::iota_view<decay_t<_Start>>(std::forward<_Start>(__start));
381390 }
382391
383392 template <class _Start, class _BoundSentinel>
384 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept(
393 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
394 operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept(
385395 noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
386396 -> decltype(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))) {
387397 return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel));
......@@ -392,6 +402,15 @@ struct __fn {
392402inline namespace __cpo {
393403inline constexpr auto iota = __iota::__fn{};
394404} // namespace __cpo
405
406# if _LIBCPP_STD_VER >= 26
407
408inline constexpr auto indices = [] [[nodiscard]] (__integer_like auto __size) static {
409 return ranges::views::iota(decltype(__size){}, __size);
410};
411
412# endif
413
395414} // namespace views
396415} // namespace ranges
397416
lib/libcxx/include/__ranges/owning_view.h+15-15
......@@ -49,52 +49,52 @@ public:
4949 _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default;
5050 _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default;
5151
52 _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
53 _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
54 _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
55 _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
56
57 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
58 _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
59 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
52 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
53 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
54 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
55 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
56
57 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
58 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
6060 requires range<const _Rp>
6161 {
6262 return ranges::begin(__r_);
6363 }
64 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
64 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
6565 requires range<const _Rp>
6666 {
6767 return ranges::end(__r_);
6868 }
6969
70 _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
70 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
7171 requires requires { ranges::empty(__r_); }
7272 {
7373 return ranges::empty(__r_);
7474 }
75 _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
75 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
7676 requires requires { ranges::empty(__r_); }
7777 {
7878 return ranges::empty(__r_);
7979 }
8080
81 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
81 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
8282 requires sized_range<_Rp>
8383 {
8484 return ranges::size(__r_);
8585 }
86 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
86 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
8787 requires sized_range<const _Rp>
8888 {
8989 return ranges::size(__r_);
9090 }
9191
92 _LIBCPP_HIDE_FROM_ABI constexpr auto data()
92 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto data()
9393 requires contiguous_range<_Rp>
9494 {
9595 return ranges::data(__r_);
9696 }
97 _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
9898 requires contiguous_range<const _Rp>
9999 {
100100 return ranges::data(__r_);
lib/libcxx/include/__ranges/ref_view.h+6-6
......@@ -51,24 +51,24 @@ public:
5151 _LIBCPP_HIDE_FROM_ABI constexpr ref_view(_Tp&& __t)
5252 : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {}
5353
54 _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
54 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
5555
56 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
57 _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
56 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
57 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
5858
59 _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
6060 requires requires { ranges::empty(*__range_); }
6161 {
6262 return ranges::empty(*__range_);
6363 }
6464
65 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
65 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
6666 requires sized_range<_Range>
6767 {
6868 return ranges::size(*__range_);
6969 }
7070
71 _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
71 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
7272 requires contiguous_range<_Range>
7373 {
7474 return ranges::data(*__range_);
lib/libcxx/include/__ranges/repeat_view.h+17-10
......@@ -108,17 +108,21 @@ public:
108108 __bound_ >= 0, "The behavior is undefined if Bound is not unreachable_sentinel_t and bound is negative");
109109 }
110110
111 _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator(std::addressof(*__value_)); }
111 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const {
112 return __iterator(std::addressof(*__value_));
113 }
112114
113 _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
115 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
114116 requires(!same_as<_Bound, unreachable_sentinel_t>)
115117 {
116118 return __iterator(std::addressof(*__value_), __bound_);
117119 }
118120
119 _LIBCPP_HIDE_FROM_ABI constexpr unreachable_sentinel_t end() const noexcept { return unreachable_sentinel; }
121 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr unreachable_sentinel_t end() const noexcept {
122 return unreachable_sentinel;
123 }
120124
121 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
125 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
122126 requires(!same_as<_Bound, unreachable_sentinel_t>)
123127 {
124128 return std::__to_unsigned_like(__bound_);
......@@ -152,7 +156,7 @@ public:
152156
153157 _LIBCPP_HIDE_FROM_ABI __iterator() = default;
154158
155 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const noexcept { return *__value_; }
159 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const noexcept { return *__value_; }
156160
157161 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
158162 ++__current_;
......@@ -192,7 +196,9 @@ public:
192196 return *this;
193197 }
194198
195 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](difference_type __n) const noexcept { return *(*this + __n); }
199 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](difference_type __n) const noexcept {
200 return *(*this + __n);
201 }
196202
197203 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
198204 return __x.__current_ == __y.__current_;
......@@ -202,22 +208,23 @@ public:
202208 return __x.__current_ <=> __y.__current_;
203209 }
204210
205 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) {
211 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) {
206212 __i += __n;
207213 return __i;
208214 }
209215
210 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) {
216 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) {
211217 __i += __n;
212218 return __i;
213219 }
214220
215 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) {
221 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) {
216222 __i -= __n;
217223 return __i;
218224 }
219225
220 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) {
226 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
227 operator-(const __iterator& __x, const __iterator& __y) {
221228 return static_cast<difference_type>(__x.__current_) - static_cast<difference_type>(__y.__current_);
222229 }
223230
lib/libcxx/include/__ranges/single_view.h+8-8
......@@ -63,21 +63,21 @@ public:
6363 _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(in_place_t, _Args&&... __args)
6464 : __value_{in_place, std::forward<_Args>(__args)...} {}
6565
66 _LIBCPP_HIDE_FROM_ABI constexpr _Tp* begin() noexcept { return data(); }
66 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* begin() noexcept { return data(); }
6767
68 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* begin() const noexcept { return data(); }
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* begin() const noexcept { return data(); }
6969
70 _LIBCPP_HIDE_FROM_ABI constexpr _Tp* end() noexcept { return data() + 1; }
70 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* end() noexcept { return data() + 1; }
7171
72 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* end() const noexcept { return data() + 1; }
72 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* end() const noexcept { return data() + 1; }
7373
74 _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return false; }
74 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return false; }
7575
76 _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 1; }
76 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 1; }
7777
78 _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data() noexcept { return __value_.operator->(); }
78 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data() noexcept { return __value_.operator->(); }
7979
80 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
80 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
8181};
8282
8383template <class _Tp>
lib/libcxx/include/__ranges/take_view.h+9-9
......@@ -75,15 +75,15 @@ public:
7575 _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero");
7676 }
7777
78 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
78 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
7979 requires copy_constructible<_View>
8080 {
8181 return __base_;
8282 }
8383
84 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
8585
86 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
86 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
8787 requires(!__simple_view<_View>)
8888 {
8989 if constexpr (sized_range<_View>) {
......@@ -99,7 +99,7 @@ public:
9999 }
100100 }
101101
102 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
102 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
103103 requires range<const _View>
104104 {
105105 if constexpr (sized_range<const _View>) {
......@@ -115,7 +115,7 @@ public:
115115 }
116116 }
117117
118 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
118 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
119119 requires(!__simple_view<_View>)
120120 {
121121 if constexpr (sized_range<_View>) {
......@@ -129,7 +129,7 @@ public:
129129 }
130130 }
131131
132 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
132 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
133133 requires range<const _View>
134134 {
135135 if constexpr (sized_range<const _View>) {
......@@ -143,14 +143,14 @@ public:
143143 }
144144 }
145145
146 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
146 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
147147 requires sized_range<_View>
148148 {
149149 auto __n = ranges::size(__base_);
150150 return ranges::min(__n, static_cast<decltype(__n)>(__count_));
151151 }
152152
153 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
153 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
154154 requires sized_range<const _View>
155155 {
156156 auto __n = ranges::size(__base_);
......@@ -178,7 +178,7 @@ public:
178178 requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
179179 : __end_(std::move(__s.__end_)) {}
180180
181 _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
181 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
182182
183183 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
184184 return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
lib/libcxx/include/__ranges/transform_view.h+1-2
......@@ -13,7 +13,6 @@
1313#include <__compare/three_way_comparable.h>
1414#include <__concepts/constructible.h>
1515#include <__concepts/convertible_to.h>
16#include <__concepts/copyable.h>
1716#include <__concepts/derived_from.h>
1817#include <__concepts/equality_comparable.h>
1918#include <__concepts/invocable.h>
......@@ -64,7 +63,7 @@ concept __regular_invocable_with_range_ref = regular_invocable<_Fn, range_refere
6463template <class _View, class _Fn>
6564concept __transform_view_constraints =
6665 view<_View> && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_View>> &&
67 __is_referenceable_v<invoke_result_t<_Fn&, range_reference_t<_View>>>;
66 __referenceable<invoke_result_t<_Fn&, range_reference_t<_View>>>;
6867
6968# if _LIBCPP_STD_VER >= 23
7069template <input_range _View, move_constructible _Fn>
lib/libcxx/include/__ranges/view_interface.h+10-10
......@@ -87,35 +87,35 @@ public:
8787 }
8888
8989 template <class _D2 = _Derived>
90 _LIBCPP_HIDE_FROM_ABI constexpr auto data()
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto data()
9191 requires contiguous_iterator<iterator_t<_D2>>
9292 {
9393 return std::to_address(ranges::begin(__derived()));
9494 }
9595
9696 template <class _D2 = _Derived>
97 _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
9898 requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>>
9999 {
100100 return std::to_address(ranges::begin(__derived()));
101101 }
102102
103103 template <class _D2 = _Derived>
104 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
104 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
105105 requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>>
106106 {
107107 return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
108108 }
109109
110110 template <class _D2 = _Derived>
111 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
111 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
112112 requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>>
113113 {
114114 return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
115115 }
116116
117117 template <class _D2 = _Derived>
118 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front()
118 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front()
119119 requires forward_range<_D2>
120120 {
121121 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
......@@ -124,7 +124,7 @@ public:
124124 }
125125
126126 template <class _D2 = _Derived>
127 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() const
127 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() const
128128 requires forward_range<const _D2>
129129 {
130130 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
......@@ -133,7 +133,7 @@ public:
133133 }
134134
135135 template <class _D2 = _Derived>
136 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back()
136 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back()
137137 requires bidirectional_range<_D2> && common_range<_D2>
138138 {
139139 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
......@@ -142,7 +142,7 @@ public:
142142 }
143143
144144 template <class _D2 = _Derived>
145 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() const
145 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() const
146146 requires bidirectional_range<const _D2> && common_range<const _D2>
147147 {
148148 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
......@@ -151,12 +151,12 @@ public:
151151 }
152152
153153 template <random_access_range _RARange = _Derived>
154 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) {
154 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) {
155155 return ranges::begin(__derived())[__index];
156156 }
157157
158158 template <random_access_range _RARange = const _Derived>
159 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const {
159 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const {
160160 return ranges::begin(__derived())[__index];
161161 }
162162};
lib/libcxx/include/__ranges/zip_transform_view.h created+357
......@@ -0,0 +1,357 @@
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_ZIP_TRANSFORM_VIEW_H
11#define _LIBCPP___RANGES_ZIP_TRANSFORM_VIEW_H
12
13#include <__config>
14
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 <__concepts/invocable.h>
20#include <__functional/invoke.h>
21#include <__iterator/concepts.h>
22#include <__iterator/incrementable_traits.h>
23#include <__iterator/iterator_traits.h>
24#include <__memory/addressof.h>
25#include <__ranges/access.h>
26#include <__ranges/all.h>
27#include <__ranges/concepts.h>
28#include <__ranges/empty_view.h>
29#include <__ranges/movable_box.h>
30#include <__ranges/view_interface.h>
31#include <__ranges/zip_view.h>
32#include <__type_traits/decay.h>
33#include <__type_traits/invoke.h>
34#include <__type_traits/is_object.h>
35#include <__type_traits/is_reference.h>
36#include <__type_traits/is_referenceable.h>
37#include <__type_traits/maybe_const.h>
38#include <__type_traits/remove_cvref.h>
39#include <__utility/forward.h>
40#include <__utility/in_place.h>
41#include <__utility/move.h>
42#include <tuple> // for std::apply
43
44#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
45# pragma GCC system_header
46#endif
47
48_LIBCPP_PUSH_MACROS
49#include <__undef_macros>
50_LIBCPP_BEGIN_NAMESPACE_STD
51
52#if _LIBCPP_STD_VER >= 23
53
54namespace ranges {
55
56template <move_constructible _Fn, input_range... _Views>
57 requires(view<_Views> && ...) &&
58 (sizeof...(_Views) > 0) && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_Views>...> &&
59 __referenceable<invoke_result_t<_Fn&, range_reference_t<_Views>...>>
60class zip_transform_view : public view_interface<zip_transform_view<_Fn, _Views...>> {
61 _LIBCPP_NO_UNIQUE_ADDRESS zip_view<_Views...> __zip_;
62 _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Fn> __fun_;
63
64 using _InnerView _LIBCPP_NODEBUG = zip_view<_Views...>;
65 template <bool _Const>
66 using __ziperator _LIBCPP_NODEBUG = iterator_t<__maybe_const<_Const, _InnerView>>;
67 template <bool _Const>
68 using __zentinel _LIBCPP_NODEBUG = sentinel_t<__maybe_const<_Const, _InnerView>>;
69
70 template <bool>
71 class __iterator;
72
73 template <bool>
74 class __sentinel;
75
76public:
77 _LIBCPP_HIDE_FROM_ABI zip_transform_view() = default;
78
79 _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_transform_view(_Fn __fun, _Views... __views)
80 : __zip_(std::move(__views)...), __fun_(in_place, std::move(__fun)) {}
81
82 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __zip_.begin()); }
83
84 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
85 requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...>
86 {
87 return __iterator<true>(*this, __zip_.begin());
88 }
89
90 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
91 if constexpr (common_range<_InnerView>) {
92 return __iterator<false>(*this, __zip_.end());
93 } else {
94 return __sentinel<false>(__zip_.end());
95 }
96 }
97
98 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
99 requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...>
100 {
101 if constexpr (common_range<const _InnerView>) {
102 return __iterator<true>(*this, __zip_.end());
103 } else {
104 return __sentinel<true>(__zip_.end());
105 }
106 }
107
108 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
109 requires sized_range<_InnerView>
110 {
111 return __zip_.size();
112 }
113
114 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
115 requires sized_range<const _InnerView>
116 {
117 return __zip_.size();
118 }
119};
120
121template <class _Fn, class... _Ranges>
122zip_transform_view(_Fn, _Ranges&&...) -> zip_transform_view<_Fn, views::all_t<_Ranges>...>;
123
124template <bool _Const, class _Fn, class... _Views>
125struct __zip_transform_iterator_category_base {};
126
127template <bool _Const, class _Fn, class... _Views>
128 requires forward_range<__maybe_const<_Const, zip_view<_Views...>>>
129struct __zip_transform_iterator_category_base<_Const, _Fn, _Views...> {
130private:
131 template <class _View>
132 using __tag _LIBCPP_NODEBUG = typename iterator_traits<iterator_t<__maybe_const<_Const, _View>>>::iterator_category;
133
134 static consteval auto __get_iterator_category() {
135 if constexpr (!is_reference_v<invoke_result_t<__maybe_const<_Const, _Fn>&,
136 range_reference_t<__maybe_const<_Const, _Views>>...>>) {
137 return input_iterator_tag();
138 } else if constexpr ((derived_from<__tag<_Views>, random_access_iterator_tag> && ...)) {
139 return random_access_iterator_tag();
140 } else if constexpr ((derived_from<__tag<_Views>, bidirectional_iterator_tag> && ...)) {
141 return bidirectional_iterator_tag();
142 } else if constexpr ((derived_from<__tag<_Views>, forward_iterator_tag> && ...)) {
143 return forward_iterator_tag();
144 } else {
145 return input_iterator_tag();
146 }
147 }
148
149public:
150 using iterator_category = decltype(__get_iterator_category());
151};
152
153template <move_constructible _Fn, input_range... _Views>
154 requires(view<_Views> && ...) &&
155 (sizeof...(_Views) > 0) && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_Views>...> &&
156 __referenceable<invoke_result_t<_Fn&, range_reference_t<_Views>...>>
157template <bool _Const>
158class zip_transform_view<_Fn, _Views...>::__iterator
159 : public __zip_transform_iterator_category_base<_Const, _Fn, _Views...> {
160 using _Parent _LIBCPP_NODEBUG = __maybe_const<_Const, zip_transform_view>;
161 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _InnerView>;
162
163 friend zip_transform_view<_Fn, _Views...>;
164
165 _Parent* __parent_ = nullptr;
166 __ziperator<_Const> __inner_;
167
168 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, __ziperator<_Const> __inner)
169 : __parent_(std::addressof(__parent)), __inner_(std::move(__inner)) {}
170
171 _LIBCPP_HIDE_FROM_ABI constexpr auto __get_deref_and_invoke() const noexcept {
172 return [&__fun = *__parent_->__fun_](const auto&... __iters) noexcept(noexcept(std::invoke(
173 *__parent_->__fun_, *__iters...))) -> decltype(auto) { return std::invoke(__fun, *__iters...); };
174 }
175
176public:
177 using iterator_concept = typename __ziperator<_Const>::iterator_concept;
178 using value_type =
179 remove_cvref_t<invoke_result_t<__maybe_const<_Const, _Fn>&, range_reference_t<__maybe_const<_Const, _Views>>...>>;
180 using difference_type = range_difference_t<_Base>;
181
182 _LIBCPP_HIDE_FROM_ABI __iterator() = default;
183 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
184 requires _Const && convertible_to<__ziperator<false>, __ziperator<_Const>>
185 : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {}
186
187 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
188 noexcept(noexcept(std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)))) {
189 return std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_));
190 }
191
192 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
193 ++__inner_;
194 return *this;
195 }
196
197 _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
198
199 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
200 requires forward_range<_Base>
201 {
202 auto __tmp = *this;
203 ++*this;
204 return __tmp;
205 }
206
207 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
208 requires bidirectional_range<_Base>
209 {
210 --__inner_;
211 return *this;
212 }
213
214 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
215 requires bidirectional_range<_Base>
216 {
217 auto __tmp = *this;
218 --*this;
219 return __tmp;
220 }
221
222 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __x)
223 requires random_access_range<_Base>
224 {
225 __inner_ += __x;
226 return *this;
227 }
228
229 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
230 requires random_access_range<_Base>
231 {
232 __inner_ -= __x;
233 return *this;
234 }
235
236 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
237 requires random_access_range<_Base>
238 {
239 return std::apply(
240 [&]<class... _Is>(const _Is&... __iters) -> decltype(auto) {
241 return std::invoke(*__parent_->__fun_, __iters[iter_difference_t<_Is>(__n)]...);
242 },
243 __zip_view_iterator_access::__get_underlying(__inner_));
244 }
245
246 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
247 requires equality_comparable<__ziperator<_Const>>
248 {
249 return __x.__inner_ == __y.__inner_;
250 }
251
252 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
253 requires random_access_range<_Base>
254 {
255 return __x.__inner_ <=> __y.__inner_;
256 }
257
258 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
259 requires random_access_range<_Base>
260 {
261 return __iterator(*__i.__parent_, __i.__inner_ + __n);
262 }
263
264 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
265 requires random_access_range<_Base>
266 {
267 return __iterator(*__i.__parent_, __i.__inner_ + __n);
268 }
269
270 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
271 requires random_access_range<_Base>
272 {
273 return __iterator(*__i.__parent_, __i.__inner_ - __n);
274 }
275
276 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
277 requires sized_sentinel_for<__ziperator<_Const>, __ziperator<_Const>>
278 {
279 return __x.__inner_ - __y.__inner_;
280 }
281};
282
283template <move_constructible _Fn, input_range... _Views>
284 requires(view<_Views> && ...) &&
285 (sizeof...(_Views) > 0) && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_Views>...> &&
286 __referenceable<invoke_result_t<_Fn&, range_reference_t<_Views>...>>
287template <bool _Const>
288class zip_transform_view<_Fn, _Views...>::__sentinel {
289 __zentinel<_Const> __inner_;
290
291 friend zip_transform_view<_Fn, _Views...>;
292
293 _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(__zentinel<_Const> __inner) : __inner_(__inner) {}
294
295public:
296 _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
297
298 _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
299 requires _Const && convertible_to<__zentinel<false>, __zentinel<_Const>>
300 : __inner_(__i.__inner_) {}
301
302 template <bool _OtherConst>
303 requires sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
304 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
305 return __x.__inner_ == __y.__inner_;
306 }
307
308 template <bool _OtherConst>
309 requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
310 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
311 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
312 return __x.__inner_ - __y.__inner_;
313 }
314
315 template <bool _OtherConst>
316 requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
317 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
318 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
319 return __x.__inner_ - __y.__inner_;
320 }
321};
322
323namespace views {
324namespace __zip_transform {
325
326struct __fn {
327 template <class _Fn>
328 requires(move_constructible<decay_t<_Fn>> && regular_invocable<decay_t<_Fn>&> &&
329 is_object_v<invoke_result_t<decay_t<_Fn>&>>)
330 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&&) const
331 noexcept(noexcept(auto(views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>))) {
332 return views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>;
333 }
334
335 template <class _Fn, class... _Ranges>
336 requires(sizeof...(_Ranges) > 0)
337 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __fun, _Ranges&&... __rs) const
338 noexcept(noexcept(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)))
339 -> decltype(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)) {
340 return zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...);
341 }
342};
343
344} // namespace __zip_transform
345inline namespace __cpo {
346inline constexpr auto zip_transform = __zip_transform::__fn{};
347} // namespace __cpo
348} // namespace views
349} // namespace ranges
350
351#endif // _LIBCPP_STD_VER >= 23
352
353_LIBCPP_END_NAMESPACE_STD
354
355_LIBCPP_POP_MACROS
356
357#endif // _LIBCPP___RANGES_ZIP_TRANSFORM_VIEW_H
lib/libcxx/include/__ranges/zip_view.h+20-20
......@@ -31,6 +31,7 @@
3131#include <__ranges/enable_borrowed_range.h>
3232#include <__ranges/size.h>
3333#include <__ranges/view_interface.h>
34#include <__tuple/tuple_transform.h>
3435#include <__type_traits/is_nothrow_constructible.h>
3536#include <__type_traits/make_unsigned.h>
3637#include <__utility/declval.h>
......@@ -58,15 +59,6 @@ concept __zip_is_common =
5859 (!(bidirectional_range<_Ranges> && ...) && (common_range<_Ranges> && ...)) ||
5960 ((random_access_range<_Ranges> && ...) && (sized_range<_Ranges> && ...));
6061
61template <class _Fun, class _Tuple>
62_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_transform(_Fun&& __f, _Tuple&& __tuple) {
63 return std::apply(
64 [&]<class... _Types>(_Types&&... __elements) {
65 return tuple<invoke_result_t<_Fun&, _Types>...>(std::invoke(__f, std::forward<_Types>(__elements))...);
66 },
67 std::forward<_Tuple>(__tuple));
68}
69
7062template <class _Fun, class _Tuple>
7163_LIBCPP_HIDE_FROM_ABI constexpr void __tuple_for_each(_Fun&& __f, _Tuple&& __tuple) {
7264 std::apply(
......@@ -145,24 +137,24 @@ public:
145137 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
146138 requires(!(__simple_view<_Views> && ...))
147139 {
148 return __iterator<false>(ranges::__tuple_transform(ranges::begin, __views_));
140 return __iterator<false>(std::__tuple_transform(ranges::begin, __views_));
149141 }
150142
151143 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
152144 requires(range<const _Views> && ...)
153145 {
154 return __iterator<true>(ranges::__tuple_transform(ranges::begin, __views_));
146 return __iterator<true>(std::__tuple_transform(ranges::begin, __views_));
155147 }
156148
157149 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
158150 requires(!(__simple_view<_Views> && ...))
159151 {
160152 if constexpr (!__zip_is_common<_Views...>) {
161 return __sentinel<false>(ranges::__tuple_transform(ranges::end, __views_));
153 return __sentinel<false>(std::__tuple_transform(ranges::end, __views_));
162154 } else if constexpr ((random_access_range<_Views> && ...)) {
163155 return begin() + iter_difference_t<__iterator<false>>(size());
164156 } else {
165 return __iterator<false>(ranges::__tuple_transform(ranges::end, __views_));
157 return __iterator<false>(std::__tuple_transform(ranges::end, __views_));
166158 }
167159 }
168160
......@@ -170,11 +162,11 @@ public:
170162 requires(range<const _Views> && ...)
171163 {
172164 if constexpr (!__zip_is_common<const _Views...>) {
173 return __sentinel<true>(ranges::__tuple_transform(ranges::end, __views_));
165 return __sentinel<true>(std::__tuple_transform(ranges::end, __views_));
174166 } else if constexpr ((random_access_range<const _Views> && ...)) {
175167 return begin() + iter_difference_t<__iterator<true>>(size());
176168 } else {
177 return __iterator<true>(ranges::__tuple_transform(ranges::end, __views_));
169 return __iterator<true>(std::__tuple_transform(ranges::end, __views_));
178170 }
179171 }
180172
......@@ -186,7 +178,7 @@ public:
186178 using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
187179 return ranges::min({_CT(__sizes)...});
188180 },
189 ranges::__tuple_transform(ranges::size, __views_));
181 std::__tuple_transform(ranges::size, __views_));
190182 }
191183
192184 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
......@@ -197,7 +189,7 @@ public:
197189 using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
198190 return ranges::min({_CT(__sizes)...});
199191 },
200 ranges::__tuple_transform(ranges::size, __views_));
192 std::__tuple_transform(ranges::size, __views_));
201193 }
202194};
203195
......@@ -235,6 +227,13 @@ struct __zip_view_iterator_category_base<_Const, _Views...> {
235227 using iterator_category = input_iterator_tag;
236228};
237229
230struct __zip_view_iterator_access {
231 template <class _Iter>
232 _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_underlying(_Iter& __iter) noexcept {
233 return (__iter.__current_);
234 }
235};
236
238237template <input_range... _Views>
239238 requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
240239template <bool _Const>
......@@ -255,6 +254,7 @@ class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base
255254 static constexpr bool __is_zip_view_iterator = true;
256255
257256 friend struct __product_iterator_traits<__iterator>;
257 friend __zip_view_iterator_access;
258258
259259public:
260260 using iterator_concept = decltype(ranges::__get_zip_view_iterator_tag<_Const, _Views...>());
......@@ -268,7 +268,7 @@ public:
268268 : __current_(std::move(__i.__current_)) {}
269269
270270 _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
271 return ranges::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
271 return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
272272 }
273273
274274 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
......@@ -318,7 +318,7 @@ public:
318318 _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
319319 requires __zip_all_random_access<_Const, _Views...>
320320 {
321 return ranges::__tuple_transform(
321 return std::__tuple_transform(
322322 [&]<class _Iter>(_Iter& __i) -> decltype(auto) { return __i[iter_difference_t<_Iter>(__n)]; }, __current_);
323323 }
324324
......@@ -377,7 +377,7 @@ public:
377377 _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
378378 (noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) &&
379379 (is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) {
380 return ranges::__tuple_transform(ranges::iter_move, __i.__current_);
380 return std::__tuple_transform(ranges::iter_move, __i.__current_);
381381 }
382382
383383 _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
lib/libcxx/include/__split_buffer+612-240
......@@ -13,10 +13,12 @@
1313#include <__algorithm/max.h>
1414#include <__algorithm/move.h>
1515#include <__algorithm/move_backward.h>
16#include <__assert>
1617#include <__config>
1718#include <__iterator/distance.h>
1819#include <__iterator/iterator_traits.h>
1920#include <__iterator/move_iterator.h>
21#include <__memory/addressof.h>
2022#include <__memory/allocate_at_least.h>
2123#include <__memory/allocator.h>
2224#include <__memory/allocator_traits.h>
......@@ -28,11 +30,9 @@
2830#include <__type_traits/integral_constant.h>
2931#include <__type_traits/is_nothrow_assignable.h>
3032#include <__type_traits/is_nothrow_constructible.h>
31#include <__type_traits/is_replaceable.h>
3233#include <__type_traits/is_swappable.h>
3334#include <__type_traits/is_trivially_destructible.h>
3435#include <__type_traits/is_trivially_relocatable.h>
35#include <__type_traits/remove_reference.h>
3636#include <__utility/forward.h>
3737#include <__utility/move.h>
3838
......@@ -45,25 +45,430 @@ _LIBCPP_PUSH_MACROS
4545
4646_LIBCPP_BEGIN_NAMESPACE_STD
4747
48// __split_buffer allocates a contiguous chunk of memory and stores objects in the range [__begin_, __end_).
49// It has uninitialized memory in the ranges [__first_, __begin_) and [__end_, __cap_). That allows
50// it to grow both in the front and back without having to move the data.
48template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
49class __split_buffer;
50
51template <class _SplitBuffer, class _Tp, class _Allocator>
52class __split_buffer_pointer_layout {
53protected:
54 using value_type = _Tp;
55 using allocator_type = _Allocator;
56 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
57 using reference = value_type&;
58 using const_reference = const value_type&;
59 using size_type = typename __alloc_traits::size_type;
60 using difference_type = typename __alloc_traits::difference_type;
61 using pointer = typename __alloc_traits::pointer;
62 using const_pointer = typename __alloc_traits::const_pointer;
63 using iterator = pointer;
64 using const_iterator = const_pointer;
65 using __sentinel_type _LIBCPP_NODEBUG = pointer;
5166
52template <class _Tp, class _Allocator = allocator<_Tp> >
53struct __split_buffer {
5467public:
55 using value_type = _Tp;
56 using allocator_type = _Allocator;
57 using __alloc_rr _LIBCPP_NODEBUG = __libcpp_remove_reference_t<allocator_type>;
58 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<__alloc_rr>;
59 using reference = value_type&;
60 using const_reference = const value_type&;
61 using size_type = typename __alloc_traits::size_type;
62 using difference_type = typename __alloc_traits::difference_type;
63 using pointer = typename __alloc_traits::pointer;
64 using const_pointer = typename __alloc_traits::const_pointer;
65 using iterator = pointer;
66 using const_iterator = const_pointer;
68 // Can't be defaulted due to _LIBCPP_COMPRESSED_PAIR not being an aggregate in C++03 and C++11.
69 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer_pointer_layout() : __back_cap_(nullptr) {}
70
71 _LIBCPP_CONSTEXPR_SINCE_CXX20
72 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer_pointer_layout(const allocator_type& __alloc)
73 : __back_cap_(nullptr), __alloc_(__alloc) {}
74
75 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __front_cap() _NOEXCEPT { return __front_cap_; }
76
77 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __front_cap() const _NOEXCEPT {
78 return __front_cap_;
79 }
80
81 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer begin() _NOEXCEPT { return __begin_; }
82
83 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer begin() const _NOEXCEPT { return __begin_; }
84
85 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer end() _NOEXCEPT { return __end_; }
86
87 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer end() const _NOEXCEPT { return __end_; }
88
89 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
90 return static_cast<size_type>(__end_ - __begin_);
91 }
92
93 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __begin_ == __end_; }
94
95 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT {
96 return static_cast<size_type>(__back_cap_ - __front_cap_);
97 }
98
99 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __get_allocator() _NOEXCEPT { return __alloc_; }
100
101 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type const& __get_allocator() const _NOEXCEPT {
102 return __alloc_;
103 }
104
105 // Returns the sentinel object directly. Should be used in conjunction with automatic type deduction,
106 // not explicit types.
107 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __sentinel_type __raw_sentinel() const _NOEXCEPT {
108 return __end_;
109 }
110 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __sentinel_type __raw_capacity() const _NOEXCEPT {
111 return __back_cap_;
112 }
113
114 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_data(pointer __new_first) _NOEXCEPT {
115 __front_cap_ = __new_first;
116 }
117
118 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
119 __set_valid_range(pointer __new_begin, pointer __new_end) _NOEXCEPT {
120 __begin_ = __new_begin;
121 __end_ = __new_end;
122 }
123
124 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
125 __set_valid_range(pointer __new_begin, size_type __new_size) _NOEXCEPT {
126 __begin_ = __new_begin;
127 __end_ = __begin_ + __new_size;
128 }
129
130 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(pointer __new_end) _NOEXCEPT {
131 _LIBCPP_ASSERT_INTERNAL(__front_cap_ <= __new_end, "__new_end cannot precede __front_cap_");
132 __end_ = __new_end;
133 }
134
135 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(size_type __new_size) _NOEXCEPT {
136 __end_ = __begin_ + __new_size;
137 }
138
139 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_capacity(size_type __new_capacity) _NOEXCEPT {
140 __back_cap_ = __front_cap_ + __new_capacity;
141 }
142
143 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_capacity(pointer __new_capacity) _NOEXCEPT {
144 __back_cap_ = __new_capacity;
145 }
146
147 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const _NOEXCEPT {
148 return static_cast<size_type>(__begin_ - __front_cap_);
149 }
150
151 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const _NOEXCEPT {
152 return static_cast<size_type>(__back_cap_ - __end_);
153 }
154
155 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT { return *(__end_ - 1); }
156
157 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { return *(__end_ - 1); }
158
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 {
163 std::swap(__front_cap_, __other.__front_cap_);
164 std::swap(__begin_, __other.__begin_);
165 std::swap(__back_cap_, __other.__back_cap_);
166 std::swap(__end_, __other.__end_);
167 }
168
169 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer_pointer_layout& __other) _NOEXCEPT {
170 std::swap(__front_cap_, __other.__front_cap_);
171 std::swap(__begin_, __other.__begin_);
172 std::swap(__back_cap_, __other.__back_cap_);
173 std::swap(__end_, __other.__end_);
174 std::__swap_allocator(__alloc_, __other.__alloc_);
175 }
176
177 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __reset() _NOEXCEPT {
178 __front_cap_ = nullptr;
179 __begin_ = nullptr;
180 __end_ = nullptr;
181 __back_cap_ = nullptr;
182 }
183
184 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
185 __copy_without_alloc(__split_buffer_pointer_layout const& __other)
186 _NOEXCEPT_(is_nothrow_copy_assignable<pointer>::value) {
187 __front_cap_ = __other.__front_cap_;
188 __begin_ = __other.__begin_;
189 __end_ = __other.__end_;
190 __back_cap_ = __other.__back_cap_;
191 }
192
193private:
194 pointer __front_cap_ = nullptr;
195 pointer __begin_ = nullptr;
196 pointer __end_ = nullptr;
197 _LIBCPP_COMPRESSED_PAIR(pointer, __back_cap_, allocator_type, __alloc_);
198
199 template <class, class, class>
200 friend class __split_buffer_pointer_layout;
201};
202
203template <class _SplitBuffer, class _Tp, class _Allocator>
204class __split_buffer_size_layout {
205protected:
206 using value_type = _Tp;
207 using allocator_type = _Allocator;
208 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
209 using reference = value_type&;
210 using const_reference = const value_type&;
211 using size_type = typename __alloc_traits::size_type;
212 using difference_type = typename __alloc_traits::difference_type;
213 using pointer = typename __alloc_traits::pointer;
214 using const_pointer = typename __alloc_traits::const_pointer;
215 using iterator = pointer;
216 using const_iterator = const_pointer;
217 using __sentinel_type _LIBCPP_NODEBUG = size_type;
218
219public:
220 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer_size_layout() = default;
221
222 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer_size_layout(const allocator_type& __alloc)
223 : __alloc_(__alloc) {}
224
225 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __front_cap() _NOEXCEPT { return __front_cap_; }
226
227 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __front_cap() const _NOEXCEPT {
228 return __front_cap_;
229 }
230
231 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer begin() _NOEXCEPT { return __begin_; }
232
233 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer begin() const _NOEXCEPT { return __begin_; }
234
235 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer end() _NOEXCEPT { return __begin_ + __size_; }
236
237 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer end() const _NOEXCEPT { return __begin_ + __size_; }
238
239 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
240
241 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __size_ == 0; }
242
243 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT { return __cap_; }
244
245 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __get_allocator() _NOEXCEPT { return __alloc_; }
246
247 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type const& __get_allocator() const _NOEXCEPT {
248 return __alloc_;
249 }
250
251 // Returns the sentinel object directly. Should be used in conjunction with automatic type deduction,
252 // not explicit types.
253 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __sentinel_type __raw_sentinel() const _NOEXCEPT {
254 return __size_;
255 }
256 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __sentinel_type __raw_capacity() const _NOEXCEPT {
257 return __cap_;
258 }
259
260 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_data(pointer __new_first) _NOEXCEPT {
261 __front_cap_ = __new_first;
262 }
263
264 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
265 __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_;
269 __begin_ = __new_begin;
270 __set_sentinel(__new_end);
271 }
272
273 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
274 __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_;
278 __begin_ = __new_begin;
279 __set_sentinel(__new_size);
280 }
281
282 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(pointer __new_end) _NOEXCEPT {
283 _LIBCPP_ASSERT_INTERNAL(__front_cap_ <= __new_end, "__new_end cannot precede __front_cap_");
284 __size_ += __new_end - end();
285 }
286
287 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(size_type __new_size) _NOEXCEPT {
288 __size_ = __new_size;
289 }
290
291 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_capacity(size_type __new_capacity) _NOEXCEPT {
292 __cap_ = __new_capacity;
293 }
294
295 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_capacity(pointer __new_capacity) _NOEXCEPT {
296 __cap_ = __new_capacity - __begin_;
297 }
298
299 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const _NOEXCEPT {
300 return static_cast<size_type>(__begin_ - __front_cap_);
301 }
302
303 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const _NOEXCEPT {
304 // `__cap_ - __end_` tells us the total number of spares when in size-mode. We need to remove
305 // the __front_spare from the count.
306 return __cap_ - __size_ - __front_spare();
307 }
308
309 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT { return __begin_[__size_ - 1]; }
310
311 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
312 return __begin_[__size_ - 1];
313 }
314
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 {
319 std::swap(__front_cap_, __other.__front_cap_);
320 std::swap(__begin_, __other.__begin_);
321 std::swap(__cap_, __other.__cap_);
322 std::swap(__size_, __other.__size_);
323 }
324
325 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer_size_layout& __other) _NOEXCEPT {
326 std::swap(__front_cap_, __other.__front_cap_);
327 std::swap(__begin_, __other.__begin_);
328 std::swap(__cap_, __other.__cap_);
329 std::swap(__size_, __other.__size_);
330 std::__swap_allocator(__alloc_, __other.__alloc_);
331 }
332
333 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __reset() _NOEXCEPT {
334 __front_cap_ = nullptr;
335 __begin_ = nullptr;
336 __size_ = 0;
337 __cap_ = 0;
338 }
339
340 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
341 __copy_without_alloc(__split_buffer_size_layout const& __other)
342 _NOEXCEPT_(is_nothrow_copy_assignable<pointer>::value) {
343 __front_cap_ = __other.__front_cap_;
344 __begin_ = __other.__begin_;
345 __cap_ = __other.__cap_;
346 __size_ = __other.__size_;
347 }
348
349private:
350 pointer __front_cap_ = nullptr;
351 pointer __begin_ = nullptr;
352 size_type __size_ = 0;
353 size_type __cap_ = 0;
354 _LIBCPP_NO_UNIQUE_ADDRESS allocator_type __alloc_;
355
356 template <class, class, class>
357 friend class __split_buffer_size_layout;
358};
359
360// `__split_buffer` is a contiguous array data structure. It may hold spare capacity at both ends of
361// the sequence. This allows for a `__split_buffer` to grow from both the front and the back without
362// relocating its contents until it runs out of room. This characteristic sets it apart from
363// `std::vector`, which only holds spare capacity at its end. As such, `__split_buffer` is useful
364// for implementing both `std::vector` and `std::deque`.
365//
366// The sequence is stored as a contiguous chunk of memory delimited by the following "pointers" (`o` denotes
367// uninitialized memory and `x` denotes a valid object):
368//
369// |oooooooooooooooooooxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoooooooooooooooooooooooo|
370// ^ ^ ^ ^
371// __front_cap_ __begin_ __end_ __back_cap_
372//
373// The range [__front_cap_, __begin_) contains uninitialized memory. It is referred to as the "front spare capacity".
374// The range [__begin_, __end_) contains valid objects. It is referred to as the "valid range".
375// The range [__end_, __back_cap_) contains uninitialized memory. It is referred to as the "back spare capacity".
376//
377// The layout of `__split_buffer` is determined by the `_Layout` template template parameter. This
378// `_Layout` allows the above pointers to be stored as different representations, such as integer
379// offsets. A layout class template must provide the following interface:
380//
381// template<class _Tp, class _Allocator, class _Layout>
382// class __layout {
383// protected:
384// using value_type = _Tp;
385// using allocator_type = _Allocator;
386// using __alloc_traits = allocator_traits<allocator_type>;
387// using reference = value_type&;
388// using const_reference = const value_type&;
389// using size_type = typename __alloc_traits::size_type;
390// using difference_type = typename __alloc_traits::difference_type;
391// using pointer = typename __alloc_traits::pointer;
392// using const_pointer = typename __alloc_traits::const_pointer;
393// using iterator = pointer;
394// using const_iterator = const_pointer;
395// using __sentinel_type = /* type that represents the layout's sentinel */;
396//
397// public:
398// __layout() = default;
399// explicit __layout(const allocator_type&);
400//
401// pointer __front_cap();
402// const_pointer __front_cap() const;
403//
404// pointer begin();
405// const_pointer begin() const;
406//
407// pointer end();
408// pointer end() const;
409//
410// size_type size() const;
411// bool empty() const;
412// size_type capacity() const;
413//
414// allocator_type& __get_allocator();
415// allocator_type const& __get_allocator() const;
416//
417// __sentinel_type __raw_sentinel() const;
418// __sentinel_type __raw_capacity() const;
419//
420// void __set_data(pointer);
421// void __set_valid_range(pointer __begin, pointer __end);
422// void __set_valid_range(pointer __begin, size_type __size);
423// void __set_sentinel(pointer __end);
424// void __set_sentinel(size_type __size);
425//
426// void __set_capacity(size_type __capacity);
427// void __set_capacity(pointer __capacity);
428//
429// size_type __front_spare() const;
430// size_type __back_spare() const;
431//
432// reference back();
433// const_reference back() const;
434//
435// template<class _OtherLayout>
436// void __swap_without_allocator(_OtherLayout&);
437// void swap(__layout&);
438//
439// void __reset();
440// void __copy_without_alloc(__layout const&);
441// };
442//
443template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
444class __split_buffer : _Layout<__split_buffer<_Tp, _Allocator, _Layout>, _Tp, _Allocator> {
445 using __base_type _LIBCPP_NODEBUG = _Layout<__split_buffer<_Tp, _Allocator, _Layout>, _Tp, _Allocator>;
446
447public:
448 using __base_type::__back_spare;
449 using __base_type::__copy_without_alloc;
450 using __base_type::__front_cap;
451 using __base_type::__front_spare;
452 using __base_type::__get_allocator;
453 using __base_type::__raw_capacity;
454 using __base_type::__raw_sentinel;
455 using __base_type::__reset;
456 using __base_type::__set_capacity;
457 using __base_type::__set_data;
458 using __base_type::__set_sentinel;
459 using __base_type::__set_valid_range;
460
461 using typename __base_type::__alloc_traits;
462 using typename __base_type::allocator_type;
463 using typename __base_type::const_iterator;
464 using typename __base_type::const_pointer;
465 using typename __base_type::const_reference;
466 using typename __base_type::difference_type;
467 using typename __base_type::iterator;
468 using typename __base_type::pointer;
469 using typename __base_type::reference;
470 using typename __base_type::size_type;
471 using typename __base_type::value_type;
67472
68473 // A __split_buffer contains the following members which may be trivially relocatable:
69474 // - pointer: may be trivially relocatable, so it's checked
......@@ -73,36 +478,24 @@ public:
73478 __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
74479 __split_buffer,
75480 void>;
76 using __replaceable _LIBCPP_NODEBUG =
77 __conditional_t<__is_replaceable_v<pointer> && __container_allocator_is_replaceable<__alloc_traits>::value,
78 __split_buffer,
79 void>;
80
81 pointer __first_;
82 pointer __begin_;
83 pointer __end_;
84 _LIBCPP_COMPRESSED_PAIR(pointer, __cap_, allocator_type, __alloc_);
85481
86482 __split_buffer(const __split_buffer&) = delete;
87483 __split_buffer& operator=(const __split_buffer&) = delete;
88484
89 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer()
90 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
91 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __cap_(nullptr) {}
485 _LIBCPP_HIDE_FROM_ABI __split_buffer() = default;
92486
93 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(__alloc_rr& __a)
94 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __cap_(nullptr), __alloc_(__a) {}
487 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(allocator_type& __a) : __base_type(__a) {}
95488
96 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(const __alloc_rr& __a)
97 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __cap_(nullptr), __alloc_(__a) {}
489 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(const allocator_type& __a)
490 : __base_type(__a) {}
98491
99492 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
100 __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
493 __split_buffer(size_type __cap, size_type __start, allocator_type& __a);
101494
102495 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c)
103496 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
104497
105 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
498 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c, const allocator_type& __a);
106499
107500 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer& operator=(__split_buffer&& __c)
108501 _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
......@@ -111,36 +504,16 @@ public:
111504
112505 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~__split_buffer();
113506
114 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __begin_; }
115 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __begin_; }
116
117 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __end_; }
118 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __end_; }
119
120 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __destruct_at_end(__begin_); }
507 using __base_type::back;
508 using __base_type::begin;
509 using __base_type::capacity;
510 using __base_type::empty;
511 using __base_type::end;
512 using __base_type::size;
121513
122 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const {
123 return static_cast<size_type>(__end_ - __begin_);
124 }
125
126 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const { return __end_ == __begin_; }
127
128 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const {
129 return static_cast<size_type>(__cap_ - __first_);
130 }
131
132 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const {
133 return static_cast<size_type>(__begin_ - __first_);
134 }
135
136 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const {
137 return static_cast<size_type>(__cap_ - __end_);
138 }
139
140 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() { return *__begin_; }
141 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const { return *__begin_; }
142 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() { return *(__end_ - 1); }
143 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const { return *(__end_ - 1); }
514 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __destruct_at_end(begin()); }
515 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() { return *begin(); }
516 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const { return *begin(); }
144517
145518 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
146519
......@@ -149,8 +522,8 @@ public:
149522 template <class... _Args>
150523 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
151524
152 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_front() { __destruct_at_begin(__begin_ + 1); }
153 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() { __destruct_at_end(__end_ - 1); }
525 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_front() { __destruct_at_begin(begin() + 1); }
526 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() { __destruct_at_end(end() - 1); }
154527
155528 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n);
156529 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x);
......@@ -182,244 +555,242 @@ public:
182555 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
183556
184557 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer& __x)
185 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__alloc_rr>);
558 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
559
560 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const {
561 if (__front_cap() == nullptr) {
562 if (begin() != nullptr)
563 return false;
564
565 if (!empty())
566 return false;
567
568 if (capacity() != 0)
569 return false;
570
571 return true;
572 } else {
573 if (begin() < __front_cap())
574 return false;
186575
187 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
576 if (capacity() < size())
577 return false;
578
579 if (end() < begin())
580 return false;
581
582 return true;
583 }
584 }
585
586 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
587 __swap_without_allocator(__split_buffer<value_type, allocator_type, _Layout>& __other) _NOEXCEPT {
588 __base_type::__swap_without_allocator(__other);
589 }
188590
189591private:
190592 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer& __c, true_type)
191593 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
192 __alloc_ = std::move(__c.__alloc_);
594 __get_allocator() = std::move(__c.__get_allocator());
193595 }
194596
195597 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {}
196598
197599 struct _ConstructTransaction {
198600 _LIBCPP_CONSTEXPR_SINCE_CXX20
199 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT
200 : __pos_(*__p),
201 __end_(*__p + __n),
202 __dest_(__p) {}
601 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(__split_buffer* __parent, pointer __p, size_type __n) _NOEXCEPT
602 : __pos_(__p),
603 __end_(__p + __n),
604 __parent_(__parent) {}
203605
204 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { *__dest_ = __pos_; }
606 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { __parent_->__set_sentinel(__pos_); }
205607
206608 pointer __pos_;
207609 const pointer __end_;
208610
209611 private:
210 pointer* __dest_;
612 __split_buffer* __parent_;
211613 };
212};
213614
214template <class _Tp, class _Allocator>
215_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __split_buffer<_Tp, _Allocator>::__invariants() const {
216 if (__first_ == nullptr) {
217 if (__begin_ != nullptr)
218 return false;
219 if (__end_ != nullptr)
220 return false;
221 if (__cap_ != nullptr)
222 return false;
223 } else {
224 if (__begin_ < __first_)
225 return false;
226 if (__end_ < __begin_)
227 return false;
228 if (__cap_ < __end_)
229 return false;
230 }
231 return true;
232}
615 template <class _T2, class _A2, template <class, class, class> class _L2>
616 friend class __split_buffer;
617};
233618
234// Default constructs __n objects starting at __end_
619// Default constructs __n objects starting at `end()`
235620// throws if construction throws
236621// Precondition: __n > 0
237622// Precondition: size() + __n <= capacity()
238623// Postcondition: size() == size() + __n
239template <class _Tp, class _Allocator>
240_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) {
241 _ConstructTransaction __tx(std::addressof(this->__end_), __n);
624template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
625_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::__construct_at_end(size_type __n) {
626 _ConstructTransaction __tx(this, end(), __n);
242627 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
243 __alloc_traits::construct(__alloc_, std::__to_address(__tx.__pos_));
628 __alloc_traits::construct(__get_allocator(), std::__to_address(__tx.__pos_));
244629 }
245630}
246631
247// Copy constructs __n objects starting at __end_ from __x
632// Copy constructs __n objects starting at `end()` from __x
248633// throws if construction throws
249634// Precondition: __n > 0
250635// Precondition: size() + __n <= capacity()
251636// Postcondition: size() == old size() + __n
252637// Postcondition: [i] == __x for all i in [size() - __n, __n)
253template <class _Tp, class _Allocator>
638template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
254639_LIBCPP_CONSTEXPR_SINCE_CXX20 void
255__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) {
256 _ConstructTransaction __tx(std::addressof(this->__end_), __n);
640__split_buffer<_Tp, _Allocator, _Layout>::__construct_at_end(size_type __n, const_reference __x) {
641 _ConstructTransaction __tx(this, end(), __n);
257642 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
258 __alloc_traits::construct(__alloc_, std::__to_address(__tx.__pos_), __x);
643 __alloc_traits::construct(__get_allocator(), std::__to_address(__tx.__pos_), __x);
259644 }
260645}
261646
262template <class _Tp, class _Allocator>
647template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
263648template <class _Iterator, class _Sentinel>
264649_LIBCPP_CONSTEXPR_SINCE_CXX20 void
265__split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
266 __alloc_rr& __a = __alloc_;
650__split_buffer<_Tp, _Allocator, _Layout>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
651 allocator_type& __a = __get_allocator();
267652 for (; __first != __last; ++__first) {
268 if (__end_ == __cap_) {
269 size_type __old_cap = __cap_ - __first_;
653 if (__back_spare() == 0) {
654 size_type __old_cap = capacity();
270655 size_type __new_cap = std::max<size_type>(2 * __old_cap, 8);
271656 __split_buffer __buf(__new_cap, 0, __a);
272 for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_)
273 __alloc_traits::construct(__buf.__alloc_, std::__to_address(__buf.__end_), std::move(*__p));
657 pointer __buf_end = __buf.end();
658 pointer __end = end();
659 for (pointer __p = begin(); __p != __end; ++__p) {
660 __alloc_traits::construct(__buf.__get_allocator(), std::__to_address(__buf_end), std::move(*__p));
661 __buf.__set_sentinel(++__buf_end);
662 }
274663 swap(__buf);
275664 }
276 __alloc_traits::construct(__a, std::__to_address(this->__end_), *__first);
277 ++this->__end_;
665
666 __alloc_traits::construct(__a, std::__to_address(end()), *__first);
667 __set_sentinel(size() + 1);
278668 }
279669}
280template <class _Tp, class _Allocator>
670
671template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
281672template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
282673_LIBCPP_CONSTEXPR_SINCE_CXX20 void
283__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) {
674__split_buffer<_Tp, _Allocator, _Layout>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) {
284675 __construct_at_end_with_size(__first, std::distance(__first, __last));
285676}
286677
287template <class _Tp, class _Allocator>
678template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
288679template <class _ForwardIterator>
289680_LIBCPP_CONSTEXPR_SINCE_CXX20 void
290__split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
291 _ConstructTransaction __tx(std::addressof(this->__end_), __n);
681__split_buffer<_Tp, _Allocator, _Layout>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
682 _ConstructTransaction __tx(this, end(), __n);
292683 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) {
293 __alloc_traits::construct(__alloc_, std::__to_address(__tx.__pos_), *__first);
684 __alloc_traits::construct(__get_allocator(), std::__to_address(__tx.__pos_), *__first);
294685 }
295686}
296687
297template <class _Tp, class _Allocator>
688template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
298689_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
299__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) {
300 while (__begin_ != __new_begin)
301 __alloc_traits::destroy(__alloc_, std::__to_address(__begin_++));
690__split_buffer<_Tp, _Allocator, _Layout>::__destruct_at_begin(pointer __new_begin, false_type) {
691 pointer __begin = begin();
692 // Updating begin at every iteration is unnecessary because destruction can't throw.
693 while (__begin != __new_begin)
694 __alloc_traits::destroy(__get_allocator(), std::__to_address(__begin++));
695 __set_valid_range(__begin, end());
302696}
303697
304template <class _Tp, class _Allocator>
698template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
305699_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
306__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) {
307 __begin_ = __new_begin;
308}
309
310template <class _Tp, class _Allocator>
311_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
312__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT {
313 while (__new_last != __end_)
314 __alloc_traits::destroy(__alloc_, std::__to_address(--__end_));
700__split_buffer<_Tp, _Allocator, _Layout>::__destruct_at_begin(pointer __new_begin, true_type) {
701 __set_valid_range(__new_begin, end());
315702}
316703
317template <class _Tp, class _Allocator>
704template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
318705_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
319__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT {
320 __end_ = __new_last;
706__split_buffer<_Tp, _Allocator, _Layout>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT {
707 pointer __end = end();
708 // Updating begin at every iteration is unnecessary because destruction can't throw.
709 while (__new_last != __end)
710 __alloc_traits::destroy(__get_allocator(), std::__to_address(--__end));
711 __set_sentinel(__end);
321712}
322713
323template <class _Tp, class _Allocator>
714template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
324715_LIBCPP_CONSTEXPR_SINCE_CXX20
325__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
326 : __cap_(nullptr), __alloc_(__a) {
327 if (__cap == 0) {
328 __first_ = nullptr;
329 } else {
330 auto __allocation = std::__allocate_at_least(__alloc_, __cap);
331 __first_ = __allocation.ptr;
332 __cap = __allocation.count;
716__split_buffer<_Tp, _Allocator, _Layout>::__split_buffer(size_type __cap, size_type __start, allocator_type& __a)
717 : __base_type(__a) {
718 _LIBCPP_ASSERT_INTERNAL(__cap >= __start, "can't have a start point outside the capacity");
719 if (__cap > 0) {
720 auto __allocation = std::__allocate_at_least(__get_allocator(), __cap);
721 __set_data(__allocation.ptr);
722 __cap = __allocation.count;
333723 }
334 __begin_ = __end_ = __first_ + __start;
335 __cap_ = __first_ + __cap;
724
725 pointer __begin = __front_cap() + __start;
726 __set_valid_range(__begin, __begin);
727 __set_capacity(__cap);
336728}
337729
338template <class _Tp, class _Allocator>
339_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::~__split_buffer() {
730template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
731_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator, _Layout>::~__split_buffer() {
340732 clear();
341 if (__first_)
342 __alloc_traits::deallocate(__alloc_, __first_, capacity());
733 if (__front_cap())
734 __alloc_traits::deallocate(__get_allocator(), __front_cap(), capacity());
343735}
344736
345template <class _Tp, class _Allocator>
346_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
737template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
738_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator, _Layout>::__split_buffer(__split_buffer&& __c)
347739 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
348 : __first_(std::move(__c.__first_)),
349 __begin_(std::move(__c.__begin_)),
350 __end_(std::move(__c.__end_)),
351 __cap_(std::move(__c.__cap_)),
352 __alloc_(std::move(__c.__alloc_)) {
353 __c.__first_ = nullptr;
354 __c.__begin_ = nullptr;
355 __c.__end_ = nullptr;
356 __c.__cap_ = nullptr;
740 : __base_type(std::move(__c)) {
741 __c.__reset();
357742}
358743
359template <class _Tp, class _Allocator>
744template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
360745_LIBCPP_CONSTEXPR_SINCE_CXX20
361__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
362 : __cap_(nullptr), __alloc_(__a) {
363 if (__a == __c.__alloc_) {
364 __first_ = __c.__first_;
365 __begin_ = __c.__begin_;
366 __end_ = __c.__end_;
367 __cap_ = __c.__cap_;
368 __c.__first_ = nullptr;
369 __c.__begin_ = nullptr;
370 __c.__end_ = nullptr;
371 __c.__cap_ = nullptr;
746__split_buffer<_Tp, _Allocator, _Layout>::__split_buffer(__split_buffer&& __c, const allocator_type& __a)
747 : __base_type(__a) {
748 if (__a == __c.__get_allocator()) {
749 __set_data(__c.__front_cap());
750 __set_valid_range(__c.begin(), __c.end());
751 __set_capacity(__c.capacity());
752 __c.__reset();
372753 } else {
373 auto __allocation = std::__allocate_at_least(__alloc_, __c.size());
374 __first_ = __allocation.ptr;
375 __begin_ = __end_ = __first_;
376 __cap_ = __first_ + __allocation.count;
754 auto __allocation = std::__allocate_at_least(__get_allocator(), __c.size());
755 __set_data(__allocation.ptr);
756 __set_valid_range(__front_cap(), __front_cap());
757 __set_capacity(__allocation.count);
377758 typedef move_iterator<iterator> _Ip;
378759 __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
379760 }
380761}
381762
382template <class _Tp, class _Allocator>
383_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>&
384__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
763template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
764_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator, _Layout>&
765__split_buffer<_Tp, _Allocator, _Layout>::operator=(__split_buffer&& __c)
385766 _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
386767 is_nothrow_move_assignable<allocator_type>::value) ||
387768 !__alloc_traits::propagate_on_container_move_assignment::value) {
388769 clear();
389770 shrink_to_fit();
390 __first_ = __c.__first_;
391 __begin_ = __c.__begin_;
392 __end_ = __c.__end_;
393 __cap_ = __c.__cap_;
771 __copy_without_alloc(__c);
394772 __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
395 __c.__first_ = __c.__begin_ = __c.__end_ = __c.__cap_ = nullptr;
773 __c.__reset();
396774 return *this;
397775}
398776
399template <class _Tp, class _Allocator>
400_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
401 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__alloc_rr>) {
402 std::swap(__first_, __x.__first_);
403 std::swap(__begin_, __x.__begin_);
404 std::swap(__end_, __x.__end_);
405 std::swap(__cap_, __x.__cap_);
406 std::__swap_allocator(__alloc_, __x.__alloc_);
777template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
778_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::swap(__split_buffer& __x)
779 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>) {
780 __base_type::swap(__x);
407781}
408782
409template <class _Tp, class _Allocator>
410_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
783template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
784_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::shrink_to_fit() _NOEXCEPT {
411785 if (capacity() > size()) {
412786#if _LIBCPP_HAS_EXCEPTIONS
413787 try {
414788#endif // _LIBCPP_HAS_EXCEPTIONS
415 __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc_);
789 __split_buffer<value_type, allocator_type, _Layout> __t(size(), 0, __get_allocator());
416790 if (__t.capacity() < capacity()) {
417 __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
418 __t.__end_ = __t.__begin_ + (__end_ - __begin_);
419 std::swap(__first_, __t.__first_);
420 std::swap(__begin_, __t.__begin_);
421 std::swap(__end_, __t.__end_);
422 std::swap(__cap_, __t.__cap_);
791 __t.__construct_at_end(move_iterator<pointer>(begin()), move_iterator<pointer>(end()));
792 __t.__set_sentinel(size());
793 __swap_without_allocator(__t);
423794 }
424795#if _LIBCPP_HAS_EXCEPTIONS
425796 } catch (...) {
......@@ -428,55 +799,56 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
428799 }
429800}
430801
431template <class _Tp, class _Allocator>
802template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
432803template <class... _Args>
433_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
434 if (__begin_ == __first_) {
435 if (__end_ < __cap_) {
436 difference_type __d = __cap_ - __end_;
804_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::emplace_front(_Args&&... __args) {
805 if (__front_spare() == 0) {
806 pointer __end = end();
807 if (__back_spare() > 0) {
808 // The elements are pressed up against the front of the buffer: we need to move them back a
809 // little bit to make `emplace_front` have amortised O(1) complexity.
810 difference_type __d = __back_spare();
437811 __d = (__d + 1) / 2;
438 __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
439 __end_ += __d;
812 auto __new_end = __end + __d;
813 __set_valid_range(std::move_backward(begin(), __end, __new_end), __new_end);
440814 } else {
441 size_type __c = std::max<size_type>(2 * static_cast<size_type>(__cap_ - __first_), 1);
442 __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc_);
443 __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
444 std::swap(__first_, __t.__first_);
445 std::swap(__begin_, __t.__begin_);
446 std::swap(__end_, __t.__end_);
447 std::swap(__cap_, __t.__cap_);
815 size_type __c = std::max<size_type>(2 * capacity(), 1);
816 __split_buffer<value_type, allocator_type, _Layout> __t(__c, (__c + 3) / 4, __get_allocator());
817 __t.__construct_at_end(move_iterator<pointer>(begin()), move_iterator<pointer>(__end));
818 __base_type::__swap_without_allocator(__t);
448819 }
449820 }
450 __alloc_traits::construct(__alloc_, std::__to_address(__begin_ - 1), std::forward<_Args>(__args)...);
451 --__begin_;
821
822 __alloc_traits::construct(__get_allocator(), std::__to_address(begin() - 1), std::forward<_Args>(__args)...);
823 __set_valid_range(begin() - 1, size() + 1);
452824}
453825
454template <class _Tp, class _Allocator>
826template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
455827template <class... _Args>
456_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
457 if (__end_ == __cap_) {
458 if (__begin_ > __first_) {
459 difference_type __d = __begin_ - __first_;
828_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::emplace_back(_Args&&... __args) {
829 pointer __end = end();
830 if (__back_spare() == 0) {
831 if (__front_spare() > 0) {
832 difference_type __d = __front_spare();
460833 __d = (__d + 1) / 2;
461 __end_ = std::move(__begin_, __end_, __begin_ - __d);
462 __begin_ -= __d;
834 __end = std::move(begin(), __end, begin() - __d);
835 __set_valid_range(begin() - __d, __end);
463836 } else {
464 size_type __c = std::max<size_type>(2 * static_cast<size_type>(__cap_ - __first_), 1);
465 __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc_);
466 __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
467 std::swap(__first_, __t.__first_);
468 std::swap(__begin_, __t.__begin_);
469 std::swap(__end_, __t.__end_);
470 std::swap(__cap_, __t.__cap_);
837 size_type __c = std::max<size_type>(2 * capacity(), 1);
838 __split_buffer<value_type, allocator_type, _Layout> __t(__c, __c / 4, __get_allocator());
839 __t.__construct_at_end(move_iterator<pointer>(begin()), move_iterator<pointer>(__end));
840 __base_type::__swap_without_allocator(__t);
471841 }
472842 }
473 __alloc_traits::construct(__alloc_, std::__to_address(__end_), std::forward<_Args>(__args)...);
474 ++__end_;
843
844 __alloc_traits::construct(__get_allocator(), std::__to_address(__end), std::forward<_Args>(__args)...);
845 __set_sentinel(++__end);
475846}
476847
477template <class _Tp, class _Allocator>
848template <class _Tp, class _Allocator, template <class, class, class> class _Layout>
478849_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
479swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
850swap(__split_buffer<_Tp, _Allocator, _Layout>& __x, __split_buffer<_Tp, _Allocator, _Layout>& __y)
851 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
480852 __x.swap(__y);
481853}
482854
lib/libcxx/include/__stop_token/atomic_unique_lock.h+1-1
......@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2727// where State contains a lock bit and might contain other data,
2828// and LockedBit is the value of State when the lock bit is set, e.g 1 << 2
2929template <class _State, _State _LockedBit>
30class _LIBCPP_AVAILABILITY_SYNC __atomic_unique_lock {
30class __atomic_unique_lock {
3131 static_assert(std::__popcount(static_cast<unsigned long long>(_LockedBit)) == 1,
3232 "LockedBit must be an integer where only one bit is set");
3333
lib/libcxx/include/__stop_token/stop_callback.h+2-2
......@@ -34,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3434#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
3535
3636template <class _Callback>
37class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base {
37class stop_callback : private __stop_callback_base {
3838 static_assert(invocable<_Callback>,
3939 "Mandates: stop_callback is instantiated with an argument for the template parameter Callback that "
4040 "satisfies invocable.");
......@@ -91,7 +91,7 @@ private:
9191};
9292
9393template <class _Callback>
94_LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
94stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
9595
9696#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
9797
lib/libcxx/include/__stop_token/stop_source.h+1-1
......@@ -30,7 +30,7 @@ struct nostopstate_t {
3030
3131inline constexpr nostopstate_t nostopstate{};
3232
33class _LIBCPP_AVAILABILITY_SYNC stop_source {
33class stop_source {
3434public:
3535 _LIBCPP_HIDE_FROM_ABI stop_source() : __state_(new __stop_state()) { __state_->__increment_stop_source_counter(); }
3636
lib/libcxx/include/__stop_token/stop_state.h+4-4
......@@ -100,7 +100,7 @@ public:
100100 return ((__curent_state & __stop_requested_bit) != 0) || ((__curent_state >> __stop_source_counter_shift) != 0);
101101 }
102102
103 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __request_stop() noexcept {
103 _LIBCPP_HIDE_FROM_ABI bool __request_stop() noexcept {
104104 auto __cb_list_lock = __try_lock_for_request_stop();
105105 if (!__cb_list_lock.__owns_lock()) {
106106 return false;
......@@ -137,7 +137,7 @@ public:
137137 return true;
138138 }
139139
140 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __add_callback(__stop_callback_base* __cb) noexcept {
140 _LIBCPP_HIDE_FROM_ABI bool __add_callback(__stop_callback_base* __cb) noexcept {
141141 // If it is already stop_requested. Do not try to request it again.
142142 const auto __give_up_trying_to_lock_condition = [__cb](__state_t __state) {
143143 if ((__state & __stop_requested_bit) != 0) {
......@@ -164,7 +164,7 @@ public:
164164 }
165165
166166 // called by the destructor of stop_callback
167 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __remove_callback(__stop_callback_base* __cb) noexcept {
167 _LIBCPP_HIDE_FROM_ABI void __remove_callback(__stop_callback_base* __cb) noexcept {
168168 __callback_list_lock __cb_list_lock(__state_);
169169
170170 // under below condition, the request_stop call just popped __cb from the list and could execute it now
......@@ -192,7 +192,7 @@ public:
192192 }
193193
194194private:
195 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI __callback_list_lock __try_lock_for_request_stop() noexcept {
195 _LIBCPP_HIDE_FROM_ABI __callback_list_lock __try_lock_for_request_stop() noexcept {
196196 // If it is already stop_requested, do not try to request stop or lock the list again.
197197 const auto __lock_fail_condition = [](__state_t __state) { return (__state & __stop_requested_bit) != 0; };
198198
lib/libcxx/include/__stop_token/stop_token.h+1-1
......@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222
2323#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
2424
25class _LIBCPP_AVAILABILITY_SYNC stop_token {
25class stop_token {
2626public:
2727 _LIBCPP_HIDE_FROM_ABI stop_token() noexcept = default;
2828
lib/libcxx/include/__string/char_traits.h+51-31
......@@ -94,16 +94,17 @@ struct char_traits<char> {
9494 }
9595
9696 // TODO: Make this _LIBCPP_HIDE_FROM_ABI
97 static inline _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
97 [[__nodiscard__]] static inline _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
9898 return __c1 == __c2;
9999 }
100 static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
100 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
101 lt(char_type __c1, char_type __c2) _NOEXCEPT {
101102 return (unsigned char)__c1 < (unsigned char)__c2;
102103 }
103104
104105 // __constexpr_memcmp requires a trivially lexicographically comparable type, but char is not when char is a signed
105106 // type
106 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
107 [[__nodiscard__]] static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
107108 compare(const char_type* __lhs, const char_type* __rhs, size_t __count) _NOEXCEPT {
108109 if (__libcpp_is_constant_evaluated()) {
109110#ifdef _LIBCPP_COMPILER_CLANG_BASED
......@@ -126,11 +127,12 @@ struct char_traits<char> {
126127 }
127128 }
128129
129 static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
130 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17
131 length(const char_type* __s) _NOEXCEPT {
130132 return std::__constexpr_strlen(__s);
131133 }
132134
133 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
135 [[__nodiscard__]] static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
134136 find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
135137 return std::__constexpr_memchr(__s, __a, __n);
136138 }
......@@ -154,19 +156,24 @@ struct char_traits<char> {
154156 return __s;
155157 }
156158
157 static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
159 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
158160 return eq_int_type(__c, eof()) ? ~eof() : __c;
159161 }
160 static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
162 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type
163 to_char_type(int_type __c) _NOEXCEPT {
161164 return char_type(__c);
162165 }
163 static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
166 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type
167 to_int_type(char_type __c) _NOEXCEPT {
164168 return int_type((unsigned char)__c);
165169 }
166 static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
170 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
171 eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
167172 return __c1 == __c2;
168173 }
169 static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(EOF); }
174 [[__nodiscard__]] static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT {
175 return int_type(EOF);
176 }
170177};
171178
172179template <class _CharT, class _IntT, _IntT _EOFVal>
......@@ -187,11 +194,11 @@ struct __char_traits_base {
187194 __lhs = __rhs;
188195 }
189196
190 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR bool eq(char_type __lhs, char_type __rhs) _NOEXCEPT {
197 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR bool eq(char_type __lhs, char_type __rhs) _NOEXCEPT {
191198 return __lhs == __rhs;
192199 }
193200
194 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR bool lt(char_type __lhs, char_type __rhs) _NOEXCEPT {
201 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR bool lt(char_type __lhs, char_type __rhs) _NOEXCEPT {
195202 return __lhs < __rhs;
196203 }
197204
......@@ -213,19 +220,22 @@ struct __char_traits_base {
213220 return __str;
214221 }
215222
216 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
223 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
217224 return char_type(__c);
218225 }
219226
220 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT { return int_type(__c); }
227 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
228 return int_type(__c);
229 }
221230
222 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __lhs, int_type __rhs) _NOEXCEPT {
231 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR bool
232 eq_int_type(int_type __lhs, int_type __rhs) _NOEXCEPT {
223233 return __lhs == __rhs;
224234 }
225235
226 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return _EOFVal; }
236 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return _EOFVal; }
227237
228 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
238 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
229239 return eq_int_type(__c, eof()) ? static_cast<int_type>(~eof()) : __c;
230240 }
231241};
......@@ -235,18 +245,19 @@ struct __char_traits_base {
235245#if _LIBCPP_HAS_WIDE_CHARACTERS
236246template <>
237247struct char_traits<wchar_t> : __char_traits_base<wchar_t, wint_t, static_cast<wint_t>(WEOF)> {
238 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
248 [[__nodiscard__]] static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
239249 compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
240250 if (__n == 0)
241251 return 0;
242252 return std::__constexpr_wmemcmp(__s1, __s2, __n);
243253 }
244254
245 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT {
255 [[__nodiscard__]] static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t
256 length(const char_type* __s) _NOEXCEPT {
246257 return std::__constexpr_wcslen(__s);
247258 }
248259
249 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
260 [[__nodiscard__]] static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
250261 find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
251262 return std::__constexpr_wmemchr(__s, __a, __n);
252263 }
......@@ -257,16 +268,16 @@ struct char_traits<wchar_t> : __char_traits_base<wchar_t, wint_t, static_cast<wi
257268
258269template <>
259270struct char_traits<char8_t> : __char_traits_base<char8_t, unsigned int, static_cast<unsigned int>(EOF)> {
260 static _LIBCPP_HIDE_FROM_ABI constexpr int
271 [[nodiscard]] static _LIBCPP_HIDE_FROM_ABI constexpr int
261272 compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept {
262273 return std::__constexpr_memcmp(__s1, __s2, __element_count(__n));
263274 }
264275
265 static _LIBCPP_HIDE_FROM_ABI constexpr size_t length(const char_type* __str) noexcept {
276 [[nodiscard]] static _LIBCPP_HIDE_FROM_ABI constexpr size_t length(const char_type* __str) noexcept {
266277 return std::__constexpr_strlen(__str);
267278 }
268279
269 _LIBCPP_HIDE_FROM_ABI static constexpr const char_type*
280 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr const char_type*
270281 find(const char_type* __s, size_t __n, const char_type& __a) noexcept {
271282 return std::__constexpr_memchr(__s, __a, __n);
272283 }
......@@ -276,11 +287,11 @@ struct char_traits<char8_t> : __char_traits_base<char8_t, unsigned int, static_c
276287
277288template <>
278289struct char_traits<char16_t> : __char_traits_base<char16_t, uint_least16_t, static_cast<uint_least16_t>(0xFFFF)> {
279 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
290 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
280291 compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
281292 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT;
282293
283 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
294 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
284295 find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
285296 __identity __proj;
286297 const char_type* __match = std::__find(__s, __s + __n, __a, __proj);
......@@ -290,7 +301,7 @@ struct char_traits<char16_t> : __char_traits_base<char16_t, uint_least16_t, stat
290301 }
291302};
292303
293inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
304[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
294305char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
295306 for (; __n; --__n, ++__s1, ++__s2) {
296307 if (lt(*__s1, *__s2))
......@@ -301,7 +312,8 @@ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, siz
301312 return 0;
302313}
303314
304inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT {
315[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t
316char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT {
305317 size_t __len = 0;
306318 for (; !eq(*__s, char_type(0)); ++__s)
307319 ++__len;
......@@ -310,11 +322,11 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char16_t>::length(const
310322
311323template <>
312324struct char_traits<char32_t> : __char_traits_base<char32_t, uint_least32_t, static_cast<uint_least32_t>(0xFFFFFFFF)> {
313 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
325 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
314326 compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
315327 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT;
316328
317 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
329 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
318330 find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
319331 __identity __proj;
320332 const char_type* __match = std::__find(__s, __s + __n, __a, __proj);
......@@ -324,7 +336,7 @@ struct char_traits<char32_t> : __char_traits_base<char32_t, uint_least32_t, stat
324336 }
325337};
326338
327inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
339[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
328340char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
329341 for (; __n; --__n, ++__s1, ++__s2) {
330342 if (lt(*__s1, *__s2))
......@@ -335,7 +347,8 @@ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, siz
335347 return 0;
336348}
337349
338inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT {
350[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t
351char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT {
339352 size_t __len = 0;
340353 for (; !eq(*__s, char_type(0)); ++__s)
341354 ++__len;
......@@ -369,6 +382,13 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const _CharT* __searc
369382 if (__len1 < __len2)
370383 return __last1;
371384
385 if (__builtin_constant_p(__len2 == 1) && __len2 == 1) {
386 auto __res = _Traits::find(__first1, __len1, *__first2);
387 if (__res == nullptr)
388 return __last1;
389 return __res;
390 }
391
372392 // First element of __first2 is loop invariant.
373393 _CharT __f2 = *__first2;
374394 while (true) {
lib/libcxx/include/__string/constexpr_c_functions.h+5-5
......@@ -22,7 +22,6 @@
2222#include <__type_traits/is_equality_comparable.h>
2323#include <__type_traits/is_integral.h>
2424#include <__type_traits/is_same.h>
25#include <__type_traits/is_trivially_copyable.h>
2625#include <__type_traits/is_trivially_lexicographically_comparable.h>
2726#include <__type_traits/remove_cv.h>
2827#include <__utility/element_count.h>
......@@ -96,14 +95,13 @@ __constexpr_memcmp(const _Tp* __lhs, const _Up* __rhs, __element_count __n) {
9695 }
9796}
9897
99// Because of __libcpp_is_trivially_equality_comparable we know that comparing the object representations is equivalent
98// Because of __is_trivially_equality_comparable_v we know that comparing the object representations is equivalent
10099// to a std::memcmp(...) == 0. Since we have multiple objects contiguously in memory, we can call memcmp once instead
101100// of invoking it on every object individually.
102101template <class _Tp, class _Up>
103102_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
104103__constexpr_memcmp_equal(const _Tp* __lhs, const _Up* __rhs, __element_count __n) {
105 static_assert(__libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
106 "_Tp and _Up have to be trivially equality comparable");
104 static_assert(__is_trivially_equality_comparable_v<_Tp, _Up>, "_Tp and _Up have to be trivially equality comparable");
107105
108106 auto __count = static_cast<size_t>(__n);
109107
......@@ -128,7 +126,7 @@ __constexpr_memcmp_equal(const _Tp* __lhs, const _Up* __rhs, __element_count __n
128126
129127template <class _Tp, class _Up>
130128_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_memchr(_Tp* __str, _Up __value, size_t __count) {
131 static_assert(sizeof(_Tp) == 1 && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
129 static_assert(sizeof(_Tp) == 1 && __is_trivially_equality_comparable_v<_Tp, _Up>,
132130 "Calling memchr on non-trivially equality comparable types is unsafe.");
133131
134132 if (__libcpp_is_constant_evaluated()) {
......@@ -225,6 +223,8 @@ __constexpr_memmove(_Tp* __dest, _Up* __src, __element_count __n) {
225223 std::__assign_trivially_copyable(__dest[__i], __src[__i]);
226224 }
227225 }
226 } else if _LIBCPP_CONSTEXPR (sizeof(_Tp) == __datasizeof_v<_Tp>) {
227 ::__builtin_memmove(__dest, __src, __count * sizeof(_Tp));
228228 } else if (__count > 0) {
229229 ::__builtin_memmove(__dest, __src, (__count - 1) * sizeof(_Tp) + __datasizeof_v<_Tp>);
230230 }
lib/libcxx/include/__support/xlocale/__strtonum_fallback.h-8
......@@ -34,12 +34,4 @@ inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __
3434 return ::strtold(__nptr, __endptr);
3535}
3636
37inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
38 return ::strtoll(__nptr, __endptr, __base);
39}
40
41inline _LIBCPP_HIDE_FROM_ABI unsigned long long strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
42 return ::strtoull(__nptr, __endptr, __base);
43}
44
4537#endif // _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
lib/libcxx/include/__system_error/error_category.h+8-8
......@@ -20,7 +20,7 @@
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
2222
23class _LIBCPP_EXPORTED_FROM_ABI error_condition;
23class error_condition;
2424class _LIBCPP_EXPORTED_FROM_ABI error_code;
2525
2626class _LIBCPP_HIDDEN __do_message;
......@@ -37,11 +37,11 @@ public:
3737 error_category(const error_category&) = delete;
3838 error_category& operator=(const error_category&) = delete;
3939
40 virtual const char* name() const _NOEXCEPT = 0;
41 virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
42 virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
43 virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
44 virtual string message(int __ev) const = 0;
40 [[__nodiscard__]] virtual const char* name() const _NOEXCEPT = 0;
41 [[__nodiscard__]] virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
42 [[__nodiscard__]] virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
43 [[__nodiscard__]] virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
44 [[__nodiscard__]] virtual string message(int __ev) const = 0;
4545
4646 _LIBCPP_HIDE_FROM_ABI bool operator==(const error_category& __rhs) const _NOEXCEPT { return this == &__rhs; }
4747
......@@ -67,8 +67,8 @@ public:
6767 string message(int __ev) const override;
6868};
6969
70[[__gnu__::__const__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT;
71[[__gnu__::__const__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT;
70[[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT;
71[[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT;
7272
7373_LIBCPP_END_NAMESPACE_STD
7474
lib/libcxx/include/__system_error/error_code.h+5-5
......@@ -71,20 +71,20 @@ public:
7171 __cat_ = &system_category();
7272 }
7373
74 _LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; }
74 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; }
7575
76 _LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; }
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; }
7777
78 _LIBCPP_HIDE_FROM_ABI error_condition default_error_condition() const _NOEXCEPT {
78 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI error_condition default_error_condition() const _NOEXCEPT {
7979 return __cat_->default_error_condition(__val_);
8080 }
8181
82 string message() const;
82 [[__nodiscard__]] string message() const;
8383
8484 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __val_ != 0; }
8585};
8686
87inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(errc __e) _NOEXCEPT {
87[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(errc __e) _NOEXCEPT {
8888 return error_code(static_cast<int>(__e), generic_category());
8989}
9090
lib/libcxx/include/__system_error/error_condition.h+4-4
......@@ -80,15 +80,15 @@ public:
8080 __cat_ = &generic_category();
8181 }
8282
83 _LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; }
8484
85 _LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; }
86 string message() const;
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; }
86 [[__nodiscard__]] string message() const;
8787
8888 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __val_ != 0; }
8989};
9090
91inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(errc __e) _NOEXCEPT {
91[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(errc __e) _NOEXCEPT {
9292 return error_condition(static_cast<int>(__e), generic_category());
9393}
9494
lib/libcxx/include/__system_error/system_error.h+1-1
......@@ -36,7 +36,7 @@ public:
3636 _LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default;
3737 ~system_error() _NOEXCEPT override;
3838
39 _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
39 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
4040};
4141
4242// __ev is expected to be an error in the generic_category domain (e.g. from
lib/libcxx/include/__thread/id.h+1-1
......@@ -23,7 +23,7 @@
2323_LIBCPP_BEGIN_NAMESPACE_STD
2424
2525#if _LIBCPP_HAS_THREADS
26class _LIBCPP_EXPORTED_FROM_ABI __thread_id;
26class __thread_id;
2727
2828namespace this_thread {
2929
lib/libcxx/include/__thread/jthread.h+1-1
......@@ -36,7 +36,7 @@ _LIBCPP_PUSH_MACROS
3636
3737_LIBCPP_BEGIN_NAMESPACE_STD
3838
39class _LIBCPP_AVAILABILITY_SYNC jthread {
39class jthread {
4040public:
4141 // types
4242 using id = thread::id;
lib/libcxx/include/__thread/poll_with_backoff.h+27-8
......@@ -22,33 +22,50 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222
2323static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
2424
25enum class __backoff_results : unsigned char {
26 __continue_poll = 1,
27 __poll_success = 2,
28 __timeout = 3,
29 __backoff_failure = 4,
30};
31
32enum class __poll_with_backoff_results : unsigned char {
33 __poll_success = static_cast<unsigned char>(__backoff_results::__poll_success),
34 __timeout = static_cast<unsigned char>(__backoff_results::__timeout),
35 __backoff_failure = static_cast<unsigned char>(__backoff_results::__backoff_failure),
36};
37
2538// Polls a thread for a condition given by a predicate, and backs off based on a backoff policy
2639// before polling again.
2740//
2841// - __poll is the "test function" that should return true if polling succeeded, and false if it failed.
2942//
3043// - __backoff is the "backoff policy", which is called with the duration since we started polling. It should
31// return false in order to resume polling, and true if polling should stop entirely for some reason.
44// return __backoff_results::__continue_poll in order to resume polling, and other appropriate __backoff_results
45// if polling should stop entirely for some reason.
3246// In general, backoff policies sleep for some time before returning control to the polling loop.
3347//
3448// - __max_elapsed is the maximum duration to try polling for. If the maximum duration is exceeded,
35// the polling loop will return false to report a timeout.
49// the polling loop will return __poll_with_backoff_results::__timeout to report a timeout.
50
3651template <class _Poll, class _Backoff>
37_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_backoff(
52_LIBCPP_HIDE_FROM_ABI __poll_with_backoff_results __libcpp_thread_poll_with_backoff(
3853 _Poll&& __poll, _Backoff&& __backoff, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
3954 auto const __start = chrono::high_resolution_clock::now();
4055 for (int __count = 0;;) {
4156 if (__poll())
42 return true; // __poll completion means success
57 return __poll_with_backoff_results::__poll_success;
4358 if (__count < __libcpp_polling_count) {
4459 __count += 1;
4560 continue;
4661 }
4762 chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start;
4863 if (__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed)
49 return false; // timeout failure
50 if (__backoff(__elapsed))
51 return false; // __backoff completion means failure
64 return __poll_with_backoff_results::__timeout;
65 if (auto __backoff_res = __backoff(__elapsed); __backoff_res == __backoff_results::__continue_poll)
66 continue;
67 else
68 return static_cast<__poll_with_backoff_results>(__backoff_res);
5269 }
5370}
5471
......@@ -59,7 +76,9 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_b
5976// so this should most likely only be used on single-threaded systems where there
6077// are no other threads to compete with.
6178struct __spinning_backoff_policy {
62 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(chrono::nanoseconds const&) const { return false; }
79 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __backoff_results operator()(chrono::nanoseconds const&) const {
80 return __backoff_results::__continue_poll;
81 }
6382};
6483
6584_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__thread/support/c11.h+8-8
......@@ -39,17 +39,17 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_init(__libcpp_recursiv
3939 return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL;
4040}
4141
42inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
42_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
4343__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) {
4444 return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
4545}
4646
47inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool
47_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI bool
4848__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) {
4949 return mtx_trylock(__m) == thrd_success;
5050}
5151
52inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
52_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
5353__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) {
5454 return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
5555}
......@@ -59,15 +59,15 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_destroy(__libcpp_recur
5959 return 0;
6060}
6161
62inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m) {
62_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mutex_lock(__libcpp_mutex_t* __m) {
6363 return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
6464}
6565
66inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) {
66_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) {
6767 return mtx_trylock(__m) == thrd_success;
6868}
6969
70inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) {
70_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) {
7171 return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
7272}
7373
......@@ -92,12 +92,12 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_broadcast(__libcpp_condvar_t*
9292 return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL;
9393}
9494
95inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
95_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
9696__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) {
9797 return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL;
9898}
9999
100inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
100_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
101101__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts) {
102102 int __ec = cnd_timedwait(__cv, __m, __ts);
103103 return __ec == thrd_timedout ? ETIMEDOUT : __ec;
lib/libcxx/include/__thread/support/pthread.h+8-8
......@@ -72,17 +72,17 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_init(__libcpp_recursiv
7272 return 0;
7373}
7474
75inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
75_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
7676__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) {
7777 return pthread_mutex_lock(__m);
7878}
7979
80inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool
80_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI bool
8181__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) {
8282 return pthread_mutex_trylock(__m) == 0;
8383}
8484
85inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
85_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
8686__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) {
8787 return pthread_mutex_unlock(__m);
8888}
......@@ -91,15 +91,15 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_recursive_mutex_destroy(__libcpp_recur
9191 return pthread_mutex_destroy(__m);
9292}
9393
94inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m) {
94_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mutex_lock(__libcpp_mutex_t* __m) {
9595 return pthread_mutex_lock(__m);
9696}
9797
98inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) {
98_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) {
9999 return pthread_mutex_trylock(__m) == 0;
100100}
101101
102inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) {
102_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) {
103103 return pthread_mutex_unlock(__m);
104104}
105105
......@@ -117,12 +117,12 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_condvar_broadcast(__libcpp_condvar_t*
117117 return pthread_cond_broadcast(__cv);
118118}
119119
120inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
120_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
121121__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) {
122122 return pthread_cond_wait(__cv, __m);
123123}
124124
125inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
125_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI int
126126__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts) {
127127 return pthread_cond_timedwait(__cv, __m, __ts);
128128}
lib/libcxx/include/__thread/support/windows.h+8-8
......@@ -36,22 +36,22 @@ typedef void* __libcpp_recursive_mutex_t[6];
3636
3737_LIBCPP_EXPORTED_FROM_ABI int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m);
3838
39_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
39_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI int
4040__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m);
4141
42_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool
42_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI bool
4343__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m);
4444
45_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
45_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI int
4646__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m);
4747
4848_LIBCPP_EXPORTED_FROM_ABI int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m);
4949
50_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m);
50_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI int __libcpp_mutex_lock(__libcpp_mutex_t* __m);
5151
52_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m);
52_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m);
5353
54_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m);
54_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI int __libcpp_mutex_unlock(__libcpp_mutex_t* __m);
5555
5656_LIBCPP_EXPORTED_FROM_ABI int __libcpp_mutex_destroy(__libcpp_mutex_t* __m);
5757
......@@ -65,10 +65,10 @@ _LIBCPP_EXPORTED_FROM_ABI int __libcpp_condvar_signal(__libcpp_condvar_t* __cv);
6565
6666_LIBCPP_EXPORTED_FROM_ABI int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv);
6767
68_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
68_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI int
6969__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
7070
71_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
71_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_EXPORTED_FROM_ABI int
7272__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts);
7373
7474_LIBCPP_EXPORTED_FROM_ABI int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
lib/libcxx/include/__thread/thread.h+13-8
......@@ -25,6 +25,8 @@
2525#include <__thread/support.h>
2626#include <__type_traits/decay.h>
2727#include <__type_traits/enable_if.h>
28#include <__type_traits/invoke.h>
29#include <__type_traits/is_constructible.h>
2830#include <__type_traits/is_same.h>
2931#include <__type_traits/remove_cvref.h>
3032#include <__utility/forward.h>
......@@ -155,8 +157,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
155157# ifndef _LIBCPP_CXX03_LANG
156158
157159template <class _TSp, class _Fp, class... _Args, size_t... _Indices>
158inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) {
159 std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
160inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __index_sequence<_Indices...>) {
161 std::__invoke(std::move(std::get<_Indices + 1>(__t))...);
160162}
161163
162164template <class _Fp>
......@@ -164,8 +166,7 @@ _LIBCPP_HIDE_FROM_ABI void* __thread_proxy(void* __vp) {
164166 // _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
165167 unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
166168 __thread_local_data().set_pointer(std::get<0>(*__p.get()).release());
167 typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
168 std::__thread_execute(*__p.get(), _Index());
169 std::__thread_execute(*__p.get(), __make_index_sequence<tuple_size<_Fp>::value - 1>());
169170 return nullptr;
170171}
171172
......@@ -206,6 +207,10 @@ public:
206207# ifndef _LIBCPP_CXX03_LANG
207208 template <class _Fp, class... _Args, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value, int> = 0>
208209 _LIBCPP_HIDE_FROM_ABI explicit thread(_Fp&& __f, _Args&&... __args) {
210 static_assert(is_constructible<__decay_t<_Fp>, _Fp>::value, "");
211 static_assert(_And<is_constructible<__decay_t<_Args>, _Args>...>::value, "");
212 static_assert(__is_invocable_v<__decay_t<_Fp>, __decay_t<_Args>...>, "");
213
209214 typedef unique_ptr<__thread_struct> _TSPtr;
210215 _TSPtr __tsp(new __thread_struct);
211216 typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp;
......@@ -243,13 +248,13 @@ public:
243248
244249 _LIBCPP_HIDE_FROM_ABI void swap(thread& __t) _NOEXCEPT { std::swap(__t_, __t.__t_); }
245250
246 _LIBCPP_HIDE_FROM_ABI bool joinable() const _NOEXCEPT { return !__libcpp_thread_isnull(&__t_); }
251 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool joinable() const _NOEXCEPT { return !__libcpp_thread_isnull(&__t_); }
247252 void join();
248253 void detach();
249 _LIBCPP_HIDE_FROM_ABI id get_id() const _NOEXCEPT { return __libcpp_thread_get_id(&__t_); }
250 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() _NOEXCEPT { return __t_; }
254 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI id get_id() const _NOEXCEPT { return __libcpp_thread_get_id(&__t_); }
255 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() _NOEXCEPT { return __t_; }
251256
252 static unsigned hardware_concurrency() _NOEXCEPT;
257 [[__nodiscard__]] static unsigned hardware_concurrency() _NOEXCEPT;
253258};
254259
255260inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x.swap(__y); }
lib/libcxx/include/__thread/timed_backoff_policy.h+3-2
......@@ -11,6 +11,7 @@
1111#define _LIBCPP___THREAD_TIMED_BACKOFF_POLICY_H
1212
1313#include <__config>
14#include <__thread/poll_with_backoff.h>
1415
1516#if _LIBCPP_HAS_THREADS
1617
......@@ -24,7 +25,7 @@
2425_LIBCPP_BEGIN_NAMESPACE_STD
2526
2627struct __libcpp_timed_backoff_policy {
27 _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
28 _LIBCPP_HIDE_FROM_ABI __backoff_results operator()(chrono::nanoseconds __elapsed) const {
2829 if (__elapsed > chrono::milliseconds(128))
2930 __libcpp_thread_sleep_for(chrono::milliseconds(8));
3031 else if (__elapsed > chrono::microseconds(64))
......@@ -33,7 +34,7 @@ struct __libcpp_timed_backoff_policy {
3334 __libcpp_thread_yield();
3435 else {
3536 } // poll
36 return false;
37 return __backoff_results::__continue_poll;
3738 }
3839};
3940
lib/libcxx/include/__tree+849-701
......@@ -11,37 +11,39 @@
1111#define _LIBCPP___TREE
1212
1313#include <__algorithm/min.h>
14#include <__algorithm/specialized_algorithms.h>
1415#include <__assert>
1516#include <__config>
16#include <__fwd/map.h>
1717#include <__fwd/pair.h>
18#include <__fwd/set.h>
1918#include <__iterator/distance.h>
2019#include <__iterator/iterator_traits.h>
2120#include <__iterator/next.h>
2221#include <__memory/addressof.h>
2322#include <__memory/allocator_traits.h>
2423#include <__memory/compressed_pair.h>
24#include <__memory/construct_at.h>
2525#include <__memory/pointer_traits.h>
2626#include <__memory/swap_allocator.h>
2727#include <__memory/unique_ptr.h>
28#include <__type_traits/can_extract_key.h>
28#include <__new/launder.h>
2929#include <__type_traits/copy_cvref.h>
3030#include <__type_traits/enable_if.h>
3131#include <__type_traits/invoke.h>
32#include <__type_traits/is_const.h>
3332#include <__type_traits/is_constructible.h>
3433#include <__type_traits/is_nothrow_assignable.h>
3534#include <__type_traits/is_nothrow_constructible.h>
3635#include <__type_traits/is_same.h>
36#include <__type_traits/is_specialization.h>
3737#include <__type_traits/is_swappable.h>
38#include <__type_traits/make_transparent.h>
3839#include <__type_traits/remove_const.h>
39#include <__type_traits/remove_const_ref.h>
4040#include <__type_traits/remove_cvref.h>
4141#include <__utility/forward.h>
42#include <__utility/lazy_synth_three_way_comparator.h>
4243#include <__utility/move.h>
4344#include <__utility/pair.h>
4445#include <__utility/swap.h>
46#include <__utility/try_key_extraction.h>
4547#include <limits>
4648
4749#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -51,14 +53,31 @@
5153_LIBCPP_PUSH_MACROS
5254#include <__undef_macros>
5355
54_LIBCPP_BEGIN_NAMESPACE_STD
56_LIBCPP_DIAGNOSTIC_PUSH
57// GCC complains about the backslashes at the end, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121528
58_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wcomment")
59// __tree is a red-black-tree implementation used for the associative containers (i.e. (multi)map/set). It stores
60// - (1) a pointer to the node with the smallest (i.e. leftmost) element, namely __begin_node_
61// - (2) the number of nodes in the tree, namely __size_
62// - (3) a pointer to the root of the tree, namely __end_node_
63//
64// Storing (1) and (2) is required to allow for constant time lookups. A tree looks like this in memory:
65//
66// __end_node_
67// |
68// root
69// / \
70// l1 r1
71// / \ / \
72// ... ... ... ...
73//
74// All nodes except __end_node_ have a __left_ and __right_ pointer as well as a __parent_ pointer.
75// __end_node_ only contains a __left_ pointer, which points to the root of the tree.
76// This layout allows for iteration through the tree without a need for special handling of the end node. See
77// __tree_next_iter and __tree_prev_iter for more details.
78_LIBCPP_DIAGNOSTIC_POP
5579
56template <class _Tp, class _Compare, class _Allocator>
57class __tree;
58template <class _Tp, class _NodePtr, class _DiffType>
59class __tree_iterator;
60template <class _Tp, class _ConstNodePtr, class _DiffType>
61class __tree_const_iterator;
80_LIBCPP_BEGIN_NAMESPACE_STD
6281
6382template <class _Pointer>
6483class __tree_end_node;
......@@ -70,13 +89,6 @@ class __tree_node;
7089template <class _Key, class _Value>
7190struct __value_type;
7291
73template <class _Allocator>
74class __map_node_destructor;
75template <class _TreeIterator>
76class __map_iterator;
77template <class _TreeIterator>
78class __map_const_iterator;
79
8092/*
8193
8294_NodePtr algorithms
......@@ -185,6 +197,11 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
185197 return __x->__parent_unsafe();
186198}
187199
200// __tree_next_iter and __tree_prev_iter implement iteration through the tree. The order is as follows:
201// left sub-tree -> node -> right sub-tree. When the right-most node of a sub-tree is reached, we walk up the tree until
202// we find a node where we were in the left sub-tree. We are _always_ in a left sub-tree, since the __end_node_ points
203// to the actual root of the tree through a __left_ pointer. Incrementing the end() pointer is UB, so we can assume that
204// never happens.
188205template <class _EndNodePtr, class _NodePtr>
189206inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
190207 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
......@@ -494,16 +511,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEP
494511// node traits
495512
496513template <class _Tp>
497struct __is_tree_value_type_imp : false_type {};
498
499template <class _Key, class _Value>
500struct __is_tree_value_type_imp<__value_type<_Key, _Value> > : true_type {};
501
502template <class... _Args>
503struct __is_tree_value_type : false_type {};
504
505template <class _One>
506struct __is_tree_value_type<_One> : __is_tree_value_type_imp<__remove_cvref_t<_One> > {};
514inline const bool __is_tree_value_type_v = __is_specialization_v<_Tp, __value_type>;
507515
508516template <class _Tp>
509517struct __get_tree_key_type {
......@@ -549,15 +557,14 @@ private:
549557template <class _Pointer>
550558class __tree_end_node {
551559public:
552 typedef _Pointer pointer;
560 using pointer = _Pointer;
553561 pointer __left_;
554562
555563 _LIBCPP_HIDE_FROM_ABI __tree_end_node() _NOEXCEPT : __left_() {}
556564};
557565
558566template <class _VoidPtr>
559class _LIBCPP_STANDALONE_DEBUG
560__tree_node_base : public __tree_end_node<__rebind_pointer_t<_VoidPtr, __tree_node_base<_VoidPtr> > > {
567class __tree_node_base : public __tree_end_node<__rebind_pointer_t<_VoidPtr, __tree_node_base<_VoidPtr> > > {
561568public:
562569 using pointer = __rebind_pointer_t<_VoidPtr, __tree_node_base>;
563570 using __end_node_pointer _LIBCPP_NODEBUG = __rebind_pointer_t<_VoidPtr, __tree_end_node<pointer> >;
......@@ -570,20 +577,41 @@ public:
570577
571578 _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__end_node_pointer>(__p); }
572579
573 ~__tree_node_base() = delete;
580 _LIBCPP_HIDE_FROM_ABI __tree_node_base() = default;
574581 __tree_node_base(__tree_node_base const&) = delete;
575582 __tree_node_base& operator=(__tree_node_base const&) = delete;
576583};
577584
578585template <class _Tp, class _VoidPtr>
579class _LIBCPP_STANDALONE_DEBUG __tree_node : public __tree_node_base<_VoidPtr> {
586class __tree_node : public __tree_node_base<_VoidPtr> {
580587public:
581588 using __node_value_type _LIBCPP_NODEBUG = __get_node_value_type_t<_Tp>;
582589
583 __node_value_type __value_;
590// We use a union to avoid initialization during member initialization, which allows us
591// to use the allocator from the container to construct the `__node_value_type` in the
592// memory provided by the union member
593#ifndef _LIBCPP_CXX03_LANG
594
595private:
596 union {
597 __node_value_type __value_;
598 };
584599
600public:
585601 _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return __value_; }
602#else
603
604private:
605 _ALIGNAS_TYPE(__node_value_type) unsigned char __buffer_[sizeof(__node_value_type)];
606
607public:
608 _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return *reinterpret_cast<__node_value_type*>(__buffer_); }
609#endif
586610
611 template <class _Alloc, class... _Args>
612 _LIBCPP_HIDE_FROM_ABI explicit __tree_node(_Alloc& __na, _Args&&... __args) {
613 allocator_traits<_Alloc>::construct(__na, std::addressof(__get_value()), std::forward<_Args>(__args)...);
614 }
587615 ~__tree_node() = delete;
588616 __tree_node(__tree_node const&) = delete;
589617 __tree_node& operator=(__tree_node const&) = delete;
......@@ -591,11 +619,11 @@ public:
591619
592620template <class _Allocator>
593621class __tree_node_destructor {
594 typedef _Allocator allocator_type;
595 typedef allocator_traits<allocator_type> __alloc_traits;
622 using allocator_type = _Allocator;
623 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
596624
597625public:
598 typedef typename __alloc_traits::pointer pointer;
626 using pointer = typename __alloc_traits::pointer;
599627
600628private:
601629 allocator_type& __na_;
......@@ -612,7 +640,7 @@ public:
612640
613641 _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
614642 if (__value_constructed)
615 __alloc_traits::destroy(__na_, std::addressof(__p->__value_));
643 __alloc_traits::destroy(__na_, std::addressof(__p->__get_value()));
616644 if (__p)
617645 __alloc_traits::deallocate(__na_, __p, 1);
618646 }
......@@ -630,12 +658,60 @@ struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc> :
630658};
631659#endif
632660
661// Do an in-order traversal of the tree until `__break` returns true. Takes the root node of the tree.
662template <class _Reference, class _Break, class _NodePtr, class _Func, class _Proj>
663#ifndef _LIBCPP_COMPILER_GCC // This function is recursive, so GCC complains about always_inline.
664_LIBCPP_HIDE_FROM_ABI
665#endif
666bool __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _Proj& __proj) {
667 if (__root->__left_) {
668 if (std::__tree_iterate_from_root<_Reference>(__break, static_cast<_NodePtr>(__root->__left_), __func, __proj))
669 return true;
670 }
671 if (__break(__root))
672 return true;
673 std::__invoke(__func, std::__invoke(__proj, static_cast<_Reference>(__root->__get_value())));
674 if (__root->__right_)
675 return std::__tree_iterate_from_root<_Reference>(__break, static_cast<_NodePtr>(__root->__right_), __func, __proj);
676 return false;
677}
678
679// Do an in-order traversal of the tree from __first to __last.
680template <class _NodeIter, class _Func, class _Proj>
681_LIBCPP_HIDE_FROM_ABI void
682__tree_iterate_subrange(_NodeIter __first_it, _NodeIter __last_it, _Func& __func, _Proj& __proj) {
683 using _NodePtr = typename _NodeIter::__node_pointer;
684 using _Reference = typename _NodeIter::reference;
685
686 auto __first = __first_it.__ptr_;
687 auto __last = __last_it.__ptr_;
688
689 while (true) {
690 if (__first == __last)
691 return;
692 const auto __nfirst = static_cast<_NodePtr>(__first);
693 std::__invoke(__func, std::__invoke(__proj, static_cast<_Reference>(__nfirst->__get_value())));
694 if (__nfirst->__right_) {
695 if (std::__tree_iterate_from_root<_Reference>(
696 [&](_NodePtr __node) -> bool { return __node == __last; },
697 static_cast<_NodePtr>(__nfirst->__right_),
698 __func,
699 __proj))
700 return;
701 }
702 while (!std::__tree_is_left_child(static_cast<_NodePtr>(__first)))
703 __first = static_cast<_NodePtr>(__first)->__parent_;
704 __first = static_cast<_NodePtr>(__first)->__parent_;
705 }
706}
707
633708template <class _Tp, class _NodePtr, class _DiffType>
634709class __tree_iterator {
635 typedef __tree_node_types<_NodePtr> _NodeTypes;
636 typedef _NodePtr __node_pointer;
637 typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
638 typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
710 using _NodeTypes _LIBCPP_NODEBUG = __tree_node_types<_NodePtr>;
711 // NOLINTNEXTLINE(libcpp-nodebug-on-aliases) lldb relies on this alias for pretty printing
712 using __node_pointer = _NodePtr;
713 using __node_base_pointer _LIBCPP_NODEBUG = typename _NodeTypes::__node_base_pointer;
714 using __end_node_pointer _LIBCPP_NODEBUG = typename _NodeTypes::__end_node_pointer;
639715
640716 __end_node_pointer __ptr_;
641717
......@@ -646,15 +722,12 @@ public:
646722 using reference = value_type&;
647723 using pointer = __rebind_pointer_t<_NodePtr, value_type>;
648724
649 _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT
650#if _LIBCPP_STD_VER >= 14
651 : __ptr_(nullptr)
652#endif
653 {
654 }
725 _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {}
655726
656 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__value_; }
657 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_np()->__value_); }
727 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); }
728 _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
729 return pointer_traits<pointer>::pointer_to(__get_np()->__get_value());
730 }
658731
659732 _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator++() {
660733 __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_));
......@@ -691,50 +764,54 @@ private:
691764 friend class __tree;
692765 template <class, class, class>
693766 friend class __tree_const_iterator;
694 template <class>
695 friend class __map_iterator;
696 template <class, class, class, class>
697 friend class map;
698 template <class, class, class, class>
699 friend class multimap;
700 template <class, class, class>
701 friend class set;
702 template <class, class, class>
703 friend class multiset;
767
768 template <class _NodeIter, class _Func, class _Proj>
769 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
770};
771
772#ifndef _LIBCPP_CXX03_LANG
773// This also handles {multi,}set::iterator, since they're just aliases to __tree::iterator
774template <class _Tp, class _NodePtr, class _DiffType>
775struct __specialized_algorithm<
776 _Algorithm::__for_each,
777 __iterator_pair<__tree_iterator<_Tp, _NodePtr, _DiffType>, __tree_iterator<_Tp, _NodePtr, _DiffType>>> {
778 static const bool __has_algorithm = true;
779
780 using __iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, _NodePtr, _DiffType>;
781
782 template <class _Func, class _Proj>
783 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) {
784 std::__tree_iterate_subrange(__first, __last, __func, __proj);
785 }
704786};
787#endif
705788
706789template <class _Tp, class _NodePtr, class _DiffType>
707790class __tree_const_iterator {
708 typedef __tree_node_types<_NodePtr> _NodeTypes;
791 using _NodeTypes _LIBCPP_NODEBUG = __tree_node_types<_NodePtr>;
709792 // NOLINTNEXTLINE(libcpp-nodebug-on-aliases) lldb relies on this alias for pretty printing
710 using __node_pointer = _NodePtr;
711 typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
712 typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
793 using __node_pointer = _NodePtr;
794 using __node_base_pointer _LIBCPP_NODEBUG = typename _NodeTypes::__node_base_pointer;
795 using __end_node_pointer _LIBCPP_NODEBUG = typename _NodeTypes::__end_node_pointer;
713796
714797 __end_node_pointer __ptr_;
715798
716799public:
717 using iterator_category = bidirectional_iterator_tag;
718 using value_type = __get_node_value_type_t<_Tp>;
719 using difference_type = _DiffType;
720 using reference = const value_type&;
721 using pointer = __rebind_pointer_t<_NodePtr, const value_type>;
800 using iterator_category = bidirectional_iterator_tag;
801 using value_type = __get_node_value_type_t<_Tp>;
802 using difference_type = _DiffType;
803 using reference = const value_type&;
804 using pointer = __rebind_pointer_t<_NodePtr, const value_type>;
805 using __non_const_iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, __node_pointer, difference_type>;
722806
723 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT
724#if _LIBCPP_STD_VER >= 14
725 : __ptr_(nullptr)
726#endif
727 {
728 }
729
730private:
731 typedef __tree_iterator<_Tp, __node_pointer, difference_type> __non_const_iterator;
807 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
732808
733public:
734809 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
735810
736 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__value_; }
737 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_np()->__value_); }
811 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); }
812 _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
813 return pointer_traits<pointer>::pointer_to(__get_np()->__get_value());
814 }
738815
739816 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator++() {
740817 __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_));
......@@ -772,18 +849,28 @@ private:
772849
773850 template <class, class, class>
774851 friend class __tree;
775 template <class, class, class, class>
776 friend class map;
777 template <class, class, class, class>
778 friend class multimap;
779 template <class, class, class>
780 friend class set;
781 template <class, class, class>
782 friend class multiset;
783 template <class>
784 friend class __map_const_iterator;
852
853 template <class _NodeIter, class _Func, class _Proj>
854 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
785855};
786856
857#ifndef _LIBCPP_CXX03_LANG
858// This also handles {multi,}set::const_iterator, since they're just aliases to __tree::iterator
859template <class _Tp, class _NodePtr, class _DiffType>
860struct __specialized_algorithm<
861 _Algorithm::__for_each,
862 __iterator_pair<__tree_const_iterator<_Tp, _NodePtr, _DiffType>, __tree_const_iterator<_Tp, _NodePtr, _DiffType>>> {
863 static const bool __has_algorithm = true;
864
865 using __iterator _LIBCPP_NODEBUG = __tree_const_iterator<_Tp, _NodePtr, _DiffType>;
866
867 template <class _Func, class _Proj>
868 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) {
869 std::__tree_iterate_subrange(__first, __last, __func, __proj);
870 }
871};
872#endif
873
787874template <class _Tp, class _Compare>
788875#ifndef _LIBCPP_CXX03_LANG
789876_LIBCPP_DIAGNOSE_WARNING(!__is_invocable_v<_Compare const&, _Tp const&, _Tp const&>,
......@@ -794,21 +881,20 @@ int __diagnose_non_const_comparator();
794881template <class _Tp, class _Compare, class _Allocator>
795882class __tree {
796883public:
797 using value_type = __get_node_value_type_t<_Tp>;
798 typedef _Compare value_compare;
799 typedef _Allocator allocator_type;
884 using value_type = __get_node_value_type_t<_Tp>;
885 using value_compare = _Compare;
886 using allocator_type = _Allocator;
800887
801888private:
802 typedef allocator_traits<allocator_type> __alloc_traits;
803 using key_type = __get_tree_key_type_t<_Tp>;
889 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
890 using key_type = __get_tree_key_type_t<_Tp>;
804891
805892public:
806 typedef typename __alloc_traits::pointer pointer;
807 typedef typename __alloc_traits::const_pointer const_pointer;
808 typedef typename __alloc_traits::size_type size_type;
809 typedef typename __alloc_traits::difference_type difference_type;
893 using pointer = typename __alloc_traits::pointer;
894 using const_pointer = typename __alloc_traits::const_pointer;
895 using size_type = typename __alloc_traits::size_type;
896 using difference_type = typename __alloc_traits::difference_type;
810897
811public:
812898 using __void_pointer _LIBCPP_NODEBUG = typename __alloc_traits::void_pointer;
813899
814900 using __node _LIBCPP_NODEBUG = __tree_node<_Tp, __void_pointer>;
......@@ -821,22 +907,8 @@ public:
821907 using __end_node_t _LIBCPP_NODEBUG = __tree_end_node<__node_base_pointer>;
822908 using __end_node_pointer _LIBCPP_NODEBUG = __rebind_pointer_t<__void_pointer, __end_node_t>;
823909
824 using __parent_pointer _LIBCPP_NODEBUG = __end_node_pointer; // TODO: Remove this once the uses in <map> are removed
825
826 typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
827 typedef allocator_traits<__node_allocator> __node_traits;
828
829// TODO(LLVM 22): Remove this check
830#ifndef _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
831 static_assert(sizeof(__node_base_pointer) == sizeof(__end_node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) ==
832 _LIBCPP_ALIGNOF(__end_node_pointer),
833 "It looks like you are using std::__tree (an implementation detail for (multi)map/set) with a fancy "
834 "pointer type that thas a different representation depending on whether it points to a __tree base "
835 "pointer or a __tree node pointer (both of which are implementation details of the standard library). "
836 "This means that your ABI is being broken between LLVM 19 and LLVM 20. If you don't care about your "
837 "ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to silence this "
838 "diagnostic.");
839#endif
910 using __node_allocator _LIBCPP_NODEBUG = __rebind_alloc<__alloc_traits, __node>;
911 using __node_traits _LIBCPP_NODEBUG = allocator_traits<__node_allocator>;
840912
841913private:
842914 // check for sane allocator pointer rebinding semantics. Rebinding the
......@@ -844,8 +916,8 @@ private:
844916 // the pointer using 'pointer_traits'.
845917 static_assert(is_same<__node_pointer, typename __node_traits::pointer>::value,
846918 "Allocator does not rebind pointers in a sane manner.");
847 typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator;
848 typedef allocator_traits<__node_base_allocator> __node_base_traits;
919 using __node_base_allocator _LIBCPP_NODEBUG = __rebind_alloc<__node_traits, __node_base>;
920 using __node_base_traits _LIBCPP_NODEBUG = allocator_traits<__node_base_allocator>;
849921 static_assert(is_same<__node_base_pointer, typename __node_base_traits::pointer>::value,
850922 "Allocator does not rebind pointers in a sane manner.");
851923
......@@ -865,17 +937,11 @@ public:
865937
866938private:
867939 _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; }
868 _LIBCPP_HIDE_FROM_ABI __end_node_pointer& __begin_node() _NOEXCEPT { return __begin_node_; }
869 _LIBCPP_HIDE_FROM_ABI const __end_node_pointer& __begin_node() const _NOEXCEPT { return __begin_node_; }
870940
871941public:
872942 _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
873943
874private:
875 _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; }
876
877public:
878 _LIBCPP_HIDE_FROM_ABI const size_type& size() const _NOEXCEPT { return __size_; }
944 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
879945 _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
880946 _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; }
881947
......@@ -888,32 +954,61 @@ public:
888954 return std::addressof(__end_node()->__left_);
889955 }
890956
891 typedef __tree_iterator<_Tp, __node_pointer, difference_type> iterator;
892 typedef __tree_const_iterator<_Tp, __node_pointer, difference_type> const_iterator;
957 using iterator = __tree_iterator<_Tp, __node_pointer, difference_type>;
958 using const_iterator = __tree_const_iterator<_Tp, __node_pointer, difference_type>;
893959
894960 _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp) _NOEXCEPT_(
895 is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value);
896 _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a);
897 _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a);
961 is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value)
962 : __size_(0), __value_comp_(__comp) {
963 __begin_node_ = __end_node();
964 }
965
966 _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a)
967 : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0) {
968 __begin_node_ = __end_node();
969 }
970
971 _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a)
972 : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) {
973 __begin_node_ = __end_node();
974 }
975
898976 _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
977
978 _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __other, const allocator_type& __alloc)
979 : __begin_node_(__end_node()), __node_alloc_(__alloc), __size_(0), __value_comp_(__other.value_comp()) {
980 if (__other.size() == 0)
981 return;
982
983 *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__other.__root()));
984 __root()->__parent_ = __end_node();
985 __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
986 __size_ = __other.size();
987 }
988
899989 _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
900990 template <class _ForwardIterator>
901991 _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
902 template <class _InputIterator>
903 _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
904992 _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t) _NOEXCEPT_(
905993 is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value);
906994 _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
995
907996 _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t)
908997 _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
909998 ((__node_traits::propagate_on_container_move_assignment::value &&
910999 is_nothrow_move_assignable<__node_allocator>::value) ||
911 allocator_traits<__node_allocator>::is_always_equal::value));
1000 allocator_traits<__node_allocator>::is_always_equal::value)) {
1001 __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
1002 return *this;
1003 }
9121004
913 _LIBCPP_HIDE_FROM_ABI ~__tree();
1005 _LIBCPP_HIDE_FROM_ABI ~__tree() {
1006 static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible.");
1007 destroy(__root());
1008 }
9141009
915 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__begin_node()); }
916 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node()); }
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_); }
9171012 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_node()); }
9181013 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); }
9191014
......@@ -931,116 +1026,151 @@ public:
9311026 _NOEXCEPT_(__is_nothrow_swappable_v<value_compare>);
9321027#endif
9331028
934 template <class _Key, class... _Args>
935 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args&&... __args);
936 template <class _Key, class... _Args>
937 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
938
939 template <class... _Args>
940 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
941
942 template <class... _Args>
943 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args);
944
9451029 template <class... _Args>
9461030 _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
9471031
9481032 template <class... _Args>
9491033 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
9501034
951 template <class _Pp>
952 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Pp&& __x) {
953 return __emplace_unique_extract_key(std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
954 }
955
956 template <class _First,
957 class _Second,
958 __enable_if_t<__can_extract_map_key<_First, key_type, value_type>::value, int> = 0>
959 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_First&& __f, _Second&& __s) {
960 return __emplace_unique_key_args(__f, std::forward<_First>(__f), std::forward<_Second>(__s));
961 }
962
9631035 template <class... _Args>
9641036 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
965 return __emplace_unique_impl(std::forward<_Args>(__args)...);
966 }
967
968 template <class _Pp>
969 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
970 return __emplace_unique_impl(std::forward<_Pp>(__x));
971 }
972
973 template <class _Pp>
974 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
975 return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
976 }
977
978 template <class _Pp>
979 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
980 return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
981 }
982
983 template <class _Pp>
984 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) {
985 return __emplace_hint_unique_extract_key(__p, std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
986 }
987
988 template <class _First,
989 class _Second,
990 __enable_if_t<__can_extract_map_key<_First, key_type, value_type>::value, int> = 0>
991 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
992 return __emplace_hint_unique_key_args(__p, __f, std::forward<_First>(__f), std::forward<_Second>(__s)).first;
1037 return std::__try_key_extraction<key_type>(
1038 [this](const key_type& __key, _Args&&... __args2) {
1039 auto [__parent, __child] = __find_equal(__key);
1040 __node_pointer __r = static_cast<__node_pointer>(__child);
1041 bool __inserted = false;
1042 if (__child == nullptr) {
1043 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
1044 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1045 __r = __h.release();
1046 __inserted = true;
1047 }
1048 return pair<iterator, bool>(iterator(__r), __inserted);
1049 },
1050 [this](_Args&&... __args2) {
1051 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
1052 auto [__parent, __child] = __find_equal(__h->__get_value());
1053 __node_pointer __r = static_cast<__node_pointer>(__child);
1054 bool __inserted = false;
1055 if (__child == nullptr) {
1056 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1057 __r = __h.release();
1058 __inserted = true;
1059 }
1060 return pair<iterator, bool>(iterator(__r), __inserted);
1061 },
1062 std::forward<_Args>(__args)...);
9931063 }
9941064
9951065 template <class... _Args>
996 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
997 return __emplace_hint_unique_impl(__p, std::forward<_Args>(__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>(
1068 [this, __p](const key_type& __key, _Args&&... __args2) {
1069 __node_base_pointer __dummy;
1070 auto [__parent, __child] = __find_equal(__p, __dummy, __key);
1071 __node_pointer __r = static_cast<__node_pointer>(__child);
1072 bool __inserted = false;
1073 if (__child == nullptr) {
1074 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
1075 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1076 __r = __h.release();
1077 __inserted = true;
1078 }
1079 return pair<iterator, bool>(iterator(__r), __inserted);
1080 },
1081 [this, __p](_Args&&... __args2) {
1082 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
1083 __node_base_pointer __dummy;
1084 auto [__parent, __child] = __find_equal(__p, __dummy, __h->__get_value());
1085 __node_pointer __r = static_cast<__node_pointer>(__child);
1086 if (__child == nullptr) {
1087 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1088 __r = __h.release();
1089 }
1090 return pair<iterator, bool>(iterator(__r), __child == nullptr);
1091 },
1092 std::forward<_Args>(__args)...);
9981093 }
9991094
1000 template <class _Pp>
1001 _LIBCPP_HIDE_FROM_ABI iterator
1002 __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) {
1003 return __emplace_hint_unique_impl(__p, std::forward<_Pp>(__x));
1004 }
1095 template <class _InIter, class _Sent>
1096 _LIBCPP_HIDE_FROM_ABI void __insert_range_multi(_InIter __first, _Sent __last) {
1097 if (__first == __last)
1098 return;
10051099
1006 template <class _Pp>
1007 _LIBCPP_HIDE_FROM_ABI iterator
1008 __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
1009 return __emplace_hint_unique_key_args(__p, __x, std::forward<_Pp>(__x)).first;
1010 }
1100 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()));
1103 ++__first;
1104 }
10111105
1012 template <class _Pp>
1013 _LIBCPP_HIDE_FROM_ABI iterator
1014 __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
1015 return __emplace_hint_unique_key_args(__p, __x.first, std::forward<_Pp>(__x)).first;
1016 }
1106 auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
10171107
1018 template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0>
1019 _LIBCPP_HIDE_FROM_ABI void
1020 __insert_unique_from_orphaned_node(const_iterator __p, __get_node_value_type_t<_Tp>&& __value) {
1021 __emplace_hint_unique(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
1108 for (; __first != __last; ++__first) {
1109 __node_holder __nd = __construct_node(*__first);
1110 // Always check the max node first. This optimizes for sorted ranges inserted at the end.
1111 if (!value_comp()(__nd->__get_value(), __max_node->__get_value())) { // __node >= __max_val
1112 __insert_node_at(static_cast<__end_node_pointer>(__max_node),
1113 __max_node->__right_,
1114 static_cast<__node_base_pointer>(__nd.get()));
1115 __max_node = __nd.release();
1116 } else {
1117 __end_node_pointer __parent;
1118 __node_base_pointer& __child = __find_leaf_high(__parent, __nd->__get_value());
1119 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
1120 }
1121 }
10221122 }
10231123
1024 template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type<_ValueT>::value, int> = 0>
1025 _LIBCPP_HIDE_FROM_ABI void __insert_unique_from_orphaned_node(const_iterator __p, _Tp&& __value) {
1026 __emplace_hint_unique(__p, std::move(__value));
1027 }
1124 template <class _InIter, class _Sent>
1125 _LIBCPP_HIDE_FROM_ABI void __insert_range_unique(_InIter __first, _Sent __last) {
1126 if (__first == __last)
1127 return;
10281128
1029 template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0>
1030 _LIBCPP_HIDE_FROM_ABI void __insert_multi_from_orphaned_node(const_iterator __p, value_type&& __value) {
1031 __emplace_hint_multi(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
1032 }
1129 if (__root() == nullptr) {
1130 __insert_node_at(
1131 __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release()));
1132 ++__first;
1133 }
10331134
1034 template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type<_ValueT>::value, int> = 0>
1035 _LIBCPP_HIDE_FROM_ABI void __insert_multi_from_orphaned_node(const_iterator __p, _Tp&& __value) {
1036 __emplace_hint_multi(__p, std::move(__value));
1135 auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
1136
1137 using __reference = decltype(*__first);
1138
1139 for (; __first != __last; ++__first) {
1140 std::__try_key_extraction<key_type>(
1141 [this, &__max_node](const key_type& __key, __reference&& __val) {
1142 if (value_comp()(__max_node->__get_value(), __key)) { // __key > __max_node
1143 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
1144 __insert_node_at(static_cast<__end_node_pointer>(__max_node),
1145 __max_node->__right_,
1146 static_cast<__node_base_pointer>(__nd.get()));
1147 __max_node = __nd.release();
1148 } else {
1149 auto [__parent, __child] = __find_equal(__key);
1150 if (__child == nullptr) {
1151 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
1152 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
1153 }
1154 }
1155 },
1156 [this, &__max_node](__reference&& __val) {
1157 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
1158 if (value_comp()(__max_node->__get_value(), __nd->__get_value())) { // __node > __max_node
1159 __insert_node_at(static_cast<__end_node_pointer>(__max_node),
1160 __max_node->__right_,
1161 static_cast<__node_base_pointer>(__nd.get()));
1162 __max_node = __nd.release();
1163 } else {
1164 auto [__parent, __child] = __find_equal(__nd->__get_value());
1165 if (__child == nullptr) {
1166 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
1167 }
1168 }
1169 },
1170 *__first);
1171 }
10371172 }
10381173
1039 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __node_assign_unique(const value_type& __v, __node_pointer __dest);
1040
1041 _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
1042 _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
1043
10441174 _LIBCPP_HIDE_FROM_ABI iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
10451175
10461176#if _LIBCPP_STD_VER >= 17
......@@ -1048,15 +1178,15 @@ public:
10481178 _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
10491179 template <class _NodeHandle>
10501180 _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
1051 template <class _Tree>
1052 _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(_Tree& __source);
1181 template <class _Comp2>
1182 _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source);
10531183
10541184 template <class _NodeHandle>
10551185 _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&&);
10561186 template <class _NodeHandle>
10571187 _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
1058 template <class _Tree>
1059 _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(_Tree& __source);
1188 template <class _Comp2>
1189 _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source);
10601190
10611191 template <class _NodeHandle>
10621192 _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const&);
......@@ -1075,41 +1205,157 @@ public:
10751205 __insert_node_at(__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
10761206
10771207 template <class _Key>
1078 _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __v);
1208 _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __key) {
1209 auto [__, __match] = __find_equal(__key);
1210 if (__match == nullptr)
1211 return end();
1212 return iterator(static_cast<__node_pointer>(__match));
1213 }
1214
10791215 template <class _Key>
1080 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __v) const;
1216 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __key) const {
1217 auto [__, __match] = __find_equal(__key);
1218 if (__match == nullptr)
1219 return end();
1220 return const_iterator(static_cast<__node_pointer>(__match));
1221 }
10811222
10821223 template <class _Key>
10831224 _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
10841225 template <class _Key>
10851226 _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
10861227
1228 template <bool _LowerBound, class _Key>
1229 _LIBCPP_HIDE_FROM_ABI __end_node_pointer __lower_upper_bound_unique_impl(const _Key& __v) const {
1230 auto __rt = __root();
1231 auto __result = __end_node();
1232 auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp());
1233 while (__rt != nullptr) {
1234 auto __comp_res = __comp(__v, __rt->__get_value());
1235
1236 if (__comp_res.__less()) {
1237 __result = static_cast<__end_node_pointer>(__rt);
1238 __rt = static_cast<__node_pointer>(__rt->__left_);
1239 } else if (__comp_res.__greater()) {
1240 __rt = static_cast<__node_pointer>(__rt->__right_);
1241 } else if _LIBCPP_CONSTEXPR (_LowerBound) {
1242 return static_cast<__end_node_pointer>(__rt);
1243 } else {
1244 return __rt->__right_ ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result;
1245 }
1246 }
1247 return __result;
1248 }
1249
1250 // Compatibility escape hatch for comparators that are not strict weak orderings. This
1251 // can be removed for the LLVM 23 release.
1252#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
10871253 template <class _Key>
1088 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _Key& __v) {
1089 return __lower_bound(__v, __root(), __end_node());
1254 _LIBCPP_HIDE_FROM_ABI __end_node_pointer __lower_bound_unique_compat_impl(const _Key& __v) const {
1255 auto __rt = __root();
1256 auto __result = __end_node();
1257 while (__rt != nullptr) {
1258 if (!value_comp()(__rt->__get_value(), __v)) {
1259 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
1260 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
1261 } else {
1262 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
1263 }
1264 }
1265 return __result;
10901266 }
1267
10911268 template <class _Key>
1092 _LIBCPP_HIDE_FROM_ABI iterator __lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
1269 _LIBCPP_HIDE_FROM_ABI __end_node_pointer __upper_bound_unique_compat_impl(const _Key& __v) const {
1270 auto __rt = __root();
1271 auto __result = __end_node();
1272 while (__rt != nullptr) {
1273 if (value_comp()(__v, __rt->__get_value())) {
1274 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
1275 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
1276 } else {
1277 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
1278 }
1279 }
1280 return __result;
1281 }
1282#endif // _LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND
1283
10931284 template <class _Key>
1094 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _Key& __v) const {
1095 return __lower_bound(__v, __root(), __end_node());
1285 _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_unique(const _Key& __v) {
1286#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
1287 return iterator(__lower_bound_unique_compat_impl(__v));
1288#else
1289 return iterator(__lower_upper_bound_unique_impl<true>(__v));
1290#endif
10961291 }
1292
1293 template <class _Key>
1294 _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_unique(const _Key& __v) const {
1295#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
1296 return const_iterator(__lower_bound_unique_compat_impl(__v));
1297#else
1298 return const_iterator(__lower_upper_bound_unique_impl<true>(__v));
1299#endif
1300 }
1301
1302 template <class _Key>
1303 _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_unique(const _Key& __v) {
1304#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
1305 return iterator(__upper_bound_unique_compat_impl(__v));
1306#else
1307 return iterator(__lower_upper_bound_unique_impl<false>(__v));
1308#endif
1309 }
1310
1311 template <class _Key>
1312 _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_unique(const _Key& __v) const {
1313#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
1314 return iterator(__upper_bound_unique_compat_impl(__v));
1315#else
1316 return iterator(__lower_upper_bound_unique_impl<false>(__v));
1317#endif
1318 }
1319
1320private:
1321 template <class _Key>
1322 _LIBCPP_HIDE_FROM_ABI iterator
1323 __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
1324
10971325 template <class _Key>
10981326 _LIBCPP_HIDE_FROM_ABI const_iterator
1099 __lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
1327 __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
1328
1329public:
11001330 template <class _Key>
1101 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _Key& __v) {
1102 return __upper_bound(__v, __root(), __end_node());
1331 _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_multi(const _Key& __v) {
1332 return __lower_bound_multi(__v, __root(), __end_node());
11031333 }
11041334 template <class _Key>
1105 _LIBCPP_HIDE_FROM_ABI iterator __upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
1335 _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_multi(const _Key& __v) const {
1336 return __lower_bound_multi(__v, __root(), __end_node());
1337 }
1338
1339 template <class _Key>
1340 _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_multi(const _Key& __v) {
1341 return __upper_bound_multi(__v, __root(), __end_node());
1342 }
1343
11061344 template <class _Key>
1107 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _Key& __v) const {
1108 return __upper_bound(__v, __root(), __end_node());
1345 _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_multi(const _Key& __v) const {
1346 return __upper_bound_multi(__v, __root(), __end_node());
11091347 }
1348
1349private:
1350 template <class _Key>
1351 _LIBCPP_HIDE_FROM_ABI iterator
1352 __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
1353
11101354 template <class _Key>
11111355 _LIBCPP_HIDE_FROM_ABI const_iterator
1112 __upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
1356 __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
1357
1358public:
11131359 template <class _Key>
11141360 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
11151361 template <class _Key>
......@@ -1120,22 +1366,24 @@ public:
11201366 template <class _Key>
11211367 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
11221368
1123 typedef __tree_node_destructor<__node_allocator> _Dp;
1124 typedef unique_ptr<__node, _Dp> __node_holder;
1369 using _Dp _LIBCPP_NODEBUG = __tree_node_destructor<__node_allocator>;
1370 using __node_holder _LIBCPP_NODEBUG = unique_ptr<__node, _Dp>;
11251371
11261372 _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
11271373
11281374 // FIXME: Make this function const qualified. Unfortunately doing so
11291375 // breaks existing code which uses non-const callable comparators.
11301376 template <class _Key>
1131 _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__end_node_pointer& __parent, const _Key& __v);
1377 _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v);
1378
11321379 template <class _Key>
1133 _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__end_node_pointer& __parent, const _Key& __v) const {
1134 return const_cast<__tree*>(this)->__find_equal(__parent, __v);
1380 _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v) const {
1381 return const_cast<__tree*>(this)->__find_equal(__v);
11351382 }
1383
11361384 template <class _Key>
1137 _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
1138 __find_equal(const_iterator __hint, __end_node_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v);
1385 _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&>
1386 __find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v);
11391387
11401388 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t) {
11411389 __copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
......@@ -1160,7 +1408,7 @@ private:
11601408 _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
11611409
11621410 // TODO: Make this _LIBCPP_HIDE_FROM_ABI
1163 _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT;
1411 _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT { (__tree_deleter(__node_alloc_))(__nd); }
11641412
11651413 _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
11661414 _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
......@@ -1178,7 +1426,7 @@ private:
11781426 }
11791427 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
11801428
1181 template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0>
1429 template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
11821430 _LIBCPP_HIDE_FROM_ABI static void __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
11831431 using __key_type = __remove_const_t<typename value_type::first_type>;
11841432
......@@ -1188,166 +1436,203 @@ private:
11881436 __lhs.second = std::forward<_From>(__rhs).second;
11891437 }
11901438
1191 template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type<_ValueT>::value, int> = 0>
1439 template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
11921440 _LIBCPP_HIDE_FROM_ABI static void __assign_value(_To& __lhs, _From&& __rhs) {
11931441 __lhs = std::forward<_From>(__rhs);
11941442 }
11951443
1196 struct _DetachedTreeCache {
1197 _LIBCPP_HIDE_FROM_ABI explicit _DetachedTreeCache(__tree* __t) _NOEXCEPT
1198 : __t_(__t),
1199 __cache_root_(__detach_from_tree(__t)) {
1200 __advance();
1444 class __tree_deleter {
1445 __node_allocator& __alloc_;
1446
1447 public:
1448 using pointer = __node_pointer;
1449
1450 _LIBCPP_HIDE_FROM_ABI __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {}
1451
1452#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
1453 _LIBCPP_HIDE_FROM_ABI
1454#endif
1455 void
1456 operator()(__node_pointer __ptr) {
1457 if (!__ptr)
1458 return;
1459
1460 (*this)(static_cast<__node_pointer>(__ptr->__left_));
1461
1462 auto __right = __ptr->__right_;
1463
1464 __node_traits::destroy(__alloc_, std::addressof(__ptr->__get_value()));
1465 __node_traits::deallocate(__alloc_, __ptr, 1);
1466
1467 (*this)(static_cast<__node_pointer>(__right));
12011468 }
1469 };
1470
1471 // This copy construction will always produce a correct red-black-tree assuming the incoming tree is correct, since we
1472 // copy the exact structure 1:1. Since this is for copy construction _only_ we know that we get a correct tree. If we
1473 // didn't get a correct tree, the invariants of __tree are broken and we have a much bigger problem than an improperly
1474 // balanced tree.
1475 template <class _NodeConstructor>
1476#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
1477 _LIBCPP_HIDE_FROM_ABI
1478#endif
1479 __node_pointer __construct_from_tree(__node_pointer __src, _NodeConstructor __construct) {
1480 if (!__src)
1481 return nullptr;
12021482
1203 _LIBCPP_HIDE_FROM_ABI __node_pointer __get() const _NOEXCEPT { return __cache_elem_; }
1483 __node_holder __new_node = __construct(__src->__get_value());
12041484
1205 _LIBCPP_HIDE_FROM_ABI void __advance() _NOEXCEPT {
1206 __cache_elem_ = __cache_root_;
1207 if (__cache_root_) {
1208 __cache_root_ = __detach_next(__cache_root_);
1209 }
1485 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);
1488
1489 __node_pointer __new_node_ptr = __new_node.release();
1490
1491 __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);
1494 if (__new_node_ptr->__left_)
1495 __new_node_ptr->__left_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr);
1496 if (__new_node_ptr->__right_)
1497 __new_node_ptr->__right_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr);
1498 return __new_node_ptr;
1499 }
1500
1501 _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_construct_tree(__node_pointer __src) {
1502 return __construct_from_tree(__src, [this](const value_type& __val) { return __construct_node(__val); });
1503 }
1504
1505 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) {
1507 return __construct_from_tree(__src, [this](value_type& __val) {
1508 return __construct_node(const_cast<key_type&&>(__val.first), std::move(__val.second));
1509 });
1510 }
1511
1512 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) {
1514 return __construct_from_tree(__src, [this](value_type& __val) { return __construct_node(std::move(__val)); });
1515 }
1516
1517 template <class _Assignment, class _ConstructionAlg>
1518 // This copy assignment will always produce a correct red-black-tree assuming the incoming tree is correct, since our
1519 // own tree is a red-black-tree and the incoming tree is a red-black-tree. The invariants of a red-black-tree are
1520 // temporarily not met until all of the incoming red-black tree is copied.
1521#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
1522 _LIBCPP_HIDE_FROM_ABI
1523#endif
1524 __node_pointer __assign_from_tree(
1525 __node_pointer __dest, __node_pointer __src, _Assignment __assign, _ConstructionAlg __construct_subtree) {
1526 if (!__src) {
1527 destroy(__dest);
1528 return nullptr;
12101529 }
12111530
1212 _LIBCPP_HIDE_FROM_ABI ~_DetachedTreeCache() {
1213 __t_->destroy(__cache_elem_);
1214 if (__cache_root_) {
1215 while (__cache_root_->__parent_ != nullptr)
1216 __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
1217 __t_->destroy(__cache_root_);
1218 }
1531 __assign(__dest->__get_value(), __src->__get_value());
1532 __dest->__is_black_ = __src->__is_black_;
1533
1534 // If we already have a left node in the destination tree, reuse it and copy-assign recursively
1535 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_),
1539 __assign,
1540 __construct_subtree));
1541
1542 // Otherwise, we must create new nodes; copy-construct from here on
1543 } 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);
12191547 }
12201548
1221 _DetachedTreeCache(_DetachedTreeCache const&) = delete;
1222 _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
1549 // Identical to the left case above, just for the right nodes
1550 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_),
1554 __assign,
1555 __construct_subtree));
1556 } 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);
1560 }
12231561
1224 private:
1225 _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_from_tree(__tree* __t) _NOEXCEPT;
1226 _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
1562 return __dest;
1563 }
12271564
1228 __tree* __t_;
1229 __node_pointer __cache_root_;
1230 __node_pointer __cache_elem_;
1231 };
1232};
1565 _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_assign_tree(__node_pointer __dest, __node_pointer __src) {
1566 return __assign_from_tree(
1567 __dest,
1568 __src,
1569 [](value_type& __lhs, const value_type& __rhs) { __assign_value(__lhs, __rhs); },
1570 [this](__node_pointer __nd) { return __copy_construct_tree(__nd); });
1571 }
12331572
1234template <class _Tp, class _Compare, class _Allocator>
1235__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) _NOEXCEPT_(
1236 is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value)
1237 : __size_(0), __value_comp_(__comp) {
1238 __begin_node() = __end_node();
1239}
1573 _LIBCPP_HIDE_FROM_ABI __node_pointer __move_assign_tree(__node_pointer __dest, __node_pointer __src) {
1574 return __assign_from_tree(
1575 __dest,
1576 __src,
1577 [](value_type& __lhs, value_type& __rhs) { __assign_value(__lhs, std::move(__rhs)); },
1578 [this](__node_pointer __nd) { return __move_construct_tree(__nd); });
1579 }
12401580
1241template <class _Tp, class _Compare, class _Allocator>
1242__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
1243 : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0) {
1244 __begin_node() = __end_node();
1245}
1581 friend struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree> >;
1582};
12461583
1584#if _LIBCPP_STD_VER >= 14
12471585template <class _Tp, class _Compare, class _Allocator>
1248__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a)
1249 : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) {
1250 __begin_node() = __end_node();
1251}
1586struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp, _Compare, _Allocator> > > {
1587 static const bool __has_algorithm = true;
12521588
1253// Precondition: size() != 0
1254template <class _Tp, class _Compare, class _Allocator>
1255typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
1256__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree* __t) _NOEXCEPT {
1257 __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
1258 __t->__begin_node() = __t->__end_node();
1259 __t->__end_node()->__left_->__parent_ = nullptr;
1260 __t->__end_node()->__left_ = nullptr;
1261 __t->size() = 0;
1262 // __cache->__left_ == nullptr
1263 if (__cache->__right_ != nullptr)
1264 __cache = static_cast<__node_pointer>(__cache->__right_);
1265 // __cache->__left_ == nullptr
1266 // __cache->__right_ == nullptr
1267 return __cache;
1268}
1589 using __node_pointer _LIBCPP_NODEBUG = typename __tree<_Tp, _Compare, _Allocator>::__node_pointer;
12691590
1270// Precondition: __cache != nullptr
1271// __cache->left_ == nullptr
1272// __cache->right_ == nullptr
1273// This is no longer a red-black tree
1274template <class _Tp, class _Compare, class _Allocator>
1275typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
1276__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT {
1277 if (__cache->__parent_ == nullptr)
1278 return nullptr;
1279 if (std::__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) {
1280 __cache->__parent_->__left_ = nullptr;
1281 __cache = static_cast<__node_pointer>(__cache->__parent_);
1282 if (__cache->__right_ == nullptr)
1283 return __cache;
1284 return static_cast<__node_pointer>(std::__tree_leaf(__cache->__right_));
1285 }
1286 // __cache is right child
1287 __cache->__parent_unsafe()->__right_ = nullptr;
1288 __cache = static_cast<__node_pointer>(__cache->__parent_);
1289 if (__cache->__left_ == nullptr)
1290 return __cache;
1291 return static_cast<__node_pointer>(std::__tree_leaf(__cache->__left_));
1292}
1591 template <class _Tree, class _Func, class _Proj>
1592 _LIBCPP_HIDE_FROM_ABI static auto operator()(_Tree&& __range, _Func __func, _Proj __proj) {
1593 if (__range.size() != 0)
1594 std::__tree_iterate_from_root<__copy_cvref_t<_Tree, typename __remove_cvref_t<_Tree>::value_type>>(
1595 [](__node_pointer) { return false; }, __range.__root(), __func, __proj);
1596 return std::make_pair(__range.end(), std::move(__func));
1597 }
1598};
1599#endif
12931600
12941601template <class _Tp, class _Compare, class _Allocator>
12951602__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
1296 if (this != std::addressof(__t)) {
1297 value_comp() = __t.value_comp();
1298 __copy_assign_alloc(__t);
1299 __assign_multi(__t.begin(), __t.end());
1300 }
1301 return *this;
1302}
1603 if (this == std::addressof(__t))
1604 return *this;
13031605
1304template <class _Tp, class _Compare, class _Allocator>
1305template <class _ForwardIterator>
1306void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) {
1307 typedef iterator_traits<_ForwardIterator> _ITraits;
1308 typedef typename _ITraits::value_type _ItValueType;
1309 static_assert(
1310 is_same<_ItValueType, value_type>::value, "__assign_unique may only be called with the containers value type");
1311 static_assert(
1312 __has_forward_iterator_category<_ForwardIterator>::value, "__assign_unique requires a forward iterator");
1313 if (size() != 0) {
1314 _DetachedTreeCache __cache(this);
1315 for (; __cache.__get() != nullptr && __first != __last; ++__first) {
1316 if (__node_assign_unique(*__first, __cache.__get()).second)
1317 __cache.__advance();
1318 }
1319 }
1320 for (; __first != __last; ++__first)
1321 __emplace_unique(*__first);
1322}
1606 value_comp() = __t.value_comp();
1607 __copy_assign_alloc(__t);
13231608
1324template <class _Tp, class _Compare, class _Allocator>
1325template <class _InputIterator>
1326void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) {
1327 typedef iterator_traits<_InputIterator> _ITraits;
1328 typedef typename _ITraits::value_type _ItValueType;
1329 static_assert(
1330 is_same<_ItValueType, value_type>::value, "__assign_multi may only be called with the containers value_type");
1331 if (size() != 0) {
1332 _DetachedTreeCache __cache(this);
1333 for (; __cache.__get() && __first != __last; ++__first) {
1334 __assign_value(__cache.__get()->__value_, *__first);
1335 __node_insert_multi(__cache.__get());
1336 __cache.__advance();
1337 }
1609 if (__size_ != 0) {
1610 *__root_ptr() = static_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root()));
1611 } else {
1612 *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
1613 if (__root())
1614 __root()->__parent_ = __end_node();
13381615 }
1339 const_iterator __e = end();
1340 for (; __first != __last; ++__first)
1341 __emplace_hint_multi(__e, *__first);
1616 __begin_node_ =
1617 __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node();
1618 __size_ = __t.size();
1619
1620 return *this;
13421621}
13431622
13441623template <class _Tp, class _Compare, class _Allocator>
13451624__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
1346 : __begin_node_(),
1625 : __begin_node_(__end_node()),
13471626 __node_alloc_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
13481627 __size_(0),
13491628 __value_comp_(__t.value_comp()) {
1350 __begin_node() = __end_node();
1629 if (__t.size() == 0)
1630 return;
1631
1632 *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
1633 __root()->__parent_ = __end_node();
1634 __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
1635 __size_ = __t.size();
13511636}
13521637
13531638template <class _Tp, class _Compare, class _Allocator>
......@@ -1358,33 +1643,38 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
13581643 __node_alloc_(std::move(__t.__node_alloc_)),
13591644 __size_(__t.__size_),
13601645 __value_comp_(std::move(__t.__value_comp_)) {
1361 if (size() == 0)
1362 __begin_node() = __end_node();
1646 if (__size_ == 0)
1647 __begin_node_ = __end_node();
13631648 else {
13641649 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1365 __t.__begin_node() = __t.__end_node();
1650 __t.__begin_node_ = __t.__end_node();
13661651 __t.__end_node()->__left_ = nullptr;
1367 __t.size() = 0;
1652 __t.__size_ = 0;
13681653 }
13691654}
13701655
13711656template <class _Tp, class _Compare, class _Allocator>
13721657__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
1373 : __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(std::move(__t.value_comp())) {
1658 : __begin_node_(__end_node()),
1659 __node_alloc_(__node_allocator(__a)),
1660 __size_(0),
1661 __value_comp_(std::move(__t.value_comp())) {
1662 if (__t.size() == 0)
1663 return;
13741664 if (__a == __t.__alloc()) {
1375 if (__t.size() == 0)
1376 __begin_node() = __end_node();
1377 else {
1378 __begin_node() = __t.__begin_node();
1379 __end_node()->__left_ = __t.__end_node()->__left_;
1380 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1381 size() = __t.size();
1382 __t.__begin_node() = __t.__end_node();
1383 __t.__end_node()->__left_ = nullptr;
1384 __t.size() = 0;
1385 }
1665 __begin_node_ = __t.__begin_node_;
1666 __end_node()->__left_ = __t.__end_node()->__left_;
1667 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1668 __size_ = __t.__size_;
1669 __t.__begin_node_ = __t.__end_node();
1670 __t.__end_node()->__left_ = nullptr;
1671 __t.__size_ = 0;
13861672 } else {
1387 __begin_node() = __end_node();
1673 *__root_ptr() = static_cast<__node_base_pointer>(__move_construct_tree(__t.__root()));
1674 __root()->__parent_ = __end_node();
1675 __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
1676 __size_ = __t.size();
1677 __t.clear(); // Ensure that __t is in a valid state after moving out the keys
13881678 }
13891679}
13901680
......@@ -1397,61 +1687,33 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
13971687 __move_assign_alloc(__t);
13981688 __size_ = __t.__size_;
13991689 __value_comp_ = std::move(__t.__value_comp_);
1400 if (size() == 0)
1401 __begin_node() = __end_node();
1690 if (__size_ == 0)
1691 __begin_node_ = __end_node();
14021692 else {
14031693 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1404 __t.__begin_node() = __t.__end_node();
1694 __t.__begin_node_ = __t.__end_node();
14051695 __t.__end_node()->__left_ = nullptr;
1406 __t.size() = 0;
1696 __t.__size_ = 0;
14071697 }
14081698}
14091699
14101700template <class _Tp, class _Compare, class _Allocator>
14111701void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
1412 if (__node_alloc() == __t.__node_alloc())
1702 if (__node_alloc() == __t.__node_alloc()) {
14131703 __move_assign(__t, true_type());
1414 else {
1415 value_comp() = std::move(__t.value_comp());
1416 const_iterator __e = end();
1417 if (size() != 0) {
1418 _DetachedTreeCache __cache(this);
1419 while (__cache.__get() != nullptr && __t.size() != 0) {
1420 __assign_value(__cache.__get()->__value_, std::move(__t.remove(__t.begin())->__value_));
1421 __node_insert_multi(__cache.__get());
1422 __cache.__advance();
1423 }
1424 }
1425 while (__t.size() != 0) {
1426 __insert_multi_from_orphaned_node(__e, std::move(__t.remove(__t.begin())->__value_));
1704 } else {
1705 value_comp() = std::move(__t.value_comp());
1706 if (__size_ != 0) {
1707 *__root_ptr() = static_cast<__node_base_pointer>(__move_assign_tree(__root(), __t.__root()));
1708 } else {
1709 *__root_ptr() = static_cast<__node_base_pointer>(__move_construct_tree(__t.__root()));
1710 if (__root())
1711 __root()->__parent_ = __end_node();
14271712 }
1428 }
1429}
1430
1431template <class _Tp, class _Compare, class _Allocator>
1432__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
1433 _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
1434 ((__node_traits::propagate_on_container_move_assignment::value &&
1435 is_nothrow_move_assignable<__node_allocator>::value) ||
1436 allocator_traits<__node_allocator>::is_always_equal::value)) {
1437 __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
1438 return *this;
1439}
1440
1441template <class _Tp, class _Compare, class _Allocator>
1442__tree<_Tp, _Compare, _Allocator>::~__tree() {
1443 static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible.");
1444 destroy(__root());
1445}
1446
1447template <class _Tp, class _Compare, class _Allocator>
1448void __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT {
1449 if (__nd != nullptr) {
1450 destroy(static_cast<__node_pointer>(__nd->__left_));
1451 destroy(static_cast<__node_pointer>(__nd->__right_));
1452 __node_allocator& __na = __node_alloc();
1453 __node_traits::destroy(__na, std::addressof(__nd->__value_));
1454 __node_traits::deallocate(__na, __nd, 1);
1713 __begin_node_ =
1714 __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node();
1715 __size_ = __t.size();
1716 __t.clear(); // Ensure that __t is in a valid state after moving out the keys
14551717 }
14561718}
14571719
......@@ -1470,12 +1732,12 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
14701732 std::__swap_allocator(__node_alloc(), __t.__node_alloc());
14711733 swap(__size_, __t.__size_);
14721734 swap(__value_comp_, __t.__value_comp_);
1473 if (size() == 0)
1474 __begin_node() = __end_node();
1735 if (__size_ == 0)
1736 __begin_node_ = __end_node();
14751737 else
14761738 __end_node()->__left_->__parent_ = __end_node();
1477 if (__t.size() == 0)
1478 __t.__begin_node() = __t.__end_node();
1739 if (__t.__size_ == 0)
1740 __t.__begin_node_ = __t.__end_node();
14791741 else
14801742 __t.__end_node()->__left_->__parent_ = __t.__end_node();
14811743}
......@@ -1483,8 +1745,8 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
14831745template <class _Tp, class _Compare, class _Allocator>
14841746void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
14851747 destroy(__root());
1486 size() = 0;
1487 __begin_node() = __end_node();
1748 __size_ = 0;
1749 __begin_node_ = __end_node();
14881750 __end_node()->__left_ = nullptr;
14891751}
14901752
......@@ -1497,7 +1759,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent,
14971759 __node_pointer __nd = __root();
14981760 if (__nd != nullptr) {
14991761 while (true) {
1500 if (value_comp()(__nd->__value_, __v)) {
1762 if (value_comp()(__nd->__get_value(), __v)) {
15011763 if (__nd->__right_ != nullptr)
15021764 __nd = static_cast<__node_pointer>(__nd->__right_);
15031765 else {
......@@ -1527,7 +1789,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
15271789 __node_pointer __nd = __root();
15281790 if (__nd != nullptr) {
15291791 while (true) {
1530 if (value_comp()(__v, __nd->__value_)) {
1792 if (value_comp()(__v, __nd->__get_value())) {
15311793 if (__nd->__left_ != nullptr)
15321794 __nd = static_cast<__node_pointer>(__nd->__left_);
15331795 else {
......@@ -1578,92 +1840,91 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co
15781840 return __find_leaf_low(__parent, __v);
15791841}
15801842
1581// Find place to insert if __v doesn't exist
1582// Set __parent to parent of null leaf
1583// Return reference to null leaf
1584// If __v exists, set parent to node of __v and return reference to node of __v
1843// Find __v
1844// If __v exists, return the parent of the node of __v and a reference to the pointer to the node of __v.
1845// If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf.
15851846template <class _Tp, class _Compare, class _Allocator>
15861847template <class _Key>
1587typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
1588__tree<_Tp, _Compare, _Allocator>::__find_equal(__end_node_pointer& __parent, const _Key& __v) {
1589 __node_pointer __nd = __root();
1590 __node_base_pointer* __nd_ptr = __root_ptr();
1591 if (__nd != nullptr) {
1592 while (true) {
1593 if (value_comp()(__v, __nd->__value_)) {
1594 if (__nd->__left_ != nullptr) {
1595 __nd_ptr = std::addressof(__nd->__left_);
1596 __nd = static_cast<__node_pointer>(__nd->__left_);
1597 } else {
1598 __parent = static_cast<__end_node_pointer>(__nd);
1599 return __parent->__left_;
1600 }
1601 } else if (value_comp()(__nd->__value_, __v)) {
1602 if (__nd->__right_ != nullptr) {
1603 __nd_ptr = std::addressof(__nd->__right_);
1604 __nd = static_cast<__node_pointer>(__nd->__right_);
1605 } else {
1606 __parent = static_cast<__end_node_pointer>(__nd);
1607 return __nd->__right_;
1608 }
1609 } else {
1610 __parent = static_cast<__end_node_pointer>(__nd);
1611 return *__nd_ptr;
1612 }
1848_LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
1849 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
1850__tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
1851 using _Pair = pair<__end_node_pointer, __node_base_pointer&>;
1852
1853 __node_pointer __nd = __root();
1854
1855 if (__nd == nullptr) {
1856 auto __end = __end_node();
1857 return _Pair(__end, __end->__left_);
1858 }
1859
1860 __node_base_pointer* __node_ptr = __root_ptr();
1861 auto&& __transparent = std::__as_transparent<_Key>(value_comp());
1862 auto __comp =
1863 __lazy_synth_three_way_comparator<__make_transparent_t<_Key, _Compare>, _Key, value_type>(__transparent);
1864
1865 while (true) {
1866 auto __comp_res = __comp(__v, __nd->__get_value());
1867
1868 if (__comp_res.__less()) {
1869 if (__nd->__left_ == nullptr)
1870 return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__left_);
1871
1872 __node_ptr = std::addressof(__nd->__left_);
1873 __nd = static_cast<__node_pointer>(__nd->__left_);
1874 } else if (__comp_res.__greater()) {
1875 if (__nd->__right_ == nullptr)
1876 return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__right_);
1877
1878 __node_ptr = std::addressof(__nd->__right_);
1879 __nd = static_cast<__node_pointer>(__nd->__right_);
1880 } else {
1881 return _Pair(static_cast<__end_node_pointer>(__nd), *__node_ptr);
16131882 }
16141883 }
1615 __parent = __end_node();
1616 return __parent->__left_;
16171884}
16181885
1619// Find place to insert if __v doesn't exist
1886// Find __v
16201887// First check prior to __hint.
16211888// Next check after __hint.
16221889// Next do O(log N) search.
1623// Set __parent to parent of null leaf
1624// Return reference to null leaf
1625// If __v exists, set parent to node of __v and return reference to node of __v
1890// If __v exists, return the parent of the node of __v and a reference to the pointer to the node of __v.
1891// If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf.
16261892template <class _Tp, class _Compare, class _Allocator>
16271893template <class _Key>
1628typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_equal(
1629 const_iterator __hint, __end_node_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v) {
1630 if (__hint == end() || value_comp()(__v, *__hint)) // check before
1631 {
1894_LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
1895 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
1896__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v) {
1897 using _Pair = pair<__end_node_pointer, __node_base_pointer&>;
1898
1899 if (__hint == end() || value_comp()(__v, *__hint)) { // check before
16321900 // __v < *__hint
16331901 const_iterator __prior = __hint;
16341902 if (__prior == begin() || value_comp()(*--__prior, __v)) {
16351903 // *prev(__hint) < __v < *__hint
1636 if (__hint.__ptr_->__left_ == nullptr) {
1637 __parent = __hint.__ptr_;
1638 return __parent->__left_;
1639 } else {
1640 __parent = __prior.__ptr_;
1641 return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
1642 }
1904 if (__hint.__ptr_->__left_ == nullptr)
1905 return _Pair(__hint.__ptr_, __hint.__ptr_->__left_);
1906 return _Pair(__prior.__ptr_, static_cast<__node_pointer>(__prior.__ptr_)->__right_);
16431907 }
16441908 // __v <= *prev(__hint)
1645 return __find_equal(__parent, __v);
1646 } else if (value_comp()(*__hint, __v)) // check after
1647 {
1909 return __find_equal(__v);
1910 }
1911
1912 if (value_comp()(*__hint, __v)) { // check after
16481913 // *__hint < __v
16491914 const_iterator __next = std::next(__hint);
16501915 if (__next == end() || value_comp()(__v, *__next)) {
16511916 // *__hint < __v < *std::next(__hint)
1652 if (__hint.__get_np()->__right_ == nullptr) {
1653 __parent = __hint.__ptr_;
1654 return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_;
1655 } else {
1656 __parent = __next.__ptr_;
1657 return __parent->__left_;
1658 }
1917 if (__hint.__get_np()->__right_ == nullptr)
1918 return _Pair(__hint.__ptr_, static_cast<__node_pointer>(__hint.__ptr_)->__right_);
1919 return _Pair(__next.__ptr_, __next.__ptr_->__left_);
16591920 }
16601921 // *next(__hint) <= __v
1661 return __find_equal(__parent, __v);
1922 return __find_equal(__v);
16621923 }
1924
16631925 // else __v == *__hint
1664 __parent = __hint.__ptr_;
1665 __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
1666 return __dummy;
1926 __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
1927 return _Pair(__hint.__ptr_, __dummy);
16671928}
16681929
16691930template <class _Tp, class _Compare, class _Allocator>
......@@ -1674,46 +1935,10 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
16741935 __new_node->__parent_ = __parent;
16751936 // __new_node->__is_black_ is initialized in __tree_balance_after_insert
16761937 __child = __new_node;
1677 if (__begin_node()->__left_ != nullptr)
1678 __begin_node() = static_cast<__end_node_pointer>(__begin_node()->__left_);
1938 if (__begin_node_->__left_ != nullptr)
1939 __begin_node_ = static_cast<__end_node_pointer>(__begin_node_->__left_);
16791940 std::__tree_balance_after_insert(__end_node()->__left_, __child);
1680 ++size();
1681}
1682
1683template <class _Tp, class _Compare, class _Allocator>
1684template <class _Key, class... _Args>
1685pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
1686__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) {
1687 __end_node_pointer __parent;
1688 __node_base_pointer& __child = __find_equal(__parent, __k);
1689 __node_pointer __r = static_cast<__node_pointer>(__child);
1690 bool __inserted = false;
1691 if (__child == nullptr) {
1692 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
1693 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1694 __r = __h.release();
1695 __inserted = true;
1696 }
1697 return pair<iterator, bool>(iterator(__r), __inserted);
1698}
1699
1700template <class _Tp, class _Compare, class _Allocator>
1701template <class _Key, class... _Args>
1702pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
1703__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
1704 const_iterator __p, _Key const& __k, _Args&&... __args) {
1705 __end_node_pointer __parent;
1706 __node_base_pointer __dummy;
1707 __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
1708 __node_pointer __r = static_cast<__node_pointer>(__child);
1709 bool __inserted = false;
1710 if (__child == nullptr) {
1711 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
1712 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1713 __r = __h.release();
1714 __inserted = true;
1715 }
1716 return pair<iterator, bool>(iterator(__r), __inserted);
1941 ++__size_;
17171942}
17181943
17191944template <class _Tp, class _Compare, class _Allocator>
......@@ -1722,51 +1947,18 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
17221947__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
17231948 __node_allocator& __na = __node_alloc();
17241949 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1725 __node_traits::construct(__na, std::addressof(__h->__value_), std::forward<_Args>(__args)...);
1950 std::__construct_at(std::addressof(*__h), __na, std::forward<_Args>(__args)...);
17261951 __h.get_deleter().__value_constructed = true;
17271952 return __h;
17281953}
17291954
1730template <class _Tp, class _Compare, class _Allocator>
1731template <class... _Args>
1732pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
1733__tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) {
1734 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
1735 __end_node_pointer __parent;
1736 __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
1737 __node_pointer __r = static_cast<__node_pointer>(__child);
1738 bool __inserted = false;
1739 if (__child == nullptr) {
1740 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1741 __r = __h.release();
1742 __inserted = true;
1743 }
1744 return pair<iterator, bool>(iterator(__r), __inserted);
1745}
1746
1747template <class _Tp, class _Compare, class _Allocator>
1748template <class... _Args>
1749typename __tree<_Tp, _Compare, _Allocator>::iterator
1750__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args) {
1751 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
1752 __end_node_pointer __parent;
1753 __node_base_pointer __dummy;
1754 __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_);
1755 __node_pointer __r = static_cast<__node_pointer>(__child);
1756 if (__child == nullptr) {
1757 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1758 __r = __h.release();
1759 }
1760 return iterator(__r);
1761}
1762
17631955template <class _Tp, class _Compare, class _Allocator>
17641956template <class... _Args>
17651957typename __tree<_Tp, _Compare, _Allocator>::iterator
17661958__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
17671959 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
17681960 __end_node_pointer __parent;
1769 __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
1961 __node_base_pointer& __child = __find_leaf_high(__parent, __h->__get_value());
17701962 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
17711963 return iterator(static_cast<__node_pointer>(__h.release()));
17721964}
......@@ -1777,53 +1969,19 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator
17771969__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
17781970 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
17791971 __end_node_pointer __parent;
1780 __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
1972 __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__get_value());
17811973 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
17821974 return iterator(static_cast<__node_pointer>(__h.release()));
17831975}
17841976
1785template <class _Tp, class _Compare, class _Allocator>
1786pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
1787__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const value_type& __v, __node_pointer __nd) {
1788 __end_node_pointer __parent;
1789 __node_base_pointer& __child = __find_equal(__parent, __v);
1790 __node_pointer __r = static_cast<__node_pointer>(__child);
1791 bool __inserted = false;
1792 if (__child == nullptr) {
1793 __assign_value(__nd->__value_, __v);
1794 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
1795 __r = __nd;
1796 __inserted = true;
1797 }
1798 return pair<iterator, bool>(iterator(__r), __inserted);
1799}
1800
1801template <class _Tp, class _Compare, class _Allocator>
1802typename __tree<_Tp, _Compare, _Allocator>::iterator
1803__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd) {
1804 __end_node_pointer __parent;
1805 __node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
1806 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
1807 return iterator(__nd);
1808}
1809
1810template <class _Tp, class _Compare, class _Allocator>
1811typename __tree<_Tp, _Compare, _Allocator>::iterator
1812__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, __node_pointer __nd) {
1813 __end_node_pointer __parent;
1814 __node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
1815 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
1816 return iterator(__nd);
1817}
1818
18191977template <class _Tp, class _Compare, class _Allocator>
18201978typename __tree<_Tp, _Compare, _Allocator>::iterator
18211979__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT {
18221980 iterator __r(__ptr);
18231981 ++__r;
1824 if (__begin_node() == __ptr)
1825 __begin_node() = __r.__ptr_;
1826 --size();
1982 if (__begin_node_ == __ptr)
1983 __begin_node_ = __r.__ptr_;
1984 --__size_;
18271985 std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr));
18281986 return __r;
18291987}
......@@ -1837,8 +1995,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __n
18371995 return _InsertReturnType{end(), false, _NodeHandle()};
18381996
18391997 __node_pointer __ptr = __nh.__ptr_;
1840 __end_node_pointer __parent;
1841 __node_base_pointer& __child = __find_equal(__parent, __ptr->__value_);
1998 auto [__parent, __child] = __find_equal(__ptr->__get_value());
18421999 if (__child != nullptr)
18432000 return _InsertReturnType{iterator(static_cast<__node_pointer>(__child)), false, std::move(__nh)};
18442001
......@@ -1855,10 +2012,9 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __
18552012 return end();
18562013
18572014 __node_pointer __ptr = __nh.__ptr_;
1858 __end_node_pointer __parent;
18592015 __node_base_pointer __dummy;
1860 __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy, __ptr->__value_);
1861 __node_pointer __r = static_cast<__node_pointer>(__child);
2016 auto [__parent, __child] = __find_equal(__hint, __dummy, __ptr->__get_value());
2017 __node_pointer __r = static_cast<__node_pointer>(__child);
18622018 if (__child == nullptr) {
18632019 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
18642020 __r = __ptr;
......@@ -1885,14 +2041,12 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand
18852041}
18862042
18872043template <class _Tp, class _Compare, class _Allocator>
1888template <class _Tree>
1889_LIBCPP_HIDE_FROM_ABI void __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source) {
1890 static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
1891
1892 for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
2044template <class _Comp2>
2045_LIBCPP_HIDE_FROM_ABI void
2046__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source) {
2047 for (iterator __i = __source.begin(); __i != __source.end();) {
18932048 __node_pointer __src_ptr = __i.__get_np();
1894 __end_node_pointer __parent;
1895 __node_base_pointer& __child = __find_equal(__parent, __src_ptr->__value_);
2049 auto [__parent, __child] = __find_equal(__src_ptr->__get_value());
18962050 ++__i;
18972051 if (__child != nullptr)
18982052 continue;
......@@ -1909,7 +2063,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh
19092063 return end();
19102064 __node_pointer __ptr = __nh.__ptr_;
19112065 __end_node_pointer __parent;
1912 __node_base_pointer& __child = __find_leaf_high(__parent, __ptr->__value_);
2066 __node_base_pointer& __child = __find_leaf_high(__parent, __ptr->__get_value());
19132067 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
19142068 __nh.__release_ptr();
19152069 return iterator(__ptr);
......@@ -1924,21 +2078,20 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __h
19242078
19252079 __node_pointer __ptr = __nh.__ptr_;
19262080 __end_node_pointer __parent;
1927 __node_base_pointer& __child = __find_leaf(__hint, __parent, __ptr->__value_);
2081 __node_base_pointer& __child = __find_leaf(__hint, __parent, __ptr->__get_value());
19282082 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
19292083 __nh.__release_ptr();
19302084 return iterator(__ptr);
19312085}
19322086
19332087template <class _Tp, class _Compare, class _Allocator>
1934template <class _Tree>
1935_LIBCPP_HIDE_FROM_ABI void __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source) {
1936 static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
1937
1938 for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
2088template <class _Comp2>
2089_LIBCPP_HIDE_FROM_ABI void
2090__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source) {
2091 for (iterator __i = __source.begin(); __i != __source.end();) {
19392092 __node_pointer __src_ptr = __i.__get_np();
19402093 __end_node_pointer __parent;
1941 __node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__value_);
2094 __node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__get_value());
19422095 ++__i;
19432096 __source.__remove_node_pointer(__src_ptr);
19442097 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
......@@ -1987,34 +2140,17 @@ __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
19872140 return __r;
19882141}
19892142
1990template <class _Tp, class _Compare, class _Allocator>
1991template <class _Key>
1992typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) {
1993 iterator __p = __lower_bound(__v, __root(), __end_node());
1994 if (__p != end() && !value_comp()(__v, *__p))
1995 return __p;
1996 return end();
1997}
1998
1999template <class _Tp, class _Compare, class _Allocator>
2000template <class _Key>
2001typename __tree<_Tp, _Compare, _Allocator>::const_iterator
2002__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const {
2003 const_iterator __p = __lower_bound(__v, __root(), __end_node());
2004 if (__p != end() && !value_comp()(__v, *__p))
2005 return __p;
2006 return end();
2007}
2008
20092143template <class _Tp, class _Compare, class _Allocator>
20102144template <class _Key>
20112145typename __tree<_Tp, _Compare, _Allocator>::size_type
20122146__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
20132147 __node_pointer __rt = __root();
2148 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
20142149 while (__rt != nullptr) {
2015 if (value_comp()(__k, __rt->__value_)) {
2150 auto __comp_res = __comp(__k, __rt->__get_value());
2151 if (__comp_res.__less()) {
20162152 __rt = static_cast<__node_pointer>(__rt->__left_);
2017 } else if (value_comp()(__rt->__value_, __k))
2153 } else if (__comp_res.__greater())
20182154 __rt = static_cast<__node_pointer>(__rt->__right_);
20192155 else
20202156 return 1;
......@@ -2028,26 +2164,28 @@ typename __tree<_Tp, _Compare, _Allocator>::size_type
20282164__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
20292165 __end_node_pointer __result = __end_node();
20302166 __node_pointer __rt = __root();
2167 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
20312168 while (__rt != nullptr) {
2032 if (value_comp()(__k, __rt->__value_)) {
2169 auto __comp_res = __comp(__k, __rt->__get_value());
2170 if (__comp_res.__less()) {
20332171 __result = static_cast<__end_node_pointer>(__rt);
20342172 __rt = static_cast<__node_pointer>(__rt->__left_);
2035 } else if (value_comp()(__rt->__value_, __k))
2173 } else if (__comp_res.__greater())
20362174 __rt = static_cast<__node_pointer>(__rt->__right_);
20372175 else
20382176 return std::distance(
2039 __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
2040 __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
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));
20412179 }
20422180 return 0;
20432181}
20442182
20452183template <class _Tp, class _Compare, class _Allocator>
20462184template <class _Key>
2047typename __tree<_Tp, _Compare, _Allocator>::iterator
2048__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
2185typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
2186 const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
20492187 while (__root != nullptr) {
2050 if (!value_comp()(__root->__value_, __v)) {
2188 if (!value_comp()(__root->__get_value(), __v)) {
20512189 __result = static_cast<__end_node_pointer>(__root);
20522190 __root = static_cast<__node_pointer>(__root->__left_);
20532191 } else
......@@ -2058,10 +2196,10 @@ __tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer
20582196
20592197template <class _Tp, class _Compare, class _Allocator>
20602198template <class _Key>
2061typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound(
2199typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
20622200 const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
20632201 while (__root != nullptr) {
2064 if (!value_comp()(__root->__value_, __v)) {
2202 if (!value_comp()(__root->__get_value(), __v)) {
20652203 __result = static_cast<__end_node_pointer>(__root);
20662204 __root = static_cast<__node_pointer>(__root->__left_);
20672205 } else
......@@ -2072,10 +2210,10 @@ typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare,
20722210
20732211template <class _Tp, class _Compare, class _Allocator>
20742212template <class _Key>
2075typename __tree<_Tp, _Compare, _Allocator>::iterator
2076__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
2213typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
2214 const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
20772215 while (__root != nullptr) {
2078 if (value_comp()(__v, __root->__value_)) {
2216 if (value_comp()(__v, __root->__get_value())) {
20792217 __result = static_cast<__end_node_pointer>(__root);
20802218 __root = static_cast<__node_pointer>(__root->__left_);
20812219 } else
......@@ -2086,10 +2224,10 @@ __tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer
20862224
20872225template <class _Tp, class _Compare, class _Allocator>
20882226template <class _Key>
2089typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound(
2227typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
20902228 const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
20912229 while (__root != nullptr) {
2092 if (value_comp()(__v, __root->__value_)) {
2230 if (value_comp()(__v, __root->__get_value())) {
20932231 __result = static_cast<__end_node_pointer>(__root);
20942232 __root = static_cast<__node_pointer>(__root->__left_);
20952233 } else
......@@ -2102,14 +2240,16 @@ template <class _Tp, class _Compare, class _Allocator>
21022240template <class _Key>
21032241pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
21042242__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
2105 typedef pair<iterator, iterator> _Pp;
2243 using _Pp = pair<iterator, iterator>;
21062244 __end_node_pointer __result = __end_node();
21072245 __node_pointer __rt = __root();
2246 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
21082247 while (__rt != nullptr) {
2109 if (value_comp()(__k, __rt->__value_)) {
2248 auto __comp_res = __comp(__k, __rt->__get_value());
2249 if (__comp_res.__less()) {
21102250 __result = static_cast<__end_node_pointer>(__rt);
21112251 __rt = static_cast<__node_pointer>(__rt->__left_);
2112 } else if (value_comp()(__rt->__value_, __k))
2252 } else if (__comp_res.__greater())
21132253 __rt = static_cast<__node_pointer>(__rt->__right_);
21142254 else
21152255 return _Pp(iterator(__rt),
......@@ -2124,14 +2264,16 @@ template <class _Key>
21242264pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
21252265 typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
21262266__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
2127 typedef pair<const_iterator, const_iterator> _Pp;
2267 using _Pp = pair<const_iterator, const_iterator>;
21282268 __end_node_pointer __result = __end_node();
21292269 __node_pointer __rt = __root();
2270 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
21302271 while (__rt != nullptr) {
2131 if (value_comp()(__k, __rt->__value_)) {
2272 auto __comp_res = __comp(__k, __rt->__get_value());
2273 if (__comp_res.__less()) {
21322274 __result = static_cast<__end_node_pointer>(__rt);
21332275 __rt = static_cast<__node_pointer>(__rt->__left_);
2134 } else if (value_comp()(__rt->__value_, __k))
2276 } else if (__comp_res.__greater())
21352277 __rt = static_cast<__node_pointer>(__rt->__right_);
21362278 else
21372279 return _Pp(
......@@ -2146,18 +2288,21 @@ template <class _Tp, class _Compare, class _Allocator>
21462288template <class _Key>
21472289pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
21482290__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
2149 typedef pair<iterator, iterator> _Pp;
2291 using _Pp = pair<iterator, iterator>;
21502292 __end_node_pointer __result = __end_node();
2151 __node_pointer __rt = __root();
2293 __node_pointer __rt = __root();
2294 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
21522295 while (__rt != nullptr) {
2153 if (value_comp()(__k, __rt->__value_)) {
2296 auto __comp_res = __comp(__k, __rt->__get_value());
2297 if (__comp_res.__less()) {
21542298 __result = static_cast<__end_node_pointer>(__rt);
21552299 __rt = static_cast<__node_pointer>(__rt->__left_);
2156 } else if (value_comp()(__rt->__value_, __k))
2300 } else if (__comp_res.__greater())
21572301 __rt = static_cast<__node_pointer>(__rt->__right_);
21582302 else
2159 return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
2160 __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
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));
21612306 }
21622307 return _Pp(iterator(__result), iterator(__result));
21632308}
......@@ -2167,18 +2312,21 @@ template <class _Key>
21672312pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
21682313 typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
21692314__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
2170 typedef pair<const_iterator, const_iterator> _Pp;
2315 using _Pp = pair<const_iterator, const_iterator>;
21712316 __end_node_pointer __result = __end_node();
2172 __node_pointer __rt = __root();
2317 __node_pointer __rt = __root();
2318 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
21732319 while (__rt != nullptr) {
2174 if (value_comp()(__k, __rt->__value_)) {
2320 auto __comp_res = __comp(__k, __rt->__get_value());
2321 if (__comp_res.__less()) {
21752322 __result = static_cast<__end_node_pointer>(__rt);
21762323 __rt = static_cast<__node_pointer>(__rt->__left_);
2177 } else if (value_comp()(__rt->__value_, __k))
2324 } else if (__comp_res.__greater())
21782325 __rt = static_cast<__node_pointer>(__rt->__right_);
21792326 else
2180 return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
2181 __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
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));
21822330 }
21832331 return _Pp(const_iterator(__result), const_iterator(__result));
21842332}
......@@ -2187,13 +2335,13 @@ template <class _Tp, class _Compare, class _Allocator>
21872335typename __tree<_Tp, _Compare, _Allocator>::__node_holder
21882336__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT {
21892337 __node_pointer __np = __p.__get_np();
2190 if (__begin_node() == __p.__ptr_) {
2338 if (__begin_node_ == __p.__ptr_) {
21912339 if (__np->__right_ != nullptr)
2192 __begin_node() = static_cast<__end_node_pointer>(__np->__right_);
2340 __begin_node_ = static_cast<__end_node_pointer>(__np->__right_);
21932341 else
2194 __begin_node() = static_cast<__end_node_pointer>(__np->__parent_);
2342 __begin_node_ = static_cast<__end_node_pointer>(__np->__parent_);
21952343 }
2196 --size();
2344 --__size_;
21972345 std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np));
21982346 return __node_holder(__np, _Dp(__node_alloc(), true));
21992347}
lib/libcxx/include/__tuple/sfinae_helpers.h+1-44
......@@ -10,20 +10,6 @@
1010#define _LIBCPP___TUPLE_SFINAE_HELPERS_H
1111
1212#include <__config>
13#include <__cstddef/size_t.h>
14#include <__fwd/tuple.h>
15#include <__tuple/make_tuple_types.h>
16#include <__tuple/tuple_element.h>
17#include <__tuple/tuple_like_ext.h>
18#include <__tuple/tuple_size.h>
19#include <__tuple/tuple_types.h>
20#include <__type_traits/conjunction.h>
21#include <__type_traits/enable_if.h>
22#include <__type_traits/integral_constant.h>
23#include <__type_traits/is_constructible.h>
24#include <__type_traits/is_same.h>
25#include <__type_traits/remove_cvref.h>
26#include <__type_traits/remove_reference.h>
2713
2814#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2915# pragma GCC system_header
......@@ -33,36 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3319
3420#ifndef _LIBCPP_CXX03_LANG
3521
36struct __tuple_sfinae_base {
37 template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
38 static auto __do_test(__tuple_types<_LArgs...>,
39 __tuple_types<_RArgs...>) -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
40 template <template <class...> class>
41 static auto __do_test(...) -> false_type;
42
43 template <class _FromArgs, class _ToArgs>
44 using __constructible _LIBCPP_NODEBUG = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{}));
45};
46
47// __tuple_constructible
48
49template <class _Tp,
50 class _Up,
51 bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
52 bool = __tuple_like_ext<_Up>::value>
53struct __tuple_constructible : public false_type {};
54
55template <class _Tp, class _Up>
56struct __tuple_constructible<_Tp, _Up, true, true>
57 : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type,
58 typename __make_tuple_types<_Up>::type > {};
59
60template <size_t _Ip, class... _Tp>
61struct tuple_element<_Ip, tuple<_Tp...> > {
62 using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, __tuple_types<_Tp...> >::type;
63};
64
65struct _LIBCPP_EXPORTED_FROM_ABI __check_tuple_constructor_fail {
22struct __check_tuple_constructor_fail {
6623 static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
6724 static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
6825 template <class...>
lib/libcxx/include/__tuple/tuple_element.h-12
......@@ -11,8 +11,6 @@
1111
1212#include <__config>
1313#include <__cstddef/size_t.h>
14#include <__tuple/tuple_indices.h>
15#include <__tuple/tuple_types.h>
1614
1715#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1816# pragma GCC system_header
......@@ -38,21 +36,11 @@ struct tuple_element<_Ip, const volatile _Tp> {
3836 using type _LIBCPP_NODEBUG = const volatile typename tuple_element<_Ip, _Tp>::type;
3937};
4038
41#ifndef _LIBCPP_CXX03_LANG
42
43template <size_t _Ip, class... _Types>
44struct tuple_element<_Ip, __tuple_types<_Types...> > {
45 static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
46 using type _LIBCPP_NODEBUG = __type_pack_element<_Ip, _Types...>;
47};
48
4939# if _LIBCPP_STD_VER >= 14
5040template <size_t _Ip, class... _Tp>
5141using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element<_Ip, _Tp...>::type;
5242# endif
5343
54#endif // _LIBCPP_CXX03_LANG
55
5644_LIBCPP_END_NAMESPACE_STD
5745
5846#endif // _LIBCPP___TUPLE_TUPLE_ELEMENT_H
lib/libcxx/include/__tuple/tuple_size.h-4
......@@ -12,7 +12,6 @@
1212#include <__config>
1313#include <__cstddef/size_t.h>
1414#include <__fwd/tuple.h>
15#include <__tuple/tuple_types.h>
1615#include <__type_traits/enable_if.h>
1716#include <__type_traits/integral_constant.h>
1817#include <__type_traits/is_const.h>
......@@ -59,9 +58,6 @@ struct tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
5958template <class... _Tp>
6059struct tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
6160
62template <class... _Tp>
63struct tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
64
6561# if _LIBCPP_STD_VER >= 17
6662template <class _Tp>
6763inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
lib/libcxx/include/__tuple/tuple_transform.h created+45
......@@ -0,0 +1,45 @@
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___TUPLE_TUPLE_TRANSFORM_H
11#define _LIBCPP___TUPLE_TUPLE_TRANSFORM_H
12
13#include <__config>
14
15#include <__functional/invoke.h>
16#include <__utility/forward.h>
17#include <tuple>
18
19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20# pragma GCC system_header
21#endif
22
23_LIBCPP_PUSH_MACROS
24#include <__undef_macros>
25
26_LIBCPP_BEGIN_NAMESPACE_STD
27
28#if _LIBCPP_STD_VER >= 23
29
30template <class _Fun, class _Tuple>
31_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_transform(_Fun&& __f, _Tuple&& __tuple) {
32 return std::apply(
33 [&]<class... _Types>(_Types&&... __elements) {
34 return tuple<invoke_result_t<_Fun&, _Types>...>(std::invoke(__f, std::forward<_Types>(__elements))...);
35 },
36 std::forward<_Tuple>(__tuple));
37}
38
39#endif // _LIBCPP_STD_VER >= 23
40
41_LIBCPP_END_NAMESPACE_STD
42
43_LIBCPP_POP_MACROS
44
45#endif // _LIBCPP___TUPLE_TUPLE_TRANSFORM_H
lib/libcxx/include/__type_traits/aligned_storage.h+13-40
......@@ -11,8 +11,6 @@
1111
1212#include <__config>
1313#include <__cstddef/size_t.h>
14#include <__type_traits/integral_constant.h>
15#include <__type_traits/type_list.h>
1614
1715#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1816# pragma GCC system_header
......@@ -21,10 +19,10 @@
2119_LIBCPP_BEGIN_NAMESPACE_STD
2220
2321template <class _Tp>
24struct __align_type {
25 static const size_t value = _LIBCPP_PREFERRED_ALIGNOF(_Tp);
26 typedef _Tp type;
27};
22struct _ALIGNAS(_LIBCPP_PREFERRED_ALIGNOF(_Tp)) _AlignedAsT {};
23
24template <class... _Args>
25struct __max_align_impl : _AlignedAsT<_Args>... {};
2826
2927struct __struct_double {
3028 long double __lx;
......@@ -33,41 +31,16 @@ struct __struct_double4 {
3331 double __lx[4];
3432};
3533
36using __all_types _LIBCPP_NODEBUG =
37 __type_list<__align_type<unsigned char>,
38 __align_type<unsigned short>,
39 __align_type<unsigned int>,
40 __align_type<unsigned long>,
41 __align_type<unsigned long long>,
42 __align_type<double>,
43 __align_type<long double>,
44 __align_type<__struct_double>,
45 __align_type<__struct_double4>,
46 __align_type<int*> >;
47
48template <class _TL, size_t _Len>
49struct __find_max_align;
50
51template <class _Head, size_t _Len>
52struct __find_max_align<__type_list<_Head>, _Len> : public integral_constant<size_t, _Head::value> {};
53
54template <size_t _Len, size_t _A1, size_t _A2>
55struct __select_align {
56private:
57 static const size_t __min = _A2 < _A1 ? _A2 : _A1;
58 static const size_t __max = _A1 < _A2 ? _A2 : _A1;
59
60public:
61 static const size_t value = _Len < __max ? __min : __max;
62};
34inline const size_t __aligned_storage_max_align =
35 _LIBCPP_ALIGNOF(__max_align_impl<unsigned long long, double, long double, __struct_double, __struct_double4, int*>);
6336
64template <class _Head, class... _Tail, size_t _Len>
65struct __find_max_align<__type_list<_Head, _Tail...>, _Len>
66 : public integral_constant<
67 size_t,
68 __select_align<_Len, _Head::value, __find_max_align<__type_list<_Tail...>, _Len>::value>::value> {};
37template <size_t _Len>
38inline const size_t __aligned_storage_alignment =
39 _Len > __aligned_storage_max_align
40 ? __aligned_storage_max_align
41 : size_t(1) << ((sizeof(size_t) * __CHAR_BIT__) - __builtin_clzg(_Len) - 1);
6942
70template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
43template <size_t _Len, size_t _Align = __aligned_storage_alignment<_Len> >
7144struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_NO_SPECIALIZATIONS aligned_storage {
7245 union _ALIGNAS(_Align) type {
7346 unsigned char __data[(_Len + _Align - 1) / _Align * _Align];
......@@ -77,7 +50,7 @@ struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_NO_SPECIALIZATIONS aligned_storage {
7750#if _LIBCPP_STD_VER >= 14
7851
7952_LIBCPP_SUPPRESS_DEPRECATED_PUSH
80template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
53template <size_t _Len, size_t _Align = __aligned_storage_alignment<_Len> >
8154using aligned_storage_t _LIBCPP_DEPRECATED_IN_CXX23 = typename aligned_storage<_Len, _Align>::type;
8255_LIBCPP_SUPPRESS_DEPRECATED_POP
8356
lib/libcxx/include/__type_traits/desugars_to.h+4
......@@ -10,6 +10,7 @@
1010#define _LIBCPP___TYPE_TRAITS_DESUGARS_TO_H
1111
1212#include <__config>
13#include <__type_traits/integral_constant.h>
1314
1415#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1516# pragma GCC system_header
......@@ -64,6 +65,9 @@ template <class _CanonicalTag, class _Operation, class... _Args>
6465inline const bool __desugars_to_v<_CanonicalTag, _Operation&&, _Args...> =
6566 __desugars_to_v<_CanonicalTag, _Operation, _Args...>;
6667
68template <class _CanonicalTag, class _Operation, class... _Args>
69struct __desugars_to : integral_constant<bool, __desugars_to_v<_CanonicalTag, _Operation, _Args...> > {};
70
6771_LIBCPP_END_NAMESPACE_STD
6872
6973#endif // _LIBCPP___TYPE_TRAITS_DESUGARS_TO_H
lib/libcxx/include/__type_traits/invoke.h+8
......@@ -62,6 +62,9 @@
6262//
6363// template <class Func, class... Args>
6464// using __invoke_result_t = invoke_result_t<Func, Args...>;
65//
66// template <class Ret, class Func, class... Args>
67// struct __is_invocable_r : is_invocable_r<Ret, Func, Args...> {};
6568
6669_LIBCPP_BEGIN_NAMESPACE_STD
6770
......@@ -112,8 +115,10 @@ inline const bool __is_invocable_r_v = __is_invocable_r_impl<_Ret, __is_invocabl
112115template <bool __is_invocable, class... _Args>
113116inline const bool __is_nothrow_invocable_impl = false;
114117
118# ifndef _LIBCPP_CXX03_LANG
115119template <class... _Args>
116120inline const bool __is_nothrow_invocable_impl<true, _Args...> = noexcept(__builtin_invoke(std::declval<_Args>()...));
121# endif
117122
118123template <class... _Args>
119124inline const bool __is_nothrow_invocable_v = __is_nothrow_invocable_impl<__is_invocable_v<_Args...>, _Args...>;
......@@ -327,6 +332,9 @@ using __invoke_result_t _LIBCPP_NODEBUG = typename __invoke_result<_Func, _Args.
327332
328333#endif // __has_builtin(__builtin_invoke_r)
329334
335template <class _Ret, class _Func, class... _Args>
336struct __is_invocable_r : integral_constant<bool, __is_invocable_r_v<_Ret, _Func, _Args...> > {};
337
330338template <class _Ret, bool = is_void<_Ret>::value>
331339struct __invoke_void_return_wrapper {
332340 template <class... _Args>
lib/libcxx/include/__type_traits/is_allocator.h+6-7
......@@ -11,7 +11,6 @@
1111
1212#include <__config>
1313#include <__cstddef/size_t.h>
14#include <__type_traits/integral_constant.h>
1514#include <__type_traits/void_t.h>
1615#include <__utility/declval.h>
1716
......@@ -21,13 +20,13 @@
2120
2221_LIBCPP_BEGIN_NAMESPACE_STD
2322
24template <typename _Alloc, typename = void, typename = void>
25struct __is_allocator : false_type {};
23template <class _Alloc, class = void, class = void>
24inline const bool __is_allocator_v = false;
2625
27template <typename _Alloc>
28struct __is_allocator<_Alloc,
29 __void_t<typename _Alloc::value_type>,
30 __void_t<decltype(std::declval<_Alloc&>().allocate(size_t(0)))> > : true_type {};
26template <class _Alloc>
27inline const bool __is_allocator_v<_Alloc,
28 __void_t<typename _Alloc::value_type>,
29 __void_t<decltype(std::declval<_Alloc&>().allocate(size_t()))> > = true;
3130
3231_LIBCPP_END_NAMESPACE_STD
3332
lib/libcxx/include/__type_traits/is_array.h+26
......@@ -26,6 +26,32 @@ template <class _Tp>
2626_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_array_v = __is_array(_Tp);
2727#endif
2828
29template <class _Tp>
30inline const bool __is_bounded_array_v = __is_bounded_array(_Tp);
31
32#if _LIBCPP_STD_VER >= 20
33
34template <class _Tp>
35struct _LIBCPP_NO_SPECIALIZATIONS is_bounded_array : bool_constant<__is_bounded_array(_Tp)> {};
36
37template <class _Tp>
38_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
39
40#endif
41
42template <class _Tp>
43inline const bool __is_unbounded_array_v = __is_unbounded_array(_Tp);
44
45#if _LIBCPP_STD_VER >= 20
46
47template <class _Tp>
48struct _LIBCPP_NO_SPECIALIZATIONS is_unbounded_array : bool_constant<__is_unbounded_array(_Tp)> {};
49
50template <class _Tp>
51_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
52
53#endif
54
2955_LIBCPP_END_NAMESPACE_STD
3056
3157#endif // _LIBCPP___TYPE_TRAITS_IS_ARRAY_H
lib/libcxx/include/__type_traits/is_equality_comparable.h+16-21
......@@ -27,11 +27,11 @@
2727_LIBCPP_BEGIN_NAMESPACE_STD
2828
2929template <class _Tp, class _Up, class = void>
30struct __is_equality_comparable : false_type {};
30inline const bool __is_equality_comparable_v = false;
3131
3232template <class _Tp, class _Up>
33struct __is_equality_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() == std::declval<_Up>())> > : true_type {
34};
33inline const bool
34 __is_equality_comparable_v<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() == std::declval<_Up>())> > = true;
3535
3636// A type is_trivially_equality_comparable if the expression `a == b` is equivalent to `std::memcmp(&a, &b, sizeof(T))`
3737// (with `a` and `b` being of type `T`). For the case where we compare two object of the same type, we can use
......@@ -48,40 +48,35 @@ struct __is_equality_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>()
4848// representation may not be equivalent.
4949
5050template <class _Tp, class _Up, class = void>
51struct __libcpp_is_trivially_equality_comparable_impl : false_type {};
51inline const bool __is_trivially_equality_comparable_impl = false;
5252
5353template <class _Tp>
54struct __libcpp_is_trivially_equality_comparable_impl<_Tp, _Tp>
54inline const bool __is_trivially_equality_comparable_impl<_Tp, _Tp>
5555#if __has_builtin(__is_trivially_equality_comparable)
56 : integral_constant<bool, __is_trivially_equality_comparable(_Tp) && __is_equality_comparable<_Tp, _Tp>::value> {
57};
56 = __is_trivially_equality_comparable(_Tp) && __is_equality_comparable_v<_Tp, _Tp>;
5857#else
59 : is_integral<_Tp> {
60};
58 = is_integral<_Tp>::value;
6159#endif // __has_builtin(__is_trivially_equality_comparable)
6260
6361template <class _Tp, class _Up>
64struct __libcpp_is_trivially_equality_comparable_impl<
62inline const bool __is_trivially_equality_comparable_impl<
6563 _Tp,
6664 _Up,
67 __enable_if_t<is_integral<_Tp>::value && is_integral<_Up>::value && !is_same<_Tp, _Up>::value &&
68 is_signed<_Tp>::value == is_signed<_Up>::value && sizeof(_Tp) == sizeof(_Up)> > : true_type {};
65 __enable_if_t<is_integral<_Tp>::value && is_integral<_Up>::value && !is_same<_Tp, _Up>::value> > =
66 is_signed<_Tp>::value == is_signed<_Up>::value && sizeof(_Tp) == sizeof(_Up);
6967
7068template <class _Tp>
71struct __libcpp_is_trivially_equality_comparable_impl<_Tp*, _Tp*> : true_type {};
69inline const bool __is_trivially_equality_comparable_impl<_Tp*, _Tp*> = true;
7270
7371// TODO: Use is_pointer_inverconvertible_base_of
7472template <class _Tp, class _Up>
75struct __libcpp_is_trivially_equality_comparable_impl<_Tp*, _Up*>
76 : integral_constant<
77 bool,
78 __is_equality_comparable<_Tp*, _Up*>::value &&
79 (is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >::value || is_void<_Tp>::value || is_void<_Up>::value)> {
80};
73inline const bool __is_trivially_equality_comparable_impl<_Tp*, _Up*> =
74 __is_equality_comparable_v<_Tp*, _Up*> &&
75 (is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >::value || is_void<_Tp>::value || is_void<_Up>::value);
8176
8277template <class _Tp, class _Up>
83using __libcpp_is_trivially_equality_comparable _LIBCPP_NODEBUG =
84 __libcpp_is_trivially_equality_comparable_impl<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >;
78inline const bool __is_trivially_equality_comparable_v =
79 __is_trivially_equality_comparable_impl<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >;
8580
8681_LIBCPP_END_NAMESPACE_STD
8782
lib/libcxx/include/__type_traits/is_final.h+1-1
......@@ -19,7 +19,7 @@
1919_LIBCPP_BEGIN_NAMESPACE_STD
2020
2121template <class _Tp>
22struct __libcpp_is_final : integral_constant<bool, __is_final(_Tp)> {};
22inline const bool __is_final_v = __is_final(_Tp);
2323
2424#if _LIBCPP_STD_VER >= 14
2525template <class _Tp>
lib/libcxx/include/__type_traits/is_floating_point.h+7-6
......@@ -20,18 +20,19 @@
2020_LIBCPP_BEGIN_NAMESPACE_STD
2121
2222// clang-format off
23template <class _Tp> struct __libcpp_is_floating_point : false_type {};
24template <> struct __libcpp_is_floating_point<float> : true_type {};
25template <> struct __libcpp_is_floating_point<double> : true_type {};
26template <> struct __libcpp_is_floating_point<long double> : true_type {};
23template <class _Tp> inline const bool __is_floating_point_impl = false;
24template <> inline const bool __is_floating_point_impl<float> = true;
25template <> inline const bool __is_floating_point_impl<double> = true;
26template <> inline const bool __is_floating_point_impl<long double> = true;
2727// clang-format on
2828
2929template <class _Tp>
30struct _LIBCPP_NO_SPECIALIZATIONS is_floating_point : __libcpp_is_floating_point<__remove_cv_t<_Tp> > {};
30struct _LIBCPP_NO_SPECIALIZATIONS is_floating_point
31 : integral_constant<bool, __is_floating_point_impl<__remove_cv_t<_Tp> > > {};
3132
3233#if _LIBCPP_STD_VER >= 17
3334template <class _Tp>
34_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
35_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_floating_point_v = __is_floating_point_impl<__remove_cv_t<_Tp>>;
3536#endif
3637
3738_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__type_traits/is_generic_transparent_comparator.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_GENERIC_TRANSPARENT_COMPARATOR_H
10#define _LIBCPP___TYPE_TRAITS_IS_GENERIC_TRANSPARENT_COMPARATOR_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
20// This trait returns true if the given _Comparator is known to accept any two types for comparison. This is separate
21// from `__is_transparent_v`, since that only enables overloads of specific functions, but doesn't give any semantic
22// guarantees. This trait guarantess that the comparator simply calls the appropriate comparison functions for any two
23// types.
24
25template <class _Comparator>
26inline const bool __is_generic_transparent_comparator_v = false;
27
28_LIBCPP_END_NAMESPACE_STD
29
30#endif // _LIBCPP___TYPE_TRAITS_IS_GENERIC_TRANSPARENT_COMPARATOR_H
lib/libcxx/include/__type_traits/is_specialization.h+2-6
......@@ -30,15 +30,11 @@
3030
3131_LIBCPP_BEGIN_NAMESPACE_STD
3232
33#if _LIBCPP_STD_VER >= 17
34
3533template <class _Tp, template <class...> class _Template>
36inline constexpr bool __is_specialization_v = false; // true if and only if _Tp is a specialization of _Template
34inline const bool __is_specialization_v = false; // true if and only if _Tp is a specialization of _Template
3735
3836template <template <class...> class _Template, class... _Args>
39inline constexpr bool __is_specialization_v<_Template<_Args...>, _Template> = true;
40
41#endif // _LIBCPP_STD_VER >= 17
37inline const bool __is_specialization_v<_Template<_Args...>, _Template> = true;
4238
4339_LIBCPP_END_NAMESPACE_STD
4440
lib/libcxx/include/__type_traits/is_within_lifetime.h created+29
......@@ -0,0 +1,29 @@
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_WITHIN_LIFETIME_H
10#define _LIBCPP___TYPE_TRAITS_IS_WITHIN_LIFETIME_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
20#if _LIBCPP_STD_VER >= 26 && __has_builtin(__builtin_is_within_lifetime)
21template <class _Tp>
22_LIBCPP_HIDE_FROM_ABI consteval bool is_within_lifetime(const _Tp* __p) noexcept {
23 return __builtin_is_within_lifetime(__p);
24}
25#endif
26
27_LIBCPP_END_NAMESPACE_STD
28
29#endif // _LIBCPP___TYPE_TRAITS_IS_WITHIN_LIFETIME_H
lib/libcxx/include/__type_traits/make_transparent.h created+52
......@@ -0,0 +1,52 @@
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_MAKE_TRANSPARENT_H
10#define _LIBCPP___TYPE_TRAITS_MAKE_TRANSPARENT_H
11
12#include <__config>
13#include <__type_traits/enable_if.h>
14#include <__type_traits/is_empty.h>
15#include <__type_traits/is_same.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
23// __make_transparent tries to create a transparent comparator from its non-transparent counterpart, e.g. obtain
24// `less<>` from `less<T>`. This is useful in cases where conversions can be avoided (e.g. a string literal to a
25// std::string).
26
27template <class _Tp, class _Comparator>
28struct __make_transparent {
29 using type _LIBCPP_NODEBUG = _Comparator;
30};
31
32template <class _Tp, class _Comparator>
33using __make_transparent_t _LIBCPP_NODEBUG = typename __make_transparent<_Tp, _Comparator>::type;
34
35template <class _Tp,
36 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) {
39 return __comp;
40}
41
42template <class _Tp,
43 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&) {
46 static_assert(is_empty<_Comparator>::value);
47 return __make_transparent_t<_Tp, _Comparator>();
48}
49
50_LIBCPP_END_NAMESPACE_STD
51
52#endif // _LIBCPP___TYPE_TRAITS_MAKE_TRANSPARENT_H
lib/libcxx/include/__type_traits/reference_constructs_from_temporary.h+1-7
......@@ -18,7 +18,7 @@
1818
1919_LIBCPP_BEGIN_NAMESPACE_STD
2020
21#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_constructs_from_temporary)
21#if _LIBCPP_STD_VER >= 23
2222
2323template <class _Tp, class _Up>
2424struct _LIBCPP_NO_SPECIALIZATIONS reference_constructs_from_temporary
......@@ -30,14 +30,8 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool reference_constructs_from_tempo
3030
3131#endif
3232
33#if __has_builtin(__reference_constructs_from_temporary)
3433template <class _Tp, class _Up>
3534inline const bool __reference_constructs_from_temporary_v = __reference_constructs_from_temporary(_Tp, _Up);
36#else
37// TODO(LLVM 22): Remove this as all supported compilers should have __reference_constructs_from_temporary implemented.
38template <class _Tp, class _Up>
39inline const bool __reference_constructs_from_temporary_v = __reference_binds_to_temporary(_Tp, _Up);
40#endif
4135
4236_LIBCPP_END_NAMESPACE_STD
4337
lib/libcxx/include/__type_traits/reference_converts_from_temporary.h+1-1
......@@ -18,7 +18,7 @@
1818
1919_LIBCPP_BEGIN_NAMESPACE_STD
2020
21#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_converts_from_temporary)
21#if _LIBCPP_STD_VER >= 23
2222
2323template <class _Tp, class _Up>
2424struct _LIBCPP_NO_SPECIALIZATIONS reference_converts_from_temporary
lib/libcxx/include/__utility/cmp.h+19-7
......@@ -26,10 +26,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2626
2727#if _LIBCPP_STD_VER >= 20
2828
29template <typename _Tp, typename _Ip>
30concept __comparison_can_promote_to =
31 sizeof(_Tp) < sizeof(_Ip) || (sizeof(_Tp) == sizeof(_Ip) && __signed_integer<_Tp>);
32
2933template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
30_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
34[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
3135 if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
3236 return __t == __u;
37 else if constexpr (__comparison_can_promote_to<_Tp, int> && __comparison_can_promote_to<_Up, int>)
38 return static_cast<int>(__t) == static_cast<int>(__u);
39 else if constexpr (__comparison_can_promote_to<_Tp, long long> && __comparison_can_promote_to<_Up, long long>)
40 return static_cast<long long>(__t) == static_cast<long long>(__u);
3341 else if constexpr (is_signed_v<_Tp>)
3442 return __t < 0 ? false : make_unsigned_t<_Tp>(__t) == __u;
3543 else
......@@ -37,14 +45,18 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
3745}
3846
3947template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
40_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
48[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
4149 return !std::cmp_equal(__t, __u);
4250}
4351
4452template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
45_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
53[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
4654 if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
4755 return __t < __u;
56 else if constexpr (__comparison_can_promote_to<_Tp, int> && __comparison_can_promote_to<_Up, int>)
57 return static_cast<int>(__t) < static_cast<int>(__u);
58 else if constexpr (__comparison_can_promote_to<_Tp, long long> && __comparison_can_promote_to<_Up, long long>)
59 return static_cast<long long>(__t) < static_cast<long long>(__u);
4860 else if constexpr (is_signed_v<_Tp>)
4961 return __t < 0 ? true : make_unsigned_t<_Tp>(__t) < __u;
5062 else
......@@ -52,22 +64,22 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
5264}
5365
5466template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
55_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
67[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
5668 return std::cmp_less(__u, __t);
5769}
5870
5971template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
60_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
72[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
6173 return !std::cmp_greater(__t, __u);
6274}
6375
6476template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
65_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
77[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
6678 return !std::cmp_less(__t, __u);
6779}
6880
6981template <__signed_or_unsigned_integer _Tp, __signed_or_unsigned_integer _Up>
70_LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
82[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
7183 return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
7284 std::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
7385}
lib/libcxx/include/__utility/default_three_way_comparator.h created+70
......@@ -0,0 +1,70 @@
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_DEFAULT_THREE_WAY_COMPARATOR_H
10#define _LIBCPP___UTILITY_DEFAULT_THREE_WAY_COMPARATOR_H
11
12#include <__config>
13#include <__type_traits/enable_if.h>
14#include <__type_traits/is_arithmetic.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
22// This struct can be specialized to provide a three way comparator between _LHS and _RHS.
23// The return value should be
24// - less than zero if (lhs_val < rhs_val)
25// - greater than zero if (rhs_val < lhs_val)
26// - zero otherwise
27template <class _LHS, class _RHS, class = void>
28struct __default_three_way_comparator;
29
30template <class _LHS, class _RHS>
31struct __default_three_way_comparator<_LHS,
32 _RHS,
33 __enable_if_t<is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value> > {
34 _LIBCPP_HIDE_FROM_ABI static int operator()(_LHS __lhs, _RHS __rhs) {
35 if (__lhs < __rhs)
36 return -1;
37 if (__lhs > __rhs)
38 return 1;
39 return 0;
40 }
41};
42
43#if _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_lt_synthesizes_from_spaceship)
44template <class _LHS, class _RHS>
45struct __default_three_way_comparator<
46 _LHS,
47 _RHS,
48 __enable_if_t<!(is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value) &&
49 __builtin_lt_synthesizes_from_spaceship(const _LHS&, const _RHS&)>> {
50 _LIBCPP_HIDE_FROM_ABI static int operator()(const _LHS& __lhs, const _RHS& __rhs) {
51 auto __res = __lhs <=> __rhs;
52 if (__res < 0)
53 return -1;
54 if (__res > 0)
55 return 1;
56 return 0;
57 }
58};
59#endif
60
61template <class _LHS, class _RHS, bool = true>
62struct __has_default_three_way_comparator : false_type {};
63
64template <class _LHS, class _RHS>
65struct __has_default_three_way_comparator<_LHS, _RHS, sizeof(__default_three_way_comparator<_LHS, _RHS>) >= 0>
66 : true_type {};
67
68_LIBCPP_END_NAMESPACE_STD
69
70#endif // _LIBCPP___UTILITY_DEFAULT_THREE_WAY_COMPARATOR_H
lib/libcxx/include/__utility/in_place.h+1-1
......@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222
2323#if _LIBCPP_STD_VER >= 17
2424
25struct _LIBCPP_EXPORTED_FROM_ABI in_place_t {
25struct in_place_t {
2626 explicit in_place_t() = default;
2727};
2828inline constexpr in_place_t in_place{};
lib/libcxx/include/__utility/integer_sequence.h+56-41
......@@ -11,63 +11,52 @@
1111
1212#include <__config>
1313#include <__cstddef/size_t.h>
14#include <__tuple/tuple_element.h>
15#include <__tuple/tuple_size.h>
1416#include <__type_traits/is_integral.h>
1517
1618#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1719# pragma GCC system_header
1820#endif
1921
22#ifndef _LIBCPP_CXX03_LANG
23
2024_LIBCPP_BEGIN_NAMESPACE_STD
2125
22template <size_t...>
23struct __tuple_indices;
26# if __has_builtin(__make_integer_seq)
27template <template <class _Tp, _Tp...> class _BaseType, class _Tp, _Tp _SequenceSize>
28using __make_integer_sequence_impl _LIBCPP_NODEBUG = __make_integer_seq<_BaseType, _Tp, _SequenceSize>;
29# else
30template <template <class _Tp, _Tp...> class _BaseType, class _Tp, _Tp _SequenceSize>
31using __make_integer_sequence_impl _LIBCPP_NODEBUG = _BaseType<_Tp, __integer_pack(_SequenceSize)...>;
32# endif
2433
25template <class _IdxType, _IdxType... _Values>
34template <class _Tp, _Tp... _Indices>
2635struct __integer_sequence {
27 template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType>
28 using __convert _LIBCPP_NODEBUG = _ToIndexSeq<_ToIndexType, _Values...>;
29
30 template <size_t _Sp>
31 using __to_tuple_indices _LIBCPP_NODEBUG = __tuple_indices<(_Values + _Sp)...>;
36 using value_type = _Tp;
37 static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
38 [[__nodiscard__]] static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Indices); }
3239};
3340
34#if __has_builtin(__make_integer_seq)
35template <size_t _Ep, size_t _Sp>
36using __make_indices_imp _LIBCPP_NODEBUG =
37 typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>;
38#elif __has_builtin(__integer_pack)
39template <size_t _Ep, size_t _Sp>
40using __make_indices_imp _LIBCPP_NODEBUG =
41 typename __integer_sequence<size_t, __integer_pack(_Ep - _Sp)...>::template __to_tuple_indices<_Sp>;
42#else
43# error "No known way to get an integer pack from the compiler"
44#endif
41template <size_t... _Indices>
42using __index_sequence _LIBCPP_NODEBUG = __integer_sequence<size_t, _Indices...>;
4543
46#if _LIBCPP_STD_VER >= 14
44template <size_t _SequenceSize>
45using __make_index_sequence _LIBCPP_NODEBUG = __make_integer_sequence_impl<__integer_sequence, size_t, _SequenceSize>;
4746
48template <class _Tp, _Tp... _Ip>
49struct integer_sequence {
50 typedef _Tp value_type;
51 static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
52 static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Ip); }
53};
47template <class... _Args>
48using __index_sequence_for _LIBCPP_NODEBUG = __make_index_sequence<sizeof...(_Args)>;
49
50# if _LIBCPP_STD_VER >= 14
51
52template <class _Tp, _Tp... _Indices>
53struct integer_sequence : __integer_sequence<_Tp, _Indices...> {};
5454
5555template <size_t... _Ip>
5656using index_sequence = integer_sequence<size_t, _Ip...>;
5757
58# if __has_builtin(__make_integer_seq)
59
6058template <class _Tp, _Tp _Ep>
61using make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>;
62
63# elif __has_builtin(__integer_pack)
64
65template <class _Tp, _Tp _SequenceSize>
66using make_integer_sequence _LIBCPP_NODEBUG = integer_sequence<_Tp, __integer_pack(_SequenceSize)...>;
67
68# else
69# error "No known way to get an integer pack from the compiler"
70# endif
59using make_integer_sequence _LIBCPP_NODEBUG = __make_integer_sequence_impl<integer_sequence, _Tp, _Ep>;
7160
7261template <size_t _Np>
7362using make_index_sequence = make_integer_sequence<size_t, _Np>;
......@@ -75,16 +64,42 @@ using make_index_sequence = make_integer_sequence<size_t, _Np>;
7564template <class... _Tp>
7665using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
7766
78# if _LIBCPP_STD_VER >= 20
67# if _LIBCPP_STD_VER >= 20
7968// Executes __func for every element in an index_sequence.
8069template <size_t... _Index, class _Function>
8170_LIBCPP_HIDE_FROM_ABI constexpr void __for_each_index_sequence(index_sequence<_Index...>, _Function __func) {
8271 (__func.template operator()<_Index>(), ...);
8372}
84# endif // _LIBCPP_STD_VER >= 20
73# endif // _LIBCPP_STD_VER >= 20
74
75# if _LIBCPP_STD_VER >= 26
76// [intseq.binding], structured binding support
77template <class _Tp, _Tp... _Indices>
78struct tuple_size<integer_sequence<_Tp, _Indices...>> : integral_constant<size_t, sizeof...(_Indices)> {};
8579
86#endif // _LIBCPP_STD_VER >= 14
80template <size_t _Ip, class _Tp, _Tp... _Indices>
81struct tuple_element<_Ip, integer_sequence<_Tp, _Indices...>> {
82 static_assert(_Ip < sizeof...(_Indices), "Index out of bounds in std::tuple_element<> (std::integer_sequence)");
83 using type _LIBCPP_NODEBUG = _Tp;
84};
85
86template <size_t _Ip, class _Tp, _Tp... _Indices>
87struct tuple_element<_Ip, const integer_sequence<_Tp, _Indices...>> {
88 static_assert(_Ip < sizeof...(_Indices), "Index out of bounds in std::tuple_element<> (const std::integer_sequence)");
89 using type _LIBCPP_NODEBUG = _Tp;
90};
91
92template <size_t _Ip, class _Tp, _Tp... _Indices>
93[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp get(integer_sequence<_Tp, _Indices...>) noexcept {
94 static_assert(_Ip < sizeof...(_Indices), "Index out of bounds in std::get<> (std::integer_sequence)");
95 return _Indices...[_Ip];
96}
97# endif // _LIBCPP_STD_VER >= 26
98
99# endif // _LIBCPP_STD_VER >= 14
87100
88101_LIBCPP_END_NAMESPACE_STD
89102
103#endif // _LIBCPP_CXX03_LANG
104
90105#endif // _LIBCPP___UTILITY_INTEGER_SEQUENCE_H
lib/libcxx/include/__utility/lazy_synth_three_way_comparator.h created+120
......@@ -0,0 +1,120 @@
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_LAZY_SYNTH_THREE_WAY_COMPARATOR_H
10#define _LIBCPP___UTILITY_LAZY_SYNTH_THREE_WAY_COMPARATOR_H
11
12#include <__assert>
13#include <__config>
14#include <__type_traits/conjunction.h>
15#include <__type_traits/desugars_to.h>
16#include <__type_traits/enable_if.h>
17#include <__utility/default_three_way_comparator.h>
18
19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20# pragma GCC system_header
21#endif
22
23// This file implements a __lazy_synth_three_way_comparator, which tries to build an efficient three way comparison from
24// a binary comparator. That is done in multiple steps:
25// 1) Check whether the comparator desugars to a less-than operator
26// If that is the case, check whether there exists a specialization of `__default_three_way_comparator`, which
27// can be specialized to implement a three way comparator for the specific types.
28// 2) Fall back to doing a lazy less than/greater than comparison
29
30_LIBCPP_BEGIN_NAMESPACE_STD
31
32template <class _Comparator, class _LHS, class _RHS>
33struct __lazy_compare_result {
34 const _Comparator& __comp_;
35 const _LHS& __lhs_;
36 const _RHS& __rhs_;
37
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)
42 : __comp_(__comp), __lhs_(__lhs), __rhs_(__rhs) {}
43
44 _LIBCPP_HIDE_FROM_ABI bool __less() const {
45 bool __result = __comp_(__lhs_, __rhs_);
46 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__rhs_, __lhs_)) : true,
47 "Comparator does not induce a strict weak ordering");
48 return __result;
49 }
50
51 _LIBCPP_HIDE_FROM_ABI bool __greater() const {
52 bool __result = __comp_(__rhs_, __lhs_);
53 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__lhs_, __rhs_)) : true,
54 "Comparator does not induce a strict weak ordering");
55 return __result;
56 }
57};
58
59// This class provides three way comparison between _LHS and _RHS as efficiently as possible. This can be specialized if
60// a comparator only compares part of the object, potentially allowing an efficient three way comparison between the
61// subobjects. The specialization should use the __lazy_synth_three_way_comparator for the subobjects to achieve this.
62template <class _Comparator, class _LHS, class _RHS, class = void>
63struct __lazy_synth_three_way_comparator {
64 const _Comparator& __comp_;
65
66 _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp)
67 : __comp_(__comp) {}
68
69 _LIBCPP_HIDE_FROM_ABI __lazy_compare_result<_Comparator, _LHS, _RHS>
70 operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) const {
71 return __lazy_compare_result<_Comparator, _LHS, _RHS>(__comp_, __lhs, __rhs);
72 }
73};
74
75struct __eager_compare_result {
76 int __res_;
77
78 _LIBCPP_HIDE_FROM_ABI explicit __eager_compare_result(int __res) : __res_(__res) {}
79
80 _LIBCPP_HIDE_FROM_ABI bool __less() const { return __res_ < 0; }
81 _LIBCPP_HIDE_FROM_ABI bool __greater() const { return __res_ > 0; }
82};
83
84template <class _Comparator, class _LHS, class _RHS>
85struct __lazy_synth_three_way_comparator<_Comparator,
86 _LHS,
87 _RHS,
88 __enable_if_t<_And<__desugars_to<__less_tag, _Comparator, _LHS, _RHS>,
89 __has_default_three_way_comparator<_LHS, _RHS> >::value> > {
90 // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of
91 // the comparator.
92 _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
93
94 // Same comment as above.
95 _LIBCPP_HIDE_FROM_ABI static __eager_compare_result
96 operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) {
97 return __eager_compare_result(__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs));
98 }
99};
100
101template <class _Comparator, class _LHS, class _RHS>
102struct __lazy_synth_three_way_comparator<_Comparator,
103 _LHS,
104 _RHS,
105 __enable_if_t<_And<__desugars_to<__greater_tag, _Comparator, _LHS, _RHS>,
106 __has_default_three_way_comparator<_LHS, _RHS> >::value> > {
107 // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of
108 // the comparator.
109 _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
110
111 // Same comment as above.
112 _LIBCPP_HIDE_FROM_ABI static __eager_compare_result
113 operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) {
114 return __eager_compare_result(-__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs));
115 }
116};
117
118_LIBCPP_END_NAMESPACE_STD
119
120#endif // _LIBCPP___UTILITY_LAZY_SYNTH_THREE_WAY_COMPARATOR_H
lib/libcxx/include/__utility/pair.h+22-25
......@@ -18,7 +18,6 @@
1818#include <__fwd/array.h>
1919#include <__fwd/pair.h>
2020#include <__fwd/tuple.h>
21#include <__tuple/tuple_indices.h>
2221#include <__tuple/tuple_like_no_subrange.h>
2322#include <__tuple/tuple_size.h>
2423#include <__type_traits/common_reference.h>
......@@ -32,14 +31,13 @@
3231#include <__type_traits/is_implicitly_default_constructible.h>
3332#include <__type_traits/is_nothrow_assignable.h>
3433#include <__type_traits/is_nothrow_constructible.h>
35#include <__type_traits/is_replaceable.h>
36#include <__type_traits/is_same.h>
3734#include <__type_traits/is_swappable.h>
3835#include <__type_traits/is_trivially_relocatable.h>
3936#include <__type_traits/nat.h>
4037#include <__type_traits/unwrap_ref.h>
4138#include <__utility/declval.h>
4239#include <__utility/forward.h>
40#include <__utility/integer_sequence.h>
4341#include <__utility/move.h>
4442#include <__utility/piecewise_construct.h>
4543
......@@ -102,7 +100,6 @@ struct pair
102100 __conditional_t<__libcpp_is_trivially_relocatable<_T1>::value && __libcpp_is_trivially_relocatable<_T2>::value,
103101 pair,
104102 void>;
105 using __replaceable _LIBCPP_NODEBUG = __conditional_t<__is_replaceable_v<_T1> && __is_replaceable_v<_T2>, pair, void>;
106103
107104 _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
108105 _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
......@@ -222,11 +219,7 @@ struct pair
222219 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
223220 pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) noexcept(
224221 is_nothrow_constructible<first_type, _Args1...>::value && is_nothrow_constructible<second_type, _Args2...>::value)
225 : pair(__pc,
226 __first_args,
227 __second_args,
228 typename __make_tuple_indices<sizeof...(_Args1)>::type(),
229 typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
222 : pair(__pc, __first_args, __second_args, __index_sequence_for<_Args1...>(), __index_sequence_for<_Args2...>()) {}
230223
231224 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
232225 operator=(__conditional_t<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
......@@ -440,8 +433,8 @@ private:
440433 pair(piecewise_construct_t,
441434 tuple<_Args1...>& __first_args,
442435 tuple<_Args2...>& __second_args,
443 __tuple_indices<_I1...>,
444 __tuple_indices<_I2...>)
436 __index_sequence<_I1...>,
437 __index_sequence<_I2...>)
445438 : first(std::forward<_Args1>(std::get<_I1>(__first_args))...),
446439 second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
447440#endif
......@@ -546,8 +539,8 @@ swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x
546539#endif
547540
548541template <class _T1, class _T2>
549inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> >
550make_pair(_T1&& __t1, _T2&& __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) {
551544 return pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> >(std::forward<_T1>(__t1), std::forward<_T2>(__t2));
552545}
553546
......@@ -619,67 +612,71 @@ struct __get_pair<1> {
619612};
620613
621614template <size_t _Ip, class _T1, class _T2>
622inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
615[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
616typename tuple_element<_Ip, pair<_T1, _T2> >::type&
623617get(pair<_T1, _T2>& __p) _NOEXCEPT {
624618 return __get_pair<_Ip>::get(__p);
625619}
626620
627621template <size_t _Ip, class _T1, class _T2>
628inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
622[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
623_LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
629624get(const pair<_T1, _T2>& __p) _NOEXCEPT {
630625 return __get_pair<_Ip>::get(__p);
631626}
632627
633628template <size_t _Ip, class _T1, class _T2>
634inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
629[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
630typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
635631get(pair<_T1, _T2>&& __p) _NOEXCEPT {
636632 return __get_pair<_Ip>::get(std::move(__p));
637633}
638634
639635template <size_t _Ip, class _T1, class _T2>
640inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
636[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
637_LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
641638get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
642639 return __get_pair<_Ip>::get(std::move(__p));
643640}
644641
645642#if _LIBCPP_STD_VER >= 14
646643template <class _T1, class _T2>
647inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
644[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
648645 return __p.first;
649646}
650647
651648template <class _T1, class _T2>
652inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
649[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
653650 return __p.first;
654651}
655652
656653template <class _T1, class _T2>
657inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
654[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
658655 return std::forward<_T1&&>(__p.first);
659656}
660657
661658template <class _T1, class _T2>
662inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
659[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
663660 return std::forward<_T1 const&&>(__p.first);
664661}
665662
666663template <class _T2, class _T1>
667inline _LIBCPP_HIDE_FROM_ABI constexpr _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
664[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
668665 return __p.second;
669666}
670667
671668template <class _T2, class _T1>
672inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
669[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
673670 return __p.second;
674671}
675672
676673template <class _T2, class _T1>
677inline _LIBCPP_HIDE_FROM_ABI constexpr _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
674[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
678675 return std::forward<_T2&&>(__p.second);
679676}
680677
681678template <class _T2, class _T1>
682inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
679[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
683680 return std::forward<_T2 const&&>(__p.second);
684681}
685682
lib/libcxx/include/__utility/scope_guard.h+2
......@@ -43,6 +43,8 @@ public:
4343#endif
4444};
4545
46_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__scope_guard);
47
4648template <class _Func>
4749_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __scope_guard<_Func> __make_scope_guard(_Func __func) {
4850 return __scope_guard<_Func>(std::move(__func));
lib/libcxx/include/__utility/try_key_extraction.h created+114
......@@ -0,0 +1,114 @@
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_TRY_EXTRACT_KEY_H
10#define _LIBCPP___UTILITY_TRY_EXTRACT_KEY_H
11
12#include <__config>
13#include <__fwd/pair.h>
14#include <__fwd/tuple.h>
15#include <__type_traits/enable_if.h>
16#include <__type_traits/is_same.h>
17#include <__type_traits/remove_const.h>
18#include <__type_traits/remove_const_ref.h>
19#include <__utility/declval.h>
20#include <__utility/forward.h>
21#include <__utility/piecewise_construct.h>
22#include <__utility/priority_tag.h>
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28_LIBCPP_BEGIN_NAMESPACE_STD
29
30template <class _KeyT, class _Ret, class _WithKey, class _WithoutKey, class... _Args>
31_LIBCPP_HIDE_FROM_ABI _Ret
32__try_key_extraction_impl(__priority_tag<0>, _WithKey, _WithoutKey __without_key, _Args&&... __args) {
33 return __without_key(std::forward<_Args>(__args)...);
34}
35
36template <class _KeyT,
37 class _Ret,
38 class _WithKey,
39 class _WithoutKey,
40 class _Arg,
41 __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg> >::value, int> = 0>
42_LIBCPP_HIDE_FROM_ABI _Ret
43__try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) {
44 return __with_key(__arg, std::forward<_Arg>(__arg));
45}
46
47template <class _KeyT,
48 class _Ret,
49 class _WithKey,
50 class _WithoutKey,
51 class _Arg,
52 __enable_if_t<__is_pair_v<__remove_const_ref_t<_Arg> > &&
53 is_same<__remove_const_t<typename __remove_const_ref_t<_Arg>::first_type>, _KeyT>::value,
54 int> = 0>
55_LIBCPP_HIDE_FROM_ABI _Ret
56__try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) {
57 return __with_key(__arg.first, std::forward<_Arg>(__arg));
58}
59
60template <class _KeyT,
61 class _Ret,
62 class _WithKey,
63 class _WithoutKey,
64 class _Arg1,
65 class _Arg2,
66 __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg1> >::value, int> = 0>
67_LIBCPP_HIDE_FROM_ABI _Ret
68__try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg1&& __arg1, _Arg2&& __arg2) {
69 return __with_key(__arg1, std::forward<_Arg1>(__arg1), std::forward<_Arg2>(__arg2));
70}
71
72#ifndef _LIBCPP_CXX03_LANG
73template <class _KeyT,
74 class _Ret,
75 class _WithKey,
76 class _WithoutKey,
77 class _PiecewiseConstruct,
78 class _Tuple1,
79 class _Tuple2,
80 __enable_if_t<is_same<__remove_const_ref_t<_PiecewiseConstruct>, piecewise_construct_t>::value &&
81 __is_tuple_v<_Tuple1> && tuple_size<_Tuple1>::value == 1 &&
82 is_same<__remove_const_ref_t<typename tuple_element<0, _Tuple1>::type>, _KeyT>::value,
83 int> = 0>
84_LIBCPP_HIDE_FROM_ABI _Ret __try_key_extraction_impl(
85 __priority_tag<1>,
86 _WithKey __with_key,
87 _WithoutKey,
88 _PiecewiseConstruct&& __pc,
89 _Tuple1&& __tuple1,
90 _Tuple2&& __tuple2) {
91 return __with_key(
92 std::get<0>(__tuple1),
93 std::forward<_PiecewiseConstruct>(__pc),
94 std::forward<_Tuple1>(__tuple1),
95 std::forward<_Tuple2>(__tuple2));
96}
97#endif // _LIBCPP_CXX03_LANG
98
99// This function tries extracting the given _KeyT from _Args...
100// If it succeeds to extract the key, it calls the `__with_key` function with the extracted key and all of the
101// arguments. Otherwise it calls the `__without_key` function with all of the arguments.
102//
103// 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>()...))
106__try_key_extraction(_WithKey __with_key, _WithoutKey __without_key, _Args&&... __args) {
107 using _Ret = decltype(__without_key(std::forward<_Args>(__args)...));
108 return std::__try_key_extraction_impl<_KeyT, _Ret>(
109 __priority_tag<1>(), __with_key, __without_key, std::forward<_Args>(__args)...);
110}
111
112_LIBCPP_END_NAMESPACE_STD
113
114#endif // _LIBCPP___UTILITY_TRY_EXTRACT_KEY_H
lib/libcxx/include/__vector/vector.h+187-160
......@@ -12,18 +12,17 @@
1212#include <__algorithm/copy.h>
1313#include <__algorithm/copy_n.h>
1414#include <__algorithm/fill_n.h>
15#include <__algorithm/iterator_operations.h>
1516#include <__algorithm/max.h>
1617#include <__algorithm/min.h>
1718#include <__algorithm/move.h>
1819#include <__algorithm/move_backward.h>
19#include <__algorithm/ranges_copy_n.h>
2020#include <__algorithm/rotate.h>
2121#include <__assert>
2222#include <__config>
2323#include <__debug_utils/sanitizers.h>
2424#include <__format/enable_insertable.h>
2525#include <__fwd/vector.h>
26#include <__iterator/advance.h>
2726#include <__iterator/bounded_iter.h>
2827#include <__iterator/concepts.h>
2928#include <__iterator/distance.h>
......@@ -43,6 +42,7 @@
4342#include <__memory/temp_value.h>
4443#include <__memory/uninitialized_algorithms.h>
4544#include <__ranges/access.h>
45#include <__ranges/as_rvalue_view.h>
4646#include <__ranges/concepts.h>
4747#include <__ranges/container_compatible_range.h>
4848#include <__ranges/from_range.h>
......@@ -55,7 +55,6 @@
5555#include <__type_traits/is_nothrow_assignable.h>
5656#include <__type_traits/is_nothrow_constructible.h>
5757#include <__type_traits/is_pointer.h>
58#include <__type_traits/is_replaceable.h>
5958#include <__type_traits/is_same.h>
6059#include <__type_traits/is_trivially_relocatable.h>
6160#include <__type_traits/type_identity.h>
......@@ -86,6 +85,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
8685
8786template <class _Tp, class _Allocator /* = allocator<_Tp> */>
8887class vector {
88 template <class _Up, class _Alloc>
89 using __split_buffer _LIBCPP_NODEBUG = std::__split_buffer<_Up, _Alloc, __split_buffer_pointer_layout>;
90
8991public:
9092 //
9193 // Types
......@@ -113,7 +115,7 @@ public:
113115 using reverse_iterator = std::reverse_iterator<iterator>;
114116 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
115117
116 // A vector containers the following members which may be trivially relocatable:
118 // A vector contains the following members which may be trivially relocatable:
117119 // - pointer: may be trivially relocatable, so it's checked
118120 // - allocator_type: may be trivially relocatable, so it's checked
119121 // vector doesn't contain any self-references, so it's trivially relocatable if its members are.
......@@ -121,10 +123,6 @@ public:
121123 __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
122124 vector,
123125 void>;
124 using __replaceable _LIBCPP_NODEBUG =
125 __conditional_t<__is_replaceable_v<pointer> && __container_allocator_is_replaceable<__alloc_traits>::value,
126 vector,
127 void>;
128126
129127 static_assert(__check_valid_allocator<allocator_type>::value, "");
130128 static_assert(is_same<typename allocator_type::value_type, value_type>::value,
......@@ -174,7 +172,7 @@ public:
174172 __guard.__complete();
175173 }
176174
177 template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
175 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
178176 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
179177 vector(size_type __n, const value_type& __x, const allocator_type& __a)
180178 : __alloc_(__a) {
......@@ -317,7 +315,7 @@ public:
317315 is_constructible<value_type, typename iterator_traits<_ForwardIterator>::reference>::value,
318316 int> = 0>
319317 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(_ForwardIterator __first, _ForwardIterator __last) {
320 __assign_with_size(__first, __last, std::distance(__first, __last));
318 __assign_with_size<_ClassicAlgPolicy>(__first, __last, std::distance(__first, __last));
321319 }
322320
323321#if _LIBCPP_STD_VER >= 23
......@@ -325,7 +323,7 @@ public:
325323 _LIBCPP_HIDE_FROM_ABI constexpr void assign_range(_Range&& __range) {
326324 if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
327325 auto __n = static_cast<size_type>(ranges::distance(__range));
328 __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
326 __assign_with_size<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), __n);
329327
330328 } else {
331329 __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
......@@ -341,59 +339,67 @@ public:
341339 }
342340#endif
343341
344 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
342 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
345343 return this->__alloc_;
346344 }
347345
348346 //
349347 // Iterators
350348 //
351 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
349 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
352350 return __make_iter(__add_alignment_assumption(this->__begin_));
353351 }
354 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
352 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
355353 return __make_iter(__add_alignment_assumption(this->__begin_));
356354 }
357 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
355 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
358356 return __make_iter(__add_alignment_assumption(this->__end_));
359357 }
360 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
358 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
361359 return __make_iter(__add_alignment_assumption(this->__end_));
362360 }
363361
364 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
362 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
365363 return reverse_iterator(end());
366364 }
367 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
365 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
366 rbegin() const _NOEXCEPT {
368367 return const_reverse_iterator(end());
369368 }
370 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
369 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
371370 return reverse_iterator(begin());
372371 }
373 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
372 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
374373 return const_reverse_iterator(begin());
375374 }
376375
377 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
378 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
379 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
376 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
377 return begin();
378 }
379 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
380 return end();
381 }
382 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
383 crbegin() const _NOEXCEPT {
380384 return rbegin();
381385 }
382 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
386 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
387 return rend();
388 }
383389
384390 //
385391 // [vector.capacity], capacity
386392 //
387 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
393 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
388394 return static_cast<size_type>(this->__end_ - this->__begin_);
389395 }
390 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT {
396 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT {
391397 return static_cast<size_type>(this->__cap_ - this->__begin_);
392398 }
393399 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
394400 return this->__begin_ == this->__end_;
395401 }
396 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
402 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
397403 return std::min<size_type>(__alloc_traits::max_size(this->__alloc_), numeric_limits<difference_type>::max());
398404 }
399405 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n);
......@@ -402,38 +408,39 @@ public:
402408 //
403409 // element access
404410 //
405 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT {
411 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT {
406412 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
407413 return this->__begin_[__n];
408414 }
409 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const _NOEXCEPT {
415 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference
416 operator[](size_type __n) const _NOEXCEPT {
410417 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
411418 return this->__begin_[__n];
412419 }
413 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n) {
420 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n) {
414421 if (__n >= size())
415422 this->__throw_out_of_range();
416423 return this->__begin_[__n];
417424 }
418 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const {
425 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const {
419426 if (__n >= size())
420427 this->__throw_out_of_range();
421428 return this->__begin_[__n];
422429 }
423430
424 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT {
431 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT {
425432 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
426433 return *this->__begin_;
427434 }
428 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
435 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
429436 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
430437 return *this->__begin_;
431438 }
432 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT {
439 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT {
433440 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
434441 return *(this->__end_ - 1);
435442 }
436 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
443 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
437444 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
438445 return *(this->__end_ - 1);
439446 }
......@@ -441,11 +448,11 @@ public:
441448 //
442449 // [vector.data], data access
443450 //
444 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT {
451 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT {
445452 return std::__to_address(this->__begin_);
446453 }
447454
448 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT {
455 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT {
449456 return std::__to_address(this->__begin_);
450457 }
451458
......@@ -478,7 +485,21 @@ public:
478485#if _LIBCPP_STD_VER >= 23
479486 template <_ContainerCompatibleRange<_Tp> _Range>
480487 _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) {
481 insert_range(end(), std::forward<_Range>(__range));
488 if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
489 auto __len = ranges::distance(__range);
490 if (__len <= __cap_ - __end_) {
491 __construct_at_end(ranges::begin(__range), ranges::end(__range), __len);
492 } else {
493 __split_buffer<value_type, allocator_type> __buffer(__recommend(size() + __len), size(), __alloc_);
494 __buffer.__construct_at_end_with_size(ranges::begin(__range), __len);
495 __swap_out_circular_buffer(__buffer);
496 }
497 } else {
498 vector __buffer(__alloc_);
499 for (auto&& __val : __range)
500 __buffer.emplace_back(std::forward<decltype(__val)>(__val));
501 append_range(ranges::as_rvalue_view(__buffer));
502 }
482503 }
483504#endif
484505
......@@ -512,7 +533,7 @@ public:
512533 int> = 0>
513534 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
514535 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) {
515 return __insert_with_size(__position, __first, __last, std::distance(__first, __last));
536 return __insert_with_size<_ClassicAlgPolicy>(__position, __first, __last, std::distance(__first, __last));
516537 }
517538
518539#if _LIBCPP_STD_VER >= 23
......@@ -520,7 +541,7 @@ public:
520541 _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
521542 if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
522543 auto __n = static_cast<size_type>(ranges::distance(__range));
523 return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
544 return __insert_with_size<_RangeAlgPolicy>(__position, ranges::begin(__range), ranges::end(__range), __n);
524545
525546 } else {
526547 return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
......@@ -613,12 +634,13 @@ private:
613634 // The `_Iterator` in `*_with_size` functions can be input-only only if called from `*_range` (since C++23).
614635 // Otherwise, `_Iterator` is a forward iterator.
615636
616 template <class _Iterator, class _Sentinel>
637 template <class _AlgPolicy, class _Iterator, class _Sentinel>
617638 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
618639 __assign_with_size(_Iterator __first, _Sentinel __last, difference_type __n);
619640
620 template <class _Iterator,
621 __enable_if_t<!is_same<decltype(*std::declval<_Iterator&>())&&, value_type&&>::value, int> = 0>
641 template <class _AlgPolicy,
642 class _Iterator,
643 __enable_if_t<!is_same<__policy_value_type<_AlgPolicy, _Iterator>, value_type>::value, int> = 0>
622644 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
623645 __insert_assign_n_unchecked(_Iterator __first, difference_type __n, pointer __position) {
624646 for (pointer __end_position = __position + __n; __position != __end_position; ++__position, (void)++__first) {
......@@ -627,25 +649,19 @@ private:
627649 }
628650 }
629651
630 template <class _Iterator,
631 __enable_if_t<is_same<decltype(*std::declval<_Iterator&>())&&, value_type&&>::value, int> = 0>
652 template <class _AlgPolicy,
653 class _Iterator,
654 __enable_if_t<is_same<__policy_value_type<_AlgPolicy, _Iterator>, value_type>::value, int> = 0>
632655 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
633656 __insert_assign_n_unchecked(_Iterator __first, difference_type __n, pointer __position) {
634#if _LIBCPP_STD_VER >= 23
635 if constexpr (!forward_iterator<_Iterator>) { // Handles input-only sized ranges for insert_range
636 ranges::copy_n(std::move(__first), __n, __position);
637 } else
638#endif
639 {
640 std::copy_n(__first, __n, __position);
641 }
657 std::__copy_n<_AlgPolicy>(std::move(__first), __n, __position);
642658 }
643659
644660 template <class _InputIterator, class _Sentinel>
645661 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
646662 __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
647663
648 template <class _Iterator, class _Sentinel>
664 template <class _AlgPolicy, class _Iterator, class _Sentinel>
649665 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
650666 __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
651667
......@@ -653,9 +669,6 @@ private:
653669 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
654670 __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
655671
656 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
657 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
658
659672 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT {
660673#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
661674 // Bound the iterator according to the capacity, rather than the size.
......@@ -689,9 +702,9 @@ private:
689702 }
690703
691704 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
692 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
705 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v);
693706 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
694 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
707 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v, pointer __p);
695708 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
696709 __move_range(pointer __from_s, pointer __from_e, pointer __to);
697710 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type)
......@@ -811,26 +824,44 @@ private:
811824 __add_alignment_assumption(_Ptr __p) _NOEXCEPT {
812825 return __p;
813826 }
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 }
814845};
815846
816847#if _LIBCPP_STD_VER >= 17
817848template <class _InputIterator,
818 class _Alloc = allocator<__iter_value_type<_InputIterator>>,
849 class _Alloc = allocator<__iterator_value_type<_InputIterator>>,
819850 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
820 class = enable_if_t<__is_allocator<_Alloc>::value> >
821vector(_InputIterator, _InputIterator) -> vector<__iter_value_type<_InputIterator>, _Alloc>;
851 class = enable_if_t<__is_allocator_v<_Alloc>>>
852vector(_InputIterator, _InputIterator) -> vector<__iterator_value_type<_InputIterator>, _Alloc>;
822853
823854template <class _InputIterator,
824855 class _Alloc,
825856 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
826 class = enable_if_t<__is_allocator<_Alloc>::value> >
827vector(_InputIterator, _InputIterator, _Alloc) -> vector<__iter_value_type<_InputIterator>, _Alloc>;
857 class = enable_if_t<__is_allocator_v<_Alloc>>>
858vector(_InputIterator, _InputIterator, _Alloc) -> vector<__iterator_value_type<_InputIterator>, _Alloc>;
828859#endif
829860
830861#if _LIBCPP_STD_VER >= 23
831862template <ranges::input_range _Range,
832863 class _Alloc = allocator<ranges::range_value_t<_Range>>,
833 class = enable_if_t<__is_allocator<_Alloc>::value> >
864 class = enable_if_t<__is_allocator_v<_Alloc>>>
834865vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>;
835866#endif
836867
......@@ -839,17 +870,16 @@ vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_
839870// function has a strong exception guarantee.
840871template <class _Tp, class _Allocator>
841872_LIBCPP_CONSTEXPR_SINCE_CXX20 void
842vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) {
873vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v) {
843874 __annotate_delete();
844 auto __new_begin = __v.__begin_ - (__end_ - __begin_);
875 auto __new_begin = __v.begin() - size();
845876 std::__uninitialized_allocator_relocate(
846877 this->__alloc_, std::__to_address(__begin_), std::__to_address(__end_), std::__to_address(__new_begin));
847 __v.__begin_ = __new_begin;
878 __v.__set_valid_range(__new_begin, __v.end());
848879 __end_ = __begin_; // All the objects have been destroyed by relocating them.
849 std::swap(this->__begin_, __v.__begin_);
850 std::swap(this->__end_, __v.__end_);
851 std::swap(this->__cap_, __v.__cap_);
852 __v.__first_ = __v.__begin_;
880
881 __swap_layouts(__v);
882 __v.__set_data(__v.begin());
853883 __annotate_new(size());
854884}
855885
......@@ -859,27 +889,25 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
859889// function has a strong exception guarantee if __begin_ == __p || __end_ == __p.
860890template <class _Tp, class _Allocator>
861891_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
862vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) {
892vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v, pointer __p) {
863893 __annotate_delete();
864 pointer __ret = __v.__begin_;
894 pointer __ret = __v.begin();
865895
866896 // Relocate [__p, __end_) first to avoid having a hole in [__begin_, __end_)
867897 // in case something in [__begin_, __p) throws.
868898 std::__uninitialized_allocator_relocate(
869 this->__alloc_, std::__to_address(__p), std::__to_address(__end_), std::__to_address(__v.__end_));
870 __v.__end_ += (__end_ - __p);
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);
871902 __end_ = __p; // The objects in [__p, __end_) have been destroyed by relocating them.
872 auto __new_begin = __v.__begin_ - (__p - __begin_);
903 auto __new_begin = __v.begin() - (__p - __begin_);
873904
874905 std::__uninitialized_allocator_relocate(
875906 this->__alloc_, std::__to_address(__begin_), std::__to_address(__p), std::__to_address(__new_begin));
876 __v.__begin_ = __new_begin;
877 __end_ = __begin_; // All the objects have been destroyed by relocating them.
878
879 std::swap(this->__begin_, __v.__begin_);
880 std::swap(this->__end_, __v.__end_);
881 std::swap(this->__cap_, __v.__cap_);
882 __v.__first_ = __v.__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());
883911 __annotate_new(size());
884912 return __ret;
885913}
......@@ -945,36 +973,6 @@ vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __
945973 __tx.__pos_ = std::__uninitialized_allocator_copy(this->__alloc_, std::move(__first), std::move(__last), __tx.__pos_);
946974}
947975
948// Default constructs __n objects starting at __end_
949// throws if construction throws
950// Postcondition: size() == size() + __n
951// Exception safety: strong.
952template <class _Tp, class _Allocator>
953_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type __n) {
954 if (static_cast<size_type>(this->__cap_ - this->__end_) >= __n)
955 this->__construct_at_end(__n);
956 else {
957 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), this->__alloc_);
958 __v.__construct_at_end(__n);
959 __swap_out_circular_buffer(__v);
960 }
961}
962
963// Default constructs __n objects starting at __end_
964// throws if construction throws
965// Postcondition: size() == size() + __n
966// Exception safety: strong.
967template <class _Tp, class _Allocator>
968_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) {
969 if (static_cast<size_type>(this->__cap_ - this->__end_) >= __n)
970 this->__construct_at_end(__n, __x);
971 else {
972 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), this->__alloc_);
973 __v.__construct_at_end(__n, __x);
974 __swap_out_circular_buffer(__v);
975 }
976}
977
978976template <class _Tp, class _Allocator>
979977_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(vector&& __x)
980978#if _LIBCPP_STD_VER >= 17
......@@ -1051,20 +1049,14 @@ vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __l
10511049}
10521050
10531051template <class _Tp, class _Allocator>
1054template <class _Iterator, class _Sentinel>
1052template <class _AlgPolicy, class _Iterator, class _Sentinel>
10551053_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
10561054vector<_Tp, _Allocator>::__assign_with_size(_Iterator __first, _Sentinel __last, difference_type __n) {
10571055 size_type __new_size = static_cast<size_type>(__n);
10581056 if (__new_size <= capacity()) {
10591057 if (__new_size > size()) {
1060#if _LIBCPP_STD_VER >= 23
1061 auto __mid = ranges::copy_n(std::move(__first), size(), this->__begin_).in;
1058 auto __mid = std::__copy_n<_AlgPolicy>(std::move(__first), size(), this->__begin_).first;
10621059 __construct_at_end(std::move(__mid), std::move(__last), __new_size - size());
1063#else
1064 _Iterator __mid = std::next(__first, size());
1065 std::copy(__first, __mid, this->__begin_);
1066 __construct_at_end(__mid, __last, __new_size - size());
1067#endif
10681060 } else {
10691061 pointer __m = std::__copy(std::move(__first), __last, this->__begin_).second;
10701062 this->__destruct_at_end(__m);
......@@ -1097,7 +1089,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __
10971089 if (__n > capacity()) {
10981090 if (__n > max_size())
10991091 this->__throw_length_error();
1100 __split_buffer<value_type, allocator_type&> __v(__n, size(), this->__alloc_);
1092 __split_buffer<value_type, allocator_type> __v(__n, size(), this->__alloc_);
11011093 __swap_out_circular_buffer(__v);
11021094 }
11031095}
......@@ -1108,7 +1100,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE
11081100#if _LIBCPP_HAS_EXCEPTIONS
11091101 try {
11101102#endif // _LIBCPP_HAS_EXCEPTIONS
1111 __split_buffer<value_type, allocator_type&> __v(size(), size(), this->__alloc_);
1103 __split_buffer<value_type, allocator_type> __v(size(), size(), this->__alloc_);
11121104 // The Standard mandates shrink_to_fit() does not increase the capacity.
11131105 // With equal capacity keep the existing buffer. This avoids extra work
11141106 // due to swapping the elements.
......@@ -1125,14 +1117,33 @@ template <class _Tp, class _Allocator>
11251117template <class... _Args>
11261118_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
11271119vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) {
1128 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), this->__alloc_);
1120 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), size(), this->__alloc_);
11291121 // __v.emplace_back(std::forward<_Args>(__args)...);
1130 __alloc_traits::construct(this->__alloc_, std::__to_address(__v.__end_), std::forward<_Args>(__args)...);
1131 __v.__end_++;
1122 pointer __end = __v.end();
1123 __alloc_traits::construct(this->__alloc_, std::__to_address(__end), std::forward<_Args>(__args)...);
1124 __v.__set_sentinel(++__end);
11321125 __swap_out_circular_buffer(__v);
11331126 return this->__end_;
11341127}
11351128
1129// This makes the compiler inline `__else()` if `__cond` is known to be false. Currently LLVM doesn't do that without
1130// the `__builtin_constant_p`, since it considers `__else` unlikely even through it's known to be run.
1131// See https://llvm.org/PR154292
1132template <class _If, class _Else>
1133_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __if_likely_else(bool __cond, _If __if, _Else __else) {
1134 if (__builtin_constant_p(__cond)) {
1135 if (__cond)
1136 __if();
1137 else
1138 __else();
1139 } else {
1140 if (__cond) [[__likely__]]
1141 __if();
1142 else
1143 __else();
1144 }
1145}
1146
11361147template <class _Tp, class _Allocator>
11371148template <class... _Args>
11381149_LIBCPP_CONSTEXPR_SINCE_CXX20 inline
......@@ -1143,12 +1154,14 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline
11431154#endif
11441155 vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
11451156 pointer __end = this->__end_;
1146 if (__end < this->__cap_) {
1147 __emplace_back_assume_capacity(std::forward<_Args>(__args)...);
1148 ++__end;
1149 } else {
1150 __end = __emplace_back_slow_path(std::forward<_Args>(__args)...);
1151 }
1157 std::__if_likely_else(
1158 __end < this->__cap_,
1159 [&] {
1160 __emplace_back_assume_capacity(std::forward<_Args>(__args)...);
1161 ++__end;
1162 },
1163 [&] { __end = __emplace_back_slow_path(std::forward<_Args>(__args)...); });
1164
11521165 this->__end_ = __end;
11531166#if _LIBCPP_STD_VER >= 17
11541167 return *(__end - 1);
......@@ -1207,7 +1220,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
12071220 *__p = *__xr;
12081221 }
12091222 } else {
1210 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
1223 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
12111224 __v.emplace_back(__x);
12121225 __p = __swap_out_circular_buffer(__v, __p);
12131226 }
......@@ -1226,7 +1239,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) {
12261239 *__p = std::move(__x);
12271240 }
12281241 } else {
1229 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
1242 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
12301243 __v.emplace_back(std::move(__x));
12311244 __p = __swap_out_circular_buffer(__v, __p);
12321245 }
......@@ -1247,7 +1260,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) {
12471260 *__p = std::move(__tmp.get());
12481261 }
12491262 } else {
1250 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
1263 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
12511264 __v.emplace_back(std::forward<_Args>(__args)...);
12521265 __p = __swap_out_circular_buffer(__v, __p);
12531266 }
......@@ -1275,7 +1288,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_
12751288 std::fill_n(__p, __n, *__xr);
12761289 }
12771290 } else {
1278 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_);
1291 __split_buffer<value_type, allocator_type> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_);
12791292 __v.__construct_at_end(__n, __x);
12801293 __p = __swap_out_circular_buffer(__v, __p);
12811294 }
......@@ -1296,28 +1309,28 @@ vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _Inpu
12961309 if (__first == __last)
12971310 (void)std::rotate(__p, __old_last, this->__end_);
12981311 else {
1299 __split_buffer<value_type, allocator_type&> __v(__alloc_);
1312 __split_buffer<value_type, allocator_type> __v(__alloc_);
13001313 auto __guard = std::__make_exception_guard(
13011314 _AllocatorDestroyRangeReverse<allocator_type, pointer>(__alloc_, __old_last, this->__end_));
13021315 __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
1303 __split_buffer<value_type, allocator_type&> __merged(
1316 __split_buffer<value_type, allocator_type> __merged(
13041317 __recommend(size() + __v.size()), __off, __alloc_); // has `__off` positions available at the front
13051318 std::__uninitialized_allocator_relocate(
1306 __alloc_, std::__to_address(__old_last), std::__to_address(this->__end_), std::__to_address(__merged.__end_));
1319 __alloc_, std::__to_address(__old_last), std::__to_address(this->__end_), std::__to_address(__merged.end()));
13071320 __guard.__complete(); // Release the guard once objects in [__old_last_, __end_) have been successfully relocated.
1308 __merged.__end_ += this->__end_ - __old_last;
1321 __merged.__set_sentinel(__merged.end() + (this->__end_ - __old_last));
13091322 this->__end_ = __old_last;
13101323 std::__uninitialized_allocator_relocate(
1311 __alloc_, std::__to_address(__v.__begin_), std::__to_address(__v.__end_), std::__to_address(__merged.__end_));
1312 __merged.__end_ += __v.size();
1313 __v.__end_ = __v.__begin_;
1324 __alloc_, std::__to_address(__v.begin()), std::__to_address(__v.end()), std::__to_address(__merged.end()));
1325 __merged.__set_sentinel(__merged.size() + __v.size());
1326 __v.__set_sentinel(__v.begin());
13141327 __p = __swap_out_circular_buffer(__merged, __p);
13151328 }
13161329 return __make_iter(__p);
13171330}
13181331
13191332template <class _Tp, class _Allocator>
1320template <class _Iterator, class _Sentinel>
1333template <class _AlgPolicy, class _Iterator, class _Sentinel>
13211334_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
13221335vector<_Tp, _Allocator>::__insert_with_size(
13231336 const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n) {
......@@ -1338,15 +1351,15 @@ vector<_Tp, _Allocator>::__insert_with_size(
13381351 __construct_at_end(__m, __last, __n - __dx);
13391352 if (__dx > 0) {
13401353 __move_range(__p, __old_last, __p + __n);
1341 __insert_assign_n_unchecked(__first, __dx, __p);
1354 __insert_assign_n_unchecked<_AlgPolicy>(__first, __dx, __p);
13421355 }
13431356 }
13441357 } else {
13451358 __move_range(__p, __old_last, __p + __n);
1346 __insert_assign_n_unchecked(std::move(__first), __n, __p);
1359 __insert_assign_n_unchecked<_AlgPolicy>(std::move(__first), __n, __p);
13471360 }
13481361 } else {
1349 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_);
1362 __split_buffer<value_type, allocator_type> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_);
13501363 __v.__construct_at_end_with_size(std::move(__first), __n);
13511364 __p = __swap_out_circular_buffer(__v, __p);
13521365 }
......@@ -1355,21 +1368,35 @@ vector<_Tp, _Allocator>::__insert_with_size(
13551368}
13561369
13571370template <class _Tp, class _Allocator>
1358_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __sz) {
1359 size_type __cs = size();
1360 if (__cs < __sz)
1361 this->__append(__sz - __cs);
1362 else if (__cs > __sz)
1363 this->__destruct_at_end(this->__begin_ + __sz);
1371_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __new_size) {
1372 size_type __current_size = size();
1373 if (__current_size < __new_size) {
1374 if (__new_size <= capacity()) {
1375 __construct_at_end(__new_size - __current_size);
1376 } else {
1377 __split_buffer<value_type, allocator_type> __v(__recommend(__new_size), __current_size, __alloc_);
1378 __v.__construct_at_end(__new_size - __current_size);
1379 __swap_out_circular_buffer(__v);
1380 }
1381 } else if (__current_size > __new_size) {
1382 this->__destruct_at_end(this->__begin_ + __new_size);
1383 }
13641384}
13651385
13661386template <class _Tp, class _Allocator>
1367_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) {
1368 size_type __cs = size();
1369 if (__cs < __sz)
1370 this->__append(__sz - __cs, __x);
1371 else if (__cs > __sz)
1372 this->__destruct_at_end(this->__begin_ + __sz);
1387_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __new_size, const_reference __x) {
1388 size_type __current_size = size();
1389 if (__current_size < __new_size) {
1390 if (__new_size <= capacity())
1391 __construct_at_end(__new_size - __current_size, __x);
1392 else {
1393 __split_buffer<value_type, allocator_type> __v(__recommend(__new_size), __current_size, __alloc_);
1394 __v.__construct_at_end(__new_size - __current_size, __x);
1395 __swap_out_circular_buffer(__v);
1396 }
1397 } else if (__current_size > __new_size) {
1398 this->__destruct_at_end(this->__begin_ + __new_size);
1399 }
13731400}
13741401
13751402template <class _Tp, class _Allocator>
lib/libcxx/include/__vector/vector_bool.h+76-83
......@@ -11,6 +11,7 @@
1111
1212#include <__algorithm/copy.h>
1313#include <__algorithm/copy_backward.h>
14#include <__algorithm/copy_n.h>
1415#include <__algorithm/fill_n.h>
1516#include <__algorithm/iterator_operations.h>
1617#include <__algorithm/max.h>
......@@ -19,7 +20,7 @@
1920#include <__bit_reference>
2021#include <__config>
2122#include <__functional/unary_function.h>
22#include <__fwd/bit_reference.h> // TODO: This is a workaround for https://github.com/llvm/llvm-project/issues/131814
23#include <__fwd/bit_reference.h> // TODO: This is a workaround for https://llvm.org/PR131814
2324#include <__fwd/functional.h>
2425#include <__fwd/vector.h>
2526#include <__iterator/distance.h>
......@@ -234,74 +235,89 @@ public:
234235 }
235236#endif
236237
237 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
238 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
238239 return allocator_type(this->__alloc_);
239240 }
240241
241 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT;
242 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
242 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT;
243 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
243244 return __internal_cap_to_external(__cap_);
244245 }
245 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT { return __size_; }
246 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
247 return __size_;
248 }
246249 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT {
247250 return __size_ == 0;
248251 }
249252 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n);
250253 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
251254
252 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT { return __make_iter(0); }
253 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT { return __make_iter(0); }
254 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT { return __make_iter(__size_); }
255 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
255 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
256 return __make_iter(0);
257 }
258 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
259 return __make_iter(0);
260 }
261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
262 return __make_iter(__size_);
263 }
264 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
256265 return __make_iter(__size_);
257266 }
258267
259 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
268 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
260269 return reverse_iterator(end());
261270 }
262 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rbegin() const _NOEXCEPT {
271 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
272 rbegin() const _NOEXCEPT {
263273 return const_reverse_iterator(end());
264274 }
265 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
275 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
266276 return reverse_iterator(begin());
267277 }
268 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
278 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
269279 return const_reverse_iterator(begin());
270280 }
271281
272 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT { return __make_iter(0); }
273 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT {
282 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT {
283 return __make_iter(0);
284 }
285 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT {
274286 return __make_iter(__size_);
275287 }
276 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crbegin() const _NOEXCEPT {
288 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
289 crbegin() const _NOEXCEPT {
277290 return rbegin();
278291 }
279 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
292 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT {
293 return rend();
294 }
280295
281 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) {
296 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) {
282297 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector<bool>::operator[] index out of bounds");
283298 return __make_ref(__n);
284299 }
285 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __n) const {
300 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference
301 operator[](size_type __n) const {
286302 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector<bool>::operator[] index out of bounds");
287303 return __make_ref(__n);
288304 }
289 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
290 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
305 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
306 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
291307
292 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() {
308 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() {
293309 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector<bool>::front() called on an empty vector");
294310 return __make_ref(0);
295311 }
296 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const {
312 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const {
297313 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector<bool>::front() called on an empty vector");
298314 return __make_ref(0);
299315 }
300 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() {
316 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() {
301317 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector<bool>::back() called on an empty vector");
302318 return __make_ref(__size_ - 1);
303319 }
304 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const {
320 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const {
305321 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector<bool>::back() called on an empty vector");
306322 return __make_ref(__size_ - 1);
307323 }
......@@ -463,7 +479,6 @@ private:
463479 return (__new_size + (__bits_per_word - 1)) & ~((size_type)__bits_per_word - 1);
464480 }
465481 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __new_size) const;
466 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_at_end(size_type __n, bool __x);
467482 template <class _InputIterator, class _Sentinel>
468483 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
469484 __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
......@@ -552,20 +567,6 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const {
552567 return std::max<size_type>(2 * __cap, __align_it(__new_size));
553568}
554569
555// Default constructs __n objects starting at __end_
556// Precondition: size() + __n <= capacity()
557// Postcondition: size() == size() + __n
558template <class _Allocator>
559inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
560vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) {
561 _LIBCPP_ASSERT_INTERNAL(
562 capacity() >= size() + __n, "vector<bool>::__construct_at_end called with insufficient capacity");
563 std::fill_n(end(), __n, __x);
564 this->__size_ += __n;
565 if (end().__ctz_ != 0) // Ensure uninitialized leading bits in the last word are set to zero
566 std::fill_n(end(), __bits_per_word - end().__ctz_, 0);
567}
568
569570template <class _Allocator>
570571template <class _InputIterator, class _Sentinel>
571572_LIBCPP_CONSTEXPR_SINCE_CXX20 void
......@@ -598,7 +599,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n)
598599 : __begin_(nullptr), __size_(0), __cap_(0) {
599600 if (__n > 0) {
600601 __vallocate(__n);
601 __construct_at_end(__n, false);
602 std::fill_n(__begin_, __external_cap_to_internal(__n), __storage_type(0));
603 __size_ = __n;
602604 }
603605}
604606
......@@ -608,7 +610,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co
608610 : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) {
609611 if (__n > 0) {
610612 __vallocate(__n);
611 __construct_at_end(__n, false);
613 std::fill_n(__begin_, __external_cap_to_internal(__n), __storage_type(0));
614 __size_ = __n;
612615 }
613616}
614617#endif
......@@ -618,7 +621,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co
618621 : __begin_(nullptr), __size_(0), __cap_(0) {
619622 if (__n > 0) {
620623 __vallocate(__n);
621 __construct_at_end(__n, __x);
624 std::fill_n(__begin_, __external_cap_to_internal(__n), __storage_type(0) - __x);
625 __size_ = __n;
622626 }
623627}
624628
......@@ -628,7 +632,8 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all
628632 : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) {
629633 if (__n > 0) {
630634 __vallocate(__n);
631 __construct_at_end(__n, __x);
635 std::fill_n(__begin_, __external_cap_to_internal(__n), __storage_type(0) - __x);
636 __size_ = __n;
632637 }
633638}
634639
......@@ -697,7 +702,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v
697702 __alloc_(__storage_traits::select_on_container_copy_construction(__v.__alloc_)) {
698703 if (__v.size() > 0) {
699704 __vallocate(__v.size());
700 __construct_at_end(__v.begin(), __v.end(), __v.size());
705 std::copy_n(__v.__begin_, __external_cap_to_internal(__v.size()), __begin_);
706 __size_ = __v.size();
701707 }
702708}
703709
......@@ -706,7 +712,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v
706712 : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(__a) {
707713 if (__v.size() > 0) {
708714 __vallocate(__v.size());
709 __construct_at_end(__v.begin(), __v.end(), __v.size());
715 std::copy_n(__v.__begin_, __external_cap_to_internal(__v.size()), __begin_);
716 __size_ = __v.size();
710717 }
711718}
712719
......@@ -719,7 +726,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>& vector<bool, _Allocator>
719726 __vdeallocate();
720727 __vallocate(__v.__size_);
721728 }
722 std::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_);
729 std::copy_n(__v.__begin_, __external_cap_to_internal(__v.size()), __begin_);
723730 }
724731 __size_ = __v.__size_;
725732 }
......@@ -754,7 +761,8 @@ vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator
754761 __v.__cap_ = __v.__size_ = 0;
755762 } else if (__v.size() > 0) {
756763 __vallocate(__v.size());
757 __construct_at_end(__v.begin(), __v.end(), __v.size());
764 __size_ = __v.__size_;
765 std::copy_n(__v.__begin_, __external_cap_to_internal(__v.size()), __begin_);
758766 }
759767}
760768
......@@ -849,7 +857,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::reserve(size_type _
849857 this->__throw_length_error();
850858 vector __v(this->get_allocator());
851859 __v.__vallocate(__n);
852 __v.__construct_at_end(this->begin(), this->end(), this->size());
860 __v.__size_ = __size_;
861 std::copy_n(__begin_, __external_cap_to_internal(__size_), __v.__begin_);
853862 swap(__v);
854863 }
855864}
......@@ -956,21 +965,14 @@ vector<bool, _Allocator>::__insert_with_sentinel(const_iterator __position, _Inp
956965 }
957966 vector __v(get_allocator());
958967 if (__first != __last) {
959#if _LIBCPP_HAS_EXCEPTIONS
960 try {
961#endif // _LIBCPP_HAS_EXCEPTIONS
962 __v.__assign_with_sentinel(std::move(__first), std::move(__last));
963 difference_type __old_size = static_cast<difference_type>(__old_end - begin());
964 difference_type __old_p = __p - begin();
965 reserve(__recommend(size() + __v.size()));
966 __p = begin() + __old_p;
967 __old_end = begin() + __old_size;
968#if _LIBCPP_HAS_EXCEPTIONS
969 } catch (...) {
970 erase(__old_end, end());
971 throw;
972 }
973#endif // _LIBCPP_HAS_EXCEPTIONS
968 auto __guard = std::__make_exception_guard([&] { erase(__old_end, end()); });
969 __v.__assign_with_sentinel(std::move(__first), std::move(__last));
970 difference_type __old_size = static_cast<difference_type>(__old_end - begin());
971 difference_type __old_p = __p - begin();
972 reserve(__recommend(size() + __v.size()));
973 __p = begin() + __old_p;
974 __old_end = begin() + __old_size;
975 __guard.__complete();
974976 }
975977 __p = std::rotate(__p, __old_end, end());
976978 insert(__p, __v.begin(), __v.end());
......@@ -1048,25 +1050,16 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x)
10481050}
10491051
10501052template <class _Allocator>
1051_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::resize(size_type __sz, value_type __x) {
1052 size_type __cs = size();
1053 if (__cs < __sz) {
1054 iterator __r;
1055 size_type __c = capacity();
1056 size_type __n = __sz - __cs;
1057 if (__n <= __c && __cs <= __c - __n) {
1058 __r = end();
1059 __size_ += __n;
1060 } else {
1061 vector __v(get_allocator());
1062 __v.reserve(__recommend(__size_ + __n));
1063 __v.__size_ = __size_ + __n;
1064 __r = std::copy(cbegin(), cend(), __v.begin());
1065 swap(__v);
1066 }
1067 std::fill_n(__r, __n, __x);
1068 } else
1069 __size_ = __sz;
1053_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::resize(size_type __new_size, value_type __x) {
1054 size_type __current_size = size();
1055 if (__new_size < __current_size) {
1056 __size_ = __new_size;
1057 return;
1058 }
1059
1060 reserve(__new_size);
1061 std::fill_n(end(), __new_size - __current_size, __x);
1062 __size_ = __new_size;
10701063}
10711064
10721065template <class _Allocator>
lib/libcxx/include/any+118-155
......@@ -84,14 +84,12 @@ namespace std {
8484# include <__cxx03/__config>
8585#else
8686# include <__config>
87# include <__memory/allocator.h>
88# include <__memory/allocator_destructor.h>
89# include <__memory/allocator_traits.h>
90# include <__memory/unique_ptr.h>
87# include <__memory/construct_at.h>
88# include <__new/allocate.h>
9189# include <__type_traits/add_cv_quals.h>
9290# include <__type_traits/add_pointer.h>
93# include <__type_traits/aligned_storage.h>
9491# include <__type_traits/conditional.h>
92# include <__type_traits/conjunction.h>
9593# include <__type_traits/decay.h>
9694# include <__type_traits/enable_if.h>
9795# include <__type_traits/is_constructible.h>
......@@ -100,9 +98,11 @@ namespace std {
10098# include <__type_traits/is_reference.h>
10199# include <__type_traits/is_same.h>
102100# include <__type_traits/is_void.h>
101# include <__type_traits/negation.h>
103102# include <__type_traits/remove_cv.h>
104103# include <__type_traits/remove_cvref.h>
105104# include <__type_traits/remove_reference.h>
105# include <__utility/exception_guard.h>
106106# include <__utility/forward.h>
107107# include <__utility/in_place.h>
108108# include <__utility/move.h>
......@@ -142,21 +142,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
142142class any;
143143
144144template <class _ValueType>
145_LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
145_LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) noexcept;
146146
147147template <class _ValueType>
148_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
148_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) noexcept;
149149
150150namespace __any_imp {
151_LIBCPP_SUPPRESS_DEPRECATED_PUSH
152using _Buffer _LIBCPP_NODEBUG = aligned_storage_t<3 * sizeof(void*), alignof(void*)>;
153_LIBCPP_SUPPRESS_DEPRECATED_POP
151inline constexpr size_t __small_buffer_size = 3 * sizeof(void*);
152inline constexpr size_t __small_buffer_alignment = alignof(void*);
154153
155154template <class _Tp>
156155using _IsSmallObject _LIBCPP_NODEBUG =
157156 integral_constant<bool,
158 sizeof(_Tp) <= sizeof(_Buffer) && alignof(_Buffer) % alignof(_Tp) == 0 &&
159 is_nothrow_move_constructible<_Tp>::value >;
157 sizeof(_Tp) <= __small_buffer_size && alignof(_Tp) <= __small_buffer_alignment &&
158 is_nothrow_move_constructible_v<_Tp>>;
160159
161160enum class _Action { _Destroy, _Copy, _Move, _Get, _TypeInfo };
162161
......@@ -192,37 +191,44 @@ using _Handler _LIBCPP_NODEBUG = conditional_t< _IsSmallObject<_Tp>::value, _Sma
192191class any {
193192public:
194193 // construct/destruct
195 _LIBCPP_HIDE_FROM_ABI constexpr any() _NOEXCEPT : __h_(nullptr) {}
194 _LIBCPP_HIDE_FROM_ABI constexpr any() noexcept : __h_(nullptr) {}
196195
197196 _LIBCPP_HIDE_FROM_ABI any(any const& __other) : __h_(nullptr) {
198197 if (__other.__h_)
199198 __other.__call(_Action::_Copy, this);
200199 }
201200
202 _LIBCPP_HIDE_FROM_ABI any(any&& __other) _NOEXCEPT : __h_(nullptr) {
201 _LIBCPP_HIDE_FROM_ABI any(any&& __other) noexcept : __h_(nullptr) {
203202 if (__other.__h_)
204203 __other.__call(_Action::_Move, this);
205204 }
206205
207 template < class _ValueType,
208 class _Tp = decay_t<_ValueType>,
209 class = enable_if_t< !is_same<_Tp, any>::value && !__is_inplace_type<_ValueType>::value &&
210 is_copy_constructible<_Tp>::value> >
211 _LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value);
206 template <
207 class _ValueType,
208 class _Tp = decay_t<_ValueType>,
209 enable_if_t<_And<_Not<is_same<_Tp, any>>, _Not<__is_inplace_type<_ValueType>>, is_copy_constructible<_Tp>>::value,
210 int> = 0>
211 _LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value) : __h_(nullptr) {
212 __any_imp::_Handler<_Tp>::__create(*this, std::forward<_ValueType>(__value));
213 }
212214
213215 template <class _ValueType,
214216 class... _Args,
215 class _Tp = decay_t<_ValueType>,
216 class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value > >
217 _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
217 class _Tp = decay_t<_ValueType>,
218 enable_if_t<is_constructible_v<_Tp, _Args...> && is_copy_constructible_v<_Tp>, int> = 0>
219 _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, _Args&&... __args) {
220 __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
221 }
218222
219 template <class _ValueType,
220 class _Up,
221 class... _Args,
222 class _Tp = decay_t<_ValueType>,
223 class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
224 is_copy_constructible<_Tp>::value> >
225 _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
223 template <
224 class _ValueType,
225 class _Up,
226 class... _Args,
227 class _Tp = decay_t<_ValueType>,
228 enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...> && is_copy_constructible_v<_Tp>, int> = 0>
229 _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
230 __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
231 }
226232
227233 _LIBCPP_HIDE_FROM_ABI ~any() { this->reset(); }
228234
......@@ -232,43 +238,65 @@ public:
232238 return *this;
233239 }
234240
235 _LIBCPP_HIDE_FROM_ABI any& operator=(any&& __rhs) _NOEXCEPT {
241 _LIBCPP_HIDE_FROM_ABI any& operator=(any&& __rhs) noexcept {
236242 any(std::move(__rhs)).swap(*this);
237243 return *this;
238244 }
239245
240 template < class _ValueType,
241 class _Tp = decay_t<_ValueType>,
242 class = enable_if_t< !is_same<_Tp, any>::value && is_copy_constructible<_Tp>::value> >
243 _LIBCPP_HIDE_FROM_ABI any& operator=(_ValueType&& __rhs);
244
245246 template <class _ValueType,
246 class... _Args,
247 class _Tp = decay_t<_ValueType>,
248 class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value> >
249 _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&...);
247 class _Tp = decay_t<_ValueType>,
248 enable_if_t<!is_same_v<_Tp, any> && is_copy_constructible_v<_Tp>, int> = 0>
249 _LIBCPP_HIDE_FROM_ABI any& operator=(_ValueType&& __rhs) {
250 any(std::forward<_ValueType>(__rhs)).swap(*this);
251 return *this;
252 }
250253
251254 template <class _ValueType,
252 class _Up,
253255 class... _Args,
254 class _Tp = decay_t<_ValueType>,
255 class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
256 is_copy_constructible<_Tp>::value> >
257 _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up>, _Args&&...);
256 class _Tp = decay_t<_ValueType>,
257 enable_if_t<is_constructible_v<_Tp, _Args...> && is_copy_constructible_v<_Tp>, int> = 0>
258 _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) {
259 reset();
260 return __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
261 }
262
263 template <
264 class _ValueType,
265 class _Up,
266 class... _Args,
267 class _Tp = decay_t<_ValueType>,
268 enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...> && is_copy_constructible_v<_Tp>, int> = 0>
269 _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
270 reset();
271 return __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
272 }
258273
259274 // 6.3.3 any modifiers
260 _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT {
275 _LIBCPP_HIDE_FROM_ABI void reset() noexcept {
261276 if (__h_)
262277 this->__call(_Action::_Destroy);
263278 }
264279
265 _LIBCPP_HIDE_FROM_ABI void swap(any& __rhs) _NOEXCEPT;
280 _LIBCPP_HIDE_FROM_ABI void swap(any& __rhs) noexcept {
281 if (this == &__rhs)
282 return;
283 if (__h_ && __rhs.__h_) {
284 any __tmp;
285 __rhs.__call(_Action::_Move, &__tmp);
286 this->__call(_Action::_Move, &__rhs);
287 __tmp.__call(_Action::_Move, this);
288 } else if (__h_) {
289 this->__call(_Action::_Move, &__rhs);
290 } else if (__rhs.__h_) {
291 __rhs.__call(_Action::_Move, this);
292 }
293 }
266294
267295 // 6.3.4 any observers
268 _LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
296 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool has_value() const noexcept { return __h_ != nullptr; }
269297
270298# if _LIBCPP_HAS_RTTI
271 _LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
299 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const type_info& type() const noexcept {
272300 if (__h_) {
273301 return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
274302 } else {
......@@ -285,7 +313,7 @@ private:
285313 union _Storage {
286314 _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
287315 void* __ptr;
288 __any_imp::_Buffer __buf;
316 alignas(__any_imp::__small_buffer_alignment) char __buf[__any_imp::__small_buffer_size];
289317 };
290318
291319 _LIBCPP_HIDE_FROM_ABI void*
......@@ -305,10 +333,10 @@ private:
305333 friend struct __any_imp::_LargeHandler;
306334
307335 template <class _ValueType>
308 friend add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
336 friend add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) noexcept;
309337
310338 template <class _ValueType>
311 friend add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
339 friend add_pointer_t<_ValueType> any_cast(any*) noexcept;
312340
313341 _HandleFuncPtr __h_ = nullptr;
314342 _Storage __s_;
......@@ -339,22 +367,14 @@ struct _SmallHandler {
339367
340368 template <class... _Args>
341369 _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
342 typedef allocator<_Tp> _Alloc;
343 typedef allocator_traits<_Alloc> _ATraits;
344 _Alloc __a;
345 _Tp* __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf));
346 _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
370 auto __ret = std::__construct_at(reinterpret_cast<_Tp*>(&__dest.__s_.__buf), std::forward<_Args>(__args)...);
347371 __dest.__h_ = &_SmallHandler::__handle;
348372 return *__ret;
349373 }
350374
351375private:
352376 _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
353 typedef allocator<_Tp> _Alloc;
354 typedef allocator_traits<_Alloc> _ATraits;
355 _Alloc __a;
356 _Tp* __p = static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf));
357 _ATraits::destroy(__a, __p);
377 std::__destroy_at(reinterpret_cast<_Tp*>(&__this.__s_.__buf));
358378 __this.__h_ = nullptr;
359379 }
360380
......@@ -406,26 +426,20 @@ struct _LargeHandler {
406426
407427 template <class... _Args>
408428 _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
409 typedef allocator<_Tp> _Alloc;
410 typedef allocator_traits<_Alloc> _ATraits;
411 typedef __allocator_destructor<_Alloc> _Dp;
412 _Alloc __a;
413 unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
414 _Tp* __ret = __hold.get();
415 _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
416 __dest.__s_.__ptr = __hold.release();
429 _Tp* __ptr = static_cast<_Tp*>(std::__libcpp_allocate<_Tp>(__element_count(1)));
430 std::__exception_guard __guard([&] { std::__libcpp_deallocate<_Tp>(__ptr, __element_count(1)); });
431 std::__construct_at(__ptr, std::forward<_Args>(__args)...);
432 __guard.__complete();
433 __dest.__s_.__ptr = __ptr;
417434 __dest.__h_ = &_LargeHandler::__handle;
418 return *__ret;
435 return *__ptr;
419436 }
420437
421438private:
422439 _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
423 typedef allocator<_Tp> _Alloc;
424 typedef allocator_traits<_Alloc> _ATraits;
425 _Alloc __a;
426440 _Tp* __p = static_cast<_Tp*>(__this.__s_.__ptr);
427 _ATraits::destroy(__a, __p);
428 _ATraits::deallocate(__a, __p, 1);
441 std::__destroy_at(__p);
442 std::__libcpp_deallocate<_Tp>(__p, __element_count(1));
429443 __this.__h_ = nullptr;
430444 }
431445
......@@ -456,72 +470,24 @@ private:
456470
457471} // namespace __any_imp
458472
459template <class _ValueType, class _Tp, class>
460any::any(_ValueType&& __v) : __h_(nullptr) {
461 __any_imp::_Handler<_Tp>::__create(*this, std::forward<_ValueType>(__v));
462}
463
464template <class _ValueType, class... _Args, class _Tp, class>
465any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
466 __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
467}
468
469template <class _ValueType, class _Up, class... _Args, class _Tp, class>
470any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
471 __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
472}
473
474template <class _ValueType, class, class>
475inline _LIBCPP_HIDE_FROM_ABI any& any::operator=(_ValueType&& __v) {
476 any(std::forward<_ValueType>(__v)).swap(*this);
477 return *this;
478}
479
480template <class _ValueType, class... _Args, class _Tp, class>
481inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(_Args&&... __args) {
482 reset();
483 return __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
484}
485
486template <class _ValueType, class _Up, class... _Args, class _Tp, class>
487inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
488 reset();
489 return __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
490}
491
492inline _LIBCPP_HIDE_FROM_ABI void any::swap(any& __rhs) _NOEXCEPT {
493 if (this == &__rhs)
494 return;
495 if (__h_ && __rhs.__h_) {
496 any __tmp;
497 __rhs.__call(_Action::_Move, &__tmp);
498 this->__call(_Action::_Move, &__rhs);
499 __tmp.__call(_Action::_Move, this);
500 } else if (__h_) {
501 this->__call(_Action::_Move, &__rhs);
502 } else if (__rhs.__h_) {
503 __rhs.__call(_Action::_Move, this);
504 }
505}
506
507473// 6.4 Non-member functions
508474
509inline _LIBCPP_HIDE_FROM_ABI void swap(any& __lhs, any& __rhs) _NOEXCEPT { __lhs.swap(__rhs); }
475inline _LIBCPP_HIDE_FROM_ABI void swap(any& __lhs, any& __rhs) noexcept { __lhs.swap(__rhs); }
510476
511477template <class _Tp, class... _Args>
512inline _LIBCPP_HIDE_FROM_ABI any make_any(_Args&&... __args) {
478[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI any make_any(_Args&&... __args) {
513479 return any(in_place_type<_Tp>, std::forward<_Args>(__args)...);
514480}
515481
516482template <class _Tp, class _Up, class... _Args>
517inline _LIBCPP_HIDE_FROM_ABI any make_any(initializer_list<_Up> __il, _Args&&... __args) {
483[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI any make_any(initializer_list<_Up> __il, _Args&&... __args) {
518484 return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
519485}
520486
521487template <class _ValueType>
522inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any const& __v) {
488[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any const& __v) {
523489 using _RawValueType = __remove_cvref_t<_ValueType>;
524 static_assert(is_constructible<_ValueType, _RawValueType const&>::value,
490 static_assert(is_constructible_v<_ValueType, _RawValueType const&>,
525491 "ValueType is required to be a const lvalue reference "
526492 "or a CopyConstructible type");
527493 auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
......@@ -531,9 +497,9 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any const& __v) {
531497}
532498
533499template <class _ValueType>
534inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any& __v) {
500[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any& __v) {
535501 using _RawValueType = __remove_cvref_t<_ValueType>;
536 static_assert(is_constructible<_ValueType, _RawValueType&>::value,
502 static_assert(is_constructible_v<_ValueType, _RawValueType&>,
537503 "ValueType is required to be an lvalue reference "
538504 "or a CopyConstructible type");
539505 auto __tmp = std::any_cast<_RawValueType>(&__v);
......@@ -543,9 +509,9 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any& __v) {
543509}
544510
545511template <class _ValueType>
546inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any&& __v) {
512[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any&& __v) {
547513 using _RawValueType = __remove_cvref_t<_ValueType>;
548 static_assert(is_constructible<_ValueType, _RawValueType>::value,
514 static_assert(is_constructible_v<_ValueType, _RawValueType>,
549515 "ValueType is required to be an rvalue reference "
550516 "or a CopyConstructible type");
551517 auto __tmp = std::any_cast<_RawValueType>(&__v);
......@@ -555,39 +521,31 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType any_cast(any&& __v) {
555521}
556522
557523template <class _ValueType>
558inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT {
524[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) noexcept {
559525 static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
560 static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
526 static_assert(!is_reference_v<_ValueType>, "_ValueType may not be a reference.");
561527 return std::any_cast<_ValueType>(const_cast<any*>(__any));
562528}
563529
564template <class _RetType>
565inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void* __p, /*IsFunction*/ false_type) noexcept {
566 return static_cast<_RetType>(__p);
567}
568
569template <class _RetType>
570inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction*/ true_type) noexcept {
571 return nullptr;
572}
573
574530template <class _ValueType>
575_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
531[[nodiscard]] _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) noexcept {
576532 using __any_imp::_Action;
577533 static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
578 static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
579 typedef add_pointer_t<_ValueType> _ReturnType;
580 if (__any && __any->__h_) {
581 void* __p = __any->__call(
582 _Action::_Get,
583 nullptr,
534 static_assert(!is_reference_v<_ValueType>, "_ValueType may not be a reference.");
535 if constexpr (!is_function_v<_ValueType>) {
536 using _ReturnType = add_pointer_t<_ValueType>;
537 if (__any && __any->__h_) {
538 void* __p = __any->__call(
539 _Action::_Get,
540 nullptr,
584541# if _LIBCPP_HAS_RTTI
585 &typeid(_ValueType),
542 &typeid(_ValueType),
586543# else
587 nullptr,
544 nullptr,
588545# endif
589 __any_imp::__get_fallback_typeid<_ValueType>());
590 return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{});
546 __any_imp::__get_fallback_typeid<_ValueType>());
547 return static_cast<_ReturnType>(__p);
548 }
591549 }
592550 return nullptr;
593551}
......@@ -613,6 +571,11 @@ _LIBCPP_POP_MACROS
613571# include <type_traits>
614572# include <variant>
615573# endif
574
575# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
576# include <cstring>
577# include <limits>
578# endif
616579#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
617580
618581#endif // _LIBCPP_ANY
lib/libcxx/include/array+88-56
......@@ -134,7 +134,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
134134# include <__type_traits/is_const.h>
135135# include <__type_traits/is_constructible.h>
136136# include <__type_traits/is_nothrow_constructible.h>
137# include <__type_traits/is_replaceable.h>
138137# include <__type_traits/is_same.h>
139138# include <__type_traits/is_swappable.h>
140139# include <__type_traits/is_trivially_relocatable.h>
......@@ -176,7 +175,6 @@ template <class _Tp, size_t _Size>
176175struct array {
177176 using __trivially_relocatable _LIBCPP_NODEBUG =
178177 __conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, array, void>;
179 using __replaceable _LIBCPP_NODEBUG = __conditional_t<__is_replaceable_v<_Tp>, array, void>;
180178
181179 // types:
182180 using __self _LIBCPP_NODEBUG = array;
......@@ -212,28 +210,28 @@ struct array {
212210 }
213211
214212 // iterators:
215 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT {
213 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT {
216214# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
217215 return std::__make_static_bounded_iter<_Size>(data(), data());
218216# else
219217 return iterator(data());
220218# endif
221219 }
222 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
220 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
223221# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
224222 return std::__make_static_bounded_iter<_Size>(data(), data());
225223# else
226224 return const_iterator(data());
227225# endif
228226 }
229 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT {
227 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT {
230228# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
231229 return std::__make_static_bounded_iter<_Size>(data() + _Size, data());
232230# else
233231 return iterator(data() + _Size);
234232# endif
235233 }
236 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
234 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
237235# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
238236 return std::__make_static_bounded_iter<_Size>(data() + _Size, data());
239237# else
......@@ -241,62 +239,81 @@ struct array {
241239# endif
242240 }
243241
244 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
242 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
245243 return reverse_iterator(end());
246244 }
247 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rbegin() const _NOEXCEPT {
245 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator
246 rbegin() const _NOEXCEPT {
248247 return const_reverse_iterator(end());
249248 }
250 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
249 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
251250 return reverse_iterator(begin());
252251 }
253 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
252 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
254253 return const_reverse_iterator(begin());
255254 }
256255
257 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT { return begin(); }
258 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT { return end(); }
259 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crbegin() const _NOEXCEPT {
256 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT {
257 return begin();
258 }
259 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT {
260 return end();
261 }
262 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator
263 crbegin() const _NOEXCEPT {
260264 return rbegin();
261265 }
262 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
266 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT {
267 return rend();
268 }
263269
264270 // capacity:
265 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return _Size; }
266 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return _Size; }
271 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return _Size; }
272 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return _Size; }
267273 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return _Size == 0; }
268274
269275 // element access:
270 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT {
276 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT {
271277 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
272278 return __elems_[__n];
273279 }
274 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type __n) const _NOEXCEPT {
280 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference
281 operator[](size_type __n) const _NOEXCEPT {
275282 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
276283 return __elems_[__n];
277284 }
278285
279 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) {
286 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) {
280287 if (__n >= _Size)
281288 std::__throw_out_of_range("array::at");
282289 return __elems_[__n];
283290 }
284291
285 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const {
292 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const {
286293 if (__n >= _Size)
287294 std::__throw_out_of_range("array::at");
288295 return __elems_[__n];
289296 }
290297
291 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT { return (*this)[0]; }
292 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT { return (*this)[0]; }
293 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT { return (*this)[_Size - 1]; }
294 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
298 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {
299 return (*this)[0];
300 }
301 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {
302 return (*this)[0];
303 }
304 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {
305 return (*this)[_Size - 1];
306 }
307 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
295308 return (*this)[_Size - 1];
296309 }
297310
298 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return __elems_; }
299 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT { return __elems_; }
311 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT {
312 return __elems_;
313 }
314 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT {
315 return __elems_;
316 }
300317};
301318
302319template <class _Tp>
......@@ -330,8 +347,10 @@ struct array<_Tp, 0> {
330347 };
331348 _ALIGNAS_TYPE(_ArrayInStructT) _EmptyType __elems_[sizeof(_ArrayInStructT)];
332349
333 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return nullptr; }
334 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT { return nullptr; }
350 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return nullptr; }
351 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT {
352 return nullptr;
353 }
335354
336355 // No explicit construct/copy/destroy for aggregate type
337356 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void fill(const value_type&) {
......@@ -343,28 +362,28 @@ struct array<_Tp, 0> {
343362 }
344363
345364 // iterators:
346 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT {
365 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT {
347366# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
348367 return std::__make_static_bounded_iter<0>(data(), data());
349368# else
350369 return iterator(data());
351370# endif
352371 }
353 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
372 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
354373# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
355374 return std::__make_static_bounded_iter<0>(data(), data());
356375# else
357376 return const_iterator(data());
358377# endif
359378 }
360 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT {
379 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT {
361380# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
362381 return std::__make_static_bounded_iter<0>(data(), data());
363382# else
364383 return iterator(data());
365384# endif
366385 }
367 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
386 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
368387# if defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY)
369388 return std::__make_static_bounded_iter<0>(data(), data());
370389# else
......@@ -372,68 +391,77 @@ struct array<_Tp, 0> {
372391# endif
373392 }
374393
375 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
394 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
376395 return reverse_iterator(end());
377396 }
378 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rbegin() const _NOEXCEPT {
397 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator
398 rbegin() const _NOEXCEPT {
379399 return const_reverse_iterator(end());
380400 }
381 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
401 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
382402 return reverse_iterator(begin());
383403 }
384 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
404 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
385405 return const_reverse_iterator(begin());
386406 }
387407
388 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT { return begin(); }
389 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT { return end(); }
390 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crbegin() const _NOEXCEPT {
408 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT {
409 return begin();
410 }
411 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT {
412 return end();
413 }
414 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator
415 crbegin() const _NOEXCEPT {
391416 return rbegin();
392417 }
393 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
418 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT {
419 return rend();
420 }
394421
395422 // capacity:
396 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return 0; }
397 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return 0; }
423 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return 0; }
424 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return 0; }
398425 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return true; }
399426
400427 // element access:
401 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type) _NOEXCEPT {
428 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type) _NOEXCEPT {
402429 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
403430 __libcpp_unreachable();
404431 }
405432
406 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type) const _NOEXCEPT {
433 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference
434 operator[](size_type) const _NOEXCEPT {
407435 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
408436 __libcpp_unreachable();
409437 }
410438
411 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) {
439 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) {
412440 std::__throw_out_of_range("array<T, 0>::at");
413441 __libcpp_unreachable();
414442 }
415443
416 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const {
444 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const {
417445 std::__throw_out_of_range("array<T, 0>::at");
418446 __libcpp_unreachable();
419447 }
420448
421 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {
449 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {
422450 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
423451 __libcpp_unreachable();
424452 }
425453
426 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {
454 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {
427455 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
428456 __libcpp_unreachable();
429457 }
430458
431 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {
459 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {
432460 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
433461 __libcpp_unreachable();
434462 }
435463
436 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
464 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
437465 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
438466 __libcpp_unreachable();
439467 }
......@@ -503,25 +531,29 @@ struct tuple_element<_Ip, array<_Tp, _Size> > {
503531};
504532
505533template <size_t _Ip, class _Tp, size_t _Size>
506inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT {
534[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&
535get(array<_Tp, _Size>& __a) _NOEXCEPT {
507536 static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
508537 return __a.__elems_[_Ip];
509538}
510539
511540template <size_t _Ip, class _Tp, size_t _Size>
512inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>& __a) _NOEXCEPT {
541[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
542get(const array<_Tp, _Size>& __a) _NOEXCEPT {
513543 static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
514544 return __a.__elems_[_Ip];
515545}
516546
517547template <size_t _Ip, class _Tp, size_t _Size>
518inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&& __a) _NOEXCEPT {
548[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&&
549get(array<_Tp, _Size>&& __a) _NOEXCEPT {
519550 static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
520551 return std::move(__a.__elems_[_Ip]);
521552}
522553
523554template <size_t _Ip, class _Tp, size_t _Size>
524inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&& __a) _NOEXCEPT {
555[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&&
556get(const array<_Tp, _Size>&& __a) _NOEXCEPT {
525557 static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
526558 return std::move(__a.__elems_[_Ip]);
527559}
......@@ -541,7 +573,7 @@ __to_array_rvalue_impl(_Tp (&&__arr)[_Size], index_sequence<_Index...>) {
541573}
542574
543575template <typename _Tp, size_t _Size>
544_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
576[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
545577to_array(_Tp (&__arr)[_Size]) noexcept(is_nothrow_constructible_v<_Tp, _Tp&>) {
546578 static_assert(!is_array_v<_Tp>, "[array.creation]/1: to_array does not accept multidimensional arrays.");
547579 static_assert(is_constructible_v<_Tp, _Tp&>, "[array.creation]/1: to_array requires copy constructible elements.");
......@@ -549,7 +581,7 @@ to_array(_Tp (&__arr)[_Size]) noexcept(is_nothrow_constructible_v<_Tp, _Tp&>) {
549581}
550582
551583template <typename _Tp, size_t _Size>
552_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
584[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
553585to_array(_Tp (&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
554586 static_assert(!is_array_v<_Tp>, "[array.creation]/4: to_array does not accept multidimensional arrays.");
555587 static_assert(is_move_constructible_v<_Tp>, "[array.creation]/4: to_array requires move constructible elements.");
lib/libcxx/include/atomic+2
......@@ -608,6 +608,8 @@ template <class T>
608608# include <__atomic/atomic_init.h>
609609# include <__atomic/atomic_lock_free.h>
610610# include <__atomic/atomic_sync.h>
611# include <__atomic/atomic_sync_timed.h>
612# include <__atomic/atomic_waitable_traits.h>
611613# include <__atomic/check_memory_order.h>
612614# include <__atomic/contention_t.h>
613615# include <__atomic/fence.h>
lib/libcxx/include/barrier+20-24
......@@ -57,8 +57,6 @@ namespace std
5757# include <__atomic/memory_order.h>
5858# include <__cstddef/ptrdiff_t.h>
5959# include <__memory/unique_ptr.h>
60# include <__thread/poll_with_backoff.h>
61# include <__thread/timed_backoff_policy.h>
6260# include <__utility/move.h>
6361# include <cstdint>
6462# include <limits>
......@@ -97,19 +95,20 @@ using __barrier_phase_t _LIBCPP_NODEBUG = uint8_t;
9795
9896class __barrier_algorithm_base;
9997
100_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
101__construct_barrier_algorithm_base(ptrdiff_t& __expected);
98[[__gnu__::__returns_nonnull__, __gnu__::__malloc__]]
99_LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected);
102100
103_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
104__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept;
101_LIBCPP_EXPORTED_FROM_ABI bool
102__arrive_barrier_algorithm_base([[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier,
103 __barrier_phase_t __old_phase) noexcept;
105104
106_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
107__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept;
105_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(
106 [[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept;
108107
109108template <class _CompletionF>
110109class __barrier_base {
111110 ptrdiff_t __expected_;
112 unique_ptr<__barrier_algorithm_base, void (*)(__barrier_algorithm_base*)> __base_;
111 unique_ptr<__barrier_algorithm_base, void (*)(_LIBCPP_NOESCAPE __barrier_algorithm_base*)> __base_;
113112 atomic<ptrdiff_t> __expected_adjustment_;
114113 _CompletionF __completion_;
115114 atomic<__barrier_phase_t> __phase_;
......@@ -119,14 +118,13 @@ public:
119118
120119 static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
121120
122 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
123 __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
121 _LIBCPP_HIDE_FROM_ABI __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
124122 : __expected_(__expected),
125123 __base_(std::__construct_barrier_algorithm_base(this->__expected_), &__destroy_barrier_algorithm_base),
126124 __expected_adjustment_(0),
127125 __completion_(std::move(__completion)),
128126 __phase_(0) {}
129 [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) {
127 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) {
130128 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
131129 __update <= __expected_, "update is greater than the expected count for the current barrier phase");
132130
......@@ -141,11 +139,10 @@ public:
141139 }
142140 return __old_phase;
143141 }
144 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
145 auto const __test_fn = [this, __old_phase]() -> bool { return __phase_.load(memory_order_acquire) != __old_phase; };
146 std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
142 _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
143 __phase_.wait(__old_phase, std::memory_order_acquire);
147144 }
148 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
145 _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
149146 __expected_adjustment_.fetch_sub(1, memory_order_relaxed);
150147 (void)arrive(1);
151148 }
......@@ -158,9 +155,10 @@ class barrier {
158155public:
159156 using arrival_token = typename __barrier_base<_CompletionF>::arrival_token;
160157
161 static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return __barrier_base<_CompletionF>::max(); }
158 [[nodiscard]] static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
159 return __barrier_base<_CompletionF>::max();
160 }
162161
163 _LIBCPP_AVAILABILITY_SYNC
164162 _LIBCPP_HIDE_FROM_ABI explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
165163 : __b_(__count, std::move(__completion)) {
166164 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
......@@ -175,15 +173,13 @@ public:
175173 barrier(barrier const&) = delete;
176174 barrier& operator=(barrier const&) = delete;
177175
178 [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) {
176 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) {
179177 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update > 0, "barrier:arrive must be called with a value greater than 0");
180178 return __b_.arrive(__update);
181179 }
182 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
183 __b_.wait(std::move(__phase));
184 }
185 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait() { wait(arrive()); }
186 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() { __b_.arrive_and_drop(); }
180 _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const { __b_.wait(std::move(__phase)); }
181 _LIBCPP_HIDE_FROM_ABI void arrive_and_wait() { wait(arrive()); }
182 _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() { __b_.arrive_and_drop(); }
187183};
188184
189185_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/bitset+49-30
......@@ -147,7 +147,6 @@ template <size_t N> struct hash<std::bitset<N>>;
147147# include <__functional/hash.h>
148148# include <__functional/identity.h>
149149# include <__functional/unary_function.h>
150# include <__tuple/tuple_indices.h>
151150# include <__type_traits/enable_if.h>
152151# include <__type_traits/integral_constant.h>
153152# include <__type_traits/is_char_like_type.h>
......@@ -314,7 +313,7 @@ private:
314313 _LIBCPP_HIDE_FROM_ABI void __init(unsigned long long __v, true_type) _NOEXCEPT;
315314# else
316315 template <size_t... _Indices>
317 _LIBCPP_HIDE_FROM_ABI constexpr __bitset(unsigned long long __v, std::__tuple_indices<_Indices...>) _NOEXCEPT
316 _LIBCPP_HIDE_FROM_ABI constexpr __bitset(unsigned long long __v, __index_sequence<_Indices...>) _NOEXCEPT
318317 : __first_{static_cast<__storage_type>(__v >> (_Indices * __bits_per_word))...} {}
319318# endif // _LIBCPP_CXX03_LANG
320319};
......@@ -352,10 +351,9 @@ template <size_t _N_words, size_t _Size>
352351inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
353352# ifndef _LIBCPP_CXX03_LANG
354353 : __bitset(__v,
355 std::__make_indices_imp< (_N_words < (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1)
356 ? _N_words
357 : (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1,
358 0>{})
354 __make_index_sequence<(_N_words < (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1)
355 ? _N_words
356 : (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1>())
359357# endif
360358{
361359# ifdef _LIBCPP_CXX03_LANG
......@@ -677,53 +675,63 @@ public:
677675 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set(size_t __pos, bool __val = true);
678676 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset() _NOEXCEPT;
679677 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset(size_t __pos);
680 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator~() const _NOEXCEPT;
678 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator~() const _NOEXCEPT;
681679 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip() _NOEXCEPT;
682680 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip(size_t __pos);
683681
684682 // element access:
685# ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
686 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {
683 // TODO(LLVM 24): Remove the opt-out
684# ifndef _LIBCPP_DEPRECATED_ABI_BITSET_CONST_SUBSCRIPT_RETURN_REF
685 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {
687686 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p < _Size, "bitset::operator[] index out of bounds");
688687 return __base::__make_ref(__p);
689688 }
690689# else
691 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __const_reference operator[](size_t __p) const {
690 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __const_reference operator[](size_t __p) const {
692691 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p < _Size, "bitset::operator[] index out of bounds");
693692 return __base::__make_ref(__p);
694693 }
695694# endif
696 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {
695 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {
697696 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p < _Size, "bitset::operator[] index out of bounds");
698697 return __base::__make_ref(__p);
699698 }
700 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const { return __base::to_ulong(); }
701 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {
699 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {
700 return __base::to_ulong();
701 }
702 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {
702703 return __base::to_ullong();
703704 }
704705 template <class _CharT, class _Traits, class _Allocator>
705 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator>
706 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator>
706707 to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
707708 template <class _CharT, class _Traits>
708 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> >
709 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
710 _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> >
709711 to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
710712 template <class _CharT>
711 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
713 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
714 _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
712715 to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
713 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> >
716 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
717 _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> >
714718 to_string(char __zero = '0', char __one = '1') const;
715 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t count() const _NOEXCEPT;
716 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT { return _Size; }
719 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t count() const _NOEXCEPT;
720 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT { return _Size; }
717721 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const bitset& __rhs) const _NOEXCEPT;
718722# if _LIBCPP_STD_VER <= 17
719723 _LIBCPP_HIDE_FROM_ABI bool operator!=(const bitset& __rhs) const _NOEXCEPT;
720724# endif
721 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool test(size_t __pos) const;
722 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT { return __base::all(); }
723 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT { return __base::any(); }
724 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT { return !any(); }
725 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator<<(size_t __pos) const _NOEXCEPT;
726 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator>>(size_t __pos) const _NOEXCEPT;
725 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool test(size_t __pos) const;
726 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT {
727 return __base::all();
728 }
729 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT {
730 return __base::any();
731 }
732 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT { return !any(); }
733 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator<<(size_t __pos) const _NOEXCEPT;
734 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator>>(size_t __pos) const _NOEXCEPT;
727735
728736private:
729737 template <class _CharT, class _Traits>
......@@ -869,7 +877,16 @@ bitset<_Size>::to_string(char __zero, char __one) const {
869877
870878template <size_t _Size>
871879inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t bitset<_Size>::count() const _NOEXCEPT {
872 return static_cast<size_t>(std::count(__base::__make_iter(0), __base::__make_iter(_Size), true));
880# if defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG)
881 if constexpr (_Size == 0) {
882 return 0;
883 } else if constexpr (_Size <= __base::__bits_per_word) {
884 return __builtin_popcountg(static_cast<unsigned _BitInt(_Size)>(__base::__first_));
885 } else
886# endif
887 {
888 return static_cast<size_t>(std::count(__base::__make_iter(0), __base::__make_iter(_Size), true));
889 }
873890}
874891
875892template <size_t _Size>
......@@ -912,7 +929,7 @@ bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT {
912929}
913930
914931template <size_t _Size>
915inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
932[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
916933operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
917934 bitset<_Size> __r = __x;
918935 __r &= __y;
......@@ -920,7 +937,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
920937}
921938
922939template <size_t _Size>
923inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
940[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
924941operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
925942 bitset<_Size> __r = __x;
926943 __r |= __y;
......@@ -928,7 +945,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
928945}
929946
930947template <size_t _Size>
931inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
948[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
932949operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
933950 bitset<_Size> __r = __x;
934951 __r ^= __y;
......@@ -937,7 +954,9 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
937954
938955template <size_t _Size>
939956struct hash<bitset<_Size> > : public __unary_function<bitset<_Size>, size_t> {
940 _LIBCPP_HIDE_FROM_ABI size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT { return __bs.__hash_code(); }
957 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT {
958 return __bs.__hash_code();
959 }
941960};
942961
943962template <class _CharT, class _Traits, size_t _Size>
lib/libcxx/include/ccomplex+3-11
......@@ -26,18 +26,10 @@
2626# pragma GCC system_header
2727# endif
2828
29# if _LIBCPP_STD_VER >= 20
30
31using __standard_header_ccomplex
32 _LIBCPP_DEPRECATED_("removed in C++20. Include <complex> instead.") _LIBCPP_NODEBUG = void;
33using __use_standard_header_ccomplex _LIBCPP_NODEBUG = __standard_header_ccomplex;
34
35# elif _LIBCPP_STD_VER >= 17
36
37using __standard_header_ccomplex _LIBCPP_DEPRECATED_("Include <complex> instead.") _LIBCPP_NODEBUG = void;
38using __use_standard_header_ccomplex _LIBCPP_NODEBUG = __standard_header_ccomplex;
39
29# if _LIBCPP_STD_VER >= 17 && !__building_module(std) && _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS
30# warning <ccomplex> is deprecated in C++17 and removed in C++20. Include <complex> instead.
4031# endif
32
4133#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
4234
4335#endif // _LIBCPP_CCOMPLEX
lib/libcxx/include/chrono+47
......@@ -218,6 +218,9 @@ template <class ToDuration, class Rep, class Period>
218218template <class ToDuration, class Rep, class Period>
219219 constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
220220
221template <class T> struct is_clock; // C++20
222template <class T> inline constexpr bool is_clock_v = is_clock<T>::value; // C++20
223
221224// duration I/O
222225template<class charT, class traits, class Rep, class Period> // C++20
223226 basic_ostream<charT, traits>&
......@@ -1035,6 +1038,49 @@ constexpr chrono::year operator ""y(unsigned lo
10351038} // chrono_literals
10361039} // literals
10371040
1041namespace std {
1042 template<class T>
1043 struct hash; // C++26
1044 template<class Rep, class Period>
1045 struct hash<chrono::duration<Rep, Period>>; // C++26
1046 template<class Clock, class Duration>
1047 struct hash<chrono::time_point<Clock, Duration>>; // C++26
1048 template<>
1049 struct hash<chrono::day>; // C++26
1050 template<>
1051 struct hash<chrono::month>; // C++26
1052 template<>
1053 struct hash<chrono::year>; // C++26
1054 template<>
1055 struct hash<chrono::weekday>; // C++26
1056 template<>
1057 struct hash<chrono::weekday_indexed>; // C++26
1058 template<>
1059 struct hash<chrono::weekday_last>; // C++26
1060 template<>
1061 struct hash<chrono::month_day>; // C++26
1062 template<>
1063 struct hash<chrono::month_day_last>; // C++26
1064 template<>
1065 struct hash<chrono::month_weekday>; // C++26
1066 template<>
1067 struct hash<chrono::month_weekday_last>; // C++26
1068 template<>
1069 struct hash<chrono::year_month>; // C++26
1070 template<>
1071 struct hash<chrono::year_month_day>; // C++26
1072 template<>
1073 struct hash<chrono::year_month_day_last>; // C++26
1074 template<>
1075 struct hash<chrono::year_month_weekday>; // C++26
1076 template<>
1077 struct hash<chrono::year_month_weekday_last>; // C++26
1078 template<class Duration, class TimeZonePtr>
1079 struct hash<chrono::zoned_time<Duration, TimeZonePtr>>; // C++26
1080 template<>
1081 struct hash<chrono::leap_second>; // C++26
1082} // namespace std
1083
10381084} // std
10391085*/
10401086
......@@ -1057,6 +1103,7 @@ constexpr chrono::year operator ""y(unsigned lo
10571103# include <__chrono/day.h>
10581104# include <__chrono/exception.h>
10591105# include <__chrono/hh_mm_ss.h>
1106# include <__chrono/is_clock.h>
10601107# include <__chrono/literals.h>
10611108# include <__chrono/local_info.h>
10621109# include <__chrono/month.h>
lib/libcxx/include/ciso646+3-6
......@@ -24,13 +24,10 @@
2424# pragma GCC system_header
2525# endif
2626
27# if _LIBCPP_STD_VER >= 20
28
29using __standard_header_ciso646
30 _LIBCPP_DEPRECATED_("removed in C++20. Include <version> instead.") _LIBCPP_NODEBUG = void;
31using __use_standard_header_ciso646 _LIBCPP_NODEBUG = __standard_header_ciso646;
32
27# if _LIBCPP_STD_VER >= 20 && !__building_module(std) && _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS
28# warning <ciso646> is removed in C++20. Include <version> instead.
3329# endif
30
3431#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
3532
3633#endif // _LIBCPP_CISO646
lib/libcxx/include/complex+77-65
......@@ -319,8 +319,8 @@ public:
319319 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 complex(const complex<_Xp>& __c)
320320 : __re_(__c.real()), __im_(__c.imag()) {}
321321
322 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const { return __re_; }
323 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const { return __im_; }
322 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const { return __re_; }
323 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const { return __im_; }
324324
325325 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
326326 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
......@@ -432,8 +432,8 @@ public:
432432 _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
433433 _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
434434
435 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const { return __re_; }
436 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float imag() const { return __im_; }
435 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const { return __re_; }
436 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float imag() const { return __im_; }
437437
438438 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
439439 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
......@@ -529,8 +529,8 @@ public:
529529 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
530530 _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
531531
532 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const { return __re_; }
533 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double imag() const { return __im_; }
532 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const { return __re_; }
533 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double imag() const { return __im_; }
534534
535535 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
536536 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
......@@ -630,8 +630,8 @@ public:
630630 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
631631 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
632632
633 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const { return __re_; }
634 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double imag() const { return __im_; }
633 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const { return __re_; }
634 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double imag() const { return __im_; }
635635
636636 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
637637 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
......@@ -732,7 +732,7 @@ inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<double>& __
732732// 26.3.6 operators:
733733
734734template <class _Tp>
735inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
735[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
736736operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) {
737737 complex<_Tp> __t(__x);
738738 __t += __y;
......@@ -740,7 +740,7 @@ operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) {
740740}
741741
742742template <class _Tp>
743inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
743[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
744744operator+(const complex<_Tp>& __x, const _Tp& __y) {
745745 complex<_Tp> __t(__x);
746746 __t += __y;
......@@ -748,7 +748,7 @@ operator+(const complex<_Tp>& __x, const _Tp& __y) {
748748}
749749
750750template <class _Tp>
751inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
751[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
752752operator+(const _Tp& __x, const complex<_Tp>& __y) {
753753 complex<_Tp> __t(__y);
754754 __t += __x;
......@@ -756,7 +756,7 @@ operator+(const _Tp& __x, const complex<_Tp>& __y) {
756756}
757757
758758template <class _Tp>
759inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
759[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
760760operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) {
761761 complex<_Tp> __t(__x);
762762 __t -= __y;
......@@ -764,7 +764,7 @@ operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) {
764764}
765765
766766template <class _Tp>
767inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
767[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
768768operator-(const complex<_Tp>& __x, const _Tp& __y) {
769769 complex<_Tp> __t(__x);
770770 __t -= __y;
......@@ -772,7 +772,7 @@ operator-(const complex<_Tp>& __x, const _Tp& __y) {
772772}
773773
774774template <class _Tp>
775inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
775[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
776776operator-(const _Tp& __x, const complex<_Tp>& __y) {
777777 complex<_Tp> __t(-__y);
778778 __t += __x;
......@@ -780,13 +780,13 @@ operator-(const _Tp& __x, const complex<_Tp>& __y) {
780780}
781781
782782template <class _Tp, __enable_if_t<is_floating_point<_Tp>::value, int> >
783_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
783[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
784784operator*(const complex<_Tp>& __lhs, const complex<_Tp>& __rhs) {
785785 return complex<_Tp>(__from_builtin_tag(), __lhs.__builtin() * __rhs.__builtin());
786786}
787787
788788template <class _Tp, __enable_if_t<!is_floating_point<_Tp>::value, int> >
789_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
789[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
790790operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) {
791791 _Tp __a = __z.real();
792792 _Tp __b = __z.imag();
......@@ -797,7 +797,7 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) {
797797}
798798
799799template <class _Tp>
800inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
800[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
801801operator*(const complex<_Tp>& __x, const _Tp& __y) {
802802 complex<_Tp> __t(__x);
803803 __t *= __y;
......@@ -805,7 +805,7 @@ operator*(const complex<_Tp>& __x, const _Tp& __y) {
805805}
806806
807807template <class _Tp>
808inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
808[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
809809operator*(const _Tp& __x, const complex<_Tp>& __y) {
810810 complex<_Tp> __t(__y);
811811 __t *= __x;
......@@ -813,13 +813,13 @@ operator*(const _Tp& __x, const complex<_Tp>& __y) {
813813}
814814
815815template <class _Tp, __enable_if_t<is_floating_point<_Tp>::value, int> >
816_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
816[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
817817operator/(const complex<_Tp>& __lhs, const complex<_Tp>& __rhs) {
818818 return complex<_Tp>(__from_builtin_tag(), __lhs.__builtin() / __rhs.__builtin());
819819}
820820
821821template <class _Tp, __enable_if_t<!is_floating_point<_Tp>::value, int> >
822_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
822[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
823823operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) {
824824 _Tp __a = __z.real();
825825 _Tp __b = __z.imag();
......@@ -831,13 +831,13 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) {
831831}
832832
833833template <class _Tp>
834inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
834[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
835835operator/(const complex<_Tp>& __x, const _Tp& __y) {
836836 return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
837837}
838838
839839template <class _Tp>
840inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
840[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
841841operator/(const _Tp& __x, const complex<_Tp>& __y) {
842842 complex<_Tp> __t(__x);
843843 __t /= __y;
......@@ -845,12 +845,14 @@ operator/(const _Tp& __x, const complex<_Tp>& __y) {
845845}
846846
847847template <class _Tp>
848inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator+(const complex<_Tp>& __x) {
848[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
849operator+(const complex<_Tp>& __x) {
849850 return __x;
850851}
851852
852853template <class _Tp>
853inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator-(const complex<_Tp>& __x) {
854[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
855operator-(const complex<_Tp>& __x) {
854856 return complex<_Tp>(-__x.real(), -__x.imag());
855857}
856858
......@@ -912,12 +914,13 @@ struct __libcpp_complex_overload_traits<_Tp, false, true> {
912914// real
913915
914916template <class _Tp>
915inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp real(const complex<_Tp>& __c) {
917[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp real(const complex<_Tp>& __c) {
916918 return __c.real();
917919}
918920
919921template <class _Tp>
920inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
922[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
923typename __libcpp_complex_overload_traits<_Tp>::_ValueType
921924real(_Tp __re) {
922925 return __re;
923926}
......@@ -925,12 +928,13 @@ real(_Tp __re) {
925928// imag
926929
927930template <class _Tp>
928inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp imag(const complex<_Tp>& __c) {
931[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp imag(const complex<_Tp>& __c) {
929932 return __c.imag();
930933}
931934
932935template <class _Tp>
933inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
936[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
937typename __libcpp_complex_overload_traits<_Tp>::_ValueType
934938imag(_Tp) {
935939 return 0;
936940}
......@@ -938,36 +942,36 @@ imag(_Tp) {
938942// abs
939943
940944template <class _Tp>
941inline _LIBCPP_HIDE_FROM_ABI _Tp abs(const complex<_Tp>& __c) {
945[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _Tp abs(const complex<_Tp>& __c) {
942946 return std::hypot(__c.real(), __c.imag());
943947}
944948
945949// arg
946950
947951template <class _Tp>
948inline _LIBCPP_HIDE_FROM_ABI _Tp arg(const complex<_Tp>& __c) {
952[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _Tp arg(const complex<_Tp>& __c) {
949953 return std::atan2(__c.imag(), __c.real());
950954}
951955
952956template <class _Tp, __enable_if_t<is_same<_Tp, long double>::value, int> = 0>
953inline _LIBCPP_HIDE_FROM_ABI long double arg(_Tp __re) {
957[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double arg(_Tp __re) {
954958 return std::atan2l(0.L, __re);
955959}
956960
957961template <class _Tp, __enable_if_t<is_integral<_Tp>::value || is_same<_Tp, double>::value, int> = 0>
958inline _LIBCPP_HIDE_FROM_ABI double arg(_Tp __re) {
962[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double arg(_Tp __re) {
959963 return std::atan2(0., __re);
960964}
961965
962966template <class _Tp, __enable_if_t<is_same<_Tp, float>::value, int> = 0>
963inline _LIBCPP_HIDE_FROM_ABI float arg(_Tp __re) {
967[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float arg(_Tp __re) {
964968 return std::atan2f(0.F, __re);
965969}
966970
967971// norm
968972
969973template <class _Tp>
970inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp norm(const complex<_Tp>& __c) {
974[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp norm(const complex<_Tp>& __c) {
971975 if (std::__constexpr_isinf(__c.real()))
972976 return std::abs(__c.real());
973977 if (std::__constexpr_isinf(__c.imag()))
......@@ -976,7 +980,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp norm(const comple
976980}
977981
978982template <class _Tp>
979inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
983[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
984typename __libcpp_complex_overload_traits<_Tp>::_ValueType
980985norm(_Tp __re) {
981986 typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType;
982987 return static_cast<_ValueType>(__re) * __re;
......@@ -985,12 +990,14 @@ norm(_Tp __re) {
985990// conj
986991
987992template <class _Tp>
988inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> conj(const complex<_Tp>& __c) {
993[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
994conj(const complex<_Tp>& __c) {
989995 return complex<_Tp>(__c.real(), -__c.imag());
990996}
991997
992998template <class _Tp>
993inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
999[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
1000typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
9941001conj(_Tp __re) {
9951002 typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
9961003 return _ComplexType(__re);
......@@ -999,7 +1006,7 @@ conj(_Tp __re) {
9991006// proj
10001007
10011008template <class _Tp>
1002inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) {
1009[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) {
10031010 complex<_Tp> __r = __c;
10041011 if (std::isinf(__c.real()) || std::isinf(__c.imag()))
10051012 __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
......@@ -1007,14 +1014,16 @@ inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) {
10071014}
10081015
10091016template <class _Tp, __enable_if_t<is_floating_point<_Tp>::value, int> = 0>
1010inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) {
1017[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
1018proj(_Tp __re) {
10111019 if (std::isinf(__re))
10121020 __re = std::abs(__re);
10131021 return complex<_Tp>(__re);
10141022}
10151023
10161024template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
1017inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) {
1025[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
1026proj(_Tp __re) {
10181027 typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
10191028 return _ComplexType(__re);
10201029}
......@@ -1022,7 +1031,7 @@ inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_Co
10221031// polar
10231032
10241033template <class _Tp>
1025_LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) {
1034[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) {
10261035 if (std::isnan(__rho) || std::signbit(__rho))
10271036 return complex<_Tp>(_Tp(NAN), _Tp(NAN));
10281037 if (std::isnan(__theta)) {
......@@ -1047,21 +1056,21 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta =
10471056// log
10481057
10491058template <class _Tp>
1050inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log(const complex<_Tp>& __x) {
1059[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log(const complex<_Tp>& __x) {
10511060 return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
10521061}
10531062
10541063// log10
10551064
10561065template <class _Tp>
1057inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) {
1066[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) {
10581067 return std::log(__x) / std::log(_Tp(10));
10591068}
10601069
10611070// sqrt
10621071
10631072template <class _Tp>
1064_LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
1073[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
10651074 if (std::isinf(__x.imag()))
10661075 return complex<_Tp>(_Tp(INFINITY), __x.imag());
10671076 if (std::isinf(__x.real())) {
......@@ -1075,7 +1084,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
10751084// exp
10761085
10771086template <class _Tp>
1078_LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
1087[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
10791088 _Tp __i = __x.imag();
10801089 if (__i == 0) {
10811090 return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
......@@ -1097,24 +1106,27 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
10971106// pow
10981107
10991108template <class _Tp>
1100inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) {
1109[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) {
11011110 return std::exp(__y * std::log(__x));
11021111}
11031112
11041113template <class _Tp, class _Up, __enable_if_t<is_floating_point<_Tp>::value && is_floating_point<_Up>::value, int> = 0>
1105inline _LIBCPP_HIDE_FROM_ABI complex<__promote_t<_Tp, _Up> > pow(const complex<_Tp>& __x, const complex<_Up>& __y) {
1114[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<__promote_t<_Tp, _Up> >
1115pow(const complex<_Tp>& __x, const complex<_Up>& __y) {
11061116 typedef complex<__promote_t<_Tp, _Up> > result_type;
11071117 return std::pow(result_type(__x), result_type(__y));
11081118}
11091119
11101120template <class _Tp, class _Up, __enable_if_t<is_floating_point<_Tp>::value && is_arithmetic<_Up>::value, int> = 0>
1111inline _LIBCPP_HIDE_FROM_ABI complex<__promote_t<_Tp, _Up> > pow(const complex<_Tp>& __x, const _Up& __y) {
1121[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<__promote_t<_Tp, _Up> >
1122pow(const complex<_Tp>& __x, const _Up& __y) {
11121123 typedef complex<__promote_t<_Tp, _Up> > result_type;
11131124 return std::pow(result_type(__x), result_type(__y));
11141125}
11151126
11161127template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value && is_floating_point<_Up>::value, int> = 0>
1117inline _LIBCPP_HIDE_FROM_ABI complex<__promote_t<_Tp, _Up> > pow(const _Tp& __x, const complex<_Up>& __y) {
1128[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<__promote_t<_Tp, _Up> >
1129pow(const _Tp& __x, const complex<_Up>& __y) {
11181130 typedef complex<__promote_t<_Tp, _Up> > result_type;
11191131 return std::pow(result_type(__x), result_type(__y));
11201132}
......@@ -1129,7 +1141,7 @@ inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> __sqr(const complex<_Tp>& __x) {
11291141// asinh
11301142
11311143template <class _Tp>
1132_LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) {
1144[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) {
11331145 const _Tp __pi(atan2(+0., -0.));
11341146 if (std::isinf(__x.real())) {
11351147 if (std::isnan(__x.imag()))
......@@ -1154,7 +1166,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) {
11541166// acosh
11551167
11561168template <class _Tp>
1157_LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) {
1169[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) {
11581170 const _Tp __pi(atan2(+0., -0.));
11591171 if (std::isinf(__x.real())) {
11601172 if (std::isnan(__x.imag()))
......@@ -1183,7 +1195,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) {
11831195// atanh
11841196
11851197template <class _Tp>
1186_LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) {
1198[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) {
11871199 const _Tp __pi(atan2(+0., -0.));
11881200 if (std::isinf(__x.imag())) {
11891201 return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
......@@ -1209,7 +1221,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) {
12091221// sinh
12101222
12111223template <class _Tp>
1212_LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) {
1224[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) {
12131225 if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
12141226 return complex<_Tp>(__x.real(), _Tp(NAN));
12151227 if (__x.real() == 0 && !std::isfinite(__x.imag()))
......@@ -1222,7 +1234,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) {
12221234// cosh
12231235
12241236template <class _Tp>
1225_LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) {
1237[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) {
12261238 if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
12271239 return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
12281240 if (__x.real() == 0 && !std::isfinite(__x.imag()))
......@@ -1237,7 +1249,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) {
12371249// tanh
12381250
12391251template <class _Tp>
1240_LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) {
1252[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) {
12411253 if (std::isinf(__x.real())) {
12421254 if (!std::isfinite(__x.imag()))
12431255 return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
......@@ -1257,7 +1269,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) {
12571269// asin
12581270
12591271template <class _Tp>
1260_LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) {
1272[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) {
12611273 complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
12621274 return complex<_Tp>(__z.imag(), -__z.real());
12631275}
......@@ -1265,7 +1277,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) {
12651277// acos
12661278
12671279template <class _Tp>
1268_LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) {
1280[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) {
12691281 const _Tp __pi(atan2(+0., -0.));
12701282 if (std::isinf(__x.real())) {
12711283 if (std::isnan(__x.imag()))
......@@ -1297,7 +1309,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) {
12971309// atan
12981310
12991311template <class _Tp>
1300_LIBCPP_HIDE_FROM_ABI complex<_Tp> atan(const complex<_Tp>& __x) {
1312[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> atan(const complex<_Tp>& __x) {
13011313 complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
13021314 return complex<_Tp>(__z.imag(), -__z.real());
13031315}
......@@ -1305,7 +1317,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> atan(const complex<_Tp>& __x) {
13051317// sin
13061318
13071319template <class _Tp>
1308_LIBCPP_HIDE_FROM_ABI complex<_Tp> sin(const complex<_Tp>& __x) {
1320[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> sin(const complex<_Tp>& __x) {
13091321 complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
13101322 return complex<_Tp>(__z.imag(), -__z.real());
13111323}
......@@ -1313,14 +1325,14 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> sin(const complex<_Tp>& __x) {
13131325// cos
13141326
13151327template <class _Tp>
1316inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> cos(const complex<_Tp>& __x) {
1328[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> cos(const complex<_Tp>& __x) {
13171329 return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
13181330}
13191331
13201332// tan
13211333
13221334template <class _Tp>
1323_LIBCPP_HIDE_FROM_ABI complex<_Tp> tan(const complex<_Tp>& __x) {
1335[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI complex<_Tp> tan(const complex<_Tp>& __x) {
13241336 complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
13251337 return complex<_Tp>(__z.imag(), -__z.real());
13261338}
......@@ -1398,7 +1410,7 @@ struct tuple_element<_Ip, complex<_Tp>> {
13981410};
13991411
14001412template <size_t _Ip, class _Xp>
1401_LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>& __z) noexcept {
1413[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>& __z) noexcept {
14021414 static_assert(_Ip < 2, "Index value is out of range.");
14031415 if constexpr (_Ip == 0) {
14041416 return __z.__re_;
......@@ -1408,7 +1420,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>& __z) noexcept {
14081420}
14091421
14101422template <size_t _Ip, class _Xp>
1411_LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&& __z) noexcept {
1423[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&& __z) noexcept {
14121424 static_assert(_Ip < 2, "Index value is out of range.");
14131425 if constexpr (_Ip == 0) {
14141426 return std::move(__z.__re_);
......@@ -1418,7 +1430,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&& __z) noexcept {
14181430}
14191431
14201432template <size_t _Ip, class _Xp>
1421_LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>& __z) noexcept {
1433[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>& __z) noexcept {
14221434 static_assert(_Ip < 2, "Index value is out of range.");
14231435 if constexpr (_Ip == 0) {
14241436 return __z.__re_;
......@@ -1428,7 +1440,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>& __z) noexcept
14281440}
14291441
14301442template <size_t _Ip, class _Xp>
1431_LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&& __z) noexcept {
1443[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&& __z) noexcept {
14321444 static_assert(_Ip < 2, "Index value is out of range.");
14331445 if constexpr (_Ip == 0) {
14341446 return std::move(__z.__re_);
lib/libcxx/include/complex.h+10-10
......@@ -18,19 +18,19 @@
1818*/
1919
2020#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
21# include <__cxx03/complex.h>
21# include <__cxx03/__config>
2222#else
2323# include <__config>
24#endif
2425
25# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
26# pragma GCC system_header
27# endif
26#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
27# pragma GCC system_header
28#endif
2829
29# ifdef __cplusplus
30# include <complex>
31# elif __has_include_next(<complex.h>)
32# include_next <complex.h>
33# endif
34#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
30#ifdef __cplusplus
31# include <complex>
32#elif __has_include_next(<complex.h>)
33# include_next <complex.h>
34#endif
3535
3636#endif // _LIBCPP_COMPLEX_H
lib/libcxx/include/condition_variable+3-3
......@@ -206,14 +206,14 @@ public:
206206# if _LIBCPP_STD_VER >= 20
207207
208208 template <class _Lock, class _Predicate>
209 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred);
209 _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred);
210210
211211 template <class _Lock, class _Clock, class _Duration, class _Predicate>
212 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_until(
212 _LIBCPP_HIDE_FROM_ABI bool wait_until(
213213 _Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred);
214214
215215 template <class _Lock, class _Rep, class _Period, class _Predicate>
216 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
216 _LIBCPP_HIDE_FROM_ABI bool
217217 wait_for(_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred);
218218
219219# endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/cstdalign+3-10
......@@ -43,17 +43,10 @@ Macros:
4343# undef __alignof_is_defined
4444# define __alignof_is_defined 1
4545
46# if _LIBCPP_STD_VER >= 20
47
48using __standard_header_cstdalign _LIBCPP_DEPRECATED_("removed in C++20.") _LIBCPP_NODEBUG = void;
49using __use_standard_header_cstdalign _LIBCPP_NODEBUG = __standard_header_cstdalign;
50
51# elif _LIBCPP_STD_VER >= 17
52
53using __standard_header_cstdalign _LIBCPP_DEPRECATED _LIBCPP_NODEBUG = void;
54using __use_standard_header_cstdalign _LIBCPP_NODEBUG = __standard_header_cstdalign;
55
46# if _LIBCPP_STD_VER >= 17 && !__building_module(std) && _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS
47# warning <cstdalign> is deprecated in C++17 and removed in C++20.
5648# endif
49
5750#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
5851
5952#endif // _LIBCPP_CSTDALIGN
lib/libcxx/include/cstdbool+3-10
......@@ -31,17 +31,10 @@ Macros:
3131# undef __bool_true_false_are_defined
3232# define __bool_true_false_are_defined 1
3333
34# if _LIBCPP_STD_VER >= 20
35
36using __standard_header_cstdbool _LIBCPP_DEPRECATED_("removed in C++20.") _LIBCPP_NODEBUG = void;
37using __use_standard_header_cstdbool _LIBCPP_NODEBUG = __standard_header_cstdbool;
38
39# elif _LIBCPP_STD_VER >= 17
40
41using __standard_header_cstdbool _LIBCPP_DEPRECATED _LIBCPP_NODEBUG = void;
42using __use_standard_header_cstdbool _LIBCPP_NODEBUG = __standard_header_cstdbool;
43
34# if _LIBCPP_STD_VER >= 17 && !__building_module(std) && _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS
35# warning <cstdbool> is deprecated in C++17 and removed in C++20.
4436# endif
37
4538#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
4639
4740#endif // _LIBCPP_CSTDBOOL
lib/libcxx/include/ctgmath+2-11
......@@ -28,17 +28,8 @@
2828# pragma GCC system_header
2929# endif
3030
31# if _LIBCPP_STD_VER >= 20
32
33using __standard_header_ctgmath
34 _LIBCPP_DEPRECATED_("removed in C++20. Include <cmath> and <complex> instead.") _LIBCPP_NODEBUG = void;
35using __use_standard_header_ctgmath _LIBCPP_NODEBUG = __standard_header_ctgmath;
36
37# elif _LIBCPP_STD_VER >= 17
38
39using __standard_header_ctgmath _LIBCPP_DEPRECATED_("Include <cmath> and <complex> instead.") _LIBCPP_NODEBUG = void;
40using __use_standard_header_ctgmath _LIBCPP_NODEBUG = __standard_header_ctgmath;
41
31# if _LIBCPP_STD_VER >= 17 && !__building_module(std) && _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS
32# warning <ctgmath> is deprecated in C++17 and removed in C++20. Include <cmath> and <complex> instead.
4233# endif
4334
4435#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/ctype.h+24-24
......@@ -30,36 +30,36 @@ int toupper(int c);
3030*/
3131
3232#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
33# include <__cxx03/ctype.h>
33# include <__cxx03/__config>
3434#else
3535# include <__config>
36#endif
3637
37# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
38# pragma GCC system_header
39# endif
38#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
39# pragma GCC system_header
40#endif
4041
41# if __has_include_next(<ctype.h>)
42# include_next <ctype.h>
43# endif
42#if __has_include_next(<ctype.h>)
43# include_next <ctype.h>
44#endif
4445
45# ifdef __cplusplus
46#ifdef __cplusplus
4647
47# undef isalnum
48# undef isalpha
49# undef isblank
50# undef iscntrl
51# undef isdigit
52# undef isgraph
53# undef islower
54# undef isprint
55# undef ispunct
56# undef isspace
57# undef isupper
58# undef isxdigit
59# undef tolower
60# undef toupper
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
6162
62# endif
63#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
63#endif
6464
6565#endif // _LIBCPP_CTYPE_H
lib/libcxx/include/cwchar+2-2
......@@ -231,8 +231,8 @@ __constexpr_wmemcmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __count)
231231
232232template <class _Tp, class _Up>
233233_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp* __str, _Up __value, size_t __count) {
234 static_assert(sizeof(_Tp) == sizeof(wchar_t)&& _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t) &&
235 __libcpp_is_trivially_equality_comparable<_Tp, _Tp>::value,
234 static_assert(sizeof(_Tp) == sizeof(wchar_t) && _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t) &&
235 __is_trivially_equality_comparable_v<_Tp, _Tp>,
236236 "Calling wmemchr on non-trivially equality comparable types is unsafe.");
237237
238238# if __has_builtin(__builtin_wmemchr)
lib/libcxx/include/deque+109-225
......@@ -191,9 +191,9 @@ template <class T, class Allocator, class Predicate>
191191# include <__algorithm/min.h>
192192# include <__algorithm/move.h>
193193# include <__algorithm/move_backward.h>
194# include <__algorithm/ranges_copy_n.h>
194195# include <__algorithm/remove.h>
195196# include <__algorithm/remove_if.h>
196# include <__algorithm/unwrap_iter.h>
197197# include <__assert>
198198# include <__config>
199199# include <__debug_utils/sanitizers.h>
......@@ -220,21 +220,19 @@ template <class T, class Allocator, class Predicate>
220220# include <__ranges/concepts.h>
221221# include <__ranges/container_compatible_range.h>
222222# include <__ranges/from_range.h>
223# include <__ranges/size.h>
224223# include <__split_buffer>
225224# include <__type_traits/conditional.h>
226225# include <__type_traits/container_traits.h>
227# include <__type_traits/disjunction.h>
228226# include <__type_traits/enable_if.h>
229227# include <__type_traits/is_allocator.h>
230228# include <__type_traits/is_convertible.h>
231229# include <__type_traits/is_nothrow_assignable.h>
232230# include <__type_traits/is_nothrow_constructible.h>
233# include <__type_traits/is_replaceable.h>
234231# include <__type_traits/is_same.h>
235232# include <__type_traits/is_swappable.h>
236233# include <__type_traits/is_trivially_relocatable.h>
237234# include <__type_traits/type_identity.h>
235# include <__utility/exception_guard.h>
238236# include <__utility/forward.h>
239237# include <__utility/move.h>
240238# include <__utility/pair.h>
......@@ -461,9 +459,8 @@ private:
461459 __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>;
462460
463461public:
464 using __is_segmented_iterator _LIBCPP_NODEBUG = true_type;
465 using __segment_iterator _LIBCPP_NODEBUG = _MapPointer;
466 using __local_iterator _LIBCPP_NODEBUG = _Pointer;
462 using __segment_iterator _LIBCPP_NODEBUG = _MapPointer;
463 using __local_iterator _LIBCPP_NODEBUG = _Pointer;
467464
468465 static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; }
469466 static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; }
......@@ -488,6 +485,9 @@ const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
488485
489486template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
490487class deque {
488 template <class _Up, class _Alloc>
489 using __split_buffer _LIBCPP_NODEBUG = std::__split_buffer<_Up, _Alloc, __split_buffer_pointer_layout>;
490
491491public:
492492 // types:
493493
......@@ -531,10 +531,6 @@ public:
531531 __libcpp_is_trivially_relocatable<__map>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
532532 deque,
533533 void>;
534 using __replaceable _LIBCPP_NODEBUG =
535 __conditional_t<__is_replaceable_v<__map> && __container_allocator_is_replaceable<__alloc_traits>::value,
536 deque,
537 void>;
538534
539535 static_assert(is_nothrow_default_constructible<allocator_type>::value ==
540536 is_nothrow_default_constructible<__pointer_allocator>::value,
......@@ -635,7 +631,7 @@ public:
635631# endif
636632 _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
637633
638 template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
634 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
639635 _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a)
640636 : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
641637 __annotate_new(0);
......@@ -703,8 +699,16 @@ public:
703699 __assign_with_size_random_access(ranges::begin(__range), __n);
704700
705701 } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
706 auto __n = static_cast<size_type>(ranges::distance(__range));
707 __assign_with_size(ranges::begin(__range), __n);
702 auto __n = ranges::distance(__range);
703 auto __first = ranges::begin(__range);
704
705 auto __result = std::ranges::copy_n(std::move(__first), std::min<size_t>(__n, size()), begin());
706
707 if (static_cast<size_type>(__n) > size()) {
708 __append_with_size(std::move(__result.in), __n - size());
709 } else {
710 __erase_to_end(__result.out);
711 }
708712
709713 } else {
710714 __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
......@@ -720,45 +724,53 @@ public:
720724
721725 // iterators:
722726
723 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
727 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
724728 __map_pointer __mp = __map_.begin() + __start_ / __block_size;
725729 return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
726730 }
727731
728 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
732 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
729733 __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
730734 return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
731735 }
732736
733 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
737 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
734738 size_type __p = size() + __start_;
735739 __map_pointer __mp = __map_.begin() + __p / __block_size;
736740 return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
737741 }
738742
739 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
743 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
740744 size_type __p = size() + __start_;
741745 __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
742746 return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
743747 }
744748
745 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
746 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
747 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
748 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
749 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
750 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
751 return const_reverse_iterator(end());
752 }
753 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
754 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
755 return const_reverse_iterator(begin());
756 }
749757
750 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
751 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
752 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
753 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
758 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
759 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
760 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
761 return const_reverse_iterator(end());
762 }
763 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
764 return const_reverse_iterator(begin());
765 }
754766
755767 // capacity:
756 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); }
768 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); }
757769
758770 _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_; }
759771 _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_; }
760772
761 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
773 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
762774 return std::min<size_type>(__alloc_traits::max_size(__alloc()), numeric_limits<difference_type>::max());
763775 }
764776 _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
......@@ -767,18 +779,22 @@ public:
767779 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
768780
769781 // element access:
770 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT;
771 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __i) const _NOEXCEPT;
772 _LIBCPP_HIDE_FROM_ABI reference at(size_type __i);
773 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const;
774 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT;
775 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT;
776 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT;
777 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT;
782 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT;
783 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __i) const _NOEXCEPT;
784 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference at(size_type __i);
785 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const;
786 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT;
787 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT;
788 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT;
789 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT;
778790
779791 // 23.2.2.3 modifiers:
780792 _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
781793 _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
794
795 template <class... _Args>
796 _LIBCPP_HIDE_FROM_ABI iterator __emplace(const_iterator __p, _Args&&... __args);
797
782798# ifndef _LIBCPP_CXX03_LANG
783799# if _LIBCPP_STD_VER >= 17
784800 template <class... _Args>
......@@ -791,8 +807,11 @@ public:
791807 template <class... _Args>
792808 _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
793809# endif
810
794811 template <class... _Args>
795 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
812 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args) {
813 return __emplace(__p, std::forward<_Args>(__args)...);
814 }
796815
797816 _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
798817 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
......@@ -805,17 +824,21 @@ public:
805824
806825 template <_ContainerCompatibleRange<_Tp> _Range>
807826 _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
808 insert_range(end(), std::forward<_Range>(__range));
827 if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
828 __append_with_size(ranges::begin(__range), ranges::distance(__range));
829 } else {
830 __append_with_sentinel(ranges::begin(__range), ranges::end(__range));
831 }
809832 }
810833# endif
811834
812 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v);
835 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { return __emplace(__p, std::move(__v)); }
813836
814837 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, initializer_list<value_type> __il) {
815838 return insert(__p, __il.begin(), __il.end());
816839 }
817840# endif // _LIBCPP_CXX03_LANG
818 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v);
841 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { return __emplace(__p, __v); }
819842 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v);
820843 template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
821844 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l);
......@@ -1109,7 +1132,7 @@ public:
11091132 // This function tests deque object annotations.
11101133 if (empty()) {
11111134 for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
1112 if (!__sanitizer_verify_double_ended_contiguous_container(
1135 if (!::__sanitizer_verify_double_ended_contiguous_container(
11131136 std::__to_address(*__it),
11141137 std::__to_address(*__it),
11151138 std::__to_address(*__it),
......@@ -1141,7 +1164,7 @@ public:
11411164
11421165 // Is the block before or after deque blocks that contain elements?
11431166 if (__it < __first_mp || __it > __last_mp) {
1144 if (!__sanitizer_verify_double_ended_contiguous_container(
1167 if (!::__sanitizer_verify_double_ended_contiguous_container(
11451168 std::__to_address(*__it),
11461169 std::__to_address(*__it),
11471170 std::__to_address(*__it),
......@@ -1151,7 +1174,7 @@ public:
11511174 const void* __containers_buffer_beg = (__it == __first_mp) ? __p_beg : (const void*)std::__to_address(*__it);
11521175 const void* __containers_buffer_end =
11531176 (__it == __last_mp) ? __p_end : (const void*)std::__to_address(*__it + __block_size);
1154 if (!__sanitizer_verify_double_ended_contiguous_container(
1177 if (!::__sanitizer_verify_double_ended_contiguous_container(
11551178 std::__to_address(*__it),
11561179 __containers_buffer_beg,
11571180 __containers_buffer_end,
......@@ -1191,7 +1214,7 @@ private:
11911214
11921215 template <class _RandomAccessIterator>
11931216 _LIBCPP_HIDE_FROM_ABI void __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
1194 template <class _Iterator>
1217 template <class _AlgPolicy, class _Iterator>
11951218 _LIBCPP_HIDE_FROM_ABI void __assign_with_size(_Iterator __f, difference_type __n);
11961219
11971220 template <class _Iterator, class _Sentinel>
......@@ -1239,8 +1262,8 @@ private:
12391262 clear();
12401263 shrink_to_fit();
12411264 }
1242 __alloc() = __c.__alloc();
1243 __map_.__alloc_ = __c.__map_.__alloc_;
1265 __alloc() = __c.__alloc();
1266 __map_.__get_allocator() = __c.__map_.__get_allocator();
12441267 }
12451268
12461269 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque&, false_type) {}
......@@ -1256,22 +1279,22 @@ _LIBCPP_CONSTEXPR const typename allocator_traits<_Alloc>::difference_type deque
12561279
12571280# if _LIBCPP_STD_VER >= 17
12581281template <class _InputIterator,
1259 class _Alloc = allocator<__iter_value_type<_InputIterator>>,
1282 class _Alloc = allocator<__iterator_value_type<_InputIterator>>,
12601283 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1261 class = enable_if_t<__is_allocator<_Alloc>::value> >
1262deque(_InputIterator, _InputIterator) -> deque<__iter_value_type<_InputIterator>, _Alloc>;
1284 class = enable_if_t<__is_allocator_v<_Alloc>>>
1285deque(_InputIterator, _InputIterator) -> deque<__iterator_value_type<_InputIterator>, _Alloc>;
12631286
12641287template <class _InputIterator,
12651288 class _Alloc,
12661289 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1267 class = enable_if_t<__is_allocator<_Alloc>::value> >
1268deque(_InputIterator, _InputIterator, _Alloc) -> deque<__iter_value_type<_InputIterator>, _Alloc>;
1290 class = enable_if_t<__is_allocator_v<_Alloc>>>
1291deque(_InputIterator, _InputIterator, _Alloc) -> deque<__iterator_value_type<_InputIterator>, _Alloc>;
12691292# endif
12701293
12711294# if _LIBCPP_STD_VER >= 23
12721295template <ranges::input_range _Range,
12731296 class _Alloc = allocator<ranges::range_value_t<_Range>>,
1274 class = enable_if_t<__is_allocator<_Alloc>::value> >
1297 class = enable_if_t<__is_allocator_v<_Alloc>>>
12751298deque(from_range_t, _Range&&, _Alloc = _Alloc()) -> deque<ranges::range_value_t<_Range>, _Alloc>;
12761299# endif
12771300
......@@ -1319,7 +1342,7 @@ deque<_Tp, _Allocator>::deque(const deque& __c)
13191342 : __map_(__pointer_allocator(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))),
13201343 __start_(0),
13211344 __size_(0),
1322 __alloc_(__map_.__alloc_) {
1345 __alloc_(__map_.__get_allocator()) {
13231346 __annotate_new(0);
13241347 __append(__c.begin(), __c.end());
13251348}
......@@ -1451,24 +1474,6 @@ deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator _
14511474 __erase_to_end(std::copy_n(__f, __n, begin()));
14521475}
14531476
1454template <class _Tp, class _Allocator>
1455template <class _Iterator>
1456_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type __n) {
1457 if (static_cast<size_type>(__n) > size()) {
1458 auto __added_size = __n - size();
1459
1460 auto __i = begin();
1461 for (auto __count = size(); __count != 0; --__count) {
1462 *__i++ = *__f++;
1463 }
1464
1465 __append_with_size(__f, __added_size);
1466
1467 } else {
1468 __erase_to_end(std::copy_n(__f, __n, begin()));
1469 }
1470}
1471
14721477template <class _Tp, class _Allocator>
14731478void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) {
14741479 if (__n > size()) {
......@@ -1661,56 +1666,11 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
16611666 return *begin();
16621667# endif
16631668}
1664
1665template <class _Tp, class _Allocator>
1666typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) {
1667 size_type __pos = __p - begin();
1668 size_type __to_end = size() - __pos;
1669 allocator_type& __a = __alloc();
1670 if (__pos < __to_end) { // insert by shifting things backward
1671 if (__front_spare() == 0)
1672 __add_front_capacity();
1673 // __front_spare() >= 1
1674 __annotate_increase_front(1);
1675 if (__pos == 0) {
1676 __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
1677 --__start_;
1678 ++__size();
1679 } else {
1680 iterator __b = begin();
1681 iterator __bm1 = std::prev(__b);
1682 __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
1683 --__start_;
1684 ++__size();
1685 if (__pos > 1)
1686 __b = std::move(std::next(__b), __b + __pos, __b);
1687 *__b = std::move(__v);
1688 }
1689 } else { // insert by shifting things forward
1690 if (__back_spare() == 0)
1691 __add_back_capacity();
1692 // __back_capacity >= 1
1693 __annotate_increase_back(1);
1694 size_type __de = size() - __pos;
1695 if (__de == 0) {
1696 __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
1697 ++__size();
1698 } else {
1699 iterator __e = end();
1700 iterator __em1 = std::prev(__e);
1701 __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
1702 ++__size();
1703 if (__de > 1)
1704 __e = std::move_backward(__e - __de, __em1, __e);
1705 *--__e = std::move(__v);
1706 }
1707 }
1708 return begin() + __pos;
1709}
1669# endif // _LIBCPP_CXX03_LANG
17101670
17111671template <class _Tp, class _Allocator>
17121672template <class... _Args>
1713typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) {
1673typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::__emplace(const_iterator __p, _Args&&... __args) {
17141674 size_type __pos = __p - begin();
17151675 size_type __to_end = size() - __pos;
17161676 allocator_type& __a = __alloc();
......@@ -1757,60 +1717,6 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::emplace(const_
17571717 return begin() + __pos;
17581718}
17591719
1760# endif // _LIBCPP_CXX03_LANG
1761
1762template <class _Tp, class _Allocator>
1763typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) {
1764 size_type __pos = __p - begin();
1765 size_type __to_end = size() - __pos;
1766 allocator_type& __a = __alloc();
1767 if (__pos < __to_end) { // insert by shifting things backward
1768 if (__front_spare() == 0)
1769 __add_front_capacity();
1770 // __front_spare() >= 1
1771 __annotate_increase_front(1);
1772 if (__pos == 0) {
1773 __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
1774 --__start_;
1775 ++__size();
1776 } else {
1777 const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
1778 iterator __b = begin();
1779 iterator __bm1 = std::prev(__b);
1780 if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
1781 __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
1782 __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
1783 --__start_;
1784 ++__size();
1785 if (__pos > 1)
1786 __b = __move_and_check(std::next(__b), __b + __pos, __b, __vt);
1787 *__b = *__vt;
1788 }
1789 } else { // insert by shifting things forward
1790 if (__back_spare() == 0)
1791 __add_back_capacity();
1792 // __back_capacity >= 1
1793 __annotate_increase_back(1);
1794 size_type __de = size() - __pos;
1795 if (__de == 0) {
1796 __alloc_traits::construct(__a, std::addressof(*end()), __v);
1797 ++__size();
1798 } else {
1799 const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
1800 iterator __e = end();
1801 iterator __em1 = std::prev(__e);
1802 if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
1803 __vt = pointer_traits<const_pointer>::pointer_to(*__e);
1804 __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
1805 ++__size();
1806 if (__de > 1)
1807 __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
1808 *--__e = *__vt;
1809 }
1810 }
1811 return begin() + __pos;
1812}
1813
18141720template <class _Tp, class _Allocator>
18151721typename deque<_Tp, _Allocator>::iterator
18161722deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) {
......@@ -1874,9 +1780,9 @@ template <class _Tp, class _Allocator>
18741780template <class _Iterator, class _Sentinel>
18751781_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
18761782deque<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l) {
1877 __split_buffer<value_type, allocator_type&> __buf(__alloc());
1783 __split_buffer<value_type, allocator_type> __buf(__alloc());
18781784 __buf.__construct_at_end_with_sentinel(std::move(__f), std::move(__l));
1879 typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi;
1785 typedef typename __split_buffer<value_type, allocator_type>::iterator __bi;
18801786 return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
18811787}
18821788
......@@ -1891,9 +1797,9 @@ template <class _Tp, class _Allocator>
18911797template <class _Iterator>
18921798_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
18931799deque<_Tp, _Allocator>::__insert_with_size(const_iterator __p, _Iterator __f, size_type __n) {
1894 __split_buffer<value_type, allocator_type&> __buf(__n, 0, __alloc());
1895 __buf.__construct_at_end_with_size(__f, __n);
1896 typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
1800 __split_buffer<value_type, allocator_type> __buf(__n, 0, __alloc());
1801 __buf.__construct_at_end_with_size(std::move(__f), __n);
1802 typedef typename __split_buffer<value_type, allocator_type>::iterator __fwd;
18971803 return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
18981804}
18991805
......@@ -2071,8 +1977,8 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
20711977 }
20721978 // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
20731979 else {
2074 __split_buffer<pointer, __pointer_allocator&> __buf(
2075 std::max<size_type>(2 * __map_.capacity(), 1), 0, __map_.__alloc_);
1980 __split_buffer<pointer, __pointer_allocator> __buf(
1981 std::max<size_type>(2 * __map_.capacity(), 1), 0, __map_.__get_allocator());
20761982
20771983 typedef __allocator_destructor<_Allocator> _Dp;
20781984 unique_ptr<pointer, _Dp> __hold(__alloc_traits::allocate(__a, __block_size), _Dp(__a, __block_size));
......@@ -2081,10 +1987,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
20811987
20821988 for (__map_pointer __i = __map_.begin(); __i != __map_.end(); ++__i)
20831989 __buf.emplace_back(*__i);
2084 std::swap(__map_.__first_, __buf.__first_);
2085 std::swap(__map_.__begin_, __buf.__begin_);
2086 std::swap(__map_.__end_, __buf.__end_);
2087 std::swap(__map_.__cap_, __buf.__cap_);
1990 __map_.__swap_without_allocator(__buf);
20881991 __start_ = __map_.size() == 1 ? __block_size / 2 : __start_ + __block_size;
20891992 }
20901993 __annotate_whole_block(0, __asan_poison);
......@@ -2134,34 +2037,26 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
21342037 // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
21352038 else {
21362039 size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
2137 __split_buffer<pointer, __pointer_allocator&> __buf(
2138 std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()), 0, __map_.__alloc_);
2139# if _LIBCPP_HAS_EXCEPTIONS
2140 try {
2141# endif // _LIBCPP_HAS_EXCEPTIONS
2142 for (; __nb > 0; --__nb) {
2143 __buf.emplace_back(__alloc_traits::allocate(__a, __block_size));
2144 // ASan: this is empty container, we have to poison whole block
2145 __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
2146 }
2147# if _LIBCPP_HAS_EXCEPTIONS
2148 } catch (...) {
2040 __split_buffer<pointer, __pointer_allocator> __buf(
2041 std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()), 0, __map_.__get_allocator());
2042 auto __guard = std::__make_exception_guard([&] {
21492043 __annotate_delete();
21502044 for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
21512045 __alloc_traits::deallocate(__a, *__i, __block_size);
2152 throw;
2046 });
2047 for (; __nb > 0; --__nb) {
2048 __buf.emplace_back(__alloc_traits::allocate(__a, __block_size));
2049 // ASan: this is empty container, we have to poison whole block
2050 __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
21532051 }
2154# endif // _LIBCPP_HAS_EXCEPTIONS
2052 __guard.__complete();
21552053 for (; __back_capacity > 0; --__back_capacity) {
21562054 __buf.emplace_back(__map_.back());
21572055 __map_.pop_back();
21582056 }
21592057 for (__map_pointer __i = __map_.begin(); __i != __map_.end(); ++__i)
21602058 __buf.emplace_back(*__i);
2161 std::swap(__map_.__first_, __buf.__first_);
2162 std::swap(__map_.__begin_, __buf.__begin_);
2163 std::swap(__map_.__end_, __buf.__end_);
2164 std::swap(__map_.__cap_, __buf.__cap_);
2059 __map_.__swap_without_allocator(__buf);
21652060 __start_ += __ds;
21662061 }
21672062}
......@@ -2194,8 +2089,8 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
21942089 }
21952090 // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
21962091 else {
2197 __split_buffer<pointer, __pointer_allocator&> __buf(
2198 std::max<size_type>(2 * __map_.capacity(), 1), __map_.size(), __map_.__alloc_);
2092 __split_buffer<pointer, __pointer_allocator> __buf(
2093 std::max<size_type>(2 * __map_.capacity(), 1), __map_.size(), __map_.__get_allocator());
21992094
22002095 typedef __allocator_destructor<_Allocator> _Dp;
22012096 unique_ptr<pointer, _Dp> __hold(__alloc_traits::allocate(__a, __block_size), _Dp(__a, __block_size));
......@@ -2204,10 +2099,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
22042099
22052100 for (__map_pointer __i = __map_.end(); __i != __map_.begin();)
22062101 __buf.emplace_front(*--__i);
2207 std::swap(__map_.__first_, __buf.__first_);
2208 std::swap(__map_.__begin_, __buf.__begin_);
2209 std::swap(__map_.__end_, __buf.__end_);
2210 std::swap(__map_.__cap_, __buf.__cap_);
2102 __map_.__swap_without_allocator(__buf);
22112103 __annotate_whole_block(__map_.size() - 1, __asan_poison);
22122104 }
22132105}
......@@ -2257,36 +2149,28 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
22572149 // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
22582150 else {
22592151 size_type __ds = __front_capacity * __block_size;
2260 __split_buffer<pointer, __pointer_allocator&> __buf(
2152 __split_buffer<pointer, __pointer_allocator> __buf(
22612153 std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()),
22622154 __map_.size() - __front_capacity,
2263 __map_.__alloc_);
2264# if _LIBCPP_HAS_EXCEPTIONS
2265 try {
2266# endif // _LIBCPP_HAS_EXCEPTIONS
2267 for (; __nb > 0; --__nb) {
2268 __buf.emplace_back(__alloc_traits::allocate(__a, __block_size));
2269 // ASan: this is an empty container, we have to poison the whole block
2270 __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
2271 }
2272# if _LIBCPP_HAS_EXCEPTIONS
2273 } catch (...) {
2155 __map_.__get_allocator());
2156 auto __guard = std::__make_exception_guard([&] {
22742157 __annotate_delete();
22752158 for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
22762159 __alloc_traits::deallocate(__a, *__i, __block_size);
2277 throw;
2160 });
2161 for (; __nb > 0; --__nb) {
2162 __buf.emplace_back(__alloc_traits::allocate(__a, __block_size));
2163 // ASan: this is an empty container, we have to poison the whole block
2164 __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
22782165 }
2279# endif // _LIBCPP_HAS_EXCEPTIONS
2166 __guard.__complete();
22802167 for (; __front_capacity > 0; --__front_capacity) {
22812168 __buf.emplace_back(__map_.front());
22822169 __map_.pop_front();
22832170 }
22842171 for (__map_pointer __i = __map_.end(); __i != __map_.begin();)
22852172 __buf.emplace_front(*--__i);
2286 std::swap(__map_.__first_, __buf.__first_);
2287 std::swap(__map_.__begin_, __buf.__begin_);
2288 std::swap(__map_.__end_, __buf.__end_);
2289 std::swap(__map_.__cap_, __buf.__cap_);
2173 __map_.__swap_without_allocator(__buf);
22902174 __start_ -= __ds;
22912175 }
22922176}
lib/libcxx/include/errno.h+269-269
......@@ -23,381 +23,381 @@ Macros:
2323*/
2424
2525#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
26# include <__cxx03/errno.h>
26# include <__cxx03/__config>
2727#else
2828# include <__config>
29#endif
2930
30# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
31# pragma GCC system_header
32# endif
31#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
32# pragma GCC system_header
33#endif
3334
34# if __has_include_next(<errno.h>)
35# include_next <errno.h>
36# endif
35#if __has_include_next(<errno.h>)
36# include_next <errno.h>
37#endif
3738
38# ifdef __cplusplus
39#ifdef __cplusplus
3940
40# if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
41# if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
4142
42# ifdef ELAST
43# ifdef ELAST
4344
4445static const int __elast1 = ELAST + 1;
4546static const int __elast2 = ELAST + 2;
4647
47# else
48# else
4849
4950static const int __elast1 = 104;
5051static const int __elast2 = 105;
5152
52# endif
53# endif
5354
54# ifdef ENOTRECOVERABLE
55# ifdef ENOTRECOVERABLE
5556
56# define EOWNERDEAD __elast1
57# define EOWNERDEAD __elast1
5758
58# ifdef ELAST
59# undef ELAST
60# define ELAST EOWNERDEAD
61# endif
59# ifdef ELAST
60# undef ELAST
61# define ELAST EOWNERDEAD
62# endif
6263
63# elif defined(EOWNERDEAD)
64# elif defined(EOWNERDEAD)
6465
65# define ENOTRECOVERABLE __elast1
66# ifdef ELAST
67# undef ELAST
68# define ELAST ENOTRECOVERABLE
69# endif
66# define ENOTRECOVERABLE __elast1
67# ifdef ELAST
68# undef ELAST
69# define ELAST ENOTRECOVERABLE
70# endif
7071
71# else // defined(EOWNERDEAD)
72# else // defined(EOWNERDEAD)
7273
73# define EOWNERDEAD __elast1
74# define ENOTRECOVERABLE __elast2
75# ifdef ELAST
76# undef ELAST
77# define ELAST ENOTRECOVERABLE
78# endif
74# define EOWNERDEAD __elast1
75# define ENOTRECOVERABLE __elast2
76# ifdef ELAST
77# undef ELAST
78# define ELAST ENOTRECOVERABLE
79# endif
7980
80# endif // defined(EOWNERDEAD)
81# endif // defined(EOWNERDEAD)
8182
82# endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
83# endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
8384
8485// supply errno values likely to be missing, particularly on Windows
8586
86# ifndef EAFNOSUPPORT
87# define EAFNOSUPPORT 9901
88# endif
87# ifndef EAFNOSUPPORT
88# define EAFNOSUPPORT 9901
89# endif
8990
90# ifndef EADDRINUSE
91# define EADDRINUSE 9902
92# endif
91# ifndef EADDRINUSE
92# define EADDRINUSE 9902
93# endif
9394
94# ifndef EADDRNOTAVAIL
95# define EADDRNOTAVAIL 9903
96# endif
95# ifndef EADDRNOTAVAIL
96# define EADDRNOTAVAIL 9903
97# endif
9798
98# ifndef EISCONN
99# define EISCONN 9904
100# endif
99# ifndef EISCONN
100# define EISCONN 9904
101# endif
101102
102# ifndef EBADMSG
103# define EBADMSG 9905
104# endif
103# ifndef EBADMSG
104# define EBADMSG 9905
105# endif
105106
106# ifndef ECONNABORTED
107# define ECONNABORTED 9906
108# endif
107# ifndef ECONNABORTED
108# define ECONNABORTED 9906
109# endif
109110
110# ifndef EALREADY
111# define EALREADY 9907
112# endif
111# ifndef EALREADY
112# define EALREADY 9907
113# endif
113114
114# ifndef ECONNREFUSED
115# define ECONNREFUSED 9908
116# endif
115# ifndef ECONNREFUSED
116# define ECONNREFUSED 9908
117# endif
117118
118# ifndef ECONNRESET
119# define ECONNRESET 9909
120# endif
119# ifndef ECONNRESET
120# define ECONNRESET 9909
121# endif
121122
122# ifndef EDESTADDRREQ
123# define EDESTADDRREQ 9910
124# endif
123# ifndef EDESTADDRREQ
124# define EDESTADDRREQ 9910
125# endif
125126
126# ifndef EHOSTUNREACH
127# define EHOSTUNREACH 9911
128# endif
127# ifndef EHOSTUNREACH
128# define EHOSTUNREACH 9911
129# endif
129130
130# ifndef EIDRM
131# define EIDRM 9912
132# endif
131# ifndef EIDRM
132# define EIDRM 9912
133# endif
133134
134# ifndef EMSGSIZE
135# define EMSGSIZE 9913
136# endif
135# ifndef EMSGSIZE
136# define EMSGSIZE 9913
137# endif
137138
138# ifndef ENETDOWN
139# define ENETDOWN 9914
140# endif
139# ifndef ENETDOWN
140# define ENETDOWN 9914
141# endif
141142
142# ifndef ENETRESET
143# define ENETRESET 9915
144# endif
143# ifndef ENETRESET
144# define ENETRESET 9915
145# endif
145146
146# ifndef ENETUNREACH
147# define ENETUNREACH 9916
148# endif
147# ifndef ENETUNREACH
148# define ENETUNREACH 9916
149# endif
149150
150# ifndef ENOBUFS
151# define ENOBUFS 9917
152# endif
151# ifndef ENOBUFS
152# define ENOBUFS 9917
153# endif
153154
154# ifndef ENOLINK
155# define ENOLINK 9918
156# endif
155# ifndef ENOLINK
156# define ENOLINK 9918
157# endif
157158
158# ifndef ENODATA
159# define ENODATA 9919
160# endif
159# ifndef ENODATA
160# define ENODATA 9919
161# endif
161162
162# ifndef ENOMSG
163# define ENOMSG 9920
164# endif
163# ifndef ENOMSG
164# define ENOMSG 9920
165# endif
165166
166# ifndef ENOPROTOOPT
167# define ENOPROTOOPT 9921
168# endif
167# ifndef ENOPROTOOPT
168# define ENOPROTOOPT 9921
169# endif
169170
170# ifndef ENOSR
171# define ENOSR 9922
172# endif
171# ifndef ENOSR
172# define ENOSR 9922
173# endif
173174
174# ifndef ENOTSOCK
175# define ENOTSOCK 9923
176# endif
175# ifndef ENOTSOCK
176# define ENOTSOCK 9923
177# endif
177178
178# ifndef ENOSTR
179# define ENOSTR 9924
180# endif
179# ifndef ENOSTR
180# define ENOSTR 9924
181# endif
181182
182# ifndef ENOTCONN
183# define ENOTCONN 9925
184# endif
183# ifndef ENOTCONN
184# define ENOTCONN 9925
185# endif
185186
186# ifndef ENOTSUP
187# define ENOTSUP 9926
188# endif
187# ifndef ENOTSUP
188# define ENOTSUP 9926
189# endif
189190
190# ifndef ECANCELED
191# define ECANCELED 9927
192# endif
191# ifndef ECANCELED
192# define ECANCELED 9927
193# endif
193194
194# ifndef EINPROGRESS
195# define EINPROGRESS 9928
196# endif
195# ifndef EINPROGRESS
196# define EINPROGRESS 9928
197# endif
197198
198# ifndef EOPNOTSUPP
199# define EOPNOTSUPP 9929
200# endif
199# ifndef EOPNOTSUPP
200# define EOPNOTSUPP 9929
201# endif
201202
202# ifndef EWOULDBLOCK
203# define EWOULDBLOCK 9930
204# endif
203# ifndef EWOULDBLOCK
204# define EWOULDBLOCK 9930
205# endif
205206
206# ifndef EOWNERDEAD
207# define EOWNERDEAD 9931
208# endif
207# ifndef EOWNERDEAD
208# define EOWNERDEAD 9931
209# endif
209210
210# ifndef EPROTO
211# define EPROTO 9932
212# endif
211# ifndef EPROTO
212# define EPROTO 9932
213# endif
213214
214# ifndef EPROTONOSUPPORT
215# define EPROTONOSUPPORT 9933
216# endif
215# ifndef EPROTONOSUPPORT
216# define EPROTONOSUPPORT 9933
217# endif
217218
218# ifndef ENOTRECOVERABLE
219# define ENOTRECOVERABLE 9934
220# endif
219# ifndef ENOTRECOVERABLE
220# define ENOTRECOVERABLE 9934
221# endif
221222
222# ifndef ETIME
223# define ETIME 9935
224# endif
223# ifndef ETIME
224# define ETIME 9935
225# endif
225226
226# ifndef ETXTBSY
227# define ETXTBSY 9936
228# endif
227# ifndef ETXTBSY
228# define ETXTBSY 9936
229# endif
229230
230# ifndef ETIMEDOUT
231# define ETIMEDOUT 9938
232# endif
231# ifndef ETIMEDOUT
232# define ETIMEDOUT 9938
233# endif
233234
234# ifndef ELOOP
235# define ELOOP 9939
236# endif
235# ifndef ELOOP
236# define ELOOP 9939
237# endif
237238
238# ifndef EOVERFLOW
239# define EOVERFLOW 9940
240# endif
239# ifndef EOVERFLOW
240# define EOVERFLOW 9940
241# endif
241242
242# ifndef EPROTOTYPE
243# define EPROTOTYPE 9941
244# endif
243# ifndef EPROTOTYPE
244# define EPROTOTYPE 9941
245# endif
245246
246# ifndef ENOSYS
247# define ENOSYS 9942
248# endif
247# ifndef ENOSYS
248# define ENOSYS 9942
249# endif
249250
250# ifndef EINVAL
251# define EINVAL 9943
252# endif
251# ifndef EINVAL
252# define EINVAL 9943
253# endif
253254
254# ifndef ERANGE
255# define ERANGE 9944
256# endif
255# ifndef ERANGE
256# define ERANGE 9944
257# endif
257258
258# ifndef EILSEQ
259# define EILSEQ 9945
260# endif
259# ifndef EILSEQ
260# define EILSEQ 9945
261# endif
261262
262263// Windows Mobile doesn't appear to define these:
263264
264# ifndef E2BIG
265# define E2BIG 9946
266# endif
265# ifndef E2BIG
266# define E2BIG 9946
267# endif
267268
268# ifndef EDOM
269# define EDOM 9947
270# endif
269# ifndef EDOM
270# define EDOM 9947
271# endif
271272
272# ifndef EFAULT
273# define EFAULT 9948
274# endif
273# ifndef EFAULT
274# define EFAULT 9948
275# endif
275276
276# ifndef EBADF
277# define EBADF 9949
278# endif
277# ifndef EBADF
278# define EBADF 9949
279# endif
279280
280# ifndef EPIPE
281# define EPIPE 9950
282# endif
281# ifndef EPIPE
282# define EPIPE 9950
283# endif
283284
284# ifndef EXDEV
285# define EXDEV 9951
286# endif
285# ifndef EXDEV
286# define EXDEV 9951
287# endif
287288
288# ifndef EBUSY
289# define EBUSY 9952
290# endif
289# ifndef EBUSY
290# define EBUSY 9952
291# endif
291292
292# ifndef ENOTEMPTY
293# define ENOTEMPTY 9953
294# endif
293# ifndef ENOTEMPTY
294# define ENOTEMPTY 9953
295# endif
295296
296# ifndef ENOEXEC
297# define ENOEXEC 9954
298# endif
297# ifndef ENOEXEC
298# define ENOEXEC 9954
299# endif
299300
300# ifndef EEXIST
301# define EEXIST 9955
302# endif
301# ifndef EEXIST
302# define EEXIST 9955
303# endif
303304
304# ifndef EFBIG
305# define EFBIG 9956
306# endif
305# ifndef EFBIG
306# define EFBIG 9956
307# endif
307308
308# ifndef ENAMETOOLONG
309# define ENAMETOOLONG 9957
310# endif
309# ifndef ENAMETOOLONG
310# define ENAMETOOLONG 9957
311# endif
311312
312# ifndef ENOTTY
313# define ENOTTY 9958
314# endif
313# ifndef ENOTTY
314# define ENOTTY 9958
315# endif
315316
316# ifndef EINTR
317# define EINTR 9959
318# endif
317# ifndef EINTR
318# define EINTR 9959
319# endif
319320
320# ifndef ESPIPE
321# define ESPIPE 9960
322# endif
321# ifndef ESPIPE
322# define ESPIPE 9960
323# endif
323324
324# ifndef EIO
325# define EIO 9961
326# endif
325# ifndef EIO
326# define EIO 9961
327# endif
327328
328# ifndef EISDIR
329# define EISDIR 9962
330# endif
329# ifndef EISDIR
330# define EISDIR 9962
331# endif
331332
332# ifndef ECHILD
333# define ECHILD 9963
334# endif
333# ifndef ECHILD
334# define ECHILD 9963
335# endif
335336
336# ifndef ENOLCK
337# define ENOLCK 9964
338# endif
337# ifndef ENOLCK
338# define ENOLCK 9964
339# endif
339340
340# ifndef ENOSPC
341# define ENOSPC 9965
342# endif
341# ifndef ENOSPC
342# define ENOSPC 9965
343# endif
343344
344# ifndef ENXIO
345# define ENXIO 9966
346# endif
345# ifndef ENXIO
346# define ENXIO 9966
347# endif
347348
348# ifndef ENODEV
349# define ENODEV 9967
350# endif
349# ifndef ENODEV
350# define ENODEV 9967
351# endif
351352
352# ifndef ENOENT
353# define ENOENT 9968
354# endif
353# ifndef ENOENT
354# define ENOENT 9968
355# endif
355356
356# ifndef ESRCH
357# define ESRCH 9969
358# endif
357# ifndef ESRCH
358# define ESRCH 9969
359# endif
359360
360# ifndef ENOTDIR
361# define ENOTDIR 9970
362# endif
361# ifndef ENOTDIR
362# define ENOTDIR 9970
363# endif
363364
364# ifndef ENOMEM
365# define ENOMEM 9971
366# endif
365# ifndef ENOMEM
366# define ENOMEM 9971
367# endif
367368
368# ifndef EPERM
369# define EPERM 9972
370# endif
369# ifndef EPERM
370# define EPERM 9972
371# endif
371372
372# ifndef EACCES
373# define EACCES 9973
374# endif
373# ifndef EACCES
374# define EACCES 9973
375# endif
375376
376# ifndef EROFS
377# define EROFS 9974
378# endif
377# ifndef EROFS
378# define EROFS 9974
379# endif
379380
380# ifndef EDEADLK
381# define EDEADLK 9975
382# endif
381# ifndef EDEADLK
382# define EDEADLK 9975
383# endif
383384
384# ifndef EAGAIN
385# define EAGAIN 9976
386# endif
385# ifndef EAGAIN
386# define EAGAIN 9976
387# endif
387388
388# ifndef ENFILE
389# define ENFILE 9977
390# endif
389# ifndef ENFILE
390# define ENFILE 9977
391# endif
391392
392# ifndef EMFILE
393# define EMFILE 9978
394# endif
393# ifndef EMFILE
394# define EMFILE 9978
395# endif
395396
396# ifndef EMLINK
397# define EMLINK 9979
398# endif
397# ifndef EMLINK
398# define EMLINK 9979
399# endif
399400
400# endif // __cplusplus
401#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
401#endif // __cplusplus
402402
403403#endif // _LIBCPP_ERRNO_H
lib/libcxx/include/exception+4-1
......@@ -93,10 +93,13 @@ template <class E> void rethrow_if_nested(const E& e);
9393
9494# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
9595# include <cstddef>
96# include <cstdlib>
9796# include <new>
9897# include <type_traits>
9998# endif
99
100# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
101# include <cstdlib>
102# endif
100103#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
101104
102105#endif // _LIBCPP_EXCEPTION
lib/libcxx/include/ext/hash_map+7-48
......@@ -206,6 +206,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
206206#else
207207# include <__config>
208208# include <__hash_table>
209# include <__memory/compressed_pair.h>
209210# include <algorithm>
210211# include <ext/__hash>
211212# include <functional>
......@@ -224,21 +225,9 @@ _LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <un
224225
225226namespace __gnu_cxx {
226227
227template <class _Tp, class _Hash, bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value >
228class __hash_map_hasher : private _Hash {
229public:
230 _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : _Hash() {}
231 _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
232 _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const { return *this; }
233 _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Tp& __x) const { return static_cast<const _Hash&>(*this)(__x.first); }
234 _LIBCPP_HIDE_FROM_ABI size_t operator()(const typename _Tp::first_type& __x) const {
235 return static_cast<const _Hash&>(*this)(__x);
236 }
237};
238
239228template <class _Tp, class _Hash>
240class __hash_map_hasher<_Tp, _Hash, false> {
241 _Hash __hash_;
229class __hash_map_hasher {
230 _LIBCPP_COMPRESSED_ELEMENT(_Hash, __hash_);
242231
243232public:
244233 _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : __hash_() {}
......@@ -248,30 +237,9 @@ public:
248237 _LIBCPP_HIDE_FROM_ABI size_t operator()(const typename _Tp::first_type& __x) const { return __hash_(__x); }
249238};
250239
251template <class _Tp, class _Pred, bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value >
252class __hash_map_equal : private _Pred {
253public:
254 _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : _Pred() {}
255 _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
256 _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const { return *this; }
257 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
258 return static_cast<const _Pred&>(*this)(__x.first, __y.first);
259 }
260 _LIBCPP_HIDE_FROM_ABI bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const {
261 return static_cast<const _Pred&>(*this)(__x, __y.first);
262 }
263 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const {
264 return static_cast<const _Pred&>(*this)(__x.first, __y);
265 }
266 _LIBCPP_HIDE_FROM_ABI bool
267 operator()(const typename _Tp::first_type& __x, const typename _Tp::first_type& __y) const {
268 return static_cast<const _Pred&>(*this)(__x, __y);
269 }
270};
271
272240template <class _Tp, class _Pred>
273class __hash_map_equal<_Tp, _Pred, false> {
274 _Pred __pred_;
241class __hash_map_equal {
242 _LIBCPP_COMPRESSED_ELEMENT(_Pred, __pred_);
275243
276244public:
277245 _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : __pred_() {}
......@@ -467,8 +435,6 @@ private:
467435
468436 __table __table_;
469437
470 typedef typename __table::__node_pointer __node_pointer;
471 typedef typename __table::__node_const_pointer __node_const_pointer;
472438 typedef typename __table::__node_traits __node_traits;
473439 typedef typename __table::__node_allocator __node_allocator;
474440 typedef typename __table::__node __node;
......@@ -604,10 +570,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
604570}
605571
606572template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
607hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(const hash_map& __u) : __table_(__u.__table_) {
608 __table_.__rehash_unique(__u.bucket_count());
609 insert(__u.begin(), __u.end());
610}
573hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(const hash_map& __u) : __table_(__u.__table_) {}
611574
612575template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
613576typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
......@@ -693,7 +656,6 @@ private:
693656
694657 __table __table_;
695658
696 typedef typename __table::__node_traits __node_traits;
697659 typedef typename __table::__node_allocator __node_allocator;
698660 typedef typename __table::__node __node;
699661 typedef __hash_map_node_destructor<__node_allocator> _Dp;
......@@ -822,10 +784,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
822784}
823785
824786template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
825hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(const hash_multimap& __u) : __table_(__u.__table_) {
826 __table_.__rehash_multi(__u.bucket_count());
827 insert(__u.begin(), __u.end());
828}
787hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(const hash_multimap& __u) : __table_(__u.__table_) {}
829788
830789template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
831790template <class _InputIterator>
lib/libcxx/include/ext/hash_set+2-8
......@@ -356,10 +356,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
356356}
357357
358358template <class _Value, class _Hash, class _Pred, class _Alloc>
359hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(const hash_set& __u) : __table_(__u.__table_) {
360 __table_.__rehash_unique(__u.bucket_count());
361 insert(__u.begin(), __u.end());
362}
359hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(const hash_set& __u) : __table_(__u.__table_) {}
363360
364361template <class _Value, class _Hash, class _Pred, class _Alloc>
365362template <class _InputIterator>
......@@ -534,10 +531,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
534531}
535532
536533template <class _Value, class _Hash, class _Pred, class _Alloc>
537hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(const hash_multiset& __u) : __table_(__u.__table_) {
538 __table_.__rehash_multi(__u.bucket_count());
539 insert(__u.begin(), __u.end());
540}
534hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(const hash_multiset& __u) : __table_(__u.__table_) {}
541535
542536template <class _Value, class _Hash, class _Pred, class _Alloc>
543537template <class _InputIterator>
lib/libcxx/include/fenv.h+43-43
......@@ -50,69 +50,69 @@ int feupdateenv(const fenv_t* envp);
5050*/
5151
5252#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
53# include <__cxx03/fenv.h>
53# include <__cxx03/__config>
5454#else
5555# include <__config>
56#endif
5657
57# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
58# pragma GCC system_header
59# endif
58#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
59# pragma GCC system_header
60#endif
6061
61# if __has_include_next(<fenv.h>)
62# include_next <fenv.h>
63# endif
62#if __has_include_next(<fenv.h>)
63# include_next <fenv.h>
64#endif
6465
65# ifdef __cplusplus
66#ifdef __cplusplus
6667
6768extern "C++" {
6869
69# ifdef feclearexcept
70# undef feclearexcept
71# endif
70# ifdef feclearexcept
71# undef feclearexcept
72# endif
7273
73# ifdef fegetexceptflag
74# undef fegetexceptflag
75# endif
74# ifdef fegetexceptflag
75# undef fegetexceptflag
76# endif
7677
77# ifdef feraiseexcept
78# undef feraiseexcept
79# endif
78# ifdef feraiseexcept
79# undef feraiseexcept
80# endif
8081
81# ifdef fesetexceptflag
82# undef fesetexceptflag
83# endif
82# ifdef fesetexceptflag
83# undef fesetexceptflag
84# endif
8485
85# ifdef fetestexcept
86# undef fetestexcept
87# endif
86# ifdef fetestexcept
87# undef fetestexcept
88# endif
8889
89# ifdef fegetround
90# undef fegetround
91# endif
90# ifdef fegetround
91# undef fegetround
92# endif
9293
93# ifdef fesetround
94# undef fesetround
95# endif
94# ifdef fesetround
95# undef fesetround
96# endif
9697
97# ifdef fegetenv
98# undef fegetenv
99# endif
98# ifdef fegetenv
99# undef fegetenv
100# endif
100101
101# ifdef feholdexcept
102# undef feholdexcept
103# endif
102# ifdef feholdexcept
103# undef feholdexcept
104# endif
104105
105# ifdef fesetenv
106# undef fesetenv
107# endif
106# ifdef fesetenv
107# undef fesetenv
108# endif
108109
109# ifdef feupdateenv
110# undef feupdateenv
111# endif
110# ifdef feupdateenv
111# undef feupdateenv
112# endif
112113
113114} // extern "C++"
114115
115# endif // defined(__cplusplus)
116#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
116#endif // defined(__cplusplus)
117117
118118#endif // _LIBCPP_FENV_H
lib/libcxx/include/flat_map+663-11
......@@ -17,18 +17,359 @@
1717#include <initializer_list> // see [initializer.list.syn]
1818
1919namespace std {
20 struct sorted_unique_t { explicit sorted_unique_t() = default; };
21 inline constexpr sorted_unique_t sorted_unique{};
22
2023 // [flat.map], class template flat_map
2124 template<class Key, class T, class Compare = less<Key>,
2225 class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
23 class flat_map;
26 class flat_map {
27 public:
28 // types
29 using key_type = Key;
30 using mapped_type = T;
31 using value_type = pair<key_type, mapped_type>;
32 using key_compare = Compare;
33 using reference = pair<const key_type&, mapped_type&>;
34 using const_reference = pair<const key_type&, const mapped_type&>;
35 using size_type = size_t;
36 using difference_type = ptrdiff_t;
37 using iterator = implementation-defined; // see [container.requirements]
38 using const_iterator = implementation-defined; // see [container.requirements]
39 using reverse_iterator = std::reverse_iterator<iterator>;
40 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
41 using key_container_type = KeyContainer;
42 using mapped_container_type = MappedContainer;
2443
25 struct sorted_unique_t { explicit sorted_unique_t() = default; };
26 inline constexpr sorted_unique_t sorted_unique{};
44 class value_compare {
45 private:
46 key_compare comp; // exposition only
47 constexpr value_compare(key_compare c) : comp(c) { } // exposition only
48
49 public:
50 constexpr bool operator()(const_reference x, const_reference y) const {
51 return comp(x.first, y.first);
52 }
53 };
54
55 struct containers {
56 key_container_type keys;
57 mapped_container_type values;
58 };
59
60 // [flat.map.cons], constructors
61 constexpr flat_map() : flat_map(key_compare()) { }
62
63 constexpr flat_map(const flat_map&);
64 constexpr flat_map(flat_map&&);
65 constexpr flat_map& operator=(const flat_map&);
66 constexpr flat_map& operator=(flat_map&&);
67
68 constexpr explicit flat_map(const key_compare& comp)
69 : c(), compare(comp) { }
70
71 constexpr flat_map(key_container_type key_cont, mapped_container_type mapped_cont,
72 const key_compare& comp = key_compare());
73
74 constexpr flat_map(sorted_unique_t, key_container_type key_cont,
75 mapped_container_type mapped_cont,
76 const key_compare& comp = key_compare());
77
78 template<class InputIterator>
79 constexpr flat_map(InputIterator first, InputIterator last,
80 const key_compare& comp = key_compare())
81 : c(), compare(comp) { insert(first, last); }
82
83 template<class InputIterator>
84 constexpr flat_map(sorted_unique_t, InputIterator first, InputIterator last,
85 const key_compare& comp = key_compare())
86 : c(), compare(comp) { insert(sorted_unique, first, last); }
87
88 template<container-compatible-range<value_type> R>
89 constexpr flat_map(from_range_t, R&& rg)
90 : flat_map(from_range, std::forward<R>(rg), key_compare()) { }
91 template<container-compatible-range<value_type> R>
92 constexpr flat_map(from_range_t, R&& rg, const key_compare& comp)
93 : flat_map(comp) { insert_range(std::forward<R>(rg)); }
94
95 constexpr flat_map(initializer_list<value_type> il, const key_compare& comp = key_compare())
96 : flat_map(il.begin(), il.end(), comp) { }
97
98 constexpr flat_map(sorted_unique_t, initializer_list<value_type> il,
99 const key_compare& comp = key_compare())
100 : flat_map(sorted_unique, il.begin(), il.end(), comp) { }
101
102 // [flat.map.cons.alloc], constructors with allocators
103
104 template<class Alloc>
105 constexpr explicit flat_map(const Alloc& a);
106 template<class Alloc>
107 constexpr flat_map(const key_compare& comp, const Alloc& a);
108 template<class Alloc>
109 constexpr flat_map(const key_container_type& key_cont,
110 const mapped_container_type& mapped_cont,
111 const Alloc& a);
112 template<class Alloc>
113 constexpr flat_map(const key_container_type& key_cont,
114 const mapped_container_type& mapped_cont,
115 const key_compare& comp, const Alloc& a);
116 template<class Alloc>
117 constexpr flat_map(sorted_unique_t, const key_container_type& key_cont,
118 const mapped_container_type& mapped_cont, const Alloc& a);
119 template<class Alloc>
120 constexpr flat_map(sorted_unique_t, const key_container_type& key_cont,
121 const mapped_container_type& mapped_cont, const key_compare& comp,
122 const Alloc& a);
123 template<class Alloc>
124 constexpr flat_map(const flat_map&, const Alloc& a);
125 template<class Alloc>
126 constexpr flat_map(flat_map&&, const Alloc& a);
127 template<class InputIterator, class Alloc>
128 constexpr flat_map(InputIterator first, InputIterator last, const Alloc& a);
129 template<class InputIterator, class Alloc>
130 constexpr flat_map(InputIterator first, InputIterator last,
131 const key_compare& comp, const Alloc& a);
132 template<class InputIterator, class Alloc>
133 constexpr flat_map(sorted_unique_t, InputIterator first, InputIterator last,
134 const Alloc& a);
135 template<class InputIterator, class Alloc>
136 constexpr flat_map(sorted_unique_t, InputIterator first, InputIterator last,
137 const key_compare& comp, const Alloc& a);
138 template<container-compatible-range<value_type> R, class Alloc>
139 constexpr flat_map(from_range_t, R&& rg, const Alloc& a);
140 template<container-compatible-range<value_type> R, class Alloc>
141 constexpr flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
142 template<class Alloc>
143 constexpr flat_map(initializer_list<value_type> il, const Alloc& a);
144 template<class Alloc>
145 constexpr flat_map(initializer_list<value_type> il, const key_compare& comp,
146 const Alloc& a);
147 template<class Alloc>
148 constexpr flat_map(sorted_unique_t, initializer_list<value_type> il, const Alloc& a);
149 template<class Alloc>
150 constexpr flat_map(sorted_unique_t, initializer_list<value_type> il,
151 const key_compare& comp, const Alloc& a);
152
153 constexpr flat_map& operator=(initializer_list<value_type>);
154
155 // iterators
156 constexpr iterator begin() noexcept;
157 constexpr const_iterator begin() const noexcept;
158 constexpr iterator end() noexcept;
159 constexpr const_iterator end() const noexcept;
160
161 constexpr reverse_iterator rbegin() noexcept;
162 constexpr const_reverse_iterator rbegin() const noexcept;
163 constexpr reverse_iterator rend() noexcept;
164 constexpr const_reverse_iterator rend() const noexcept;
165
166 constexpr const_iterator cbegin() const noexcept;
167 constexpr const_iterator cend() const noexcept;
168 constexpr const_reverse_iterator crbegin() const noexcept;
169 constexpr const_reverse_iterator crend() const noexcept;
170
171 // [flat.map.capacity], capacity
172 constexpr bool empty() const noexcept;
173 constexpr size_type size() const noexcept;
174 constexpr size_type max_size() const noexcept;
175
176 // [flat.map.access], element access
177 constexpr mapped_type& operator[](const key_type& x);
178 constexpr mapped_type& operator[](key_type&& x);
179 template<class K> constexpr mapped_type& operator[](K&& x);
180 constexpr mapped_type& at(const key_type& x);
181 constexpr const mapped_type& at(const key_type& x) const;
182 template<class K> constexpr mapped_type& at(const K& x);
183 template<class K> constexpr const mapped_type& at(const K& x) const;
184
185 // [flat.map.modifiers], modifiers
186 template<class... Args> constexpr pair<iterator, bool> emplace(Args&&... args);
187 template<class... Args>
188 constexpr iterator emplace_hint(const_iterator position, Args&&... args);
189
190 constexpr pair<iterator, bool> insert(const value_type& x)
191 { return emplace(x); }
192 constexpr pair<iterator, bool> insert(value_type&& x)
193 { return emplace(std::move(x)); }
194 constexpr iterator insert(const_iterator position, const value_type& x)
195 { return emplace_hint(position, x); }
196 constexpr iterator insert(const_iterator position, value_type&& x)
197 { return emplace_hint(position, std::move(x)); }
198
199 template<class P> constexpr pair<iterator, bool> insert(P&& x);
200 template<class P>
201 constexpr iterator insert(const_iterator position, P&&);
202 template<class InputIterator>
203 constexpr void insert(InputIterator first, InputIterator last);
204 template<class InputIterator>
205 constexpr void insert(sorted_unique_t, InputIterator first, InputIterator last);
206 template<container-compatible-range<value_type> R>
207 constexpr void insert_range(R&& rg);
208 template<container-compatible-range<value_type> R>
209 constexpr void insert_range(sorted_unique_t, R&& rg);
210
211 constexpr void insert(initializer_list<value_type> il)
212 { insert(il.begin(), il.end()); }
213 constexpr void insert(sorted_unique_t, initializer_list<value_type> il)
214 { insert(sorted_unique, il.begin(), il.end()); }
215
216 constexpr containers extract() &&;
217 constexpr void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont);
218
219 template<class... Args>
220 constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
221 template<class... Args>
222 constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
223 template<class K, class... Args>
224 constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
225 template<class... Args>
226 constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
227 template<class... Args>
228 constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
229 template<class K, class... Args>
230 constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
231 template<class M>
232 constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
233 template<class M>
234 constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
235 template<class K, class M>
236 constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
237 template<class M>
238 constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
239 template<class M>
240 constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
241 template<class K, class M>
242 constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
243
244 constexpr iterator erase(iterator position);
245 constexpr iterator erase(const_iterator position);
246 constexpr size_type erase(const key_type& x);
247 template<class K> constexpr size_type erase(K&& x);
248 constexpr iterator erase(const_iterator first, const_iterator last);
249
250 constexpr void swap(flat_map& y) noexcept(see below);
251 constexpr void clear() noexcept;
252
253 // observers
254 constexpr key_compare key_comp() const;
255 constexpr value_compare value_comp() const;
256
257 constexpr const key_container_type& keys() const noexcept { return c.keys; }
258 constexpr const mapped_container_type& values() const noexcept { return c.values; }
259
260 // map operations
261 constexpr iterator find(const key_type& x);
262 constexpr const_iterator find(const key_type& x) const;
263 template<class K> constexpr iterator find(const K& x);
264 template<class K> constexpr const_iterator find(const K& x) const;
265
266 constexpr size_type count(const key_type& x) const;
267 template<class K> constexpr size_type count(const K& x) const;
268
269 constexpr bool contains(const key_type& x) const;
270 template<class K> constexpr bool contains(const K& x) const;
271
272 constexpr iterator lower_bound(const key_type& x);
273 constexpr const_iterator lower_bound(const key_type& x) const;
274 template<class K> constexpr iterator lower_bound(const K& x);
275 template<class K> constexpr const_iterator lower_bound(const K& x) const;
276
277 constexpr iterator upper_bound(const key_type& x);
278 constexpr const_iterator upper_bound(const key_type& x) const;
279 template<class K> constexpr iterator upper_bound(const K& x);
280 template<class K> constexpr const_iterator upper_bound(const K& x) const;
281
282 constexpr pair<iterator, iterator> equal_range(const key_type& x);
283 constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
284 template<class K> constexpr pair<iterator, iterator> equal_range(const K& x);
285 template<class K>
286 constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
287
288 friend constexpr bool operator==(const flat_map& x, const flat_map& y);
289
290 friend constexpr synth-three-way-result<value_type>
291 operator<=>(const flat_map& x, const flat_map& y);
292
293 friend constexpr void swap(flat_map& x, flat_map& y) noexcept(noexcept(x.swap(y)))
294 { x.swap(y); }
295
296 private:
297 containers c; // exposition only
298 key_compare compare; // exposition only
299
300 struct key-equiv { // exposition only
301 constexpr key-equiv(key_compare c) : comp(c) { }
302 constexpr bool operator()(const_reference x, const_reference y) const {
303 return !comp(x.first, y.first) && !comp(y.first, x.first);
304 }
305 key_compare comp;
306 };
307 };
308
309 template<class KeyContainer, class MappedContainer,
310 class Compare = less<typename KeyContainer::value_type>>
311 flat_map(KeyContainer, MappedContainer, Compare = Compare())
312 -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type,
313 Compare, KeyContainer, MappedContainer>;
314
315 template<class KeyContainer, class MappedContainer, class Allocator>
316 flat_map(KeyContainer, MappedContainer, Allocator)
317 -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type,
318 less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>;
319 template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
320 flat_map(KeyContainer, MappedContainer, Compare, Allocator)
321 -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type,
322 Compare, KeyContainer, MappedContainer>;
323
324 template<class KeyContainer, class MappedContainer,
325 class Compare = less<typename KeyContainer::value_type>>
326 flat_map(sorted_unique_t, KeyContainer, MappedContainer, Compare = Compare())
327 -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type,
328 Compare, KeyContainer, MappedContainer>;
329
330 template<class KeyContainer, class MappedContainer, class Allocator>
331 flat_map(sorted_unique_t, KeyContainer, MappedContainer, Allocator)
332 -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type,
333 less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>;
334 template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
335 flat_map(sorted_unique_t, KeyContainer, MappedContainer, Compare, Allocator)
336 -> flat_map<typename KeyContainer::value_type, typename MappedContainer::value_type,
337 Compare, KeyContainer, MappedContainer>;
338
339 template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>>
340 flat_map(InputIterator, InputIterator, Compare = Compare())
341 -> flat_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Compare>;
342
343 template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>>
344 flat_map(sorted_unique_t, InputIterator, InputIterator, Compare = Compare())
345 -> flat_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Compare>;
346
347 template<ranges::input_range R, class Compare = less<range-key-type<R>>,
348 class Allocator = allocator<byte>>
349 flat_map(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
350 -> flat_map<range-key-type<R>, range-mapped-type<R>, Compare,
351 vector<range-key-type<R>, alloc-rebind<Allocator, range-key-type<R>>>,
352 vector<range-mapped-type<R>, alloc-rebind<Allocator, range-mapped-type<R>>>>;
353
354 template<ranges::input_range R, class Allocator>
355 flat_map(from_range_t, R&&, Allocator)
356 -> flat_map<range-key-type<R>, range-mapped-type<R>, less<range-key-type<R>>,
357 vector<range-key-type<R>, alloc-rebind<Allocator, range-key-type<R>>>,
358 vector<range-mapped-type<R>, alloc-rebind<Allocator, range-mapped-type<R>>>>;
359
360 template<class Key, class T, class Compare = less<Key>>
361 flat_map(initializer_list<pair<Key, T>>, Compare = Compare())
362 -> flat_map<Key, T, Compare>;
363
364 template<class Key, class T, class Compare = less<Key>>
365 flat_map(sorted_unique_t, initializer_list<pair<Key, T>>, Compare = Compare())
366 -> flat_map<Key, T, Compare>;
27367
28368 template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
29 class Allocator>
30 struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>,
31 Allocator>;
369 class Allocator>
370 struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>, Allocator>
371 : bool_constant<uses_allocator_v<KeyContainer, Allocator> &&
372 uses_allocator_v<MappedContainer, Allocator>> { };
32373
33374 // [flat.map.erasure], erasure for flat_map
34375 template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
......@@ -36,18 +377,329 @@ namespace std {
36377 typename flat_map<Key, T, Compare, KeyContainer, MappedContainer>::size_type
37378 erase_if(flat_map<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
38379
380 struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };
381 inline constexpr sorted_equivalent_t sorted_equivalent{};
382
39383 // [flat.multimap], class template flat_multimap
40384 template<class Key, class T, class Compare = less<Key>,
41385 class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
42 class flat_multimap;
386 class flat_multimap {
387 public:
388 // types
389 using key_type = Key;
390 using mapped_type = T;
391 using value_type = pair<key_type, mapped_type>;
392 using key_compare = Compare;
393 using reference = pair<const key_type&, mapped_type&>;
394 using const_reference = pair<const key_type&, const mapped_type&>;
395 using size_type = size_t;
396 using difference_type = ptrdiff_t;
397 using iterator = implementation-defined; // see [container.requirements]
398 using const_iterator = implementation-defined; // see [container.requirements]
399 using reverse_iterator = std::reverse_iterator<iterator>;
400 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
401 using key_container_type = KeyContainer;
402 using mapped_container_type = MappedContainer;
43403
44 struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };
45 inline constexpr sorted_equivalent_t sorted_equivalent{};
404 class value_compare {
405 private:
406 key_compare comp; // exposition only
407 constexpr value_compare(key_compare c) : comp(c) { } // exposition only
408
409 public:
410 constexpr bool operator()(const_reference x, const_reference y) const {
411 return comp(x.first, y.first);
412 }
413 };
414
415 struct containers {
416 key_container_type keys;
417 mapped_container_type values;
418 };
419
420 // [flat.multimap.cons], constructors
421 constexpr flat_multimap() : flat_multimap(key_compare()) { }
422
423 constexpr flat_multimap(const flat_multimap&);
424 constexpr flat_multimap(flat_multimap&&);
425 constexpr flat_multimap& operator=(const flat_multimap&);
426 constexpr flat_multimap& operator=(flat_multimap&&);
427
428 constexpr explicit flat_multimap(const key_compare& comp)
429 : c(), compare(comp) { }
430
431 constexpr flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont,
432 const key_compare& comp = key_compare());
433
434 constexpr flat_multimap(sorted_equivalent_t,
435 key_container_type key_cont, mapped_container_type mapped_cont,
436 const key_compare& comp = key_compare());
437
438 template<class InputIterator>
439 constexpr flat_multimap(InputIterator first, InputIterator last,
440 const key_compare& comp = key_compare())
441 : c(), compare(comp)
442 { insert(first, last); }
443
444 template<class InputIterator>
445 constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
446 const key_compare& comp = key_compare())
447 : c(), compare(comp) { insert(sorted_equivalent, first, last); }
448
449 template<container-compatible-range<value_type> R>
450 constexpr flat_multimap(from_range_t, R&& rg)
451 : flat_multimap(from_range, std::forward<R>(rg), key_compare()) { }
452 template<container-compatible-range<value_type> R>
453 constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp)
454 : flat_multimap(comp) { insert_range(std::forward<R>(rg)); }
455
456 constexpr flat_multimap(initializer_list<value_type> il,
457 const key_compare& comp = key_compare())
458 : flat_multimap(il.begin(), il.end(), comp) { }
459
460 constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
461 const key_compare& comp = key_compare())
462 : flat_multimap(sorted_equivalent, il.begin(), il.end(), comp) { }
463
464 // [flat.multimap.cons.alloc], constructors with allocators
465
466 template<class Alloc>
467 constexpr explicit flat_multimap(const Alloc& a);
468 template<class Alloc>
469 constexpr flat_multimap(const key_compare& comp, const Alloc& a);
470 template<class Alloc>
471 constexpr flat_multimap(const key_container_type& key_cont,
472 const mapped_container_type& mapped_cont, const Alloc& a);
473 template<class Alloc>
474 constexpr flat_multimap(const key_container_type& key_cont,
475 const mapped_container_type& mapped_cont,
476 const key_compare& comp, const Alloc& a);
477 template<class Alloc>
478 constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
479 const mapped_container_type& mapped_cont, const Alloc& a);
480 template<class Alloc>
481 constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
482 const mapped_container_type& mapped_cont,
483 const key_compare& comp, const Alloc& a);
484 template<class Alloc>
485 constexpr flat_multimap(const flat_multimap&, const Alloc& a);
486 template<class Alloc>
487 constexpr flat_multimap(flat_multimap&&, const Alloc& a);
488 template<class InputIterator, class Alloc>
489 constexpr flat_multimap(InputIterator first, InputIterator last, const Alloc& a);
490 template<class InputIterator, class Alloc>
491 constexpr flat_multimap(InputIterator first, InputIterator last,
492 const key_compare& comp, const Alloc& a);
493 template<class InputIterator, class Alloc>
494 constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
495 const Alloc& a);
496 template<class InputIterator, class Alloc>
497 constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
498 const key_compare& comp, const Alloc& a);
499 template<container-compatible-range<value_type> R, class Alloc>
500 constexpr flat_multimap(from_range_t, R&& rg, const Alloc& a);
501 template<container-compatible-range<value_type> R, class Alloc>
502 constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
503 template<class Alloc>
504 constexpr flat_multimap(initializer_list<value_type> il, const Alloc& a);
505 template<class Alloc>
506 constexpr flat_multimap(initializer_list<value_type> il, const key_compare& comp,
507 const Alloc& a);
508 template<class Alloc>
509 constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
510 const Alloc& a);
511 template<class Alloc>
512 constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
513 const key_compare& comp, const Alloc& a);
514
515 flat_multimap& operator=(initializer_list<value_type>);
516
517 // iterators
518 constexpr iterator begin() noexcept;
519 constexpr const_iterator begin() const noexcept;
520 constexpr iterator end() noexcept;
521 constexpr const_iterator end() const noexcept;
522
523 constexpr reverse_iterator rbegin() noexcept;
524 constexpr const_reverse_iterator rbegin() const noexcept;
525 constexpr reverse_iterator rend() noexcept;
526 constexpr const_reverse_iterator rend() const noexcept;
527
528 constexpr const_iterator cbegin() const noexcept;
529 constexpr const_iterator cend() const noexcept;
530 constexpr const_reverse_iterator crbegin() const noexcept;
531 constexpr const_reverse_iterator crend() const noexcept;
532
533 // capacity
534 constexpr bool empty() const noexcept;
535 constexpr size_type size() const noexcept;
536 constexpr size_type max_size() const noexcept;
537
538 // modifiers
539 template<class... Args> constexpr iterator emplace(Args&&... args);
540 template<class... Args>
541 constexpr iterator emplace_hint(const_iterator position, Args&&... args);
542
543 constexpr iterator insert(const value_type& x)
544 { return emplace(x); }
545 constexpr iterator insert(value_type&& x)
546 { return emplace(std::move(x)); }
547 constexpr iterator insert(const_iterator position, const value_type& x)
548 { return emplace_hint(position, x); }
549 constexpr iterator insert(const_iterator position, value_type&& x)
550 { return emplace_hint(position, std::move(x)); }
551
552 template<class P> constexpr iterator insert(P&& x);
553 template<class P>
554 constexpr iterator insert(const_iterator position, P&&);
555 template<class InputIterator>
556 constexpr void insert(InputIterator first, InputIterator last);
557 template<class InputIterator>
558 constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
559 template<container-compatible-range<value_type> R>
560 constexpr void insert_range(R&& rg);
561 template<container-compatible-range<value_type> R>
562 constexpr void insert_range(sorted_equivalent_t, R&& rg);
563
564 constexpr void insert(initializer_list<value_type> il)
565 { insert(il.begin(), il.end()); }
566 constexpr void insert(sorted_equivalent_t, initializer_list<value_type> il)
567 { insert(sorted_equivalent, il.begin(), il.end()); }
568
569 constexpr containers extract() &&;
570 constexpr void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont);
571
572 constexpr iterator erase(iterator position);
573 constexpr iterator erase(const_iterator position);
574 constexpr size_type erase(const key_type& x);
575 template<class K> constexpr size_type erase(K&& x);
576 constexpr iterator erase(const_iterator first, const_iterator last);
577
578 constexpr void swap(flat_multimap&)
579 noexcept(is_nothrow_swappable_v<key_container_type> &&
580 is_nothrow_swappable_v<mapped_container_type> &&
581 is_nothrow_swappable_v<key_compare>);
582 constexpr void clear() noexcept;
583
584 // observers
585 constexpr key_compare key_comp() const;
586 constexpr value_compare value_comp() const;
587
588 constexpr const key_container_type& keys() const noexcept { return c.keys; }
589 constexpr const mapped_container_type& values() const noexcept { return c.values; }
590
591 // map operations
592 constexpr iterator find(const key_type& x);
593 constexpr const_iterator find(const key_type& x) const;
594 template<class K> constexpr iterator find(const K& x);
595 template<class K> constexpr const_iterator find(const K& x) const;
596
597 constexpr size_type count(const key_type& x) const;
598 template<class K> constexpr size_type count(const K& x) const;
599
600 constexpr bool contains(const key_type& x) const;
601 template<class K> constexpr bool contains(const K& x) const;
602
603 constexpr iterator lower_bound(const key_type& x);
604 constexpr const_iterator lower_bound(const key_type& x) const;
605 template<class K> constexpr iterator lower_bound(const K& x);
606 template<class K> constexpr const_iterator lower_bound(const K& x) const;
607
608 constexpr iterator upper_bound(const key_type& x);
609 constexpr const_iterator upper_bound(const key_type& x) const;
610 template<class K> constexpr iterator upper_bound(const K& x);
611 template<class K> constexpr const_iterator upper_bound(const K& x) const;
612
613 constexpr pair<iterator, iterator> equal_range(const key_type& x);
614 constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
615 template<class K>
616 constexpr pair<iterator, iterator> equal_range(const K& x);
617 template<class K>
618 constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
619
620 friend constexpr bool operator==(const flat_multimap& x, const flat_multimap& y);
621
622 friend constexpr synth-three-way-result<value_type>
623 operator<=>(const flat_multimap& x, const flat_multimap& y);
624
625 friend constexpr void swap(flat_multimap& x, flat_multimap& y)
626 noexcept(noexcept(x.swap(y)))
627 { x.swap(y); }
628
629 private:
630 containers c; // exposition only
631 key_compare compare; // exposition only
632 };
633
634 template<class KeyContainer, class MappedContainer,
635 class Compare = less<typename KeyContainer::value_type>>
636 flat_multimap(KeyContainer, MappedContainer, Compare = Compare())
637 -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
638 Compare, KeyContainer, MappedContainer>;
639
640 template<class KeyContainer, class MappedContainer, class Allocator>
641 flat_multimap(KeyContainer, MappedContainer, Allocator)
642 -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
643 less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>;
644 template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
645 flat_multimap(KeyContainer, MappedContainer, Compare, Allocator)
646 -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
647 Compare, KeyContainer, MappedContainer>;
648
649 template<class KeyContainer, class MappedContainer,
650 class Compare = less<typename KeyContainer::value_type>>
651 flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare = Compare())
652 -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
653 Compare, KeyContainer, MappedContainer>;
654
655 template<class KeyContainer, class MappedContainer, class Allocator>
656 flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Allocator)
657 -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
658 less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>;
659 template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
660 flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare, Allocator)
661 -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
662 Compare, KeyContainer, MappedContainer>;
663
664 template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>>
665 flat_multimap(InputIterator, InputIterator, Compare = Compare())
666 -> flat_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Compare>;
667
668 template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>>
669 flat_multimap(sorted_equivalent_t, InputIterator, InputIterator, Compare = Compare())
670 -> flat_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Compare>;
671
672 template<ranges::input_range R, class Compare = less<range-key-type<R>>,
673 class Allocator = allocator<byte>>
674 flat_multimap(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
675 -> flat_multimap<range-key-type<R>, range-mapped-type<R>, Compare,
676 vector<range-key-type<R>,
677 alloc-rebind<Allocator, range-key-type<R>>>,
678 vector<range-mapped-type<R>,
679 alloc-rebind<Allocator, range-mapped-type<R>>>>;
680
681 template<ranges::input_range R, class Allocator>
682 flat_multimap(from_range_t, R&&, Allocator)
683 -> flat_multimap<range-key-type<R>, range-mapped-type<R>, less<range-key-type<R>>,
684 vector<range-key-type<R>,
685 alloc-rebind<Allocator, range-key-type<R>>>,
686 vector<range-mapped-type<R>,
687 alloc-rebind<Allocator, range-mapped-type<R>>>>;
688
689 template<class Key, class T, class Compare = less<Key>>
690 flat_multimap(initializer_list<pair<Key, T>>, Compare = Compare())
691 -> flat_multimap<Key, T, Compare>;
692
693 template<class Key, class T, class Compare = less<Key>>
694 flat_multimap(sorted_equivalent_t, initializer_list<pair<Key, T>>, Compare = Compare())
695 -> flat_multimap<Key, T, Compare>;
46696
47697 template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
48 class Allocator>
698 class Allocator>
49699 struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>,
50 Allocator>;
700 Allocator>
701 : bool_constant<uses_allocator_v<KeyContainer, Allocator> &&
702 uses_allocator_v<MappedContainer, Allocator>> { };
51703
52704 // [flat.multimap.erasure], erasure for flat_multimap
53705 template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
lib/libcxx/include/flat_set+543-8
......@@ -17,30 +17,565 @@
1717#include <initializer_list> // see [initializer.list.syn]
1818
1919namespace std {
20 struct sorted_unique_t { explicit sorted_unique_t() = default; };
21 inline constexpr sorted_unique_t sorted_unique{};
22
2023 // [flat.set], class template flat_set
2124 template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
22 class flat_set;
25 class flat_set {
26 public:
27 // types
28 using key_type = Key;
29 using value_type = Key;
30 using key_compare = Compare;
31 using value_compare = Compare;
32 using reference = value_type&;
33 using const_reference = const value_type&;
34 using size_type = KeyContainer::size_type;
35 using difference_type = KeyContainer::difference_type;
36 using iterator = implementation-defined; // see [container.requirements]
37 using const_iterator = implementation-defined; // see [container.requirements]
38 using reverse_iterator = std::reverse_iterator<iterator>;
39 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
40 using container_type = KeyContainer;
2341
24 struct sorted_unique_t { explicit sorted_unique_t() = default; };
25 inline constexpr sorted_unique_t sorted_unique{};
42 // [flat.set.cons], constructors
43 constexpr flat_set() : flat_set(key_compare()) { }
44
45 constexpr flat_set(const flat_set&);
46 constexpr flat_set(flat_set&&);
47 constexpr flat_set& operator=(const flat_set&);
48 constexpr flat_set& operator=(flat_set&&);
49
50 constexpr explicit flat_set(const key_compare& comp)
51 : c(), compare(comp) { }
52
53 constexpr explicit flat_set(container_type cont, const key_compare& comp = key_compare());
54
55 constexpr flat_set(sorted_unique_t, container_type cont,
56 const key_compare& comp = key_compare())
57 : c(std::move(cont)), compare(comp) { }
58
59 template<class InputIterator>
60 constexpr flat_set(InputIterator first, InputIterator last,
61 const key_compare& comp = key_compare())
62 : c(), compare(comp)
63 { insert(first, last); }
64
65 template<class InputIterator>
66 constexpr flat_set(sorted_unique_t, InputIterator first, InputIterator last,
67 const key_compare& comp = key_compare())
68 : c(first, last), compare(comp) { }
69
70 template<container-compatible-range<value_type> R>
71 constexpr flat_set(from_range_t, R&& rg)
72 : flat_set(from_range, std::forward<R>(rg), key_compare()) { }
73 template<container-compatible-range<value_type> R>
74 constexpr flat_set(from_range_t, R&& rg, const key_compare& comp)
75 : flat_set(comp)
76 { insert_range(std::forward<R>(rg)); }
77
78 constexpr flat_set(initializer_list<value_type> il, const key_compare& comp = key_compare())
79 : flat_set(il.begin(), il.end(), comp) { }
80
81 constexpr flat_set(sorted_unique_t, initializer_list<value_type> il,
82 const key_compare& comp = key_compare())
83 : flat_set(sorted_unique, il.begin(), il.end(), comp) { }
84
85 // [flat.set.cons.alloc], constructors with allocators
86
87 template<class Alloc>
88 constexpr explicit flat_set(const Alloc& a);
89 template<class Alloc>
90 constexpr flat_set(const key_compare& comp, const Alloc& a);
91 template<class Alloc>
92 constexpr flat_set(const container_type& cont, const Alloc& a);
93 template<class Alloc>
94 constexpr flat_set(const container_type& cont, const key_compare& comp, const Alloc& a);
95 template<class Alloc>
96 constexpr flat_set(sorted_unique_t, const container_type& cont, const Alloc& a);
97 template<class Alloc>
98 constexpr flat_set(sorted_unique_t, const container_type& cont,
99 const key_compare& comp, const Alloc& a);
100 template<class Alloc>
101 constexpr flat_set(const flat_set&, const Alloc& a);
102 template<class Alloc>
103 constexpr flat_set(flat_set&&, const Alloc& a);
104 template<class InputIterator, class Alloc>
105 constexpr flat_set(InputIterator first, InputIterator last, const Alloc& a);
106 template<class InputIterator, class Alloc>
107 constexpr flat_set(InputIterator first, InputIterator last,
108 const key_compare& comp, const Alloc& a);
109 template<class InputIterator, class Alloc>
110 constexpr flat_set(sorted_unique_t, InputIterator first, InputIterator last,
111 const Alloc& a);
112 template<class InputIterator, class Alloc>
113 constexpr flat_set(sorted_unique_t, InputIterator first, InputIterator last,
114 const key_compare& comp, const Alloc& a);
115 template<container-compatible-range<value_type> R, class Alloc>
116 constexpr flat_set(from_range_t, R&& rg, const Alloc& a);
117 template<container-compatible-range<value_type> R, class Alloc>
118 constexpr flat_set(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
119 template<class Alloc>
120 constexpr flat_set(initializer_list<value_type> il, const Alloc& a);
121 template<class Alloc>
122 constexpr flat_set(initializer_list<value_type> il, const key_compare& comp,
123 const Alloc& a);
124 template<class Alloc>
125 constexpr flat_set(sorted_unique_t, initializer_list<value_type> il, const Alloc& a);
126 template<class Alloc>
127 constexpr flat_set(sorted_unique_t, initializer_list<value_type> il,
128 const key_compare& comp, const Alloc& a);
129
130 constexpr flat_set& operator=(initializer_list<value_type>);
131
132 // iterators
133 constexpr iterator begin() noexcept;
134 constexpr const_iterator begin() const noexcept;
135 constexpr iterator end() noexcept;
136 constexpr const_iterator end() const noexcept;
137
138 constexpr reverse_iterator rbegin() noexcept;
139 constexpr const_reverse_iterator rbegin() const noexcept;
140 constexpr reverse_iterator rend() noexcept;
141 constexpr const_reverse_iterator rend() const noexcept;
142
143 constexpr const_iterator cbegin() const noexcept;
144 constexpr const_iterator cend() const noexcept;
145 constexpr const_reverse_iterator crbegin() const noexcept;
146 constexpr const_reverse_iterator crend() const noexcept;
147
148 // capacity
149 constexpr bool empty() const noexcept;
150 constexpr size_type size() const noexcept;
151 constexpr size_type max_size() const noexcept;
152
153 // [flat.set.modifiers], modifiers
154 template<class... Args> constexpr pair<iterator, bool> emplace(Args&&... args);
155 template<class... Args>
156 constexpr iterator emplace_hint(const_iterator position, Args&&... args);
157
158 constexpr pair<iterator, bool> insert(const value_type& x)
159 { return emplace(x); }
160 constexpr pair<iterator, bool> insert(value_type&& x)
161 { return emplace(std::move(x)); }
162 template<class K> constexpr pair<iterator, bool> insert(K&& x);
163 constexpr iterator insert(const_iterator position, const value_type& x)
164 { return emplace_hint(position, x); }
165 constexpr iterator insert(const_iterator position, value_type&& x)
166 { return emplace_hint(position, std::move(x)); }
167 template<class K> constexpr iterator insert(const_iterator hint, K&& x);
168
169 template<class InputIterator>
170 constexpr void insert(InputIterator first, InputIterator last);
171 template<class InputIterator>
172 constexpr void insert(sorted_unique_t, InputIterator first, InputIterator last);
173 template<container-compatible-range<value_type> R>
174 constexpr void insert_range(R&& rg);
175 template<container-compatible-range<value_type> R>
176 constexpr void insert_range(sorted_unique_t, R&& rg);
177
178 constexpr void insert(initializer_list<value_type> il)
179 { insert(il.begin(), il.end()); }
180 constexpr void insert(sorted_unique_t, initializer_list<value_type> il)
181 { insert(sorted_unique, il.begin(), il.end()); }
182
183 constexpr container_type extract() &&;
184 constexpr void replace(container_type&&);
185
186 constexpr iterator erase(iterator position) requires (!same_as<iterator, const_iterator>);
187 constexpr iterator erase(const_iterator position);
188 constexpr size_type erase(const key_type& x);
189 template<class K> constexpr size_type erase(K&& x);
190 constexpr iterator erase(const_iterator first, const_iterator last);
191
192 constexpr void swap(flat_set& y) noexcept(see below);
193 constexpr void clear() noexcept;
194
195 // observers
196 constexpr key_compare key_comp() const;
197 constexpr value_compare value_comp() const;
198
199 // set operations
200 constexpr iterator find(const key_type& x);
201 constexpr const_iterator find(const key_type& x) const;
202 template<class K> constexpr iterator find(const K& x);
203 template<class K> constexpr const_iterator find(const K& x) const;
204
205 constexpr size_type count(const key_type& x) const;
206 template<class K> constexpr size_type count(const K& x) const;
207
208 constexpr bool contains(const key_type& x) const;
209 template<class K> constexpr bool contains(const K& x) const;
210
211 constexpr iterator lower_bound(const key_type& x);
212 constexpr const_iterator lower_bound(const key_type& x) const;
213 template<class K> constexpr iterator lower_bound(const K& x);
214 template<class K> constexpr const_iterator lower_bound(const K& x) const;
215
216 constexpr iterator upper_bound(const key_type& x);
217 constexpr const_iterator upper_bound(const key_type& x) const;
218 template<class K> constexpr iterator upper_bound(const K& x);
219 template<class K> constexpr const_iterator upper_bound(const K& x) const;
220
221 constexpr pair<iterator, iterator> equal_range(const key_type& x);
222 constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
223 template<class K>
224 constexpr pair<iterator, iterator> equal_range(const K& x);
225 template<class K>
226 constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
227
228 friend constexpr bool operator==(const flat_set& x, const flat_set& y);
229
230 friend constexpr synth-three-way-result<value_type>
231 operator<=>(const flat_set& x, const flat_set& y);
232
233 friend constexpr void swap(flat_set& x, flat_set& y) noexcept(noexcept(x.swap(y)))
234 { x.swap(y); }
235
236 private:
237 container_type c; // exposition only
238 key_compare compare; // exposition only
239 };
240
241 template<class KeyContainer, class Compare = less<typename KeyContainer::value_type>>
242 flat_set(KeyContainer, Compare = Compare())
243 -> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
244 template<class KeyContainer, class Allocator>
245 flat_set(KeyContainer, Allocator)
246 -> flat_set<typename KeyContainer::value_type,
247 less<typename KeyContainer::value_type>, KeyContainer>;
248 template<class KeyContainer, class Compare, class Allocator>
249 flat_set(KeyContainer, Compare, Allocator)
250 -> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
251
252 template<class KeyContainer, class Compare = less<typename KeyContainer::value_type>>
253 flat_set(sorted_unique_t, KeyContainer, Compare = Compare())
254 -> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
255 template<class KeyContainer, class Allocator>
256 flat_set(sorted_unique_t, KeyContainer, Allocator)
257 -> flat_set<typename KeyContainer::value_type,
258 less<typename KeyContainer::value_type>, KeyContainer>;
259 template<class KeyContainer, class Compare, class Allocator>
260 flat_set(sorted_unique_t, KeyContainer, Compare, Allocator)
261 -> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
262
263 template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
264 flat_set(InputIterator, InputIterator, Compare = Compare())
265 -> flat_set<iter-value-type<InputIterator>, Compare>;
266
267 template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
268 flat_set(sorted_unique_t, InputIterator, InputIterator, Compare = Compare())
269 -> flat_set<iter-value-type<InputIterator>, Compare>;
270
271 template<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>,
272 class Allocator = allocator<ranges::range_value_t<R>>>
273 flat_set(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
274 -> flat_set<ranges::range_value_t<R>, Compare,
275 vector<ranges::range_value_t<R>,
276 alloc-rebind<Allocator, ranges::range_value_t<R>>>>;
277
278 template<ranges::input_range R, class Allocator>
279 flat_set(from_range_t, R&&, Allocator)
280 -> flat_set<ranges::range_value_t<R>, less<ranges::range_value_t<R>>,
281 vector<ranges::range_value_t<R>,
282 alloc-rebind<Allocator, ranges::range_value_t<R>>>>;
283
284 template<class Key, class Compare = less<Key>>
285 flat_set(initializer_list<Key>, Compare = Compare())
286 -> flat_set<Key, Compare>;
287
288 template<class Key, class Compare = less<Key>>
289 flat_set(sorted_unique_t, initializer_list<Key>, Compare = Compare())
290 -> flat_set<Key, Compare>;
26291
27292 template<class Key, class Compare, class KeyContainer, class Allocator>
28 struct uses_allocator<flat_set<Key, Compare, KeyContainer>, Allocator>;
293 struct uses_allocator<flat_set<Key, Compare, KeyContainer>, Allocator>
294 : bool_constant<uses_allocator_v<KeyContainer, Allocator>> { };
29295
30296 // [flat.set.erasure], erasure for flat_set
31297 template<class Key, class Compare, class KeyContainer, class Predicate>
32298 typename flat_set<Key, Compare, KeyContainer>::size_type
33299 erase_if(flat_set<Key, Compare, KeyContainer>& c, Predicate pred);
34300
301 struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };
302 inline constexpr sorted_equivalent_t sorted_equivalent{};
303
35304 // [flat.multiset], class template flat_multiset
36305 template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
37 class flat_multiset;
306 class flat_multiset {
307 public:
308 // types
309 using key_type = Key;
310 using value_type = Key;
311 using key_compare = Compare;
312 using value_compare = Compare;
313 using reference = value_type&;
314 using const_reference = const value_type&;
315 using size_type = KeyContainer::size_type;
316 using difference_type = KeyContainer::difference_type;
317 using iterator = implementation-defined; // see [container.requirements]
318 using const_iterator = implementation-defined; // see [container.requirements]
319 using reverse_iterator = std::reverse_iterator<iterator>;
320 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
321 using container_type = KeyContainer;
38322
39 struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };
40 inline constexpr sorted_equivalent_t sorted_equivalent{};
323 // [flat.multiset.cons], constructors
324 constexpr flat_multiset() : flat_multiset(key_compare()) { }
325
326 constexpr flat_multiset(const flat_multiset&);
327 constexpr flat_multiset(flat_multiset&&);
328 constexpr flat_multiset& operator=(const flat_multiset&);
329 constexpr flat_multiset& operator=(flat_multiset&&);
330
331 constexpr explicit flat_multiset(const key_compare& comp)
332 : c(), compare(comp) { }
333
334 constexpr explicit flat_multiset(container_type cont,
335 const key_compare& comp = key_compare());
336
337 constexpr flat_multiset(sorted_equivalent_t, container_type cont,
338 const key_compare& comp = key_compare())
339 : c(std::move(cont)), compare(comp) { }
340
341 template<class InputIterator>
342 constexpr flat_multiset(InputIterator first, InputIterator last,
343 const key_compare& comp = key_compare())
344 : c(), compare(comp)
345 { insert(first, last); }
346
347 template<class InputIterator>
348 constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
349 const key_compare& comp = key_compare())
350 : c(first, last), compare(comp) { }
351
352 template<container-compatible-range<value_type> R>
353 constexpr flat_multiset(from_range_t, R&& rg)
354 : flat_multiset(from_range, std::forward<R>(rg), key_compare()) { }
355 template<container-compatible-range<value_type> R>
356 constexpr flat_multiset(from_range_t, R&& rg, const key_compare& comp)
357 : flat_multiset(comp)
358 { insert_range(std::forward<R>(rg)); }
359
360 constexpr flat_multiset(initializer_list<value_type> il,
361 const key_compare& comp = key_compare())
362 : flat_multiset(il.begin(), il.end(), comp) { }
363
364 constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
365 const key_compare& comp = key_compare())
366 : flat_multiset(sorted_equivalent, il.begin(), il.end(), comp) { }
367
368 // [flat.multiset.cons.alloc], constructors with allocators
369
370 template<class Alloc>
371 constexpr explicit flat_multiset(const Alloc& a);
372 template<class Alloc>
373 constexpr flat_multiset(const key_compare& comp, const Alloc& a);
374 template<class Alloc>
375 constexpr flat_multiset(const container_type& cont, const Alloc& a);
376 template<class Alloc>
377 constexpr flat_multiset(const container_type& cont, const key_compare& comp,
378 const Alloc& a);
379 template<class Alloc>
380 constexpr flat_multiset(sorted_equivalent_t, const container_type& cont, const Alloc& a);
381 template<class Alloc>
382 constexpr flat_multiset(sorted_equivalent_t, const container_type& cont,
383 const key_compare& comp, const Alloc& a);
384 template<class Alloc>
385 constexpr flat_multiset(const flat_multiset&, const Alloc& a);
386 template<class Alloc>
387 constexpr flat_multiset(flat_multiset&&, const Alloc& a);
388 template<class InputIterator, class Alloc>
389 constexpr flat_multiset(InputIterator first, InputIterator last, const Alloc& a);
390 template<class InputIterator, class Alloc>
391 constexpr flat_multiset(InputIterator first, InputIterator last,
392 const key_compare& comp, const Alloc& a);
393 template<class InputIterator, class Alloc>
394 constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
395 const Alloc& a);
396 template<class InputIterator, class Alloc>
397 constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
398 const key_compare& comp, const Alloc& a);
399 template<container-compatible-range<value_type> R, class Alloc>
400 constexpr flat_multiset(from_range_t, R&& rg, const Alloc& a);
401 template<container-compatible-range<value_type> R, class Alloc>
402 constexpr flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
403 template<class Alloc>
404 constexpr flat_multiset(initializer_list<value_type> il, const Alloc& a);
405 template<class Alloc>
406 constexpr flat_multiset(initializer_list<value_type> il, const key_compare& comp,
407 const Alloc& a);
408 template<class Alloc>
409 constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
410 const Alloc& a);
411 template<class Alloc>
412 constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
413 const key_compare& comp, const Alloc& a);
414
415 constexpr flat_multiset& operator=(initializer_list<value_type>);
416
417 // iterators
418 constexpr iterator begin() noexcept;
419 constexpr const_iterator begin() const noexcept;
420 constexpr iterator end() noexcept;
421 constexpr const_iterator end() const noexcept;
422
423 constexpr reverse_iterator rbegin() noexcept;
424 constexpr const_reverse_iterator rbegin() const noexcept;
425 constexpr reverse_iterator rend() noexcept;
426 constexpr const_reverse_iterator rend() const noexcept;
427
428 constexpr const_iterator cbegin() const noexcept;
429 constexpr const_iterator cend() const noexcept;
430 constexpr const_reverse_iterator crbegin() const noexcept;
431 constexpr const_reverse_iterator crend() const noexcept;
432
433 // capacity
434 constexpr bool empty() const noexcept;
435 constexpr size_type size() const noexcept;
436 constexpr size_type max_size() const noexcept;
437
438 // [flat.multiset.modifiers], modifiers
439 template<class... Args> constexpr iterator emplace(Args&&... args);
440 template<class... Args>
441 constexpr iterator emplace_hint(const_iterator position, Args&&... args);
442
443 constexpr iterator insert(const value_type& x)
444 { return emplace(x); }
445 constexpr iterator insert(value_type&& x)
446 { return emplace(std::move(x)); }
447 constexpr iterator insert(const_iterator position, const value_type& x)
448 { return emplace_hint(position, x); }
449 constexpr iterator insert(const_iterator position, value_type&& x)
450 { return emplace_hint(position, std::move(x)); }
451
452 template<class InputIterator>
453 constexpr void insert(InputIterator first, InputIterator last);
454 template<class InputIterator>
455 constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
456 template<container-compatible-range<value_type> R>
457 constexpr void insert_range(R&& rg);
458 template<container-compatible-range<value_type> R>
459 constexpr void insert_range(sorted_equivalent_t, R&& rg);
460
461 constexpr void insert(initializer_list<value_type> il)
462 { insert(il.begin(), il.end()); }
463 constexpr void insert(sorted_equivalent_t, initializer_list<value_type> il)
464 { insert(sorted_equivalent, il.begin(), il.end()); }
465
466 constexpr container_type extract() &&;
467 constexpr void replace(container_type&&);
468
469 constexpr iterator erase(iterator position) requires (!same_as<iterator, const_iterator>);
470 constexpr iterator erase(const_iterator position);
471 constexpr size_type erase(const key_type& x);
472 template<class K> constexpr size_type erase(K&& x);
473 constexpr iterator erase(const_iterator first, const_iterator last);
474
475 constexpr void swap(flat_multiset& y) noexcept(see below);
476 constexpr void clear() noexcept;
477
478 // observers
479 constexpr key_compare key_comp() const;
480 constexpr value_compare value_comp() const;
481
482 // set operations
483 constexpr iterator find(const key_type& x);
484 constexpr const_iterator find(const key_type& x) const;
485 template<class K> constexpr iterator find(const K& x);
486 template<class K> constexpr const_iterator find(const K& x) const;
487
488 constexpr size_type count(const key_type& x) const;
489 template<class K> constexpr size_type count(const K& x) const;
490
491 constexpr bool contains(const key_type& x) const;
492 template<class K> constexpr bool contains(const K& x) const;
493
494 constexpr iterator lower_bound(const key_type& x);
495 constexpr const_iterator lower_bound(const key_type& x) const;
496 template<class K> constexpr iterator lower_bound(const K& x);
497 template<class K> constexpr const_iterator lower_bound(const K& x) const;
498
499 constexpr iterator upper_bound(const key_type& x);
500 constexpr const_iterator upper_bound(const key_type& x) const;
501 template<class K> constexpr iterator upper_bound(const K& x);
502 template<class K> constexpr const_iterator upper_bound(const K& x) const;
503
504 constexpr pair<iterator, iterator> equal_range(const key_type& x);
505 constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
506 template<class K>
507 constexpr pair<iterator, iterator> equal_range(const K& x);
508 template<class K>
509 constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
510
511 friend constexpr bool operator==(const flat_multiset& x, const flat_multiset& y);
512
513 friend constexpr synth-three-way-result<value_type>
514 operator<=>(const flat_multiset& x, const flat_multiset& y);
515
516 friend constexpr void swap(flat_multiset& x, flat_multiset& y)
517 noexcept(noexcept(x.swap(y)))
518 { x.swap(y); }
519
520 private:
521 container_type c; // exposition only
522 key_compare compare; // exposition only
523 };
524
525 template<class KeyContainer, class Compare = less<typename KeyContainer::value_type>>
526 flat_multiset(KeyContainer, Compare = Compare())
527 -> flat_multiset<typename KeyContainer::value_type, Compare, KeyContainer>;
528 template<class KeyContainer, class Allocator>
529 flat_multiset(KeyContainer, Allocator)
530 -> flat_multiset<typename KeyContainer::value_type,
531 less<typename KeyContainer::value_type>, KeyContainer>;
532 template<class KeyContainer, class Compare, class Allocator>
533 flat_multiset(KeyContainer, Compare, Allocator)
534 -> flat_multiset<typename KeyContainer::value_type, Compare, KeyContainer>;
535
536 template<class KeyContainer, class Compare = less<typename KeyContainer::value_type>>
537 flat_multiset(sorted_equivalent_t, KeyContainer, Compare = Compare())
538 -> flat_multiset<typename KeyContainer::value_type, Compare, KeyContainer>;
539 template<class KeyContainer, class Allocator>
540 flat_multiset(sorted_equivalent_t, KeyContainer, Allocator)
541 -> flat_multiset<typename KeyContainer::value_type,
542 less<typename KeyContainer::value_type>, KeyContainer>;
543 template<class KeyContainer, class Compare, class Allocator>
544 flat_multiset(sorted_equivalent_t, KeyContainer, Compare, Allocator)
545 -> flat_multiset<typename KeyContainer::value_type, Compare, KeyContainer>;
546
547 template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
548 flat_multiset(InputIterator, InputIterator, Compare = Compare())
549 -> flat_multiset<iter-value-type<InputIterator>, Compare>;
550
551 template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
552 flat_multiset(sorted_equivalent_t, InputIterator, InputIterator, Compare = Compare())
553 -> flat_multiset<iter-value-type<InputIterator>, Compare>;
554
555 template<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>,
556 class Allocator = allocator<ranges::range_value_t<R>>>
557 flat_multiset(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
558 -> flat_multiset<ranges::range_value_t<R>, Compare,
559 vector<ranges::range_value_t<R>,
560 alloc-rebind<Allocator, ranges::range_value_t<R>>>>;
561
562 template<ranges::input_range R, class Allocator>
563 flat_multiset(from_range_t, R&&, Allocator)
564 -> flat_multiset<ranges::range_value_t<R>, less<ranges::range_value_t<R>>,
565 vector<ranges::range_value_t<R>,
566 alloc-rebind<Allocator, ranges::range_value_t<R>>>>;
567
568 template<class Key, class Compare = less<Key>>
569 flat_multiset(initializer_list<Key>, Compare = Compare())
570 -> flat_multiset<Key, Compare>;
571
572 template<class Key, class Compare = less<Key>>
573 flat_multiset(sorted_equivalent_t, initializer_list<Key>, Compare = Compare())
574 -> flat_multiset<Key, Compare>;
41575
42576 template<class Key, class Compare, class KeyContainer, class Allocator>
43 struct uses_allocator<flat_multiset<Key, Compare, KeyContainer>, Allocator>;
577 struct uses_allocator<flat_multiset<Key, Compare, KeyContainer>, Allocator>
578 : bool_constant<uses_allocator_v<KeyContainer, Allocator>> { };
44579
45580 // [flat.multiset.erasure], erasure for flat_multiset
46581 template<class Key, class Compare, class KeyContainer, class Predicate>
lib/libcxx/include/float.h+16-16
......@@ -71,29 +71,29 @@ Macros:
7171*/
7272
7373#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
74# include <__cxx03/float.h>
74# include <__cxx03/__config>
7575#else
7676# include <__config>
77#endif
7778
78# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
79# pragma GCC system_header
80# endif
79#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
80# pragma GCC system_header
81#endif
8182
82# if __has_include_next(<float.h>)
83# include_next <float.h>
84# endif
83#if __has_include_next(<float.h>)
84# include_next <float.h>
85#endif
8586
86# ifdef __cplusplus
87#ifdef __cplusplus
8788
88# ifndef FLT_EVAL_METHOD
89# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
90# endif
89# ifndef FLT_EVAL_METHOD
90# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
91# endif
9192
92# ifndef DECIMAL_DIG
93# define DECIMAL_DIG __DECIMAL_DIG__
94# endif
93# ifndef DECIMAL_DIG
94# define DECIMAL_DIG __DECIMAL_DIG__
95# endif
9596
96# endif // __cplusplus
97#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
97#endif // __cplusplus
9898
9999#endif // _LIBCPP_FLOAT_H
lib/libcxx/include/forward_list+33-53
......@@ -223,18 +223,17 @@ template <class T, class Allocator, class Predicate>
223223# include <__ranges/concepts.h>
224224# include <__ranges/container_compatible_range.h>
225225# include <__ranges/from_range.h>
226# include <__type_traits/conditional.h>
227226# include <__type_traits/container_traits.h>
228227# include <__type_traits/enable_if.h>
229228# include <__type_traits/is_allocator.h>
230229# include <__type_traits/is_const.h>
231230# include <__type_traits/is_nothrow_assignable.h>
232231# include <__type_traits/is_nothrow_constructible.h>
233# include <__type_traits/is_pointer.h>
234232# include <__type_traits/is_same.h>
235233# include <__type_traits/is_swappable.h>
236234# include <__type_traits/remove_cv.h>
237235# include <__type_traits/type_identity.h>
236# include <__utility/exception_guard.h>
238237# include <__utility/forward.h>
239238# include <__utility/move.h>
240239# include <__utility/swap.h>
......@@ -283,17 +282,6 @@ struct __forward_node_traits {
283282 typedef _NodePtr __node_pointer;
284283 typedef __forward_begin_node<_NodePtr> __begin_node;
285284 typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer;
286
287// TODO(LLVM 22): Remove this check
288# ifndef _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
289 static_assert(sizeof(__begin_node_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__begin_node_pointer) ==
290 _LIBCPP_ALIGNOF(__node_pointer),
291 "It looks like you are using std::forward_list with a fancy pointer type that thas a different "
292 "representation depending on whether it points to a forward_list base pointer or a forward_list node "
293 "pointer (both of which are implementation details of the standard library). This means that your ABI "
294 "is being broken between LLVM 19 and LLVM 20. If you don't care about your ABI being broken, define "
295 "the _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB macro to silence this diagnostic.");
296# endif
297285};
298286
299287template <class _NodePtr>
......@@ -680,7 +668,7 @@ public:
680668# endif
681669 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v);
682670
683 template <__enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
671 template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
684672 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
685673 forward_list(size_type __n, const value_type& __v, const allocator_type& __a)
686674 : __base(__a) {
......@@ -744,50 +732,52 @@ public:
744732
745733 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
746734
747 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
735 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
748736 return allocator_type(this->__alloc_);
749737 }
750738
751 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
739 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
752740 return iterator(__base::__before_begin()->__next_);
753741 }
754 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
742 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
755743 return const_iterator(__base::__before_begin()->__next_);
756744 }
757 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(nullptr); }
758 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
745 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
746 return iterator(nullptr);
747 }
748 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
759749 return const_iterator(nullptr);
760750 }
761751
762 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
752 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
763753 return const_iterator(__base::__before_begin()->__next_);
764754 }
765 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
755 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
766756 return const_iterator(nullptr);
767757 }
768758
769 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator before_begin() _NOEXCEPT {
759 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator before_begin() _NOEXCEPT {
770760 return iterator(__base::__before_begin());
771761 }
772 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator before_begin() const _NOEXCEPT {
762 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator before_begin() const _NOEXCEPT {
773763 return const_iterator(__base::__before_begin());
774764 }
775 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbefore_begin() const _NOEXCEPT {
765 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbefore_begin() const _NOEXCEPT {
776766 return const_iterator(__base::__before_begin());
777767 }
778768
779769 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
780770 return __base::__before_begin()->__next_ == nullptr;
781771 }
782 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
772 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
783773 return std::min<size_type>(__node_traits::max_size(this->__alloc_), numeric_limits<difference_type>::max());
784774 }
785775
786 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference front() {
776 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference front() {
787777 _LIBCPP_ASSERT_NON_NULL(!empty(), "forward_list::front called on an empty list");
788778 return __base::__before_begin()->__next_->__get_value();
789779 }
790 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference front() const {
780 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference front() const {
791781 _LIBCPP_ASSERT_NON_NULL(!empty(), "forward_list::front called on an empty list");
792782 return __base::__before_begin()->__next_->__get_value();
793783 }
......@@ -918,22 +908,22 @@ private:
918908
919909# if _LIBCPP_STD_VER >= 17
920910template <class _InputIterator,
921 class _Alloc = allocator<__iter_value_type<_InputIterator>>,
911 class _Alloc = allocator<__iterator_value_type<_InputIterator>>,
922912 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
923 class = enable_if_t<__is_allocator<_Alloc>::value> >
924forward_list(_InputIterator, _InputIterator) -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
913 class = enable_if_t<__is_allocator_v<_Alloc>>>
914forward_list(_InputIterator, _InputIterator) -> forward_list<__iterator_value_type<_InputIterator>, _Alloc>;
925915
926916template <class _InputIterator,
927917 class _Alloc,
928918 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
929 class = enable_if_t<__is_allocator<_Alloc>::value> >
930forward_list(_InputIterator, _InputIterator, _Alloc) -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
919 class = enable_if_t<__is_allocator_v<_Alloc>>>
920forward_list(_InputIterator, _InputIterator, _Alloc) -> forward_list<__iterator_value_type<_InputIterator>, _Alloc>;
931921# endif
932922
933923# if _LIBCPP_STD_VER >= 23
934924template <ranges::input_range _Range,
935925 class _Alloc = allocator<ranges::range_value_t<_Range>>,
936 class = enable_if_t<__is_allocator<_Alloc>::value> >
926 class = enable_if_t<__is_allocator_v<_Alloc>>>
937927forward_list(from_range_t, _Range&&, _Alloc = _Alloc()) -> forward_list<ranges::range_value_t<_Range>, _Alloc>;
938928# endif
939929
......@@ -1180,22 +1170,17 @@ forward_list<_Tp, _Alloc>::__insert_after(const_iterator __p, size_type __n, _Ar
11801170 if (__n > 0) {
11811171 __node_pointer __first = this->__create_node(/* next = */ nullptr, std::forward<_Args>(__args)...);
11821172 __node_pointer __last = __first;
1183# if _LIBCPP_HAS_EXCEPTIONS
1184 try {
1185# endif // _LIBCPP_HAS_EXCEPTIONS
1186 for (--__n; __n != 0; --__n, __last = __last->__next_) {
1187 __last->__next_ = this->__create_node(/* next = */ nullptr, std::forward<_Args>(__args)...);
1188 }
1189# if _LIBCPP_HAS_EXCEPTIONS
1190 } catch (...) {
1173 auto __guard = std::__make_exception_guard([&] {
11911174 while (__first != nullptr) {
11921175 __node_pointer __next = __first->__next_;
11931176 this->__delete_node(__first);
11941177 __first = __next;
11951178 }
1196 throw;
1179 });
1180 for (--__n; __n != 0; --__n, __last = __last->__next_) {
1181 __last->__next_ = this->__create_node(/* next = */ nullptr, std::forward<_Args>(__args)...);
11971182 }
1198# endif // _LIBCPP_HAS_EXCEPTIONS
1183 __guard.__complete();
11991184 __last->__next_ = __r->__next_;
12001185 __r->__next_ = __first;
12011186 __r = std::__static_fancy_pointer_cast<__begin_node_pointer>(__last);
......@@ -1220,22 +1205,17 @@ forward_list<_Tp, _Alloc>::__insert_after_with_sentinel(const_iterator __p, _Inp
12201205 __node_pointer __first = this->__create_node(/* next = */ nullptr, *__f);
12211206 __node_pointer __last = __first;
12221207
1223# if _LIBCPP_HAS_EXCEPTIONS
1224 try {
1225# endif // _LIBCPP_HAS_EXCEPTIONS
1226 for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) {
1227 __last->__next_ = this->__create_node(/* next = */ nullptr, *__f);
1228 }
1229# if _LIBCPP_HAS_EXCEPTIONS
1230 } catch (...) {
1208 auto __guard = std::__make_exception_guard([&] {
12311209 while (__first != nullptr) {
12321210 __node_pointer __next = __first->__next_;
12331211 this->__delete_node(__first);
12341212 __first = __next;
12351213 }
1236 throw;
1214 });
1215 for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) {
1216 __last->__next_ = this->__create_node(/* next = */ nullptr, *__f);
12371217 }
1238# endif // _LIBCPP_HAS_EXCEPTIONS
1218 __guard.__complete();
12391219
12401220 __last->__next_ = __r->__next_;
12411221 __r->__next_ = __first;
lib/libcxx/include/fstream+57-42
......@@ -221,7 +221,7 @@ _LIBCPP_PUSH_MACROS
221221
222222_LIBCPP_BEGIN_NAMESPACE_STD
223223
224# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_WIN32API)
224# if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_WIN32API)
225225_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept;
226226# endif
227227
......@@ -254,7 +254,7 @@ public:
254254 void swap(basic_filebuf& __rhs);
255255
256256 // 27.9.1.4 Members:
257 _LIBCPP_HIDE_FROM_ABI bool is_open() const;
257 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is_open() const;
258258 basic_filebuf* open(const char* __s, ios_base::openmode __mode);
259259# if _LIBCPP_HAS_OPEN_WITH_WCHAR
260260 basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
......@@ -262,15 +262,14 @@ public:
262262 _LIBCPP_HIDE_FROM_ABI basic_filebuf* open(const string& __s, ios_base::openmode __mode);
263263
264264# if _LIBCPP_STD_VER >= 17
265 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI basic_filebuf*
266 open(const filesystem::path& __p, ios_base::openmode __mode) {
265 _LIBCPP_HIDE_FROM_ABI basic_filebuf* open(const filesystem::path& __p, ios_base::openmode __mode) {
267266 return open(__p.c_str(), __mode);
268267 }
269268# endif
270269 _LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode);
271270 basic_filebuf* close();
272271# if _LIBCPP_STD_VER >= 26
273 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
272 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
274273 _LIBCPP_ASSERT_UNCATEGORIZED(this->is_open(), "File must be opened");
275274# if defined(_LIBCPP_WIN32API)
276275 return std::__filebuf_windows_native_handle(__file_);
......@@ -299,6 +298,16 @@ protected:
299298 int sync() override;
300299 void imbue(const locale& __loc) override;
301300
301 _LIBCPP_HIDE_FROM_ABI_VIRTUAL streamsize xsputn(const char_type* __str, streamsize __len) override {
302 if (__always_noconv_ && __len >= (this->epptr() - this->pbase())) {
303 if (traits_type::eq_int_type(overflow(), traits_type::eof()))
304 return 0;
305
306 return std::fwrite(__str, sizeof(char_type), __len, __file_);
307 }
308 return basic_streambuf<_CharT, _Traits>::xsputn(__str, __len);
309 }
310
302311private:
303312 char* __extbuf_;
304313 const char* __extbufnext_;
......@@ -401,6 +410,14 @@ private:
401410 }
402411 }
403412 }
413
414 _LIBCPP_HIDE_FROM_ABI typename traits_type::int_type __overflow_failed() {
415 if (this->pptr() == this->epptr() + 1) {
416 this->pbump(-1); // lose the character we overflowed above -- we don't really have a
417 // choice since we couldn't commit the contents of the put area
418 }
419 return traits_type::eof();
420 }
404421};
405422
406423template <class _CharT, class _Traits>
......@@ -742,7 +759,12 @@ basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::close() {
742759 if (fclose(__h.release()))
743760 __rt = nullptr;
744761 __file_ = nullptr;
745 setbuf(0, 0);
762 // Reset the get and the put areas without getting rid of the underlying buffers,
763 // which might have been configured by the user. Make sure to keep the buffers
764 // since the user may re-open the stream.
765 this->setg(nullptr, nullptr, nullptr);
766 this->setp(nullptr, nullptr);
767 __cm_ = __no_io_operations;
746768 }
747769 return __rt;
748770}
......@@ -821,14 +843,6 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
821843
822844template <class _CharT, class _Traits>
823845typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
824 auto __failed = [this]() {
825 if (this->pptr() == this->epptr() + 1) {
826 this->pbump(-1); // lose the character we overflowed above -- we don't really have a
827 // choice since we couldn't commit the contents of the put area
828 }
829 return traits_type::eof();
830 };
831
832846 if (__file_ == nullptr)
833847 return traits_type::eof();
834848 __write_mode();
......@@ -850,7 +864,7 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
850864 if (__always_noconv_) {
851865 size_t __n = static_cast<size_t>(this->pptr() - this->pbase());
852866 if (std::fwrite(this->pbase(), sizeof(char_type), __n, __file_) != __n) {
853 return __failed();
867 return __overflow_failed();
854868 }
855869 } else {
856870 if (!__cv_)
......@@ -864,14 +878,14 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
864878 do {
865879 codecvt_base::result __r = __cv_->out(__st_, __b, __p, __end, __extbuf_, __extbuf_ + __ebs_, __extbuf_end);
866880 if (__end == __b) {
867 return __failed();
881 return __overflow_failed();
868882 }
869883
870884 // No conversion needed: output characters directly to the file, done.
871885 if (__r == codecvt_base::noconv) {
872886 size_t __n = static_cast<size_t>(__p - __b);
873887 if (std::fwrite(__b, 1, __n, __file_) != __n) {
874 return __failed();
888 return __overflow_failed();
875889 }
876890 break;
877891
......@@ -879,7 +893,7 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
879893 } else if (__r == codecvt_base::ok) {
880894 size_t __n = static_cast<size_t>(__extbuf_end - __extbuf_);
881895 if (std::fwrite(__extbuf_, 1, __n, __file_) != __n) {
882 return __failed();
896 return __overflow_failed();
883897 }
884898 break;
885899
......@@ -888,13 +902,13 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
888902 } else if (__r == codecvt_base::partial) {
889903 size_t __n = static_cast<size_t>(__extbuf_end - __extbuf_);
890904 if (std::fwrite(__extbuf_, 1, __n, __file_) != __n) {
891 return __failed();
905 return __overflow_failed();
892906 }
893907 __b = const_cast<char_type*>(__end);
894908 continue;
895909
896910 } else {
897 return __failed();
911 return __overflow_failed();
898912 }
899913 } while (true);
900914 }
......@@ -977,7 +991,7 @@ template <class _CharT, class _Traits>
977991int basic_filebuf<_CharT, _Traits>::__fseek(FILE* __file, pos_type __offset, int __whence) {
978992# if defined(_LIBCPP_MSVCRT_LIKE)
979993 return _fseeki64(__file, __offset, __whence);
980# elif defined(_NEWLIB_VERSION)
994# elif _LIBCPP_LIBC_NEWLIB
981995 return fseek(__file, __offset, __whence);
982996# else
983997 return ::fseeko(__file, __offset, __whence);
......@@ -988,7 +1002,7 @@ template <class _CharT, class _Traits>
9881002typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>::__ftell(FILE* __file) {
9891003# if defined(_LIBCPP_MSVCRT_LIKE)
9901004 return _ftelli64(__file);
991# elif defined(_NEWLIB_VERSION)
1005# elif _LIBCPP_LIBC_NEWLIB
9921006 return ftell(__file);
9931007# else
9941008 return ftello(__file);
......@@ -1147,27 +1161,27 @@ public:
11471161 _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
11481162# if _LIBCPP_STD_VER >= 17
11491163 template <class _Tp, class = enable_if_t<is_same_v<_Tp, filesystem::path>>>
1150 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
1151 _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const _Tp& __p, ios_base::openmode __mode = ios_base::in)
1164 _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const _Tp& __p, ios_base::openmode __mode = ios_base::in)
11521165 : basic_ifstream(__p.c_str(), __mode) {}
11531166# endif // _LIBCPP_STD_VER >= 17
11541167 _LIBCPP_HIDE_FROM_ABI basic_ifstream(basic_ifstream&& __rhs);
11551168 _LIBCPP_HIDE_FROM_ABI basic_ifstream& operator=(basic_ifstream&& __rhs);
11561169 _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream& __rhs);
11571170
1158 _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
1171 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
11591172# if _LIBCPP_STD_VER >= 26
1160 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
1173 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
1174 return rdbuf()->native_handle();
1175 }
11611176# endif
1162 _LIBCPP_HIDE_FROM_ABI bool is_open() const;
1177 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is_open() const;
11631178 void open(const char* __s, ios_base::openmode __mode = ios_base::in);
11641179# if _LIBCPP_HAS_OPEN_WITH_WCHAR
11651180 void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
11661181# endif
11671182 void open(const string& __s, ios_base::openmode __mode = ios_base::in);
11681183# if _LIBCPP_STD_VER >= 17
1169 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
1170 open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) {
1184 _LIBCPP_HIDE_FROM_ABI void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) {
11711185 return open(__p.c_str(), __mode);
11721186 }
11731187# endif // _LIBCPP_STD_VER >= 17
......@@ -1304,8 +1318,7 @@ public:
13041318
13051319# if _LIBCPP_STD_VER >= 17
13061320 template <class _Tp, class = enable_if_t<is_same_v<_Tp, filesystem::path>>>
1307 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
1308 _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const _Tp& __p, ios_base::openmode __mode = ios_base::out)
1321 _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const _Tp& __p, ios_base::openmode __mode = ios_base::out)
13091322 : basic_ofstream(__p.c_str(), __mode) {}
13101323# endif // _LIBCPP_STD_VER >= 17
13111324
......@@ -1313,11 +1326,13 @@ public:
13131326 _LIBCPP_HIDE_FROM_ABI basic_ofstream& operator=(basic_ofstream&& __rhs);
13141327 _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream& __rhs);
13151328
1316 _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
1329 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
13171330# if _LIBCPP_STD_VER >= 26
1318 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
1331 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
1332 return rdbuf()->native_handle();
1333 }
13191334# endif
1320 _LIBCPP_HIDE_FROM_ABI bool is_open() const;
1335 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is_open() const;
13211336 void open(const char* __s, ios_base::openmode __mode = ios_base::out);
13221337# if _LIBCPP_HAS_OPEN_WITH_WCHAR
13231338 void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
......@@ -1325,8 +1340,7 @@ public:
13251340 void open(const string& __s, ios_base::openmode __mode = ios_base::out);
13261341
13271342# if _LIBCPP_STD_VER >= 17
1328 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
1329 open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) {
1343 _LIBCPP_HIDE_FROM_ABI void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) {
13301344 return open(__p.c_str(), __mode);
13311345 }
13321346# endif // _LIBCPP_STD_VER >= 17
......@@ -1466,8 +1480,7 @@ public:
14661480
14671481# if _LIBCPP_STD_VER >= 17
14681482 template <class _Tp, class = enable_if_t<is_same_v<_Tp, filesystem::path>>>
1469 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(
1470 const _Tp& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
1483 _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const _Tp& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
14711484 : basic_fstream(__p.c_str(), __mode) {}
14721485# endif // _LIBCPP_STD_VER >= 17
14731486
......@@ -1477,11 +1490,13 @@ public:
14771490
14781491 _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream& __rhs);
14791492
1480 _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
1493 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
14811494# if _LIBCPP_STD_VER >= 26
1482 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
1495 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
1496 return rdbuf()->native_handle();
1497 }
14831498# endif
1484 _LIBCPP_HIDE_FROM_ABI bool is_open() const;
1499 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is_open() const;
14851500 _LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
14861501# if _LIBCPP_HAS_OPEN_WITH_WCHAR
14871502 void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
......@@ -1489,7 +1504,7 @@ public:
14891504 _LIBCPP_HIDE_FROM_ABI void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
14901505
14911506# if _LIBCPP_STD_VER >= 17
1492 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
1507 _LIBCPP_HIDE_FROM_ABI void
14931508 open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out) {
14941509 return open(__p.c_str(), __mode);
14951510 }
lib/libcxx/include/future+41-51
......@@ -397,12 +397,14 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
397397# include <__type_traits/decay.h>
398398# include <__type_traits/enable_if.h>
399399# include <__type_traits/invoke.h>
400# include <__type_traits/is_constructible.h>
400401# include <__type_traits/is_same.h>
401402# include <__type_traits/remove_cvref.h>
402403# include <__type_traits/remove_reference.h>
403404# include <__type_traits/strip_signature.h>
404405# include <__type_traits/underlying_type.h>
405406# include <__utility/auto_cast.h>
407# include <__utility/exception_guard.h>
406408# include <__utility/forward.h>
407409# include <__utility/move.h>
408410# include <__utility/swap.h>
......@@ -477,13 +479,13 @@ inline _LIBCPP_HIDE_FROM_ABI launch& operator^=(launch& __x, launch __y) {
477479_LIBCPP_DECLARE_STRONG_ENUM(future_status){ready, timeout, deferred};
478480_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
479481
480_LIBCPP_EXPORTED_FROM_ABI const error_category& future_category() _NOEXCEPT;
482[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& future_category() _NOEXCEPT;
481483
482inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(future_errc __e) _NOEXCEPT {
484[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(future_errc __e) _NOEXCEPT {
483485 return error_code(static_cast<int>(__e), future_category());
484486}
485487
486inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __e) _NOEXCEPT {
488[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __e) _NOEXCEPT {
487489 return error_condition(static_cast<int>(__e), future_category());
488490}
489491
......@@ -502,7 +504,7 @@ public:
502504 _LIBCPP_HIDE_FROM_ABI explicit future_error(future_errc __ec) : future_error(std::make_error_code(__ec)) {}
503505# endif
504506
505 _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
507 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
506508
507509 _LIBCPP_HIDE_FROM_ABI future_error(const future_error&) _NOEXCEPT = default;
508510 ~future_error() _NOEXCEPT override;
......@@ -583,12 +585,9 @@ inline future_status __assoc_sub_state::wait_for(const chrono::duration<_Rep, _P
583585template <class _Rp>
584586class _LIBCPP_HIDDEN __assoc_state : public __assoc_sub_state {
585587 typedef __assoc_sub_state base;
586 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
587 typedef typename aligned_storage<sizeof(_Rp), _LIBCPP_ALIGNOF(_Rp)>::type _Up;
588 _LIBCPP_SUPPRESS_DEPRECATED_POP
589588
590589protected:
591 _Up __value_;
590 _ALIGNAS_TYPE(_Rp) char __value_[sizeof(_Rp)];
592591
593592 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
594593
......@@ -943,15 +942,15 @@ public:
943942 }
944943
945944 _LIBCPP_HIDE_FROM_ABI ~future();
946 _LIBCPP_HIDE_FROM_ABI shared_future<_Rp> share() _NOEXCEPT;
945 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_future<_Rp> share() _NOEXCEPT;
947946
948947 // retrieving the value
949 _LIBCPP_HIDE_FROM_ABI _Rp get();
948 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Rp get();
950949
951950 _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
952951
953952 // functions to check state
954 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
953 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
955954
956955 _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
957956 template <class _Rep, class _Period>
......@@ -1014,15 +1013,15 @@ public:
10141013 }
10151014
10161015 _LIBCPP_HIDE_FROM_ABI ~future();
1017 _LIBCPP_HIDE_FROM_ABI shared_future<_Rp&> share() _NOEXCEPT;
1016 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_future<_Rp&> share() _NOEXCEPT;
10181017
10191018 // retrieving the value
1020 _LIBCPP_HIDE_FROM_ABI _Rp& get();
1019 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Rp& get();
10211020
10221021 _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
10231022
10241023 // functions to check state
1025 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
1024 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
10261025
10271026 _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
10281027 template <class _Rep, class _Period>
......@@ -1089,7 +1088,7 @@ public:
10891088 _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
10901089
10911090 // functions to check state
1092 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
1091 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
10931092
10941093 _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
10951094 template <class _Rep, class _Period>
......@@ -1139,7 +1138,7 @@ public:
11391138 _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
11401139
11411140 // retrieving the result
1142 _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future();
1141 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future();
11431142
11441143 // setting the result
11451144 _LIBCPP_HIDE_FROM_ABI void set_value(const _Rp& __r);
......@@ -1256,7 +1255,7 @@ public:
12561255 _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
12571256
12581257 // retrieving the result
1259 _LIBCPP_HIDE_FROM_ABI future<_Rp&> get_future();
1258 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI future<_Rp&> get_future();
12601259
12611260 // setting the result
12621261 _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __r);
......@@ -1366,7 +1365,7 @@ public:
13661365 _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
13671366
13681367 // retrieving the result
1369 future<void> get_future();
1368 [[__nodiscard__]] future<void> get_future();
13701369
13711370 // setting the result
13721371 void set_value();
......@@ -1639,10 +1638,10 @@ public:
16391638 __p_.swap(__other.__p_);
16401639 }
16411640
1642 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
1641 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
16431642
16441643 // result retrieval
1645 _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future() { return __p_.get_future(); }
1644 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future() { return __p_.get_future(); }
16461645
16471646 // execution
16481647 _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
......@@ -1728,10 +1727,10 @@ public:
17281727 __p_.swap(__other.__p_);
17291728 }
17301729
1731 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
1730 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
17321731
17331732 // result retrieval
1734 _LIBCPP_HIDE_FROM_ABI future<void> get_future() { return __p_.get_future(); }
1733 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI future<void> get_future() { return __p_.get_future(); }
17351734
17361735 // execution
17371736 _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
......@@ -1815,16 +1814,9 @@ template <class _Rp, class _Fp>
18151814_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_async_assoc_state(_Fp&& __f) {
18161815 unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count> __h(
18171816 new __async_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
1818# if _LIBCPP_HAS_EXCEPTIONS
1819 try {
1820# endif
1821 std::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
1822# if _LIBCPP_HAS_EXCEPTIONS
1823 } catch (...) {
1824 __h->__make_ready();
1825 throw;
1826 }
1827# endif
1817 auto __guard = std::__make_exception_guard([&] { __h->__make_ready(); });
1818 std::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
1819 __guard.__complete();
18281820 return future<_Rp>(__h.get());
18291821}
18301822
......@@ -1837,20 +1829,16 @@ class _LIBCPP_HIDDEN __async_func {
18371829public:
18381830 using _Rp _LIBCPP_NODEBUG = __invoke_result_t<_Fp, _Args...>;
18391831
1840 _LIBCPP_HIDE_FROM_ABI explicit __async_func(_Fp&& __f, _Args&&... __args)
1841 : __f_(std::move(__f), std::move(__args)...) {}
1832 template <class _Gp, class... _BArgs>
1833 _LIBCPP_HIDE_FROM_ABI explicit __async_func(_Gp&& __g, _BArgs&&... __bargs)
1834 : __f_(std::forward<_Gp>(__g), std::forward<_BArgs>(__bargs)...) {}
18421835
18431836 _LIBCPP_HIDE_FROM_ABI __async_func(__async_func&& __f) : __f_(std::move(__f.__f_)) {}
18441837
18451838 _LIBCPP_HIDE_FROM_ABI _Rp operator()() {
1846 typedef typename __make_tuple_indices<1 + sizeof...(_Args), 1>::type _Index;
1847 return __execute(_Index());
1848 }
1849
1850private:
1851 template <size_t... _Indices>
1852 _LIBCPP_HIDE_FROM_ABI _Rp __execute(__tuple_indices<_Indices...>) {
1853 return std::__invoke(std::move(std::get<0>(__f_)), std::move(std::get<_Indices>(__f_))...);
1839 return [&]<size_t... _Indices>(__index_sequence<_Indices...>) -> _Rp {
1840 return std::__invoke(std::move(std::get<_Indices>(__f_))...);
1841 }(__index_sequence_for<_Fp, _Args...>{});
18541842 }
18551843};
18561844
......@@ -1861,6 +1849,10 @@ inline _LIBCPP_HIDE_FROM_ABI bool __does_policy_contain(launch __policy, launch
18611849template <class _Fp, class... _Args>
18621850[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI future<__invoke_result_t<__decay_t<_Fp>, __decay_t<_Args>...> >
18631851async(launch __policy, _Fp&& __f, _Args&&... __args) {
1852 static_assert(is_constructible<__decay_t<_Fp>, _Fp>::value, "");
1853 static_assert(_And<is_constructible<__decay_t<_Args>, _Args>...>::value, "");
1854 static_assert(__is_invocable_v<__decay_t<_Fp>, __decay_t<_Args>...>, "");
1855
18641856 typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF;
18651857 typedef typename _BF::_Rp _Rp;
18661858
......@@ -1868,8 +1860,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) {
18681860 try {
18691861# endif
18701862 if (__does_policy_contain(__policy, launch::async))
1871 return std::__make_async_assoc_state<_Rp>(
1872 _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
1863 return std::__make_async_assoc_state<_Rp>(_BF(std::forward<_Fp>(__f), std::forward<_Args>(__args)...));
18731864# if _LIBCPP_HAS_EXCEPTIONS
18741865 } catch (...) {
18751866 if (__policy == launch::async)
......@@ -1878,8 +1869,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) {
18781869# endif
18791870
18801871 if (__does_policy_contain(__policy, launch::deferred))
1881 return std::__make_deferred_assoc_state<_Rp>(
1882 _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
1872 return std::__make_deferred_assoc_state<_Rp>(_BF(std::forward<_Fp>(__f), std::forward<_Args>(__args)...));
18831873 return future<_Rp>{};
18841874}
18851875
......@@ -1915,12 +1905,12 @@ public:
19151905 }
19161906
19171907 // retrieving the value
1918 _LIBCPP_HIDE_FROM_ABI const _Rp& get() const { return __state_->copy(); }
1908 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Rp& get() const { return __state_->copy(); }
19191909
19201910 _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
19211911
19221912 // functions to check state
1923 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
1913 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
19241914
19251915 _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
19261916 template <class _Rep, class _Period>
......@@ -1971,12 +1961,12 @@ public:
19711961 }
19721962
19731963 // retrieving the value
1974 _LIBCPP_HIDE_FROM_ABI _Rp& get() const { return __state_->copy(); }
1964 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _Rp& get() const { return __state_->copy(); }
19751965
19761966 _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
19771967
19781968 // functions to check state
1979 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
1969 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
19801970
19811971 _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
19821972 template <class _Rep, class _Period>
......@@ -2032,7 +2022,7 @@ public:
20322022 _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
20332023
20342024 // functions to check state
2035 _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
2025 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
20362026
20372027 _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
20382028 template <class _Rep, class _Period>
lib/libcxx/include/initializer_list+9-3
......@@ -78,11 +78,17 @@ public:
7878
7979 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
8080
81 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT { return __size_; }
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT {
82 return __size_;
83 }
8284
83 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT { return __begin_; }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT {
86 return __begin_;
87 }
8488
85 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT { return __begin_ + __size_; }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT {
90 return __begin_ + __size_;
91 }
8692};
8793
8894template <class _Ep>
lib/libcxx/include/inttypes.h+16-16
......@@ -236,33 +236,33 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
236236*/
237237
238238#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
239# include <__cxx03/inttypes.h>
239# include <__cxx03/__config>
240240#else
241241# include <__config>
242#endif
242243
243# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
244# pragma GCC system_header
245# endif
244#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
245# pragma GCC system_header
246#endif
246247
247248/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed
248249 for C++11 unless __STDC_FORMAT_MACROS is defined
249250*/
250# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
251# define __STDC_FORMAT_MACROS
252# endif
251#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
252# define __STDC_FORMAT_MACROS
253#endif
253254
254# if __has_include_next(<inttypes.h>)
255# include_next <inttypes.h>
256# endif
255#if __has_include_next(<inttypes.h>)
256# include_next <inttypes.h>
257#endif
257258
258# ifdef __cplusplus
259#ifdef __cplusplus
259260
260# include <stdint.h>
261# include <stdint.h>
261262
262# undef imaxabs
263# undef imaxdiv
263# undef imaxabs
264# undef imaxdiv
264265
265# endif // __cplusplus
266#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
266#endif // __cplusplus
267267
268268#endif // _LIBCPP_INTTYPES_H
lib/libcxx/include/ios+28-28
......@@ -305,25 +305,25 @@ public:
305305 class _LIBCPP_EXPORTED_FROM_ABI Init;
306306
307307 // 27.5.2.2 fmtflags state:
308 _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
308 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
309309 _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
310310 _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
311311 _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
312312 _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
313313
314 _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
314 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
315315 _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
316 _LIBCPP_HIDE_FROM_ABI streamsize width() const;
316 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streamsize width() const;
317317 _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
318318
319319 // 27.5.2.3 locales:
320320 locale imbue(const locale& __loc);
321 locale getloc() const;
321 [[__nodiscard__]] locale getloc() const;
322322
323323 // 27.5.2.5 storage:
324 static int xalloc();
325 long& iword(int __index);
326 void*& pword(int __index);
324 [[__nodiscard__]] static int xalloc();
325 [[__nodiscard__]] long& iword(int __index);
326 [[__nodiscard__]] void*& pword(int __index);
327327
328328 // destructor
329329 virtual ~ios_base();
......@@ -338,16 +338,16 @@ public:
338338
339339 static bool sync_with_stdio(bool __sync = true);
340340
341 _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
341 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
342342 void clear(iostate __state = goodbit);
343343 _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
344344
345 _LIBCPP_HIDE_FROM_ABI bool good() const;
346 _LIBCPP_HIDE_FROM_ABI bool eof() const;
347 _LIBCPP_HIDE_FROM_ABI bool fail() const;
348 _LIBCPP_HIDE_FROM_ABI bool bad() const;
345 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool good() const;
346 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool eof() const;
347 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool fail() const;
348 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool bad() const;
349349
350 _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
350 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
351351 _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
352352
353353 void __set_badbit_and_consider_rethrow();
......@@ -425,13 +425,13 @@ template <>
425425struct is_error_code_enum<io_errc::__lx> : public true_type {};
426426# endif
427427
428_LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT;
428[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT;
429429
430inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT {
430[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT {
431431 return error_code(static_cast<int>(__e), iostream_category());
432432}
433433
434inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT {
434[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT {
435435 return error_condition(static_cast<int>(__e), iostream_category());
436436}
437437
......@@ -580,16 +580,16 @@ public:
580580 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); }
581581# endif
582582
583 _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); }
584 _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); }
583 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); }
584 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); }
585585 _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) { ios_base::clear(__state); }
586586 _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) { ios_base::setstate(__state); }
587 _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); }
588 _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); }
589 _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); }
590 _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); }
587 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); }
588 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); }
589 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); }
590 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); }
591591
592 _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); }
592 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); }
593593 _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) { ios_base::exceptions(__iostate); }
594594
595595 // 27.5.4.1 Constructor/destructor:
......@@ -597,21 +597,21 @@ public:
597597 ~basic_ios() override;
598598
599599 // 27.5.4.2 Members:
600 _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const;
600 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const;
601601 _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
602602
603 _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const;
603 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const;
604604 _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
605605
606606 basic_ios& copyfmt(const basic_ios& __rhs);
607607
608 _LIBCPP_HIDE_FROM_ABI char_type fill() const;
608 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type fill() const;
609609 _LIBCPP_HIDE_FROM_ABI char_type fill(char_type __ch);
610610
611611 _LIBCPP_HIDE_FROM_ABI locale imbue(const locale& __loc);
612612
613 _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const;
614 _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const;
613 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const;
614 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const;
615615
616616protected:
617617 _LIBCPP_HIDE_FROM_ABI basic_ios() {
lib/libcxx/include/istream+19-13
......@@ -70,6 +70,7 @@ public:
7070 basic_istream& getline(char_type* s, streamsize n, char_type delim);
7171
7272 basic_istream& ignore(streamsize n = 1, int_type delim = traits_type::eof());
73 basic_istream& ignore(streamsize n, char_type delim); // Since C++26, implemented as a DR
7374 int_type peek();
7475 basic_istream& read (char_type* s, streamsize n);
7576 streamsize readsome(char_type* s, streamsize n);
......@@ -172,6 +173,7 @@ template <class Stream, class T>
172173# include <__type_traits/conjunction.h>
173174# include <__type_traits/enable_if.h>
174175# include <__type_traits/is_base_of.h>
176# include <__type_traits/is_same.h>
175177# include <__type_traits/make_unsigned.h>
176178# include <__utility/declval.h>
177179# include <__utility/forward.h>
......@@ -207,7 +209,7 @@ public:
207209 typedef typename traits_type::off_type off_type;
208210
209211 // 27.7.1.1.1 Constructor/destructor:
210 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb)
212 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb)
211213 : __gc_(0) {
212214 this->init(__sb);
213215 }
......@@ -219,7 +221,7 @@ protected:
219221 // 27.7.1.1.2 Assign/swap:
220222 inline _LIBCPP_HIDE_FROM_ABI basic_istream& operator=(basic_istream&& __rhs);
221223
222 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_istream& __rhs) {
224 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void swap(basic_istream& __rhs) {
223225 std::swap(__gc_, __rhs.__gc_);
224226 basic_ios<char_type, traits_type>::swap(__rhs);
225227 }
......@@ -232,17 +234,17 @@ public:
232234 class sentry;
233235
234236 // 27.7.1.2 Formatted input:
235 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) {
237 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) {
236238 return __pf(*this);
237239 }
238240
239 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream&
241 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream&
240242 operator>>(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
241243 __pf(*this);
242244 return *this;
243245 }
244246
245 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) {
247 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) {
246248 __pf(*this);
247249 return *this;
248250 }
......@@ -263,35 +265,39 @@ public:
263265 basic_istream& operator>>(void*& __p);
264266
265267 // 27.7.1.3 Unformatted input:
266 _LIBCPP_HIDE_FROM_ABI streamsize gcount() const { return __gc_; }
268 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streamsize gcount() const { return __gc_; }
267269 int_type get();
268270
269 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(char_type& __c) {
271 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream& get(char_type& __c) {
270272 int_type __ch = get();
271273 if (__ch != traits_type::eof())
272274 __c = traits_type::to_char_type(__ch);
273275 return *this;
274276 }
275277
276 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(char_type* __s, streamsize __n) {
278 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream& get(char_type* __s, streamsize __n) {
277279 return get(__s, __n, this->widen('\n'));
278280 }
279281
280282 basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
281283
282 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb) {
284 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb) {
283285 return get(__sb, this->widen('\n'));
284286 }
285287
286288 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
287289
288 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& getline(char_type* __s, streamsize __n) {
290 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_istream& getline(char_type* __s, streamsize __n) {
289291 return getline(__s, __n, this->widen('\n'));
290292 }
291293
292294 basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
293295
294296 basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
297 template <class _Tp = char_type, __enable_if_t<is_same<_Tp, char>::value, int> = 0>
298 _LIBCPP_HIDE_FROM_ABI basic_istream& ignore(streamsize __n, char_type __delim) {
299 return ignore(__n, traits_type::to_int_type(__delim));
300 }
295301 int_type peek();
296302 basic_istream& read(char_type* __s, streamsize __n);
297303 streamsize readsome(char_type* __s, streamsize __n);
......@@ -300,7 +306,7 @@ public:
300306 basic_istream& unget();
301307 int sync();
302308
303 pos_type tellg();
309 [[__nodiscard__]] pos_type tellg();
304310 basic_istream& seekg(pos_type __pos);
305311 basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
306312};
......@@ -1178,7 +1184,7 @@ public:
11781184 typedef typename traits_type::off_type off_type;
11791185
11801186 // constructor/destructor
1181 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
1187 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
11821188 : basic_istream<_CharT, _Traits>(__sb) {}
11831189
11841190 ~basic_iostream() override;
......@@ -1189,7 +1195,7 @@ protected:
11891195 // assign/swap
11901196 inline _LIBCPP_HIDE_FROM_ABI basic_iostream& operator=(basic_iostream&& __rhs);
11911197
1192 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_iostream& __rhs) {
1198 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void swap(basic_iostream& __rhs) {
11931199 basic_istream<char_type, traits_type>::swap(__rhs);
11941200 }
11951201};
lib/libcxx/include/iterator+10
......@@ -737,6 +737,16 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
737737# include <compare>
738738# include <concepts>
739739
740// [range.access.general]
741# if _LIBCPP_STD_VER >= 20
742# include <__ranges/access.h>
743# include <__ranges/data.h>
744# include <__ranges/empty.h>
745# include <__ranges/rbegin.h>
746# include <__ranges/rend.h>
747# include <__ranges/size.h>
748# endif
749
740750# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
741751# pragma GCC system_header
742752# endif
lib/libcxx/include/latch+7-5
......@@ -70,7 +70,9 @@ class latch {
7070 atomic<ptrdiff_t> __a_;
7171
7272public:
73 static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
73 [[nodiscard]] static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
74 return numeric_limits<ptrdiff_t>::max();
75 }
7476
7577 inline _LIBCPP_HIDE_FROM_ABI constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) {
7678 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
......@@ -87,7 +89,7 @@ public:
8789 latch(const latch&) = delete;
8890 latch& operator=(const latch&) = delete;
8991
90 inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) {
92 inline _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) {
9193 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::count_down called with a negative value");
9294 auto const __old = __a_.fetch_sub(__update, memory_order_release);
9395 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
......@@ -97,16 +99,16 @@ public:
9799 if (__old == __update)
98100 __a_.notify_all();
99101 }
100 inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept {
102 [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept {
101103 auto __value = __a_.load(memory_order_acquire);
102104 return try_wait_impl(__value);
103105 }
104 inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait() const {
106 inline _LIBCPP_HIDE_FROM_ABI void wait() const {
105107 std::__atomic_wait_unless(__a_, memory_order_acquire, [this](ptrdiff_t& __value) -> bool {
106108 return try_wait_impl(__value);
107109 });
108110 }
109 inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) {
111 inline _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) {
110112 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::arrive_and_wait called with a negative value");
111113 // other preconditions on __update are checked in count_down()
112114
lib/libcxx/include/limits+4-4
......@@ -107,7 +107,7 @@ template<> class numeric_limits<cv long double>;
107107#else
108108# include <__config>
109109# include <__type_traits/is_arithmetic.h>
110# include <__type_traits/is_signed.h>
110# include <__type_traits/is_same.h>
111111
112112# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
113113# pragma GCC system_header
......@@ -217,10 +217,10 @@ protected:
217217
218218 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
219219 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
220 static _LIBCPP_CONSTEXPR const bool is_modulo = !std::is_signed<_Tp>::value;
220 static _LIBCPP_CONSTEXPR const bool is_modulo = !is_signed;
221221
222# if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__)
223 static _LIBCPP_CONSTEXPR const bool traps = true;
222# if defined(__i386__) || defined(__x86_64__) || defined(__wasm__)
223 static _LIBCPP_CONSTEXPR const bool traps = is_same<decltype(+_Tp(0)), _Tp>::value;
224224# else
225225 static _LIBCPP_CONSTEXPR const bool traps = false;
226226# endif
lib/libcxx/include/list+61-79
......@@ -228,15 +228,14 @@ template <class T, class Allocator, class Predicate>
228228# include <__ranges/concepts.h>
229229# include <__ranges/container_compatible_range.h>
230230# include <__ranges/from_range.h>
231# include <__type_traits/conditional.h>
232231# include <__type_traits/container_traits.h>
233232# include <__type_traits/enable_if.h>
234233# include <__type_traits/is_allocator.h>
235234# include <__type_traits/is_nothrow_assignable.h>
236235# include <__type_traits/is_nothrow_constructible.h>
237# include <__type_traits/is_pointer.h>
238236# include <__type_traits/is_same.h>
239237# include <__type_traits/type_identity.h>
238# include <__utility/exception_guard.h>
240239# include <__utility/forward.h>
241240# include <__utility/move.h>
242241# include <__utility/swap.h>
......@@ -275,17 +274,6 @@ template <class _Tp, class _VoidPtr>
275274struct __list_node_pointer_traits {
276275 typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> > __node_pointer;
277276 typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> > __base_pointer;
278
279// TODO(LLVM 22): Remove this check
280# ifndef _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
281 static_assert(sizeof(__node_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__base_pointer) ==
282 _LIBCPP_ALIGNOF(__node_pointer),
283 "It looks like you are using std::list with a fancy pointer type that thas a different representation "
284 "depending on whether it points to a list base pointer or a list node pointer (both of which are "
285 "implementation details of the standard library). This means that your ABI is being broken between "
286 "LLVM 19 and LLVM 20. If you don't care about your ABI being broken, define the "
287 "_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB macro to silence this diagnostic.");
288# endif
289277};
290278
291279template <class _Tp, class _VoidPtr>
......@@ -724,7 +712,7 @@ public:
724712 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a);
725713# endif
726714 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x);
727 template <__enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
715 template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
728716 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
729717 list(size_type __n, const value_type& __x, const allocator_type& __a)
730718 : __base(__a) {
......@@ -786,57 +774,71 @@ public:
786774
787775 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __x);
788776
789 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
777 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
790778
791 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return this->__size_; }
779 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
780 return this->__size_;
781 }
792782 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
793783 return __base::empty();
794784 }
795 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
785 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
796786 return std::min<size_type>(this->__node_alloc_max_size(), numeric_limits<difference_type >::max());
797787 }
798788
799 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __base::begin(); }
800 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __base::begin(); }
801 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __base::end(); }
802 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __base::end(); }
803 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
789 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
790 return __base::begin();
791 }
792 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
793 return __base::begin();
794 }
795 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
796 return __base::end();
797 }
798 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
799 return __base::end();
800 }
801 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
804802 return __base::begin();
805803 }
806 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __base::end(); }
804 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
805 return __base::end();
806 }
807807
808 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
808 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
809809 return reverse_iterator(end());
810810 }
811 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
811 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
812 rbegin() const _NOEXCEPT {
812813 return const_reverse_iterator(end());
813814 }
814 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
815 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
815816 return reverse_iterator(begin());
816817 }
817 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
818 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
818819 return const_reverse_iterator(begin());
819820 }
820 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
821 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
822 crbegin() const _NOEXCEPT {
821823 return const_reverse_iterator(end());
822824 }
823 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
825 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
824826 return const_reverse_iterator(begin());
825827 }
826828
827 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference front() {
829 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference front() {
828830 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
829831 return __base::__end_.__next_->__as_node()->__get_value();
830832 }
831 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference front() const {
833 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference front() const {
832834 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
833835 return __base::__end_.__next_->__as_node()->__get_value();
834836 }
835 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference back() {
837 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference back() {
836838 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
837839 return __base::__end_.__prev_->__as_node()->__get_value();
838840 }
839 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference back() const {
841 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference back() const {
840842 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
841843 return __base::__end_.__prev_->__as_node()->__get_value();
842844 }
......@@ -1000,22 +1002,22 @@ private:
10001002
10011003# if _LIBCPP_STD_VER >= 17
10021004template <class _InputIterator,
1003 class _Alloc = allocator<__iter_value_type<_InputIterator>>,
1005 class _Alloc = allocator<__iterator_value_type<_InputIterator>>,
10041006 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1005 class = enable_if_t<__is_allocator<_Alloc>::value> >
1006list(_InputIterator, _InputIterator) -> list<__iter_value_type<_InputIterator>, _Alloc>;
1007 class = enable_if_t<__is_allocator_v<_Alloc>>>
1008list(_InputIterator, _InputIterator) -> list<__iterator_value_type<_InputIterator>, _Alloc>;
10071009
10081010template <class _InputIterator,
10091011 class _Alloc,
10101012 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1011 class = enable_if_t<__is_allocator<_Alloc>::value> >
1012list(_InputIterator, _InputIterator, _Alloc) -> list<__iter_value_type<_InputIterator>, _Alloc>;
1013 class = enable_if_t<__is_allocator_v<_Alloc>>>
1014list(_InputIterator, _InputIterator, _Alloc) -> list<__iterator_value_type<_InputIterator>, _Alloc>;
10131015# endif
10141016
10151017# if _LIBCPP_STD_VER >= 23
10161018template <ranges::input_range _Range,
10171019 class _Alloc = allocator<ranges::range_value_t<_Range>>,
1018 class = enable_if_t<__is_allocator<_Alloc>::value> >
1020 class = enable_if_t<__is_allocator_v<_Alloc>>>
10191021list(from_range_t, _Range&&, _Alloc = _Alloc()) -> list<ranges::range_value_t<_Range>, _Alloc>;
10201022# endif
10211023
......@@ -1233,14 +1235,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
12331235 ++__ds;
12341236 __r = iterator(__node->__as_link());
12351237 iterator __e = __r;
1236# if _LIBCPP_HAS_EXCEPTIONS
1237 try {
1238# endif // _LIBCPP_HAS_EXCEPTIONS
1239 for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
1240 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
1241 }
1242# if _LIBCPP_HAS_EXCEPTIONS
1243 } catch (...) {
1238 auto __guard = std::__make_exception_guard([&] {
12441239 while (true) {
12451240 __base_pointer __prev = __e.__ptr_->__prev_;
12461241 __node_pointer __current = __e.__ptr_->__as_node();
......@@ -1249,9 +1244,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
12491244 break;
12501245 __e = iterator(__prev);
12511246 }
1252 throw;
1247 });
1248 for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
1249 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
12531250 }
1254# endif // _LIBCPP_HAS_EXCEPTIONS
1251 __guard.__complete();
12551252 __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
12561253 this->__size_ += __ds;
12571254 }
......@@ -1276,14 +1273,7 @@ list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Se
12761273 ++__ds;
12771274 __r = iterator(__node->__as_link());
12781275 iterator __e = __r;
1279# if _LIBCPP_HAS_EXCEPTIONS
1280 try {
1281# endif // _LIBCPP_HAS_EXCEPTIONS
1282 for (++__f; __f != __l; ++__f, (void)++__e, ++__ds) {
1283 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, *__f)->__as_link();
1284 }
1285# if _LIBCPP_HAS_EXCEPTIONS
1286 } catch (...) {
1276 auto __guard = std::__make_exception_guard([&] {
12871277 while (true) {
12881278 __base_pointer __prev = __e.__ptr_->__prev_;
12891279 __node_pointer __current = __e.__ptr_->__as_node();
......@@ -1292,9 +1282,11 @@ list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Se
12921282 break;
12931283 __e = iterator(__prev);
12941284 }
1295 throw;
1285 });
1286 for (++__f; __f != __l; ++__f, (void)++__e, ++__ds) {
1287 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, *__f)->__as_link();
12961288 }
1297# endif // _LIBCPP_HAS_EXCEPTIONS
1289 __guard.__complete();
12981290 __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
12991291 this->__size_ += __ds;
13001292 }
......@@ -1452,14 +1444,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void list<_Tp, _Alloc>::resize(size_type __n) {
14521444 ++__ds;
14531445 iterator __r = iterator(__node->__as_link());
14541446 iterator __e = __r;
1455# if _LIBCPP_HAS_EXCEPTIONS
1456 try {
1457# endif // _LIBCPP_HAS_EXCEPTIONS
1458 for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
1459 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr)->__as_link();
1460 }
1461# if _LIBCPP_HAS_EXCEPTIONS
1462 } catch (...) {
1447 auto __guard = std::__make_exception_guard([&] {
14631448 while (true) {
14641449 __base_pointer __prev = __e.__ptr_->__prev_;
14651450 __node_pointer __current = __e.__ptr_->__as_node();
......@@ -1468,9 +1453,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void list<_Tp, _Alloc>::resize(size_type __n) {
14681453 break;
14691454 __e = iterator(__prev);
14701455 }
1471 throw;
1456 });
1457 for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
1458 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr)->__as_link();
14721459 }
1473# endif // _LIBCPP_HAS_EXCEPTIONS
1460 __guard.__complete();
14741461 __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
14751462 this->__size_ += __ds;
14761463 }
......@@ -1488,14 +1475,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void list<_Tp, _Alloc>::resize(size_type __n, cons
14881475 __base_pointer __nl = __node->__as_link();
14891476 iterator __r = iterator(__nl);
14901477 iterator __e = __r;
1491# if _LIBCPP_HAS_EXCEPTIONS
1492 try {
1493# endif // _LIBCPP_HAS_EXCEPTIONS
1494 for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
1495 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
1496 }
1497# if _LIBCPP_HAS_EXCEPTIONS
1498 } catch (...) {
1478 auto __guard = std::__make_exception_guard([&] {
14991479 while (true) {
15001480 __base_pointer __prev = __e.__ptr_->__prev_;
15011481 __node_pointer __current = __e.__ptr_->__as_node();
......@@ -1504,9 +1484,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void list<_Tp, _Alloc>::resize(size_type __n, cons
15041484 break;
15051485 __e = iterator(__prev);
15061486 }
1507 throw;
1487 });
1488 for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
1489 __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
15081490 }
1509# endif // _LIBCPP_HAS_EXCEPTIONS
1491 __guard.__complete();
15101492 __link_nodes(__base::__end_as_link(), __r.__ptr_, __e.__ptr_);
15111493 this->__size_ += __ds;
15121494 }
lib/libcxx/include/map+386-274
......@@ -577,12 +577,12 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
577577# include <__algorithm/equal.h>
578578# include <__algorithm/lexicographical_compare.h>
579579# include <__algorithm/lexicographical_compare_three_way.h>
580# include <__algorithm/specialized_algorithms.h>
580581# include <__assert>
581582# include <__config>
582583# include <__functional/binary_function.h>
583584# include <__functional/is_transparent.h>
584585# include <__functional/operations.h>
585# include <__fwd/map.h>
586586# include <__iterator/erase_if_container.h>
587587# include <__iterator/iterator_traits.h>
588588# include <__iterator/ranges_iterator_traits.h>
......@@ -590,19 +590,23 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
590590# include <__memory/addressof.h>
591591# include <__memory/allocator.h>
592592# include <__memory/allocator_traits.h>
593# include <__memory/compressed_pair.h>
593594# include <__memory/pointer_traits.h>
594595# include <__memory/unique_ptr.h>
595596# include <__memory_resource/polymorphic_allocator.h>
596597# include <__node_handle>
598# include <__ranges/access.h>
597599# include <__ranges/concepts.h>
598600# include <__ranges/container_compatible_range.h>
599601# include <__ranges/from_range.h>
600602# include <__tree>
601603# include <__type_traits/container_traits.h>
602604# include <__type_traits/is_allocator.h>
605# include <__type_traits/make_transparent.h>
603606# include <__type_traits/remove_const.h>
604607# include <__type_traits/type_identity.h>
605608# include <__utility/forward.h>
609# include <__utility/lazy_synth_three_way_comparator.h>
606610# include <__utility/pair.h>
607611# include <__utility/piecewise_construct.h>
608612# include <__utility/swap.h>
......@@ -632,47 +636,9 @@ _LIBCPP_PUSH_MACROS
632636
633637_LIBCPP_BEGIN_NAMESPACE_STD
634638
635template <class _Key,
636 class _CP,
637 class _Compare,
638 bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
639class __map_value_compare : private _Compare {
640public:
641 _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
642 : _Compare() {}
643 _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
644 : _Compare(__c) {}
645 _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return *this; }
646 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const {
647 return static_cast<const _Compare&>(*this)(__x.first, __y.first);
648 }
649 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const {
650 return static_cast<const _Compare&>(*this)(__x.first, __y);
651 }
652 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
653 return static_cast<const _Compare&>(*this)(__x, __y.first);
654 }
655 _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
656 using std::swap;
657 swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
658 }
659
660# if _LIBCPP_STD_VER >= 14
661 template <typename _K2>
662 _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
663 return static_cast<const _Compare&>(*this)(__x, __y.first);
664 }
665
666 template <typename _K2>
667 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
668 return static_cast<const _Compare&>(*this)(__x.first, __y);
669 }
670# endif
671};
672
673639template <class _Key, class _CP, class _Compare>
674class __map_value_compare<_Key, _CP, _Compare, false> {
675 _Compare __comp_;
640class __map_value_compare {
641 _LIBCPP_COMPRESSED_ELEMENT(_Compare, __comp_);
676642
677643public:
678644 _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
......@@ -684,7 +650,7 @@ public:
684650 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const { return __comp_(__x.first, __y.first); }
685651 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const { return __comp_(__x.first, __y); }
686652 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const { return __comp_(__x, __y.first); }
687 void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
653 _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
688654 using std::swap;
689655 swap(__comp_, __y.__comp_);
690656 }
......@@ -702,9 +668,58 @@ public:
702668# endif
703669};
704670
705template <class _Key, class _CP, class _Compare, bool __b>
671template <class _Key, class _MapValueT, class _Compare>
672struct __make_transparent<_Key, __map_value_compare<_Key, _MapValueT, _Compare> > {
673 using type _LIBCPP_NODEBUG = __map_value_compare<_Key, _MapValueT, __make_transparent_t<_Key, _Compare> >;
674};
675
676# if _LIBCPP_STD_VER >= 14
677template <class _MapValueT, class _Key, class _Compare>
678struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _MapValueT> {
679 __lazy_synth_three_way_comparator<_Compare, _Key, _Key> __comp_;
680
681 __lazy_synth_three_way_comparator(
682 _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
683 : __comp_(__comp.key_comp()) {}
684
685 _LIBCPP_HIDE_FROM_ABI auto
686 operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const {
687 return __comp_(__lhs.first, __rhs.first);
688 }
689};
690
691template <class _MapValueT, class _Key, class _TransparentKey, class _Compare>
692struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _TransparentKey, _MapValueT> {
693 __lazy_synth_three_way_comparator<_Compare, _TransparentKey, _Key> __comp_;
694
695 __lazy_synth_three_way_comparator(
696 _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
697 : __comp_(__comp.key_comp()) {}
698
699 _LIBCPP_HIDE_FROM_ABI auto
700 operator()(_LIBCPP_LIFETIMEBOUND const _TransparentKey& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const {
701 return __comp_(__lhs, __rhs.first);
702 }
703};
704
705template <class _MapValueT, class _Key, class _TransparentKey, class _Compare>
706struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _TransparentKey> {
707 __lazy_synth_three_way_comparator<_Compare, _Key, _TransparentKey> __comp_;
708
709 __lazy_synth_three_way_comparator(
710 _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
711 : __comp_(__comp.key_comp()) {}
712
713 _LIBCPP_HIDE_FROM_ABI auto
714 operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _TransparentKey& __rhs) const {
715 return __comp_(__lhs.first, __rhs);
716 }
717};
718# endif // _LIBCPP_STD_VER >= 14
719
720template <class _Key, class _CP, class _Compare>
706721inline _LIBCPP_HIDE_FROM_ABI void
707swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x, __map_value_compare<_Key, _CP, _Compare, __b>& __y)
722swap(__map_value_compare<_Key, _CP, _Compare>& __x, __map_value_compare<_Key, _CP, _Compare>& __y)
708723 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
709724 __x.swap(__y);
710725}
......@@ -742,9 +757,9 @@ public:
742757
743758 _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
744759 if (__second_constructed)
745 __alloc_traits::destroy(__na_, std::addressof(__p->__value_.second));
760 __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().second));
746761 if (__first_constructed)
747 __alloc_traits::destroy(__na_, std::addressof(__p->__value_.first));
762 __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().first));
748763 if (__p)
749764 __alloc_traits::deallocate(__na_, __p, 1);
750765 }
......@@ -804,7 +819,26 @@ public:
804819 friend class multimap;
805820 template <class>
806821 friend class __map_const_iterator;
822
823 template <class, class...>
824 friend struct __specialized_algorithm;
825};
826
827# ifndef _LIBCPP_CXX03_LANG
828template <class _Alg, class _TreeIterator>
829struct __specialized_algorithm<_Alg, __iterator_pair<__map_iterator<_TreeIterator>, __map_iterator<_TreeIterator>>> {
830 using __base _LIBCPP_NODEBUG = __specialized_algorithm<_Alg, __iterator_pair<_TreeIterator, _TreeIterator>>;
831
832 static const bool __has_algorithm = __base::__has_algorithm;
833
834 using __iterator _LIBCPP_NODEBUG = __map_iterator<_TreeIterator>;
835
836 template <class... _Args>
837 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Args&&... __args) {
838 __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...);
839 }
807840};
841# endif
808842
809843template <class _TreeIterator>
810844class __map_const_iterator {
......@@ -859,9 +893,33 @@ public:
859893 friend class multimap;
860894 template <class, class, class>
861895 friend class __tree_const_iterator;
896
897 template <class, class...>
898 friend struct __specialized_algorithm;
862899};
863900
864template <class _Key, class _Tp, class _Compare, class _Allocator>
901# ifndef _LIBCPP_CXX03_LANG
902template <class _Alg, class _TreeIterator>
903struct __specialized_algorithm<
904 _Alg,
905 __iterator_pair<__map_const_iterator<_TreeIterator>, __map_const_iterator<_TreeIterator>>> {
906 using __base _LIBCPP_NODEBUG = __specialized_algorithm<_Alg, __iterator_pair<_TreeIterator, _TreeIterator>>;
907
908 static const bool __has_algorithm = __base::__has_algorithm;
909
910 using __iterator _LIBCPP_NODEBUG = __map_const_iterator<_TreeIterator>;
911
912 template <class... _Args>
913 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Args&&... __args) {
914 __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...);
915 }
916};
917# endif
918
919template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
920class multimap;
921
922template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
865923class map {
866924public:
867925 // types:
......@@ -970,17 +1028,17 @@ public:
9701028 : map(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
9711029# endif
9721030
973 _LIBCPP_HIDE_FROM_ABI map(const map& __m) : __tree_(__m.__tree_) { insert(__m.begin(), __m.end()); }
1031 _LIBCPP_HIDE_FROM_ABI map(const map& __m) = default;
9741032
9751033 _LIBCPP_HIDE_FROM_ABI map& operator=(const map& __m) = default;
9761034
9771035# ifndef _LIBCPP_CXX03_LANG
9781036
979 _LIBCPP_HIDE_FROM_ABI map(map&& __m) noexcept(is_nothrow_move_constructible<__base>::value) = default;
1037 _LIBCPP_HIDE_FROM_ABI map(map&& __m) = default;
9801038
981 _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
1039 _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {}
9821040
983 _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) noexcept(is_nothrow_move_assignable<__base>::value) = default;
1041 _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) = default;
9841042
9851043 _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
9861044 : __tree_(__vc(__comp)) {
......@@ -998,7 +1056,8 @@ public:
9981056# endif
9991057
10001058 _LIBCPP_HIDE_FROM_ABI map& operator=(initializer_list<value_type> __il) {
1001 __tree_.__assign_unique(__il.begin(), __il.end());
1059 clear();
1060 insert(__il.begin(), __il.end());
10021061 return *this;
10031062 }
10041063
......@@ -1006,43 +1065,66 @@ public:
10061065
10071066 _LIBCPP_HIDE_FROM_ABI explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
10081067
1009 _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __a)
1010 : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
1011 insert(__m.begin(), __m.end());
1012 }
1068 _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __alloc) : __tree_(__m.__tree_, __alloc) {}
10131069
10141070 _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
10151071
1016 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
1017 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
1018 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
1019 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
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(); }
10201076
1021 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
1022 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
1023 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
1024 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
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 {
1079 return const_reverse_iterator(end());
1080 }
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 {
1083 return const_reverse_iterator(begin());
1084 }
10251085
1026 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
1027 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
1028 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
1029 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
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(); }
10301090
10311091 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
1032 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
1033 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
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(); }
10341094
10351095 _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
10361096# ifndef _LIBCPP_CXX03_LANG
10371097 _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
10381098# endif
10391099
1040 _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
1041 _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
1100 template <class _Arg,
1101 __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);
1104 if (__child == nullptr)
1105 std::__throw_out_of_range("map::at: key not found");
1106 return static_cast<__node_pointer>(__child)->__get_value().second;
1107 }
1108
1109 template <class _Arg,
1110 __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);
1113 if (__child == nullptr)
1114 std::__throw_out_of_range("map::at: key not found");
1115 return static_cast<__node_pointer>(__child)->__get_value().second;
1116 }
10421117
1043 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
1044 _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
1045 _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
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;
1120
1121 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1122 return allocator_type(__tree_.__alloc());
1123 }
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 {
1126 return value_compare(__tree_.value_comp().key_comp());
1127 }
10461128
10471129# ifndef _LIBCPP_CXX03_LANG
10481130 template <class... _Args>
......@@ -1052,7 +1134,7 @@ public:
10521134
10531135 template <class... _Args>
10541136 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
1055 return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...);
1137 return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...).first;
10561138 }
10571139
10581140 template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
......@@ -1062,7 +1144,7 @@ public:
10621144
10631145 template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
10641146 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
1065 return __tree_.__emplace_hint_unique(__pos.__i_, std::forward<_Pp>(__p));
1147 return __tree_.__emplace_hint_unique(__pos.__i_, std::forward<_Pp>(__p)).first;
10661148 }
10671149
10681150# endif // _LIBCPP_CXX03_LANG
......@@ -1070,7 +1152,7 @@ public:
10701152 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
10711153
10721154 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
1073 return __tree_.__emplace_hint_unique(__p.__i_, __v);
1155 return __tree_.__emplace_hint_unique(__p.__i_, __v).first;
10741156 }
10751157
10761158# ifndef _LIBCPP_CXX03_LANG
......@@ -1079,25 +1161,21 @@ public:
10791161 }
10801162
10811163 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
1082 return __tree_.__emplace_hint_unique(__p.__i_, std::move(__v));
1164 return __tree_.__emplace_hint_unique(__p.__i_, std::move(__v)).first;
10831165 }
10841166
10851167 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
10861168# endif
10871169
10881170 template <class _InputIterator>
1089 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
1090 for (const_iterator __e = cend(); __f != __l; ++__f)
1091 insert(__e.__i_, *__f);
1171 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
1172 __tree_.__insert_range_unique(__first, __last);
10921173 }
10931174
10941175# if _LIBCPP_STD_VER >= 23
10951176 template <_ContainerCompatibleRange<value_type> _Range>
10961177 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
1097 const_iterator __end = cend();
1098 for (auto&& __element : __range) {
1099 insert(__end.__i_, std::forward<decltype(__element)>(__element));
1100 }
1178 __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
11011179 }
11021180# endif
11031181
......@@ -1105,17 +1183,13 @@ public:
11051183
11061184 template <class... _Args>
11071185 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
1108 return __tree_.__emplace_unique_key_args(
1109 __k,
1110 std::piecewise_construct,
1111 std::forward_as_tuple(__k),
1112 std::forward_as_tuple(std::forward<_Args>(__args)...));
1186 return __tree_.__emplace_unique(
1187 std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
11131188 }
11141189
11151190 template <class... _Args>
11161191 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
1117 return __tree_.__emplace_unique_key_args(
1118 __k,
1192 return __tree_.__emplace_unique(
11191193 std::piecewise_construct,
11201194 std::forward_as_tuple(std::move(__k)),
11211195 std::forward_as_tuple(std::forward<_Args>(__args)...));
......@@ -1124,9 +1198,8 @@ public:
11241198 template <class... _Args>
11251199 _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
11261200 return __tree_
1127 .__emplace_hint_unique_key_args(
1201 .__emplace_hint_unique(
11281202 __h.__i_,
1129 __k,
11301203 std::piecewise_construct,
11311204 std::forward_as_tuple(__k),
11321205 std::forward_as_tuple(std::forward<_Args>(__args)...))
......@@ -1136,9 +1209,8 @@ public:
11361209 template <class... _Args>
11371210 _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
11381211 return __tree_
1139 .__emplace_hint_unique_key_args(
1212 .__emplace_hint_unique(
11401213 __h.__i_,
1141 __k,
11421214 std::piecewise_construct,
11431215 std::forward_as_tuple(std::move(__k)),
11441216 std::forward_as_tuple(std::forward<_Args>(__args)...))
......@@ -1147,27 +1219,25 @@ public:
11471219
11481220 template <class _Vp>
11491221 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
1150 iterator __p = lower_bound(__k);
1151 if (__p != end() && !key_comp()(__k, __p->first)) {
1152 __p->second = std::forward<_Vp>(__v);
1153 return std::make_pair(__p, false);
1154 }
1155 return std::make_pair(emplace_hint(__p, __k, std::forward<_Vp>(__v)), true);
1222 auto __result = __tree_.__emplace_unique(__k, std::forward<_Vp>(__v));
1223 auto& [__iter, __inserted] = __result;
1224 if (!__inserted)
1225 __iter->second = std::forward<_Vp>(__v);
1226 return __result;
11561227 }
11571228
11581229 template <class _Vp>
11591230 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
1160 iterator __p = lower_bound(__k);
1161 if (__p != end() && !key_comp()(__k, __p->first)) {
1162 __p->second = std::forward<_Vp>(__v);
1163 return std::make_pair(__p, false);
1164 }
1165 return std::make_pair(emplace_hint(__p, std::move(__k), std::forward<_Vp>(__v)), true);
1231 auto __result = __tree_.__emplace_unique(std::move(__k), std::forward<_Vp>(__v));
1232 auto& [__iter, __inserted] = __result;
1233 if (!__inserted)
1234 __iter->second = std::forward<_Vp>(__v);
1235 return __result;
11661236 }
11671237
11681238 template <class _Vp>
11691239 _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
1170 auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, __k, std::forward<_Vp>(__v));
1240 auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, __k, std::forward<_Vp>(__v));
11711241
11721242 if (!__inserted)
11731243 __r->second = std::forward<_Vp>(__v);
......@@ -1177,8 +1247,7 @@ public:
11771247
11781248 template <class _Vp>
11791249 _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
1180 auto [__r, __inserted] =
1181 __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, std::move(__k), std::forward<_Vp>(__v));
1250 auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, std::move(__k), std::forward<_Vp>(__v));
11821251
11831252 if (!__inserted)
11841253 __r->second = std::forward<_Vp>(__v);
......@@ -1207,10 +1276,10 @@ public:
12071276 "node_type with incompatible allocator passed to map::insert()");
12081277 return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
12091278 }
1210 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1279 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
12111280 return __tree_.template __node_handle_extract<node_type>(__key);
12121281 }
1213 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1282 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
12141283 return __tree_.template __node_handle_extract<node_type>(__it.__i_);
12151284 }
12161285 template <class _Compare2>
......@@ -1241,75 +1310,105 @@ public:
12411310
12421311 _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__m.__tree_); }
12431312
1244 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
1245 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
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); }
12461315# if _LIBCPP_STD_VER >= 14
1247 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1248 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1316 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) {
12491320 return __tree_.find(__k);
12501321 }
1251 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1252 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1322 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 {
12531326 return __tree_.find(__k);
12541327 }
12551328# endif
12561329
1257 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
1330 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1331 return __tree_.__count_unique(__k);
1332 }
12581333# if _LIBCPP_STD_VER >= 14
12591334 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1260 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1335 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
12611336 return __tree_.__count_multi(__k);
12621337 }
12631338# endif
12641339
12651340# if _LIBCPP_STD_VER >= 20
1266 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1267 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1268 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1341 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1342 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 {
12691346 return find(__k) != end();
12701347 }
12711348# endif // _LIBCPP_STD_VER >= 20
12721349
1273 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
1274 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
1350 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
1351 return __tree_.__lower_bound_unique(__k);
1352 }
1353
1354 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
1355 return __tree_.__lower_bound_unique(__k);
1356 }
1357
1358 // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to
1359 // match multiple elements.
12751360# if _LIBCPP_STD_VER >= 14
1276 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1277 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1278 return __tree_.lower_bound(__k);
1361 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) {
1365 return __tree_.__lower_bound_multi(__k);
12791366 }
12801367
1281 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1282 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1283 return __tree_.lower_bound(__k);
1368 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 {
1372 return __tree_.__lower_bound_multi(__k);
12841373 }
12851374# endif
12861375
1287 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
1288 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
1289# if _LIBCPP_STD_VER >= 14
1290 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1291 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1292 return __tree_.upper_bound(__k);
1376 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
1377 return __tree_.__upper_bound_unique(__k);
12931378 }
1294 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1295 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1296 return __tree_.upper_bound(__k);
1379
1380 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
1381 return __tree_.__upper_bound_unique(__k);
1382 }
1383
1384# if _LIBCPP_STD_VER >= 14
1385 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) {
1389 return __tree_.__upper_bound_multi(__k);
1390 }
1391 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 {
1395 return __tree_.__upper_bound_multi(__k);
12971396 }
12981397# endif
12991398
1300 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1399 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
13011400 return __tree_.__equal_range_unique(__k);
13021401 }
1303 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1402 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
13041403 return __tree_.__equal_range_unique(__k);
13051404 }
13061405# if _LIBCPP_STD_VER >= 14
13071406 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1308 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1407 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
13091408 return __tree_.__equal_range_multi(__k);
13101409 }
13111410 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1312 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1411 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
13131412 return __tree_.__equal_range_multi(__k);
13141413 }
13151414# endif
......@@ -1319,7 +1418,6 @@ private:
13191418 typedef typename __base::__node_allocator __node_allocator;
13201419 typedef typename __base::__node_pointer __node_pointer;
13211420 typedef typename __base::__node_base_pointer __node_base_pointer;
1322 typedef typename __base::__parent_pointer __parent_pointer;
13231421
13241422 typedef __map_node_destructor<__node_allocator> _Dp;
13251423 typedef unique_ptr<__node, _Dp> __node_holder;
......@@ -1327,6 +1425,8 @@ private:
13271425# ifdef _LIBCPP_CXX03_LANG
13281426 _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
13291427# endif
1428
1429 friend struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map> >;
13301430};
13311431
13321432# if _LIBCPP_STD_VER >= 17
......@@ -1334,8 +1434,8 @@ template <class _InputIterator,
13341434 class _Compare = less<__iter_key_type<_InputIterator>>,
13351435 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
13361436 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
1337 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1338 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1437 class = enable_if_t<!__is_allocator_v<_Compare>>,
1438 class = enable_if_t<__is_allocator_v<_Allocator>>>
13391439map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
13401440 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
13411441
......@@ -1343,8 +1443,8 @@ map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocat
13431443template <ranges::input_range _Range,
13441444 class _Compare = less<__range_key_type<_Range>>,
13451445 class _Allocator = allocator<__range_to_alloc_type<_Range>>,
1346 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1347 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1446 class = enable_if_t<!__is_allocator_v<_Compare>>,
1447 class = enable_if_t<__is_allocator_v<_Allocator>>>
13481448map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
13491449 -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
13501450# endif
......@@ -1353,16 +1453,15 @@ template <class _Key,
13531453 class _Tp,
13541454 class _Compare = less<remove_const_t<_Key>>,
13551455 class _Allocator = allocator<pair<const _Key, _Tp>>,
1356 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1357 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1358map(initializer_list<pair<_Key, _Tp>>,
1359 _Compare = _Compare(),
1360 _Allocator = _Allocator()) -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
1456 class = enable_if_t<!__is_allocator_v<_Compare>>,
1457 class = enable_if_t<__is_allocator_v<_Allocator>>>
1458map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
1459 -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
13611460
13621461template <class _InputIterator,
13631462 class _Allocator,
13641463 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
1365 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1464 class = enable_if_t<__is_allocator_v<_Allocator>>>
13661465map(_InputIterator, _InputIterator, _Allocator)
13671466 -> map<__iter_key_type<_InputIterator>,
13681467 __iter_mapped_type<_InputIterator>,
......@@ -1370,44 +1469,44 @@ map(_InputIterator, _InputIterator, _Allocator)
13701469 _Allocator>;
13711470
13721471# if _LIBCPP_STD_VER >= 23
1373template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1472template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
13741473map(from_range_t, _Range&&, _Allocator)
13751474 -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
13761475# endif
13771476
1378template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1379map(initializer_list<pair<_Key, _Tp>>,
1380 _Allocator) -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
1477template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
1478map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1479 -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
13811480# endif
13821481
1383# ifndef _LIBCPP_CXX03_LANG
1482# if _LIBCPP_STD_VER >= 14
13841483template <class _Key, class _Tp, class _Compare, class _Allocator>
1385map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
1386 : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
1387 if (__a != __m.get_allocator()) {
1388 const_iterator __e = cend();
1389 while (!__m.empty()) {
1390 __tree_.__insert_unique_from_orphaned_node(__e.__i_, std::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
1391 }
1484struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key, _Tp, _Compare, _Allocator>>> {
1485 using __map _LIBCPP_NODEBUG = map<_Key, _Tp, _Compare, _Allocator>;
1486
1487 static const bool __has_algorithm = true;
1488
1489 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>>()(
1492 __map.__tree_, std::move(__func), std::move(__proj));
1493 return std::make_pair(__map.end(), std::move(__func2));
13921494 }
1393}
1495};
1496# endif
13941497
1498# ifndef _LIBCPP_CXX03_LANG
13951499template <class _Key, class _Tp, class _Compare, class _Allocator>
13961500_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
1397 return __tree_
1398 .__emplace_unique_key_args(__k, std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
1501 return __tree_.__emplace_unique(std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
13991502 .first->second;
14001503}
14011504
14021505template <class _Key, class _Tp, class _Compare, class _Allocator>
14031506_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
1404 // TODO investigate this clang-tidy warning.
1405 // NOLINTBEGIN(bugprone-use-after-move)
14061507 return __tree_
1407 .__emplace_unique_key_args(
1408 __k, std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
1508 .__emplace_unique(std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
14091509 .first->second;
1410 // NOLINTEND(bugprone-use-after-move)
14111510}
14121511
14131512# else // _LIBCPP_CXX03_LANG
......@@ -1417,44 +1516,41 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
14171516map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k) {
14181517 __node_allocator& __na = __tree_.__node_alloc();
14191518 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1420 __node_traits::construct(__na, std::addressof(__h->__value_.first), __k);
1519 __node_traits::construct(__na, std::addressof(__h->__get_value().first), __k);
14211520 __h.get_deleter().__first_constructed = true;
1422 __node_traits::construct(__na, std::addressof(__h->__value_.second));
1521 __node_traits::construct(__na, std::addressof(__h->__get_value().second));
14231522 __h.get_deleter().__second_constructed = true;
14241523 return __h;
14251524}
14261525
14271526template <class _Key, class _Tp, class _Compare, class _Allocator>
14281527_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
1429 __parent_pointer __parent;
1430 __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
1431 __node_pointer __r = static_cast<__node_pointer>(__child);
1528 auto [__parent, __child] = __tree_.__find_equal(__k);
1529 __node_pointer __r = static_cast<__node_pointer>(__child);
14321530 if (__child == nullptr) {
14331531 __node_holder __h = __construct_node_with_key(__k);
14341532 __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
14351533 __r = __h.release();
14361534 }
1437 return __r->__value_.second;
1535 return __r->__get_value().second;
14381536}
14391537
14401538# endif // _LIBCPP_CXX03_LANG
14411539
14421540template <class _Key, class _Tp, class _Compare, class _Allocator>
14431541_Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
1444 __parent_pointer __parent;
1445 __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
1542 auto [_, __child] = __tree_.__find_equal(__k);
14461543 if (__child == nullptr)
14471544 std::__throw_out_of_range("map::at: key not found");
1448 return static_cast<__node_pointer>(__child)->__value_.second;
1545 return static_cast<__node_pointer>(__child)->__get_value().second;
14491546}
14501547
14511548template <class _Key, class _Tp, class _Compare, class _Allocator>
14521549const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
1453 __parent_pointer __parent;
1454 __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
1550 auto [_, __child] = __tree_.__find_equal(__k);
14551551 if (__child == nullptr)
14561552 std::__throw_out_of_range("map::at: key not found");
1457 return static_cast<__node_pointer>(__child)->__value_.second;
1553 return static_cast<__node_pointer>(__child)->__get_value().second;
14581554}
14591555
14601556template <class _Key, class _Tp, class _Compare, class _Allocator>
......@@ -1637,22 +1733,17 @@ public:
16371733 : multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
16381734# endif
16391735
1640 _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m)
1641 : __tree_(__m.__tree_.value_comp(),
1642 __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc())) {
1643 insert(__m.begin(), __m.end());
1644 }
1736 _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m) = default;
16451737
16461738 _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) = default;
16471739
16481740# ifndef _LIBCPP_CXX03_LANG
16491741
1650 _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) noexcept(is_nothrow_move_constructible<__base>::value) = default;
1742 _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) = default;
16511743
1652 _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
1744 _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {}
16531745
1654 _LIBCPP_HIDE_FROM_ABI multimap&
1655 operator=(multimap&& __m) noexcept(is_nothrow_move_assignable<__base>::value) = default;
1746 _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) = default;
16561747
16571748 _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
16581749 : __tree_(__vc(__comp)) {
......@@ -1671,7 +1762,8 @@ public:
16711762# endif
16721763
16731764 _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) {
1674 __tree_.__assign_multi(__il.begin(), __il.end());
1765 clear();
1766 insert(__il.begin(), __il.end());
16751767 return *this;
16761768 }
16771769
......@@ -1679,37 +1771,42 @@ public:
16791771
16801772 _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
16811773
1682 _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a)
1683 : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
1684 insert(__m.begin(), __m.end());
1685 }
1774 _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a) : __tree_(__m.__tree_, __a) {}
16861775
16871776 _LIBCPP_HIDE_FROM_ABI ~multimap() {
16881777 static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
16891778 }
16901779
1691 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
1692 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
1693 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
1694 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
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(); }
16951784
1696 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
1697 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
1698 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
1699 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
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 {
1787 return const_reverse_iterator(end());
1788 }
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 {
1791 return const_reverse_iterator(begin());
1792 }
17001793
1701 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
1702 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
1703 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
1704 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
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(); }
17051798
17061799 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
1707 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
1708 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
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(); }
17091802
1710 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
1711 _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
1712 _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
1803 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1804 return allocator_type(__tree_.__alloc());
1805 }
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 {
1808 return value_compare(__tree_.value_comp().key_comp());
1809 }
17131810
17141811# ifndef _LIBCPP_CXX03_LANG
17151812
......@@ -1751,17 +1848,13 @@ public:
17511848
17521849 template <class _InputIterator>
17531850 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
1754 for (const_iterator __e = cend(); __f != __l; ++__f)
1755 __tree_.__emplace_hint_multi(__e.__i_, *__f);
1851 __tree_.__insert_range_multi(__f, __l);
17561852 }
17571853
17581854# if _LIBCPP_STD_VER >= 23
17591855 template <_ContainerCompatibleRange<value_type> _Range>
17601856 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
1761 const_iterator __end = cend();
1762 for (auto&& __element : __range) {
1763 __tree_.__emplace_hint_multi(__end.__i_, std::forward<decltype(__element)>(__element));
1764 }
1857 __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range));
17651858 }
17661859# endif
17671860
......@@ -1783,10 +1876,10 @@ public:
17831876 "node_type with incompatible allocator passed to multimap::insert()");
17841877 return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
17851878 }
1786 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1879 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
17871880 return __tree_.template __node_handle_extract<node_type>(__key);
17881881 }
1789 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1882 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
17901883 return __tree_.template __node_handle_extract<node_type>(__it.__i_);
17911884 }
17921885 template <class _Compare2>
......@@ -1821,75 +1914,89 @@ public:
18211914 __tree_.swap(__m.__tree_);
18221915 }
18231916
1824 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
1825 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
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); }
18261919# if _LIBCPP_STD_VER >= 14
18271920 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1828 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1921 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
18291922 return __tree_.find(__k);
18301923 }
18311924 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1832 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1925 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
18331926 return __tree_.find(__k);
18341927 }
18351928# endif
18361929
1837 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
1930 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1931 return __tree_.__count_multi(__k);
1932 }
18381933# if _LIBCPP_STD_VER >= 14
18391934 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1840 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1935 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
18411936 return __tree_.__count_multi(__k);
18421937 }
18431938# endif
18441939
18451940# if _LIBCPP_STD_VER >= 20
1846 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1941 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
18471942 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1848 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1943 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
18491944 return find(__k) != end();
18501945 }
18511946# endif // _LIBCPP_STD_VER >= 20
18521947
1853 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
1854 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
1948 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
1949 return __tree_.__lower_bound_multi(__k);
1950 }
1951
1952 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
1953 return __tree_.__lower_bound_multi(__k);
1954 }
1955
18551956# if _LIBCPP_STD_VER >= 14
18561957 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1857 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1858 return __tree_.lower_bound(__k);
1958 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1959 return __tree_.__lower_bound_multi(__k);
18591960 }
18601961
18611962 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1862 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1863 return __tree_.lower_bound(__k);
1963 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1964 return __tree_.__lower_bound_multi(__k);
18641965 }
18651966# endif
18661967
1867 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
1868 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
1968 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
1969 return __tree_.__upper_bound_multi(__k);
1970 }
1971
1972 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
1973 return __tree_.__upper_bound_multi(__k);
1974 }
1975
18691976# if _LIBCPP_STD_VER >= 14
18701977 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1871 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1872 return __tree_.upper_bound(__k);
1978 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1979 return __tree_.__upper_bound_multi(__k);
18731980 }
18741981 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1875 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1876 return __tree_.upper_bound(__k);
1982 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1983 return __tree_.__upper_bound_multi(__k);
18771984 }
18781985# endif
18791986
1880 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1987 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
18811988 return __tree_.__equal_range_multi(__k);
18821989 }
1883 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1990 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
18841991 return __tree_.__equal_range_multi(__k);
18851992 }
18861993# if _LIBCPP_STD_VER >= 14
18871994 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1888 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1995 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
18891996 return __tree_.__equal_range_multi(__k);
18901997 }
18911998 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1892 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1999 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
18932000 return __tree_.__equal_range_multi(__k);
18942001 }
18952002# endif
......@@ -1901,6 +2008,8 @@ private:
19012008
19022009 typedef __map_node_destructor<__node_allocator> _Dp;
19032010 typedef unique_ptr<__node, _Dp> __node_holder;
2011
2012 friend struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap> >;
19042013};
19052014
19062015# if _LIBCPP_STD_VER >= 17
......@@ -1908,8 +2017,8 @@ template <class _InputIterator,
19082017 class _Compare = less<__iter_key_type<_InputIterator>>,
19092018 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
19102019 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
1911 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1912 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2020 class = enable_if_t<!__is_allocator_v<_Compare>>,
2021 class = enable_if_t<__is_allocator_v<_Allocator>>>
19132022multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
19142023 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
19152024
......@@ -1917,8 +2026,8 @@ multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Al
19172026template <ranges::input_range _Range,
19182027 class _Compare = less<__range_key_type<_Range>>,
19192028 class _Allocator = allocator<__range_to_alloc_type<_Range>>,
1920 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1921 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2029 class = enable_if_t<!__is_allocator_v<_Compare>>,
2030 class = enable_if_t<__is_allocator_v<_Allocator>>>
19222031multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
19232032 -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
19242033# endif
......@@ -1927,16 +2036,15 @@ template <class _Key,
19272036 class _Tp,
19282037 class _Compare = less<remove_const_t<_Key>>,
19292038 class _Allocator = allocator<pair<const _Key, _Tp>>,
1930 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1931 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1932multimap(initializer_list<pair<_Key, _Tp>>,
1933 _Compare = _Compare(),
1934 _Allocator = _Allocator()) -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
2039 class = enable_if_t<!__is_allocator_v<_Compare>>,
2040 class = enable_if_t<__is_allocator_v<_Allocator>>>
2041multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
2042 -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
19352043
19362044template <class _InputIterator,
19372045 class _Allocator,
19382046 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
1939 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2047 class = enable_if_t<__is_allocator_v<_Allocator>>>
19402048multimap(_InputIterator, _InputIterator, _Allocator)
19412049 -> multimap<__iter_key_type<_InputIterator>,
19422050 __iter_mapped_type<_InputIterator>,
......@@ -1944,26 +2052,30 @@ multimap(_InputIterator, _InputIterator, _Allocator)
19442052 _Allocator>;
19452053
19462054# if _LIBCPP_STD_VER >= 23
1947template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2055template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
19482056multimap(from_range_t, _Range&&, _Allocator)
19492057 -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
19502058# endif
19512059
1952template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1953multimap(initializer_list<pair<_Key, _Tp>>,
1954 _Allocator) -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
2060template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
2061multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2062 -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
19552063# endif
19562064
1957# ifndef _LIBCPP_CXX03_LANG
2065# if _LIBCPP_STD_VER >= 14
19582066template <class _Key, class _Tp, class _Compare, class _Allocator>
1959multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
1960 : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
1961 if (__a != __m.get_allocator()) {
1962 const_iterator __e = cend();
1963 while (!__m.empty())
1964 __tree_.__insert_multi_from_orphaned_node(__e.__i_, std::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
2067struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_Key, _Tp, _Compare, _Allocator>>> {
2068 using __map _LIBCPP_NODEBUG = multimap<_Key, _Tp, _Compare, _Allocator>;
2069
2070 static const bool __has_algorithm = true;
2071
2072 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>>()(
2075 __map.__tree_, std::move(__func), std::move(__proj));
2076 return std::make_pair(__map.end(), std::move(__func2));
19652077 }
1966}
2078};
19672079# endif
19682080
19692081template <class _Key, class _Tp, class _Compare, class _Allocator>
lib/libcxx/include/math.h+19
......@@ -429,6 +429,25 @@ using std::__math::isnormal;
429429using std::__math::isunordered;
430430# endif // _LIBCPP_MSVCRT
431431
432# if defined(_LIBCPP_MSVCRT) && _LIBCPP_STD_VER >= 20
433// MS UCRT incorrectly defines some functions in a way not working with integer types. Until C++20, this was worked
434// around by -fdelayed-template-parsing. Since C++20, we can use standard feature "requires" instead.
435
436// TODO: Remove the workaround once UCRT fixes these functions. Note that this doesn't seem planned as of 2025-07 per
437// https://developercommunity.visualstudio.com/t/10294165.
438
439using std::__math::__ucrt::isfinite;
440using std::__math::__ucrt::isgreater;
441using std::__math::__ucrt::isgreaterequal;
442using std::__math::__ucrt::isinf;
443using std::__math::__ucrt::isless;
444using std::__math::__ucrt::islessequal;
445using std::__math::__ucrt::islessgreater;
446using std::__math::__ucrt::isnan;
447using std::__math::__ucrt::isnormal;
448using std::__math::__ucrt::isunordered;
449# endif // defined(_LIBCPP_MSVCRT) && _LIBCPP_STD_VER >= 20
450
432451// We have to provide double overloads for <math.h> to work on platforms that don't provide the full set of math
433452// functions. To make the overload set work with multiple functions that take the same arguments, we make our overloads
434453// templates. Functions are preferred over function templates during overload resolution, which means that our overload
lib/libcxx/include/mdspan+1-5
......@@ -450,11 +450,7 @@ namespace std {
450450# include <__config>
451451
452452# if _LIBCPP_STD_VER >= 23
453# include <__fwd/mdspan.h> // TODO(boomanaiden154): This is currently a
454 // non-standard extension to include
455 // std::dynamic_extent tracked by LWG issue 4275.
456 // This comment should be deleted or the include
457 // deleted upon resolution.
453# include <__fwd/mdspan.h>
458454# include <__fwd/span.h>
459455# include <__mdspan/default_accessor.h>
460456# include <__mdspan/extents.h>
lib/libcxx/include/mutex+29-19
......@@ -229,12 +229,12 @@ public:
229229 recursive_mutex& operator=(const recursive_mutex&) = delete;
230230
231231 void lock();
232 bool try_lock() _NOEXCEPT;
232 [[__nodiscard__]] bool try_lock() _NOEXCEPT;
233233 void unlock() _NOEXCEPT;
234234
235235 typedef __libcpp_recursive_mutex_t* native_handle_type;
236236
237 _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
237 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
238238};
239239
240240class _LIBCPP_EXPORTED_FROM_ABI timed_mutex {
......@@ -251,14 +251,14 @@ public:
251251
252252public:
253253 void lock();
254 bool try_lock() _NOEXCEPT;
254 [[__nodiscard__]] bool try_lock() _NOEXCEPT;
255255 template <class _Rep, class _Period>
256 _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
256 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
257257 return try_lock_until(chrono::steady_clock::now() + __d);
258258 }
259259
260260 template <class _Clock, class _Duration>
261 _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
262262 using namespace chrono;
263263 unique_lock<mutex> __lk(__m_);
264264 bool __no_timeout = _Clock::now() < __t;
......@@ -288,14 +288,14 @@ public:
288288 recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
289289
290290 void lock();
291 bool try_lock() _NOEXCEPT;
291 [[__nodiscard__]] bool try_lock() _NOEXCEPT;
292292 template <class _Rep, class _Period>
293 _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
293 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
294294 return try_lock_until(chrono::steady_clock::now() + __d);
295295 }
296296
297297 template <class _Clock, class _Duration>
298 _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
298 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
299299 using namespace chrono;
300300 __thread_id __id = this_thread::get_id();
301301 unique_lock<mutex> __lk(__m_);
......@@ -320,7 +320,7 @@ public:
320320};
321321
322322template <class _L0, class _L1>
323_LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1) {
323[[__nodiscard__]] _LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1) {
324324 unique_lock<_L0> __u0(__l0, try_to_lock_t());
325325 if (__u0.owns_lock()) {
326326 if (__l1.try_lock()) {
......@@ -335,7 +335,8 @@ _LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1) {
335335# ifndef _LIBCPP_CXX03_LANG
336336
337337template <class _L0, class _L1, class _L2, class... _L3>
338_LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
338[[__nodiscard__]] _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
339 _LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
339340 int __r = 0;
340341 unique_lock<_L0> __u0(__l0, try_to_lock);
341342 if (__u0.owns_lock()) {
......@@ -350,8 +351,11 @@ _LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3
350351
351352# endif // _LIBCPP_CXX03_LANG
352353
354// We're using unique_lock to implement the functions, which thread annotations don't support. So we have to disable
355// the analysis inside the function.
353356template <class _L0, class _L1>
354_LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1) {
357_LIBCPP_NO_THREAD_SAFETY_ANALYSIS _LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1)
358 _LIBCPP_ACQUIRE_CAPABILITY(__l0, __l1) {
355359 while (true) {
356360 {
357361 unique_lock<_L0> __u0(__l0);
......@@ -375,7 +379,7 @@ _LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1) {
375379# ifndef _LIBCPP_CXX03_LANG
376380
377381template <class _L0, class _L1, class _L2, class... _L3>
378void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
382_LIBCPP_NO_THREAD_SAFETY_ANALYSIS void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
379383 while (true) {
380384 switch (__i) {
381385 case 0: {
......@@ -410,8 +414,14 @@ void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
410414 }
411415}
412416
417// We're using unique_lock to implement the functions, which thread annotations don't support. So we have to disable
418// the analysis inside the function.
413419template <class _L0, class _L1, class _L2, class... _L3>
414inline _LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
420_LIBCPP_NO_THREAD_SAFETY_ANALYSIS inline _LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
421# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101
422 _LIBCPP_ACQUIRE_CAPABILITY(__l0, __l1, __l2, __l3...)
423# endif
424{
415425 std::__lock_first(0, __l0, __l1, __l2, __l3...);
416426}
417427
......@@ -469,17 +479,14 @@ public:
469479
470480 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) {}
471481
472 _LIBCPP_HIDE_FROM_ABI ~scoped_lock() {
473 typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
474 __unlock_unpack(_Indices{}, __t_);
475 }
482 _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __unlock_unpack(make_index_sequence<sizeof...(_MArgs)>(), __t_); }
476483
477484 scoped_lock(scoped_lock const&) = delete;
478485 scoped_lock& operator=(scoped_lock const&) = delete;
479486
480487private:
481488 template <size_t... _Indx>
482 _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
489 _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(index_sequence<_Indx...>, _MutexTuple& __mt) {
483490 (std::get<_Indx>(__mt).unlock(), ...);
484491 }
485492
......@@ -494,6 +501,10 @@ _LIBCPP_END_NAMESPACE_STD
494501
495502_LIBCPP_POP_MACROS
496503
504# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
505# include <typeinfo>
506# endif
507
497508# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
498509# include <atomic>
499510# include <concepts>
......@@ -507,7 +518,6 @@ _LIBCPP_POP_MACROS
507518# include <stdexcept>
508519# include <system_error>
509520# include <type_traits>
510# include <typeinfo>
511521# endif
512522#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
513523
lib/libcxx/include/optional+644-149
......@@ -20,6 +20,11 @@ namespace std {
2020 template <class T>
2121 class optional;
2222
23 template<class T>
24 constexpr bool ranges::enable_view<optional<T>> = true;
25 template<class T>
26 constexpr auto format_kind<optional<T>> = range_format::disabled;
27
2328 template<class T>
2429 concept is-derived-from-optional = requires(const T& t) { // exposition only
2530 []<class U>(const optional<U>&){ }(t);
......@@ -102,6 +107,8 @@ namespace std {
102107 class optional {
103108 public:
104109 using value_type = T;
110 using iterator = implementation-defined; // see [optional.iterators]
111 using const_iterator = implementation-defined; // see [optional.iterators]
105112
106113 // [optional.ctor], constructors
107114 constexpr optional() noexcept;
......@@ -112,7 +119,7 @@ namespace std {
112119 constexpr explicit optional(in_place_t, Args &&...);
113120 template<class U, class... Args>
114121 constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...);
115 template<class U = T>
122 template<class U = remove_cv_t<T>>
116123 constexpr explicit(see-below) optional(U &&);
117124 template<class U>
118125 explicit(see-below) optional(const optional<U> &); // constexpr in C++20
......@@ -126,7 +133,7 @@ namespace std {
126133 optional &operator=(nullopt_t) noexcept; // constexpr in C++20
127134 constexpr optional &operator=(const optional &);
128135 constexpr optional &operator=(optional &&) noexcept(see below);
129 template<class U = T> optional &operator=(U &&); // constexpr in C++20
136 template<class U = remove_cv_t<T>> optional &operator=(U &&); // constexpr in C++20
130137 template<class U> optional &operator=(const optional<U> &); // constexpr in C++20
131138 template<class U> optional &operator=(optional<U> &&); // constexpr in C++20
132139 template<class... Args> T& emplace(Args &&...); // constexpr in C++20
......@@ -135,6 +142,12 @@ namespace std {
135142 // [optional.swap], swap
136143 void swap(optional &) noexcept(see below ); // constexpr in C++20
137144
145 // [optional.iterators], iterator support
146 constexpr iterator begin() noexcept;
147 constexpr const_iterator begin() const noexcept;
148 constexpr iterator end() noexcept;
149 constexpr const_iterator end() const noexcept;
150
138151 // [optional.observe], observers
139152 constexpr T const *operator->() const noexcept;
140153 constexpr T *operator->() noexcept;
......@@ -148,8 +161,8 @@ namespace std {
148161 constexpr T &value() &;
149162 constexpr T &&value() &&;
150163 constexpr const T &&value() const &&;
151 template<class U> constexpr T value_or(U &&) const &;
152 template<class U> constexpr T value_or(U &&) &&;
164 template<class U = remove_cv_t<T>> constexpr T value_or(U &&) const &;
165 template<class U = remove_cv_t<T>> constexpr T value_or(U &&) &&;
153166
154167 // [optional.monadic], monadic operations
155168 template<class F> constexpr auto and_then(F&& f) &; // since C++23
......@@ -173,6 +186,71 @@ namespace std {
173186 template<class T>
174187 optional(T) -> optional<T>;
175188
189 template<class T>
190 class optional<T&> { // since C++26
191 public:
192 using value_type = T;
193 using iterator = implementation-defined; // see [optional.ref.iterators]
194
195 public:
196 // [optional.ref.ctor], constructors
197 constexpr optional() noexcept = default;
198 constexpr optional(nullopt_t) noexcept : optional() {}
199 constexpr optional(const optional& rhs) noexcept = default;
200
201 template<class Arg>
202 constexpr explicit optional(in_place_t, Arg&& arg);
203 template<class U>
204 constexpr explicit(see below) optional(U&& u) noexcept(see below);
205 template<class U>
206 constexpr explicit(see below) optional(optional<U>& rhs) noexcept(see below);
207 template<class U>
208 constexpr explicit(see below) optional(const optional<U>& rhs) noexcept(see below);
209 template<class U>
210 constexpr explicit(see below) optional(optional<U>&& rhs) noexcept(see below);
211 template<class U>
212 constexpr explicit(see below) optional(const optional<U>&& rhs) noexcept(see below);
213
214 constexpr ~optional() = default;
215
216 // [optional.ref.assign], assignment
217 constexpr optional& operator=(nullopt_t) noexcept;
218 constexpr optional& operator=(const optional& rhs) noexcept = default;
219
220 template<class U> constexpr T& emplace(U&& u) noexcept(see below);
221
222 // [optional.ref.swap], swap
223 constexpr void swap(optional& rhs) noexcept;
224
225 // [optional.ref.iterators], iterator support
226 constexpr iterator begin() const noexcept;
227 constexpr iterator end() const noexcept;
228
229 // [optional.ref.observe], observers
230 constexpr T* operator->() const noexcept;
231 constexpr T& operator*() const noexcept;
232 constexpr explicit operator bool() const noexcept;
233 constexpr bool has_value() const noexcept;
234 constexpr T& value() const; // freestanding-deleted
235 template<class U = remove_cv_t<T>>
236 constexpr remove_cv_t<T> value_or(U&& u) const;
237
238 // [optional.ref.monadic], monadic operations
239 template<class F> constexpr auto and_then(F&& f) const;
240 template<class F> constexpr optional<invoke_result_t<F, T&>> transform(F&& f) const;
241 template<class F> constexpr optional or_else(F&& f) const;
242
243 // [optional.ref.mod], modifiers
244 constexpr void reset() noexcept;
245
246 private:
247 T* val = nullptr; // exposition only
248
249 // [optional.ref.expos], exposition only helper functions
250 template<class U>
251 constexpr void convert-ref-init-val(U&& u); // exposition only
252 };
253
176254} // namespace std
177255
178256*/
......@@ -186,13 +264,19 @@ namespace std {
186264# include <__compare/three_way_comparable.h>
187265# include <__concepts/invocable.h>
188266# include <__config>
267# include <__cstddef/ptrdiff_t.h>
189268# include <__exception/exception.h>
269# include <__format/range_format.h>
190270# include <__functional/hash.h>
191271# include <__functional/invoke.h>
192272# include <__functional/unary_function.h>
193273# include <__fwd/functional.h>
274# include <__iterator/bounded_iter.h>
275# include <__iterator/wrap_iter.h>
194276# include <__memory/addressof.h>
195277# include <__memory/construct_at.h>
278# include <__ranges/enable_borrowed_range.h>
279# include <__ranges/enable_view.h>
196280# include <__tuple/sfinae_helpers.h>
197281# include <__type_traits/add_pointer.h>
198282# include <__type_traits/conditional.h>
......@@ -200,6 +284,7 @@ namespace std {
200284# include <__type_traits/decay.h>
201285# include <__type_traits/disjunction.h>
202286# include <__type_traits/enable_if.h>
287# include <__type_traits/integral_constant.h>
203288# include <__type_traits/invoke.h>
204289# include <__type_traits/is_array.h>
205290# include <__type_traits/is_assignable.h>
......@@ -207,11 +292,11 @@ namespace std {
207292# include <__type_traits/is_convertible.h>
208293# include <__type_traits/is_core_convertible.h>
209294# include <__type_traits/is_destructible.h>
295# include <__type_traits/is_function.h>
210296# include <__type_traits/is_nothrow_assignable.h>
211297# include <__type_traits/is_nothrow_constructible.h>
212298# include <__type_traits/is_object.h>
213299# include <__type_traits/is_reference.h>
214# include <__type_traits/is_replaceable.h>
215300# include <__type_traits/is_same.h>
216301# include <__type_traits/is_scalar.h>
217302# include <__type_traits/is_swappable.h>
......@@ -220,6 +305,7 @@ namespace std {
220305# include <__type_traits/is_trivially_destructible.h>
221306# include <__type_traits/is_trivially_relocatable.h>
222307# include <__type_traits/negation.h>
308# include <__type_traits/reference_constructs_from_temporary.h>
223309# include <__type_traits/remove_const.h>
224310# include <__type_traits/remove_cv.h>
225311# include <__type_traits/remove_cvref.h>
......@@ -255,7 +341,7 @@ public:
255341 _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
256342 // Get the key function ~bad_optional_access() into the dylib
257343 ~bad_optional_access() _NOEXCEPT override;
258 const char* what() const _NOEXCEPT override;
344 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
259345};
260346
261347} // namespace std
......@@ -358,7 +444,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> {
358444 using value_type = _Tp;
359445 using __base::__base;
360446
361 _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
447 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
362448
363449 _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() & noexcept { return this->__val_; }
364450 _LIBCPP_HIDE_FROM_ABI constexpr const value_type& __get() const& noexcept { return this->__val_; }
......@@ -390,58 +476,60 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> {
390476 __construct(std::forward<_That>(__opt).__get());
391477 }
392478 }
479
480 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
481 __swap(__optional_storage_base& __rhs) noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>) {
482 using std::swap;
483 if (this->has_value() == __rhs.has_value()) {
484 if (this->has_value())
485 swap(this->__get(), __rhs.__get());
486 } else {
487 if (this->has_value()) {
488 __rhs.__construct(std::move(this->__get()));
489 this->reset();
490 } else {
491 this->__construct(std::move(__rhs.__get()));
492 __rhs.reset();
493 }
494 }
495 }
393496};
394497
395// optional<T&> is currently required to be ill-formed. However, it may
396// be allowed in the future. For this reason, it has already been implemented
397// to ensure we can make the change in an ABI-compatible manner.
398498template <class _Tp>
399499struct __optional_storage_base<_Tp, true> {
400500 using value_type = _Tp;
401501 using __raw_type _LIBCPP_NODEBUG = remove_reference_t<_Tp>;
402502 __raw_type* __value_;
403503
504 _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
505
404506 template <class _Up>
405 static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
406 using _RawUp = __libcpp_remove_reference_t<_Up>;
407 using _UpPtr = _RawUp*;
408 using _RawTp = __libcpp_remove_reference_t<_Tp>;
409 using _TpPtr = _RawTp*;
410 using _CheckLValueArg =
411 integral_constant<bool,
412 (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) ||
413 is_same<_RawUp, reference_wrapper<_RawTp>>::value ||
414 is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value >;
415 return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) ||
416 (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
417 is_convertible<_UpPtr, _TpPtr>::value);
507 _LIBCPP_HIDE_FROM_ABI constexpr void __convert_init_ref_val(_Up&& __val) noexcept {
508 _Tp& __r(std::forward<_Up>(__val));
509 __value_ = std::addressof(__r);
418510 }
419511
420 _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
421
422512 template <class _UArg>
423 _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
424 : __value_(std::addressof(__uarg)) {
425 static_assert(__can_bind_reference<_UArg>(),
426 "Attempted to construct a reference element in tuple from a "
513 _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg) {
514 static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>,
515 "Attempted to construct a reference element in optional from a "
427516 "possible temporary");
517 __convert_init_ref_val(std::forward<_UArg>(__uarg));
428518 }
429519
430520 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
431521
432 _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
433
434 _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const& noexcept { return *__value_; }
522 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
435523
436 _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() const&& noexcept { return std::forward<value_type>(*__value_); }
524 _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const noexcept { return *__value_; }
437525
438526 template <class _UArg>
439527 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) {
440528 _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
441 static_assert(__can_bind_reference<_UArg>(),
529 static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>,
442530 "Attempted to construct a reference element in tuple from a "
443531 "possible temporary");
444 __value_ = std::addressof(__val);
532 __convert_init_ref_val(std::forward<_UArg>(__val));
445533 }
446534
447535 template <class _That>
......@@ -462,9 +550,13 @@ struct __optional_storage_base<_Tp, true> {
462550 __construct(std::forward<_That>(__opt).__get());
463551 }
464552 }
553
554 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) noexcept {
555 std::swap(__value_, __rhs.__value_);
556 }
465557};
466558
467template <class _Tp, bool = is_trivially_copy_constructible<_Tp>::value>
559template <class _Tp, bool = is_trivially_copy_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>>
468560struct __optional_copy_base : __optional_storage_base<_Tp> {
469561 using __optional_storage_base<_Tp>::__optional_storage_base;
470562};
......@@ -484,7 +576,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> {
484576 _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default;
485577};
486578
487template <class _Tp, bool = is_trivially_move_constructible<_Tp>::value>
579template <class _Tp, bool = is_trivially_move_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>>
488580struct __optional_move_base : __optional_copy_base<_Tp> {
489581 using __optional_copy_base<_Tp>::__optional_copy_base;
490582};
......@@ -507,8 +599,9 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> {
507599};
508600
509601template <class _Tp,
510 bool = is_trivially_destructible<_Tp>::value && is_trivially_copy_constructible<_Tp>::value &&
511 is_trivially_copy_assignable<_Tp>::value>
602 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>>
512605struct __optional_copy_assign_base : __optional_move_base<_Tp> {
513606 using __optional_move_base<_Tp>::__optional_move_base;
514607};
......@@ -531,8 +624,9 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> {
531624};
532625
533626template <class _Tp,
534 bool = is_trivially_destructible<_Tp>::value && is_trivially_move_constructible<_Tp>::value &&
535 is_trivially_move_assignable<_Tp>::value>
627 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>>
536630struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> {
537631 using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
538632};
......@@ -561,12 +655,24 @@ using __optional_sfinae_ctor_base_t _LIBCPP_NODEBUG =
561655
562656template <class _Tp>
563657using __optional_sfinae_assign_base_t _LIBCPP_NODEBUG =
564 __sfinae_assign_base< (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value),
565 (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value) >;
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>>;
566660
567661template <class _Tp>
568662class optional;
569663
664# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
665template <class _Tp>
666constexpr bool ranges::enable_view<optional<_Tp>> = true;
667
668template <class _Tp>
669constexpr range_format format_kind<optional<_Tp>> = range_format::disabled;
670
671template <class _Tp>
672constexpr bool ranges::enable_borrowed_range<optional<_Tp&>> = true;
673
674# endif
675
570676# if _LIBCPP_STD_VER >= 20
571677
572678template <class _Tp>
......@@ -579,29 +685,150 @@ struct __is_std_optional : false_type {};
579685template <class _Tp>
580686struct __is_std_optional<optional<_Tp>> : true_type {};
581687
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...>> {};
693
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...>;
697
698# 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
708
709template <class _Tp, class = void>
710struct __optional_iterator {};
711
712# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
713
714template <class _Tp>
715struct __optional_iterator<_Tp, enable_if_t<is_object_v<_Tp>>> {
716private:
717 using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>;
718 using __const_pointer _LIBCPP_NODEBUG = add_pointer_t<const _Tp>;
719
720public:
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
728
729 // [optional.iterators], iterator support
730 [[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());
733
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
742 }
743
744 [[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());
747
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
756 }
757
758 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() noexcept {
759 return begin() + (static_cast<optional<_Tp>&>(*this).has_value() ? 1 : 0);
760 }
761 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept {
762 return begin() + (static_cast<const optional<_Tp>&>(*this).has_value() ? 1 : 0);
763 }
764};
765
766template <class _Tp>
767struct __optional_iterator<_Tp&, enable_if_t<is_object_v<_Tp> && !__is_unbounded_array_v<_Tp> >> {
768private:
769 using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>;
770
771public:
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
777
778 // [optional.ref.iterators], iterator support
779
780 [[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;
783
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
792 }
793
794 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const noexcept {
795 return begin() + (static_cast<const optional<_Tp&>&>(*this).has_value() ? 1 : 0);
796 }
797};
798
799# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
800
582801template <class _Tp>
583802class _LIBCPP_DECLSPEC_EMPTY_BASES optional
584803 : private __optional_move_assign_base<_Tp>,
585804 private __optional_sfinae_ctor_base_t<_Tp>,
586 private __optional_sfinae_assign_base_t<_Tp> {
805 private __optional_sfinae_assign_base_t<_Tp>,
806 public __optional_iterator<_Tp> {
587807 using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>;
588808
589809public:
590 using value_type = _Tp;
810 using value_type = __libcpp_remove_reference_t<_Tp>;
591811
592812 using __trivially_relocatable _LIBCPP_NODEBUG =
593813 conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>;
594 using __replaceable _LIBCPP_NODEBUG = conditional_t<__is_replaceable_v<_Tp>, optional, void>;
595814
596815private:
597 // Disable the reference extension using this static assert.
598 static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
816 static_assert(!is_same_v<__remove_cvref_t<_Tp>, in_place_t>,
599817 "instantiation of optional with in_place_t is ill-formed");
600 static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>,
601 "instantiation of optional with nullopt_t is ill-formed");
602 static_assert(!is_reference_v<value_type>, "instantiation of optional with a reference type is ill-formed");
603 static_assert(is_destructible_v<value_type>, "instantiation of optional with a non-destructible type is ill-formed");
604 static_assert(!is_array_v<value_type>, "instantiation of optional with an array type is ill-formed");
818 static_assert(!is_same_v<__remove_cvref_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed");
819# if _LIBCPP_STD_VER >= 26
820 static_assert(!is_rvalue_reference_v<_Tp>, "instantiation of optional with an rvalue reference type is ill-formed");
821# else
822 static_assert(!is_reference_v<_Tp>, "instantiation of optional with a reference type is ill-formed");
823# endif
824 static_assert(is_destructible_v<_Tp>, "instantiation of optional with a non-destructible type is ill-formed");
825 static_assert(!is_array_v<_Tp>, "instantiation of optional with an array type is ill-formed");
826
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# endif
605832
606833 // LWG2756: conditionally explicit conversion from _Up
607834 struct _CheckOptionalArgsConstructor {
......@@ -674,45 +901,131 @@ public:
674901 _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
675902 _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
676903
677 template <class _InPlaceT,
678 class... _Args,
679 enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, is_constructible<value_type, _Args...>>::value, int> = 0>
904 template <
905 class _InPlaceT,
906 class... _Args,
907 enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, __is_constructible_for_optional<_Tp, _Args...>>::value, int> = 0>
680908 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
681909 : __base(in_place, std::forward<_Args>(__args)...) {}
682910
683911 template <class _Up,
684912 class... _Args,
685 enable_if_t<is_constructible_v<value_type, initializer_list<_Up>&, _Args...>, int> = 0>
913 enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
686914 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
687915 : __base(in_place, __il, std::forward<_Args>(__args)...) {}
688916
689 template <class _Up = value_type,
690 enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
691 _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
917 template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
918 _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v)
919# if _LIBCPP_STD_VER >= 26
920 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
921# endif
922 : __base(in_place, std::forward<_Up>(__v)) {
923 }
692924
693 template <class _Up, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
694 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
925 template <class _Up = remove_cv_t<_Tp>,
926 enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
927 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v)
928# if _LIBCPP_STD_VER >= 26
929 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
930# endif
931 : __base(in_place, std::forward<_Up>(__v)) {
932 }
695933
696934 // LWG2756: conditionally explicit conversion from const optional<_Up>&
697935 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
698 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) {
936 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v)
937# if _LIBCPP_STD_VER >= 26
938 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up&>)
939# endif
940 {
699941 this->__construct_from(__v);
700942 }
701943 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
702 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) {
944 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v)
945# if _LIBCPP_STD_VER >= 26
946 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up&>)
947# endif
948 {
703949 this->__construct_from(__v);
704950 }
705951
706952 // LWG2756: conditionally explicit conversion from optional<_Up>&&
707953 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
708 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) {
954 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v)
955# if _LIBCPP_STD_VER >= 26
956 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
957# endif
958 {
709959 this->__construct_from(std::move(__v));
710960 }
711961 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
712 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) {
962 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v)
963# if _LIBCPP_STD_VER >= 26
964 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
965# endif
966 {
713967 this->__construct_from(std::move(__v));
714968 }
715969
970 // deleted optional<T&> constructors and additional optional<T&> constructors
971# if _LIBCPP_STD_VER >= 26
972 // optional(U&&)
973 template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
974 requires __libcpp_opt_ref_ctor_deleted<_Up>
975 optional(_Up&&) = delete;
976
977 template <class _Up = remove_cv_t<_Tp>,
978 enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
979 requires __libcpp_opt_ref_ctor_deleted<_Up>
980 explicit optional(_Up&&) = delete;
981
982 // optional(optional<U>& rhs)
983 template <class _Up>
984 requires(!__libcpp_opt_ref_ctor_deleted<_Up>) && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
985 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up&>
986 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up&, _Tp&>)
987 optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) {
988 this->__construct_from(__rhs);
989 }
990
991 template <class _Up>
992 requires __libcpp_opt_ref_ctor_deleted<_Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
993 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up&>
994 constexpr explicit optional(optional<_Up>& __rhs) noexcept = delete;
995
996 // optional(const optional<U>&)
997 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
998 requires __libcpp_opt_ref_ctor_deleted<_Up>
999 optional(const optional<_Up>&) = delete;
1000
1001 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
1002 requires __libcpp_opt_ref_ctor_deleted<_Up>
1003 explicit optional(const optional<_Up>&) = delete;
1004
1005 // optional(optional<U>&&)
1006 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
1007 requires __libcpp_opt_ref_ctor_deleted<_Up>
1008 optional(optional<_Up>&&) = delete;
1009
1010 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
1011 requires __libcpp_opt_ref_ctor_deleted<_Up>
1012 explicit optional(optional<_Up>&&) = delete;
1013
1014 // optional(const optional<U>&&)
1015 template <class _Up>
1016 requires(!__libcpp_opt_ref_ctor_deleted<_Up>) && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
1017 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up>
1018 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!is_convertible_v<const _Up, _Tp&>)
1019 optional(const optional<_Up>&& __v) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) {
1020 this->__construct_from(std::move(__v));
1021 }
1022
1023 template <class _Up>
1024 requires __libcpp_opt_ref_ctor_deleted<_Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
1025 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up>
1026 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>&& __v) noexcept = delete;
1027# endif
1028
7161029# if _LIBCPP_STD_VER >= 23
7171030 template <class _Tag,
7181031 class _Fp,
......@@ -731,11 +1044,12 @@ public:
7311044 _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
7321045
7331046 // LWG2756
734 template <class _Up = value_type,
1047 template <class _Up = remove_cv_t<_Tp>,
7351048 enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Up>, optional>,
736 _Or<_IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>>>,
737 is_constructible<value_type, _Up>,
738 is_assignable<value_type&, _Up>>::value,
1049 _Or<_IsNotSame<__remove_cvref_t<_Up>, _Tp>, _Not<is_scalar<_Tp>>>,
1050 is_constructible<_Tp, _Up>,
1051 is_assignable<_Tp&, _Up>,
1052 is_object<_Tp>>::value,
7391053 int> = 0>
7401054 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
7411055 if (this->has_value())
......@@ -759,8 +1073,12 @@ public:
7591073 return *this;
7601074 }
7611075
762 template <class... _Args, enable_if_t<is_constructible_v<value_type, _Args...>, int> = 0>
763 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
1076 template <class... _Args, enable_if_t<__is_constructible_for_optional_v<_Tp, _Args...>, int> = 0>
1077 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args)
1078# if _LIBCPP_STD_VER >= 26
1079 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp, _Args...>)
1080# endif
1081 {
7641082 reset();
7651083 this->__construct(std::forward<_Args>(__args)...);
7661084 return this->__get();
......@@ -768,56 +1086,72 @@ public:
7681086
7691087 template <class _Up,
7701088 class... _Args,
771 enable_if_t<is_constructible_v<value_type, initializer_list<_Up>&, _Args...>, int> = 0>
1089 enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
7721090 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
7731091 reset();
7741092 this->__construct(__il, std::forward<_Args>(__args)...);
7751093 return this->__get();
7761094 }
7771095
778 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
779 swap(optional& __opt) noexcept(is_nothrow_move_constructible_v<value_type> && is_nothrow_swappable_v<value_type>) {
780 if (this->has_value() == __opt.has_value()) {
781 using std::swap;
782 if (this->has_value())
783 swap(this->__get(), __opt.__get());
784 } else {
785 if (this->has_value()) {
786 __opt.__construct(std::move(this->__get()));
787 reset();
788 } else {
789 this->__construct(std::move(__opt.__get()));
790 __opt.reset();
791 }
792 }
1096 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt) noexcept(
1097 (is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>)
1098# if _LIBCPP_STD_VER >= 26
1099 || is_lvalue_reference_v<_Tp>
1100# endif
1101 ) {
1102 this->__swap(__opt);
7931103 }
7941104
795 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type const> operator->() const noexcept {
1105 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept
1106# if _LIBCPP_STD_VER >= 26
1107 requires(is_object_v<_Tp>)
1108# endif
1109 {
7961110 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
7971111 return std::addressof(this->__get());
7981112 }
7991113
800 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type> operator->() noexcept {
1114 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() noexcept
1115# if _LIBCPP_STD_VER >= 26
1116 requires(is_object_v<_Tp>)
1117# endif
1118 {
8011119 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
8021120 return std::addressof(this->__get());
8031121 }
8041122
805 _LIBCPP_HIDE_FROM_ABI constexpr const value_type& operator*() const& noexcept {
1123 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept
1124# if _LIBCPP_STD_VER >= 26
1125 requires(is_object_v<_Tp>)
1126# endif
1127 {
8061128 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
8071129 return this->__get();
8081130 }
8091131
810 _LIBCPP_HIDE_FROM_ABI constexpr value_type& operator*() & noexcept {
1132 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept
1133# if _LIBCPP_STD_VER >= 26
1134 requires(is_object_v<_Tp>)
1135# endif
1136 {
8111137 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
8121138 return this->__get();
8131139 }
8141140
815 _LIBCPP_HIDE_FROM_ABI constexpr value_type&& operator*() && noexcept {
1141 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept
1142# if _LIBCPP_STD_VER >= 26
1143 requires(is_object_v<_Tp>)
1144# endif
1145 {
8161146 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
8171147 return std::move(this->__get());
8181148 }
8191149
820 _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& operator*() const&& noexcept {
1150 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept
1151# if _LIBCPP_STD_VER >= 26
1152 requires(is_object_v<_Tp>)
1153# endif
1154 {
8211155 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
8221156 return std::move(this->__get());
8231157 }
......@@ -827,48 +1161,73 @@ public:
8271161 using __base::__get;
8281162 using __base::has_value;
8291163
830 _LIBCPP_HIDE_FROM_ABI constexpr value_type const& value() const& {
1164 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& value() const&
1165# if _LIBCPP_STD_VER >= 26
1166 requires(is_object_v<_Tp>)
1167# endif
1168 {
8311169 if (!this->has_value())
8321170 std::__throw_bad_optional_access();
8331171 return this->__get();
8341172 }
8351173
836 _LIBCPP_HIDE_FROM_ABI constexpr value_type& value() & {
1174 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() &
1175# if _LIBCPP_STD_VER >= 26
1176 requires(is_object_v<_Tp>)
1177# endif
1178 {
8371179 if (!this->has_value())
8381180 std::__throw_bad_optional_access();
8391181 return this->__get();
8401182 }
8411183
842 _LIBCPP_HIDE_FROM_ABI constexpr value_type&& value() && {
1184 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() &&
1185# if _LIBCPP_STD_VER >= 26
1186 requires(is_object_v<_Tp>)
1187# endif
1188 {
8431189 if (!this->has_value())
8441190 std::__throw_bad_optional_access();
8451191 return std::move(this->__get());
8461192 }
8471193
848 _LIBCPP_HIDE_FROM_ABI constexpr value_type const&& value() const&& {
1194 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const&& value() const&&
1195# if _LIBCPP_STD_VER >= 26
1196 requires(is_object_v<_Tp>)
1197# endif
1198 {
8491199 if (!this->has_value())
8501200 std::__throw_bad_optional_access();
8511201 return std::move(this->__get());
8521202 }
8531203
854 template <class _Up>
855 _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) const& {
856 static_assert(is_copy_constructible_v<value_type>, "optional<T>::value_or: T must be copy constructible");
857 static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
858 return this->has_value() ? this->__get() : static_cast<value_type>(std::forward<_Up>(__v));
1204 template <class _Up = remove_cv_t<_Tp>>
1205# if _LIBCPP_STD_VER >= 26
1206 requires(is_object_v<_Tp>)
1207# endif
1208 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
1209 static_assert(is_copy_constructible_v<_Tp>, "optional<T>::value_or: T must be copy constructible");
1210 static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T");
1211 return this->has_value() ? this->__get() : static_cast<_Tp>(std::forward<_Up>(__v));
8591212 }
8601213
861 template <class _Up>
862 _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) && {
863 static_assert(is_move_constructible_v<value_type>, "optional<T>::value_or: T must be move constructible");
864 static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
865 return this->has_value() ? std::move(this->__get()) : static_cast<value_type>(std::forward<_Up>(__v));
1214 template <class _Up = remove_cv_t<_Tp>>
1215# if _LIBCPP_STD_VER >= 26
1216 requires(is_object_v<_Tp>)
1217# endif
1218 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
1219 static_assert(is_move_constructible_v<_Tp>, "optional<T>::value_or: T must be move constructible");
1220 static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T");
1221 return this->has_value() ? std::move(this->__get()) : static_cast<_Tp>(std::forward<_Up>(__v));
8661222 }
8671223
8681224# if _LIBCPP_STD_VER >= 23
8691225 template <class _Func>
870 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
871 using _Up = invoke_result_t<_Func, value_type&>;
1226# if _LIBCPP_STD_VER >= 26
1227 requires(is_object_v<_Tp>)
1228# endif
1229 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
1230 using _Up = invoke_result_t<_Func, _Tp&>;
8721231 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
8731232 "Result of f(value()) must be a specialization of std::optional");
8741233 if (*this)
......@@ -877,8 +1236,11 @@ public:
8771236 }
8781237
8791238 template <class _Func>
880 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
881 using _Up = invoke_result_t<_Func, const value_type&>;
1239# if _LIBCPP_STD_VER >= 26
1240 requires(is_object_v<_Tp>)
1241# endif
1242 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
1243 using _Up = invoke_result_t<_Func, const _Tp&>;
8821244 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
8831245 "Result of f(value()) must be a specialization of std::optional");
8841246 if (*this)
......@@ -887,8 +1249,11 @@ public:
8871249 }
8881250
8891251 template <class _Func>
890 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
891 using _Up = invoke_result_t<_Func, value_type&&>;
1252# if _LIBCPP_STD_VER >= 26
1253 requires(is_object_v<_Tp>)
1254# endif
1255 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
1256 using _Up = invoke_result_t<_Func, _Tp&&>;
8921257 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
8931258 "Result of f(std::move(value())) must be a specialization of std::optional");
8941259 if (*this)
......@@ -897,8 +1262,11 @@ public:
8971262 }
8981263
8991264 template <class _Func>
900 _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
901 using _Up = invoke_result_t<_Func, const value_type&&>;
1265# if _LIBCPP_STD_VER >= 26
1266 requires(is_object_v<_Tp>)
1267# endif
1268 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
1269 using _Up = invoke_result_t<_Func, const _Tp&&>;
9021270 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
9031271 "Result of f(std::move(value())) must be a specialization of std::optional");
9041272 if (*this)
......@@ -907,8 +1275,11 @@ public:
9071275 }
9081276
9091277 template <class _Func>
910 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
911 using _Up = remove_cv_t<invoke_result_t<_Func, value_type&>>;
1278# if _LIBCPP_STD_VER >= 26
1279 requires(is_object_v<_Tp>)
1280# endif
1281 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
1282 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>;
9121283 static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
9131284 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
9141285 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
......@@ -919,8 +1290,11 @@ public:
9191290 }
9201291
9211292 template <class _Func>
922 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
923 using _Up = remove_cv_t<invoke_result_t<_Func, const value_type&>>;
1293# if _LIBCPP_STD_VER >= 26
1294 requires(is_object_v<_Tp>)
1295# endif
1296 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
1297 using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>;
9241298 static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
9251299 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
9261300 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
......@@ -931,8 +1305,11 @@ public:
9311305 }
9321306
9331307 template <class _Func>
934 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
935 using _Up = remove_cv_t<invoke_result_t<_Func, value_type&&>>;
1308# if _LIBCPP_STD_VER >= 26
1309 requires(is_object_v<_Tp>)
1310# endif
1311 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
1312 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>;
9361313 static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
9371314 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
9381315 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
......@@ -943,8 +1320,11 @@ public:
9431320 }
9441321
9451322 template <class _Func>
946 _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
947 using _Up = remove_cvref_t<invoke_result_t<_Func, const value_type&&>>;
1323# if _LIBCPP_STD_VER >= 26
1324 requires(is_object_v<_Tp>)
1325# endif
1326 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
1327 using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>;
9481328 static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
9491329 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
9501330 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
......@@ -955,8 +1335,11 @@ public:
9551335 }
9561336
9571337 template <invocable _Func>
958 _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
959 requires is_copy_constructible_v<value_type>
1338 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
1339 requires is_copy_constructible_v<_Tp>
1340# if _LIBCPP_STD_VER >= 26
1341 && (is_object_v<_Tp>)
1342# endif
9601343 {
9611344 static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
9621345 "Result of f() should be the same type as this optional");
......@@ -966,8 +1349,11 @@ public:
9661349 }
9671350
9681351 template <invocable _Func>
969 _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
970 requires is_move_constructible_v<value_type>
1352 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
1353 requires is_move_constructible_v<_Tp>
1354# if _LIBCPP_STD_VER >= 26
1355 && (is_object_v<_Tp>)
1356# endif
9711357 {
9721358 static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
9731359 "Result of f() should be the same type as this optional");
......@@ -978,6 +1364,78 @@ public:
9781364# endif // _LIBCPP_STD_VER >= 23
9791365
9801366 using __base::reset;
1367
1368// optional<T&> overloads
1369# if _LIBCPP_STD_VER >= 26
1370
1371 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() const noexcept
1372 requires(is_lvalue_reference_v<_Tp>)
1373 {
1374 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
1375 return std::addressof(this->__get());
1376 }
1377
1378 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() const noexcept
1379 requires(is_lvalue_reference_v<_Tp>)
1380 {
1381 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
1382 return this->__get();
1383 }
1384
1385 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() const
1386 requires(is_lvalue_reference_v<_Tp>)
1387 {
1388 if (!this->has_value())
1389 std::__throw_bad_optional_access();
1390 return this->__get();
1391 }
1392
1393 template <class _Up = remove_cvref_t<_Tp>>
1394 requires(is_lvalue_reference_v<_Tp> && is_object_v<__libcpp_remove_reference_t<_Tp>> &&
1395 !is_array_v<__libcpp_remove_reference_t<_Tp>>)
1396 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decay_t<_Tp> value_or(_Up&& __v) const {
1397 static_assert(
1398 is_constructible_v<remove_cvref_t<_Tp>, _Tp&>, "optional<T&>::value_or: remove_cv_t<T> must be constructible");
1399 static_assert(
1400 is_convertible_v<_Up, remove_cvref_t<_Tp>>, "optional<T&>::value_or: U must be convertible to remove_cv_t<T>");
1401 return this->has_value() ? this->__get() : static_cast<remove_cvref_t<_Tp>>(std::forward<_Up>(__v));
1402 }
1403
1404 template <class _Func>
1405 requires(is_lvalue_reference_v<_Tp>)
1406 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const {
1407 using _Up = invoke_result_t<_Func, _Tp&>;
1408 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
1409 "Result of f(value()) must be a specialization of std::optional");
1410 if (*this)
1411 return std::invoke(std::forward<_Func>(__f), value());
1412 return remove_cvref_t<_Up>();
1413 }
1414
1415 template <class _Func>
1416 requires(is_lvalue_reference_v<_Tp>)
1417 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<remove_cv_t<invoke_result_t<_Func, _Tp&>>>
1418 transform(_Func&& __f) const {
1419 using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>;
1420 static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
1421 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
1422 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
1423 static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
1424 if (*this)
1425 return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
1426 return optional<_Up>();
1427 }
1428
1429 template <invocable _Func>
1430 requires(is_lvalue_reference_v<_Tp>)
1431 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const {
1432 static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
1433 "Result of f() should be the same type as this optional");
1434 if (*this)
1435 return *this;
1436 return std::forward<_Func>(__f)();
1437 }
1438# endif
9811439};
9821440
9831441template <class _Tp>
......@@ -1154,7 +1612,9 @@ template <
11541612 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
11551613 int> = 0>
11561614_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const optional<_Tp>& __x, const _Up& __v) {
1157 return static_cast<bool>(__x) ? *__x == __v : false;
1615 if (__x.has_value())
1616 return *__x == __v;
1617 return false;
11581618}
11591619
11601620template <
......@@ -1163,7 +1623,9 @@ template <
11631623 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
11641624 int> = 0>
11651625_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const _Tp& __v, const optional<_Up>& __x) {
1166 return static_cast<bool>(__x) ? __v == *__x : false;
1626 if (__x.has_value())
1627 return __v == *__x;
1628 return false;
11671629}
11681630
11691631template <
......@@ -1172,7 +1634,9 @@ template <
11721634 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
11731635 int> = 0>
11741636_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const optional<_Tp>& __x, const _Up& __v) {
1175 return static_cast<bool>(__x) ? *__x != __v : true;
1637 if (__x.has_value())
1638 return *__x != __v;
1639 return true;
11761640}
11771641
11781642template <
......@@ -1181,7 +1645,9 @@ template <
11811645 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
11821646 int> = 0>
11831647_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const _Tp& __v, const optional<_Up>& __x) {
1184 return static_cast<bool>(__x) ? __v != *__x : true;
1648 if (__x.has_value())
1649 return __v != *__x;
1650 return true;
11851651}
11861652
11871653template < class _Tp,
......@@ -1189,7 +1655,9 @@ template < class _Tp,
11891655 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
11901656 int> = 0>
11911657_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const optional<_Tp>& __x, const _Up& __v) {
1192 return static_cast<bool>(__x) ? *__x < __v : true;
1658 if (__x.has_value())
1659 return *__x < __v;
1660 return true;
11931661}
11941662
11951663template < class _Tp,
......@@ -1197,7 +1665,9 @@ template < class _Tp,
11971665 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
11981666 int> = 0>
11991667_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const _Tp& __v, const optional<_Up>& __x) {
1200 return static_cast<bool>(__x) ? __v < *__x : false;
1668 if (__x.has_value())
1669 return __v < *__x;
1670 return false;
12011671}
12021672
12031673template <
......@@ -1206,7 +1676,9 @@ template <
12061676 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
12071677 int> = 0>
12081678_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const optional<_Tp>& __x, const _Up& __v) {
1209 return static_cast<bool>(__x) ? *__x <= __v : true;
1679 if (__x.has_value())
1680 return *__x <= __v;
1681 return true;
12101682}
12111683
12121684template <
......@@ -1215,7 +1687,9 @@ template <
12151687 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
12161688 int> = 0>
12171689_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const _Tp& __v, const optional<_Up>& __x) {
1218 return static_cast<bool>(__x) ? __v <= *__x : false;
1690 if (__x.has_value())
1691 return __v <= *__x;
1692 return false;
12191693}
12201694
12211695template < class _Tp,
......@@ -1223,7 +1697,9 @@ template < class _Tp,
12231697 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
12241698 int> = 0>
12251699_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const optional<_Tp>& __x, const _Up& __v) {
1226 return static_cast<bool>(__x) ? *__x > __v : false;
1700 if (__x.has_value())
1701 return *__x > __v;
1702 return false;
12271703}
12281704
12291705template < class _Tp,
......@@ -1231,7 +1707,9 @@ template < class _Tp,
12311707 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
12321708 int> = 0>
12331709_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const _Tp& __v, const optional<_Up>& __x) {
1234 return static_cast<bool>(__x) ? __v > *__x : true;
1710 if (__x.has_value())
1711 return __v > *__x;
1712 return true;
12351713}
12361714
12371715template <
......@@ -1240,7 +1718,9 @@ template <
12401718 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
12411719 int> = 0>
12421720_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const optional<_Tp>& __x, const _Up& __v) {
1243 return static_cast<bool>(__x) ? *__x >= __v : false;
1721 if (__x.has_value())
1722 return *__x >= __v;
1723 return false;
12441724}
12451725
12461726template <
......@@ -1249,7 +1729,9 @@ template <
12491729 enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
12501730 int> = 0>
12511731_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const _Tp& __v, const optional<_Up>& __x) {
1252 return static_cast<bool>(__x) ? __v >= *__x : true;
1732 if (__x.has_value())
1733 return __v >= *__x;
1734 return true;
12531735}
12541736
12551737# if _LIBCPP_STD_VER >= 20
......@@ -1264,23 +1746,36 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) {
12641746# endif // _LIBCPP_STD_VER >= 20
12651747
12661748template <class _Tp, enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, int> = 0>
1267inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
1268swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
1749inline _LIBCPP_HIDE_FROM_ABI
1750_LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
12691751 __x.swap(__y);
12701752}
12711753
1272template <class _Tp>
1273_LIBCPP_HIDE_FROM_ABI constexpr optional<decay_t<_Tp>> make_optional(_Tp&& __v) {
1754struct __make_optional_barrier_tag {
1755 explicit __make_optional_barrier_tag() = default;
1756};
1757
1758template <
1759# if _LIBCPP_STD_VER >= 26
1760 __make_optional_barrier_tag = __make_optional_barrier_tag{},
1761# endif
1762 class _Tp,
1763 enable_if_t<is_constructible_v<decay_t<_Tp>, _Tp>, int> = 0>
1764[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<decay_t<_Tp>> make_optional(_Tp&& __v) {
12741765 return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
12751766}
12761767
1277template <class _Tp, class... _Args>
1278_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
1768template <class _Tp, class... _Args, enable_if_t<__is_constructible_for_optional_v<_Tp, _Args...>, int> = 0>
1769[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
12791770 return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
12801771}
12811772
1282template <class _Tp, class _Up, class... _Args>
1283_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args) {
1773template <class _Tp,
1774 class _Up,
1775 class... _Args,
1776 enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
1777[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp>
1778make_optional(initializer_list<_Up> __il, _Args&&... __args) {
12841779 return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
12851780}
12861781
......@@ -1291,7 +1786,7 @@ struct hash< __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>> > {
12911786 _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
12921787# endif
12931788
1294 _LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
1789 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
12951790 return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
12961791 }
12971792};
lib/libcxx/include/print+9-5
......@@ -329,7 +329,8 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
329329} // namespace __print
330330
331331template <class... _Args>
332_LIBCPP_HIDE_FROM_ABI void print(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
332_LIBCPP_HIDE_FROM_ABI void
333print(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) {
333334# if _LIBCPP_HAS_UNICODE
334335 if constexpr (__print::__use_unicode_execution_charset)
335336 __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
......@@ -346,7 +347,8 @@ _LIBCPP_HIDE_FROM_ABI void print(format_string<_Args...> __fmt, _Args&&... __arg
346347}
347348
348349template <class... _Args>
349_LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
350_LIBCPP_HIDE_FROM_ABI void
351println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) {
350352# if _LIBCPP_HAS_UNICODE
351353 // Note the wording in the Standard is inefficient. The output of
352354 // std::format is a std::string which is then copied. This solution
......@@ -361,7 +363,7 @@ _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt
361363}
362364
363365template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
364_LIBCPP_HIDE_FROM_ABI inline void println(FILE* __stream) {
366_LIBCPP_HIDE_FROM_ABI inline void println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream) {
365367 std::print(__stream, "\n");
366368}
367369
......@@ -377,7 +379,8 @@ _LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __a
377379
378380# if _LIBCPP_HAS_UNICODE
379381template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
380_LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(FILE* __stream, string_view __fmt, format_args __args) {
382_LIBCPP_HIDE_FROM_ABI inline void
383vprint_unicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) {
381384 __print::__vprint_unicode(__stream, __fmt, __args, false);
382385}
383386
......@@ -389,7 +392,8 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(string_view __fmt, format_args
389392# endif // _LIBCPP_HAS_UNICODE
390393
391394template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
392_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args) {
395_LIBCPP_HIDE_FROM_ABI inline void
396vprint_nonunicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) {
393397 __print::__vprint_nonunicode(__stream, __fmt, __args, false);
394398}
395399
lib/libcxx/include/queue+39-37
......@@ -376,12 +376,12 @@ public:
376376# endif // _LIBCPP_CXX03_LANG
377377
378378 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
379 _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
379 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
380380
381 _LIBCPP_HIDE_FROM_ABI reference front() { return c.front(); }
382 _LIBCPP_HIDE_FROM_ABI const_reference front() const { return c.front(); }
383 _LIBCPP_HIDE_FROM_ABI reference back() { return c.back(); }
384 _LIBCPP_HIDE_FROM_ABI const_reference back() const { return c.back(); }
381 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference front() { return c.front(); }
382 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference front() const { return c.front(); }
383 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference back() { return c.back(); }
384 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference back() const { return c.back(); }
385385
386386 _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v) { c.push_back(__v); }
387387# ifndef _LIBCPP_CXX03_LANG
......@@ -437,19 +437,19 @@ public:
437437};
438438
439439# if _LIBCPP_STD_VER >= 17
440template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
440template <class _Container, class = enable_if_t<!__is_allocator_v<_Container>>>
441441queue(_Container) -> queue<typename _Container::value_type, _Container>;
442442
443443template <class _Container,
444444 class _Alloc,
445 class = enable_if_t<!__is_allocator<_Container>::value>,
445 class = enable_if_t<!__is_allocator_v<_Container>>,
446446 class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
447447queue(_Container, _Alloc) -> queue<typename _Container::value_type, _Container>;
448448# endif
449449
450450# if _LIBCPP_STD_VER >= 23
451451template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
452queue(_InputIterator, _InputIterator) -> queue<__iter_value_type<_InputIterator>>;
452queue(_InputIterator, _InputIterator) -> queue<__iterator_value_type<_InputIterator>>;
453453
454454template <ranges::input_range _Range>
455455queue(from_range_t, _Range&&) -> queue<ranges::range_value_t<_Range>>;
......@@ -457,11 +457,11 @@ queue(from_range_t, _Range&&) -> queue<ranges::range_value_t<_Range>>;
457457template <class _InputIterator,
458458 class _Alloc,
459459 __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
460 __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
460 __enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
461461queue(_InputIterator, _InputIterator, _Alloc)
462 -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
462 -> queue<__iterator_value_type<_InputIterator>, deque<__iterator_value_type<_InputIterator>, _Alloc>>;
463463
464template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
464template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
465465queue(from_range_t, _Range&&, _Alloc)
466466 -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
467467# endif
......@@ -664,8 +664,10 @@ public:
664664# endif
665665
666666 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
667 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
668 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
667 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
668 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference top() const {
669 return c.front();
670 }
669671
670672 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
671673# ifndef _LIBCPP_CXX03_LANG
......@@ -700,45 +702,45 @@ public:
700702# if _LIBCPP_STD_VER >= 17
701703template <class _Compare,
702704 class _Container,
703 class = enable_if_t<!__is_allocator<_Compare>::value>,
704 class = enable_if_t<!__is_allocator<_Container>::value> >
705 class = enable_if_t<!__is_allocator_v<_Compare>>,
706 class = enable_if_t<!__is_allocator_v<_Container>>>
705707priority_queue(_Compare, _Container) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
706708
707709template <class _InputIterator,
708 class _Compare = less<__iter_value_type<_InputIterator>>,
709 class _Container = vector<__iter_value_type<_InputIterator>>,
710 class _Compare = less<__iterator_value_type<_InputIterator>>,
711 class _Container = vector<__iterator_value_type<_InputIterator>>,
710712 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
711 class = enable_if_t<!__is_allocator<_Compare>::value>,
712 class = enable_if_t<!__is_allocator<_Container>::value> >
713 class = enable_if_t<!__is_allocator_v<_Compare>>,
714 class = enable_if_t<!__is_allocator_v<_Container>>>
713715priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
714 -> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
716 -> priority_queue<__iterator_value_type<_InputIterator>, _Container, _Compare>;
715717
716718template <class _Compare,
717719 class _Container,
718720 class _Alloc,
719 class = enable_if_t<!__is_allocator<_Compare>::value>,
720 class = enable_if_t<!__is_allocator<_Container>::value>,
721 class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
721 class = enable_if_t<!__is_allocator_v<_Compare>>,
722 class = enable_if_t<!__is_allocator_v<_Container>>,
723 class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
722724priority_queue(_Compare, _Container, _Alloc) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
723725
724726template <class _InputIterator,
725727 class _Allocator,
726728 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
727 class = enable_if_t<__is_allocator<_Allocator>::value> >
729 class = enable_if_t<__is_allocator_v<_Allocator>>>
728730priority_queue(_InputIterator, _InputIterator, _Allocator)
729 -> priority_queue<__iter_value_type<_InputIterator>,
730 vector<__iter_value_type<_InputIterator>, _Allocator>,
731 less<__iter_value_type<_InputIterator>>>;
731 -> priority_queue<__iterator_value_type<_InputIterator>,
732 vector<__iterator_value_type<_InputIterator>, _Allocator>,
733 less<__iterator_value_type<_InputIterator>>>;
732734
733735template <class _InputIterator,
734736 class _Compare,
735737 class _Allocator,
736738 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
737 class = enable_if_t<!__is_allocator<_Compare>::value>,
738 class = enable_if_t<__is_allocator<_Allocator>::value> >
739 class = enable_if_t<!__is_allocator_v<_Compare>>,
740 class = enable_if_t<__is_allocator_v<_Allocator>>>
739741priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator)
740 -> priority_queue<__iter_value_type<_InputIterator>,
741 vector<__iter_value_type<_InputIterator>, _Allocator>,
742 -> priority_queue<__iterator_value_type<_InputIterator>,
743 vector<__iterator_value_type<_InputIterator>, _Allocator>,
742744 _Compare>;
743745
744746template <class _InputIterator,
......@@ -746,8 +748,8 @@ template <class _InputIterator,
746748 class _Container,
747749 class _Alloc,
748750 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
749 class = enable_if_t<!__is_allocator<_Compare>::value>,
750 class = enable_if_t<!__is_allocator<_Container>::value>,
751 class = enable_if_t<!__is_allocator_v<_Compare>>,
752 class = enable_if_t<!__is_allocator_v<_Container>>,
751753 class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
752754priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
753755 -> priority_queue<typename _Container::value_type, _Container, _Compare>;
......@@ -757,19 +759,19 @@ priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
757759
758760template <ranges::input_range _Range,
759761 class _Compare = less<ranges::range_value_t<_Range>>,
760 class = enable_if_t<!__is_allocator<_Compare>::value>>
762 class = enable_if_t<!__is_allocator_v<_Compare>>>
761763priority_queue(from_range_t, _Range&&, _Compare = _Compare())
762764 -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>>, _Compare>;
763765
764766template <ranges::input_range _Range,
765767 class _Compare,
766768 class _Alloc,
767 class = enable_if_t<!__is_allocator<_Compare>::value>,
768 class = enable_if_t<__is_allocator<_Alloc>::value>>
769 class = enable_if_t<!__is_allocator_v<_Compare>>,
770 class = enable_if_t<__is_allocator_v<_Alloc>>>
769771priority_queue(from_range_t, _Range&&, _Compare, _Alloc)
770772 -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>, _Compare>;
771773
772template <ranges::input_range _Range, class _Alloc, class = enable_if_t<__is_allocator<_Alloc>::value>>
774template <ranges::input_range _Range, class _Alloc, class = enable_if_t<__is_allocator_v<_Alloc>>>
773775priority_queue(from_range_t, _Range&&, _Alloc)
774776 -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>>;
775777
lib/libcxx/include/ranges+48
......@@ -116,6 +116,10 @@ namespace std::ranges {
116116 // [range.dangling], dangling iterator handling
117117 struct dangling;
118118
119 // [range.elementsof], class template elements_of
120 template<range R, class Allocator = allocator<byte>>
121 struct elements_of;
122
119123 template<range R>
120124 using borrowed_iterator_t = see below;
121125
......@@ -267,6 +271,11 @@ namespace std::ranges {
267271 template<class W, class Bound>
268272 inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
269273
274 namespace views {
275 inline constexpr unspecified iota = unspecified;
276 inline constexpr unspecified indices = unspecified; // Since C++26
277 }
278
270279 // [range.repeat], repeat view
271280 template<class T>
272281 concept integer-like-with-usable-difference-type = // exposition only
......@@ -339,6 +348,41 @@ namespace std::ranges {
339348
340349 namespace views { inline constexpr unspecified zip = unspecified; } // C++23
341350
351 // [range.zip.transform], zip transform view
352 template<move_constructible F, input_range... Views>
353 requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
354 regular_invocable<F&, range_reference_t<Views>...> &&
355 can-reference<invoke_result_t<F&, range_reference_t<Views>...>>
356 class zip_transform_view; // C++23
357
358 namespace views { inline constexpr unspecified zip_transform = unspecified; } // C++23
359
360 // [range.adjacent], adjacent view
361 template<forward_range V, size_t N>
362 requires view<V> && (N > 0)
363 class adjacent_view;
364
365 template<class V, size_t N>
366 constexpr bool enable_borrowed_range<adjacent_view<V, N>> =
367 enable_borrowed_range<V>;
368
369 namespace views {
370 template<size_t N>
371 constexpr unspecified adjacent = unspecified;
372 inline constexpr auto pairwise = adjacent<2>;
373 }
374
375 // [range.adjacent.transform], adjacent transform view
376 template<forward_range V, move_constructible F, size_t N>
377 requires see below
378 class adjacent_transform_view;
379
380 namespace views {
381 template<size_t N>
382 constexpr unspecified adjacent_transform = unspecified;
383 inline constexpr auto pairwise_transform = adjacent_transform<2>;
384 }
385
342386 // [range.as.rvalue]
343387 template <view V>
344388 requires input_range<V>
......@@ -404,6 +448,7 @@ namespace std {
404448# include <__ranges/data.h>
405449# include <__ranges/drop_view.h>
406450# include <__ranges/drop_while_view.h>
451# include <__ranges/elements_of.h>
407452# include <__ranges/elements_view.h>
408453# include <__ranges/empty.h>
409454# include <__ranges/empty_view.h>
......@@ -433,12 +478,15 @@ namespace std {
433478# endif
434479
435480# if _LIBCPP_STD_VER >= 23
481# include <__ranges/adjacent_transform_view.h>
482# include <__ranges/adjacent_view.h>
436483# include <__ranges/as_rvalue_view.h>
437484# include <__ranges/chunk_by_view.h>
438485# include <__ranges/from_range.h>
439486# include <__ranges/join_with_view.h>
440487# include <__ranges/repeat_view.h>
441488# include <__ranges/to.h>
489# include <__ranges/zip_transform_view.h>
442490# include <__ranges/zip_view.h>
443491# endif
444492
lib/libcxx/include/regex+33-31
......@@ -986,7 +986,7 @@ public:
986986 explicit regex_error(regex_constants::error_type __ecode);
987987 _LIBCPP_HIDE_FROM_ABI regex_error(const regex_error&) _NOEXCEPT = default;
988988 ~regex_error() _NOEXCEPT override;
989 _LIBCPP_HIDE_FROM_ABI regex_constants::error_type code() const { return __code_; }
989 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI regex_constants::error_type code() const { return __code_; }
990990};
991991
992992template <regex_constants::error_type _Ev>
......@@ -1004,7 +1004,7 @@ public:
10041004 typedef _CharT char_type;
10051005 typedef basic_string<char_type> string_type;
10061006 typedef locale locale_type;
1007# if defined(__BIONIC__) || defined(_NEWLIB_VERSION)
1007# if defined(__BIONIC__) || _LIBCPP_LIBC_NEWLIB
10081008 // Originally bionic's ctype_base used its own ctype masks because the
10091009 // builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
10101010 // was only 8 bits wide and already saturated, so it used a wider type here
......@@ -1013,9 +1013,7 @@ public:
10131013 // implementation, but this was not updated to match. Since then Android has
10141014 // needed to maintain a stable libc++ ABI, and this can't be changed without
10151015 // an ABI break.
1016 // We also need this workaround for newlib since _NEWLIB_VERSION is not
1017 // defined yet inside __config, so we can't set the
1018 // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is
1016 // We also need this workaround for newlib since newlib is
10191017 // often used for space constrained environments, so it makes sense not to
10201018 // duplicate the ctype table.
10211019 typedef uint16_t char_class_type;
......@@ -2120,7 +2118,7 @@ public:
21202118 __ranges_.push_back(
21212119 std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end())));
21222120 } else {
2123 if (__b.size() != 1 || __e.size() != 1)
2121 if (__b.size() != 1 || __e.size() != 1 || char_traits<typename string_type::value_type>::lt(__e[0], __b[0]))
21242122 std::__throw_regex_error<regex_constants::error_range>();
21252123 if (__icase_) {
21262124 __b[0] = __traits_.translate_nocase(__b[0]);
......@@ -2414,8 +2412,8 @@ public:
24142412# endif // _LIBCPP_CXX03_LANG
24152413
24162414 // const operations:
2417 _LIBCPP_HIDE_FROM_ABI unsigned mark_count() const { return __marked_count_; }
2418 _LIBCPP_HIDE_FROM_ABI flag_type flags() const { return __flags_; }
2415 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unsigned mark_count() const { return __marked_count_; }
2416 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI flag_type flags() const { return __flags_; }
24192417
24202418 // locale:
24212419 _LIBCPP_HIDE_FROM_ABI locale_type imbue(locale_type __loc) {
......@@ -2423,7 +2421,7 @@ public:
24232421 __start_.reset();
24242422 return __traits_.imbue(__loc);
24252423 }
2426 _LIBCPP_HIDE_FROM_ABI locale_type getloc() const { return __traits_.getloc(); }
2424 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI locale_type getloc() const { return __traits_.getloc(); }
24272425
24282426 // swap:
24292427 void swap(basic_regex& __r);
......@@ -4208,17 +4206,17 @@ public:
42084206
42094207 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR sub_match() : matched() {}
42104208
4211 _LIBCPP_HIDE_FROM_ABI difference_type length() const {
4209 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI difference_type length() const {
42124210 return matched ? std::distance(this->first, this->second) : 0;
42134211 }
4214 _LIBCPP_HIDE_FROM_ABI string_type str() const {
4212 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type str() const {
42154213 return matched ? string_type(this->first, this->second) : string_type();
42164214 }
42174215 _LIBCPP_HIDE_FROM_ABI operator string_type() const { return str(); }
42184216
4219 _LIBCPP_HIDE_FROM_ABI int compare(const sub_match& __s) const { return str().compare(__s.str()); }
4220 _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return str().compare(__s); }
4221 _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return str().compare(__s); }
4217 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int compare(const sub_match& __s) const { return str().compare(__s.str()); }
4218 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return str().compare(__s); }
4219 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return str().compare(__s); }
42224220
42234221 _LIBCPP_HIDE_FROM_ABI void swap(sub_match& __s) _NOEXCEPT_(__is_nothrow_swappable_v<_BidirectionalIterator>) {
42244222 this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s);
......@@ -4583,49 +4581,53 @@ public:
45834581 _LIBCPP_HIDE_FROM_ABI bool ready() const { return __ready_; }
45844582
45854583 // size:
4586 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __matches_.size(); }
4587 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __matches_.max_size(); }
4584 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __matches_.size(); }
4585 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __matches_.max_size(); }
45884586 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
45894587
45904588 // element access:
4591 _LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const {
4589 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const {
45924590 // If the match results are not ready, this will return `0`.
45934591 _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::length() called when not ready");
45944592 return (*this)[__sub].length();
45954593 }
4596 _LIBCPP_HIDE_FROM_ABI difference_type position(size_type __sub = 0) const {
4594 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI difference_type position(size_type __sub = 0) const {
45974595 // If the match results are not ready, this will return the result of subtracting two default-constructed iterators
45984596 // (which is typically a well-defined operation).
45994597 _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::position() called when not ready");
46004598 return std::distance(__position_start_, (*this)[__sub].first);
46014599 }
4602 _LIBCPP_HIDE_FROM_ABI string_type str(size_type __sub = 0) const {
4600 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type str(size_type __sub = 0) const {
46034601 // If the match results are not ready, this will return an empty string.
46044602 _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::str() called when not ready");
46054603 return (*this)[__sub].str();
46064604 }
4607 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const {
4605 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const {
46084606 // If the match results are not ready, this call will be equivalent to calling this function with `__n >= size()`,
46094607 // returning an empty subrange.
46104608 _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::operator[]() called when not ready");
46114609 return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
46124610 }
46134611
4614 _LIBCPP_HIDE_FROM_ABI const_reference prefix() const {
4612 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference prefix() const {
46154613 // If the match results are not ready, this will return a default-constructed empty `__suffix_`.
46164614 _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::prefix() called when not ready");
46174615 return __prefix_;
46184616 }
4619 _LIBCPP_HIDE_FROM_ABI const_reference suffix() const {
4617 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference suffix() const {
46204618 // If the match results are not ready, this will return a default-constructed empty `__suffix_`.
46214619 _LIBCPP_ASSERT_PEDANTIC(ready(), "match_results::suffix() called when not ready");
46224620 return __suffix_;
46234621 }
46244622
4625 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return empty() ? __matches_.end() : __matches_.begin(); }
4626 _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __matches_.end(); }
4627 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const { return empty() ? __matches_.end() : __matches_.begin(); }
4628 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const { return __matches_.end(); }
4623 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const {
4624 return empty() ? __matches_.end() : __matches_.begin();
4625 }
4626 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __matches_.end(); }
4627 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const {
4628 return empty() ? __matches_.end() : __matches_.begin();
4629 }
4630 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const { return __matches_.end(); }
46294631
46304632 // format:
46314633 template <class _OutputIter>
......@@ -4641,14 +4643,14 @@ public:
46414643 return format(__output_iter, __fmt.data(), __fmt.data() + __fmt.size(), __flags);
46424644 }
46434645 template <class _ST, class _SA>
4644 _LIBCPP_HIDE_FROM_ABI basic_string<char_type, _ST, _SA>
4646 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_string<char_type, _ST, _SA>
46454647 format(const basic_string<char_type, _ST, _SA>& __fmt,
46464648 regex_constants::match_flag_type __flags = regex_constants::format_default) const {
46474649 basic_string<char_type, _ST, _SA> __r;
46484650 format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(), __flags);
46494651 return __r;
46504652 }
4651 _LIBCPP_HIDE_FROM_ABI string_type
4653 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type
46524654 format(const char_type* __fmt, regex_constants::match_flag_type __flags = regex_constants::format_default) const {
46534655 string_type __r;
46544656 format(std::back_inserter(__r), __fmt, __fmt + char_traits<char_type>::length(__fmt), __flags);
......@@ -4656,7 +4658,7 @@ public:
46564658 }
46574659
46584660 // allocator:
4659 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return __matches_.get_allocator(); }
4661 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return __matches_.get_allocator(); }
46604662
46614663 // swap:
46624664 void swap(match_results& __m);
......@@ -5377,7 +5379,7 @@ public:
53775379 _LIBCPP_HIDE_FROM_ABI bool operator!=(const regex_iterator& __x) const { return !(*this == __x); }
53785380# endif
53795381
5380 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __match_; }
5382 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __match_; }
53815383 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return std::addressof(__match_); }
53825384
53835385 regex_iterator& operator++();
......@@ -5558,7 +5560,7 @@ public:
55585560 _LIBCPP_HIDE_FROM_ABI bool operator!=(const regex_token_iterator& __x) const { return !(*this == __x); }
55595561# endif
55605562
5561 _LIBCPP_HIDE_FROM_ABI const value_type& operator*() const { return *__result_; }
5563 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const value_type& operator*() const { return *__result_; }
55625564 _LIBCPP_HIDE_FROM_ABI const value_type* operator->() const { return __result_; }
55635565
55645566 regex_token_iterator& operator++();
lib/libcxx/include/scoped_allocator+16-11
......@@ -382,13 +382,17 @@ public:
382382 // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
383383 // ~scoped_allocator_adaptor() = default;
384384
385 _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return _Base::inner_allocator(); }
386 _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
385 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT {
386 return _Base::inner_allocator();
387 }
388 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
387389 return _Base::inner_allocator();
388390 }
389391
390 _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT { return _Base::outer_allocator(); }
391 _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
392 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
393 return _Base::outer_allocator();
394 }
395 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
392396 return _Base::outer_allocator();
393397 }
394398
......@@ -403,7 +407,7 @@ public:
403407 allocator_traits<outer_allocator_type>::deallocate(outer_allocator(), __p, __n);
404408 }
405409
406 _LIBCPP_HIDE_FROM_ABI size_type max_size() const {
410 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const {
407411 return allocator_traits<outer_allocator_type>::max_size(outer_allocator());
408412 }
409413
......@@ -434,10 +438,10 @@ public:
434438 piecewise_construct,
435439 __transform_tuple(typename __uses_alloc_ctor< _T1, inner_allocator_type&, _Args1... >::type(),
436440 std::move(__x),
437 typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
441 __index_sequence_for<_Args1...>()),
438442 __transform_tuple(typename __uses_alloc_ctor< _T2, inner_allocator_type&, _Args2... >::type(),
439443 std::move(__y),
440 typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
444 __index_sequence_for<_Args2...>()));
441445 }
442446
443447 template <class _T1, class _T2>
......@@ -473,7 +477,8 @@ public:
473477 allocator_traits<typename _OM::type>::destroy(_OM()(outer_allocator()), __p);
474478 }
475479
476 _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT {
480 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor
481 select_on_container_copy_construction() const _NOEXCEPT {
477482 return _Base::select_on_container_copy_construction();
478483 }
479484
......@@ -503,20 +508,20 @@ private:
503508
504509 template <class... _Args, size_t... _Idx>
505510 _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
506 __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
511 __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
507512 return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
508513 }
509514
510515 template <class... _Args, size_t... _Idx>
511516 _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
512 __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
517 __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
513518 using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
514519 return _Tup(allocator_arg, inner_allocator(), std::get<_Idx>(std::move(__t))...);
515520 }
516521
517522 template <class... _Args, size_t... _Idx>
518523 _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., inner_allocator_type&>
519 __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
524 __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
520525 using _Tup = tuple<_Args&&..., inner_allocator_type&>;
521526 return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
522527 }
lib/libcxx/include/semaphore+15-18
......@@ -55,12 +55,11 @@ using binary_semaphore = counting_semaphore<1>; // since C++20
5555# include <__assert>
5656# include <__atomic/atomic.h>
5757# include <__atomic/atomic_sync.h>
58# include <__atomic/atomic_sync_timed.h>
5859# include <__atomic/memory_order.h>
5960# include <__chrono/time_point.h>
6061# include <__cstddef/ptrdiff_t.h>
61# include <__thread/poll_with_backoff.h>
6262# include <__thread/support.h>
63# include <__thread/timed_backoff_policy.h>
6463# include <limits>
6564# include <version>
6665
......@@ -90,7 +89,7 @@ class __atomic_semaphore_base {
9089
9190public:
9291 _LIBCPP_HIDE_FROM_ABI constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) {}
93 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
92 _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
9493 auto __old = __a_.fetch_add(__update, memory_order_release);
9594 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
9695 __update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
......@@ -98,26 +97,26 @@ public:
9897 __a_.notify_all();
9998 }
10099 }
101 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() {
100 _LIBCPP_HIDE_FROM_ABI void acquire() {
102101 std::__atomic_wait_unless(__a_, memory_order_relaxed, [this](ptrdiff_t& __old) {
103102 return __try_acquire_impl(__old);
104103 });
105104 }
106105 template <class _Rep, class _Period>
107 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
108 try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
106 _LIBCPP_HIDE_FROM_ABI bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
109107 if (__rel_time == chrono::duration<_Rep, _Period>::zero())
110108 return try_acquire();
111 auto const __poll_fn = [this]() { return try_acquire(); };
112 return std::__libcpp_thread_poll_with_backoff(__poll_fn, __libcpp_timed_backoff_policy(), __rel_time);
109
110 return std::__atomic_wait_unless_with_timeout(
111 __a_, memory_order_relaxed, [this](ptrdiff_t& __old) { return __try_acquire_impl(__old); }, __rel_time);
113112 }
114 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() {
113 _LIBCPP_HIDE_FROM_ABI bool try_acquire() {
115114 auto __old = __a_.load(memory_order_relaxed);
116115 return __try_acquire_impl(__old);
117116 }
118117
119118private:
120 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __try_acquire_impl(ptrdiff_t& __old) {
119 _LIBCPP_HIDE_FROM_ABI bool __try_acquire_impl(ptrdiff_t& __old) {
121120 while (true) {
122121 if (__old == 0)
123122 return false;
......@@ -134,7 +133,7 @@ class counting_semaphore {
134133public:
135134 static_assert(__least_max_value >= 0, "The least maximum value must be a positive number");
136135
137 static constexpr ptrdiff_t max() noexcept { return __least_max_value; }
136 [[nodiscard]] static constexpr ptrdiff_t max() noexcept { return __least_max_value; }
138137
139138 _LIBCPP_HIDE_FROM_ABI constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) {
140139 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
......@@ -151,20 +150,18 @@ public:
151150 counting_semaphore(const counting_semaphore&) = delete;
152151 counting_semaphore& operator=(const counting_semaphore&) = delete;
153152
154 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
153 _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
155154 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "counting_semaphore:release called with a negative value");
156155 __semaphore_.release(__update);
157156 }
158 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); }
157 _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); }
159158 template <class _Rep, class _Period>
160 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
161 try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
159 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
162160 return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
163161 }
164 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() { return __semaphore_.try_acquire(); }
162 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool try_acquire() { return __semaphore_.try_acquire(); }
165163 template <class _Clock, class _Duration>
166 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
167 try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time) {
164 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time) {
168165 auto const __current = _Clock::now();
169166 if (__current >= __abs_time)
170167 return try_acquire();
lib/libcxx/include/set+220-192
......@@ -518,19 +518,19 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
518518# include <__algorithm/equal.h>
519519# include <__algorithm/lexicographical_compare.h>
520520# include <__algorithm/lexicographical_compare_three_way.h>
521# include <__algorithm/specialized_algorithms.h>
521522# include <__assert>
522523# include <__config>
523524# include <__functional/is_transparent.h>
524525# include <__functional/operations.h>
525# include <__fwd/set.h>
526526# include <__iterator/erase_if_container.h>
527527# include <__iterator/iterator_traits.h>
528# include <__iterator/ranges_iterator_traits.h>
529528# include <__iterator/reverse_iterator.h>
530529# include <__memory/allocator.h>
531530# include <__memory/allocator_traits.h>
532531# include <__memory_resource/polymorphic_allocator.h>
533532# include <__node_handle>
533# include <__ranges/access.h>
534534# include <__ranges/concepts.h>
535535# include <__ranges/container_compatible_range.h>
536536# include <__ranges/from_range.h>
......@@ -538,7 +538,6 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
538538# include <__type_traits/container_traits.h>
539539# include <__type_traits/enable_if.h>
540540# include <__type_traits/is_allocator.h>
541# include <__type_traits/is_nothrow_assignable.h>
542541# include <__type_traits/is_nothrow_constructible.h>
543542# include <__type_traits/is_same.h>
544543# include <__type_traits/is_swappable.h>
......@@ -570,7 +569,10 @@ _LIBCPP_PUSH_MACROS
570569
571570_LIBCPP_BEGIN_NAMESPACE_STD
572571
573template <class _Key, class _Compare, class _Allocator>
572template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
573class multiset;
574
575template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
574576class set {
575577public:
576578 // types:
......@@ -660,22 +662,20 @@ public:
660662 : set(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
661663# endif
662664
663 _LIBCPP_HIDE_FROM_ABI set(const set& __s) : __tree_(__s.__tree_) { insert(__s.begin(), __s.end()); }
665 _LIBCPP_HIDE_FROM_ABI set(const set& __s) = default;
664666
665667 _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) = default;
666668
667669# ifndef _LIBCPP_CXX03_LANG
668 _LIBCPP_HIDE_FROM_ABI set(set&& __s) noexcept(is_nothrow_move_constructible<__base>::value) = default;
670 _LIBCPP_HIDE_FROM_ABI set(set&& __s) = default;
669671# endif // _LIBCPP_CXX03_LANG
670672
671673 _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {}
672674
673 _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __a) : __tree_(__s.__tree_.value_comp(), __a) {
674 insert(__s.begin(), __s.end());
675 }
675 _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __alloc) : __tree_(__s.__tree_, __alloc) {}
676676
677677# ifndef _LIBCPP_CXX03_LANG
678 _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __a);
678 _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __alloc) : __tree_(std::move(__s.__tree_), __alloc) {}
679679
680680 _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
681681 : __tree_(__comp) {
......@@ -693,36 +693,38 @@ public:
693693# endif
694694
695695 _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) {
696 __tree_.__assign_unique(__il.begin(), __il.end());
696 clear();
697 insert(__il.begin(), __il.end());
697698 return *this;
698699 }
699700
700 _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) noexcept(is_nothrow_move_assignable<__base>::value) {
701 __tree_ = std::move(__s.__tree_);
702 return *this;
703 }
701 _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) = default;
704702# endif // _LIBCPP_CXX03_LANG
705703
706704 _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
707705
708 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
709 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
710 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
711 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
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(); }
712710
713 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
714 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
715 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
716 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
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 {
713 return const_reverse_iterator(end());
714 }
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 {
717 return const_reverse_iterator(begin());
718 }
717719
718 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
719 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
720 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
721 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
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(); }
722724
723725 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
724 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
725 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
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(); }
726728
727729 // modifiers:
728730# ifndef _LIBCPP_CXX03_LANG
......@@ -732,28 +734,24 @@ public:
732734 }
733735 template <class... _Args>
734736 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
735 return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...);
737 return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...).first;
736738 }
737739# endif // _LIBCPP_CXX03_LANG
738740
739741 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
740742 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
741 return __tree_.__emplace_hint_unique(__p, __v);
743 return __tree_.__emplace_hint_unique(__p, __v).first;
742744 }
743745
744746 template <class _InputIterator>
745 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
746 for (const_iterator __e = cend(); __f != __l; ++__f)
747 __tree_.__emplace_hint_unique(__e, *__f);
747 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
748 __tree_.__insert_range_unique(__first, __last);
748749 }
749750
750751# if _LIBCPP_STD_VER >= 23
751752 template <_ContainerCompatibleRange<value_type> _Range>
752753 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
753 const_iterator __end = cend();
754 for (auto&& __element : __range) {
755 __tree_.__emplace_hint_unique(__end, std::forward<decltype(__element)>(__element));
756 }
754 __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
757755 }
758756# endif
759757
......@@ -763,7 +761,7 @@ public:
763761 }
764762
765763 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
766 return __tree_.__emplace_hint_unique(__p, std::move(__v));
764 return __tree_.__emplace_hint_unique(__p, std::move(__v)).first;
767765 }
768766
769767 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
......@@ -785,10 +783,10 @@ public:
785783 "node_type with incompatible allocator passed to set::insert()");
786784 return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh));
787785 }
788 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
786 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
789787 return __tree_.template __node_handle_extract<node_type>(__key);
790788 }
791 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
789 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
792790 return __tree_.template __node_handle_extract<node_type>(__it);
793791 }
794792 template <class _Compare2>
......@@ -819,101 +817,120 @@ public:
819817
820818 _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); }
821819
822 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
823 _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
824 _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
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(); }
825823
826824 // set operations:
827 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
828 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
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); }
829827# if _LIBCPP_STD_VER >= 14
830828 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
831 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
829 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
832830 return __tree_.find(__k);
833831 }
834832 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
835 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
833 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
836834 return __tree_.find(__k);
837835 }
838836# endif
839837
840 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
838 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
839 return __tree_.__count_unique(__k);
840 }
841841# if _LIBCPP_STD_VER >= 14
842842 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
843 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
843 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
844844 return __tree_.__count_multi(__k);
845845 }
846846# endif
847847
848848# if _LIBCPP_STD_VER >= 20
849 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
849 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
850850 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
851 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
851 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
852852 return find(__k) != end();
853853 }
854854# endif // _LIBCPP_STD_VER >= 20
855855
856 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
857 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
856 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
857 return __tree_.__lower_bound_unique(__k);
858 }
859
860 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
861 return __tree_.__lower_bound_unique(__k);
862 }
863
864 // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to
865 // match multiple elements.
858866# if _LIBCPP_STD_VER >= 14
859867 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
860 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
861 return __tree_.lower_bound(__k);
868 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
869 return __tree_.__lower_bound_multi(__k);
862870 }
863871
864872 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
865 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
866 return __tree_.lower_bound(__k);
873 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
874 return __tree_.__lower_bound_multi(__k);
867875 }
868876# endif
869877
870 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
871 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
878 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
879 return __tree_.__upper_bound_unique(__k);
880 }
881
882 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
883 return __tree_.__upper_bound_unique(__k);
884 }
885
872886# if _LIBCPP_STD_VER >= 14
873887 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
874 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
875 return __tree_.upper_bound(__k);
888 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
889 return __tree_.__upper_bound_multi(__k);
876890 }
877891 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
878 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
879 return __tree_.upper_bound(__k);
892 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
893 return __tree_.__upper_bound_multi(__k);
880894 }
881895# endif
882896
883 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
897 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
884898 return __tree_.__equal_range_unique(__k);
885899 }
886 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
900 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
887901 return __tree_.__equal_range_unique(__k);
888902 }
889903# if _LIBCPP_STD_VER >= 14
890904 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
891 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
905 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
892906 return __tree_.__equal_range_multi(__k);
893907 }
894908 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
895 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
909 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
896910 return __tree_.__equal_range_multi(__k);
897911 }
898912# endif
913
914 template <class, class...>
915 friend struct __specialized_algorithm;
899916};
900917
901918# if _LIBCPP_STD_VER >= 17
902919template <class _InputIterator,
903 class _Compare = less<__iter_value_type<_InputIterator>>,
904 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
920 class _Compare = less<__iterator_value_type<_InputIterator>>,
921 class _Allocator = allocator<__iterator_value_type<_InputIterator>>,
905922 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
906 class = enable_if_t<__is_allocator<_Allocator>::value, void>,
907 class = enable_if_t<!__is_allocator<_Compare>::value, void>>
923 class = enable_if_t<__is_allocator_v<_Allocator>>,
924 class = enable_if_t<!__is_allocator_v<_Compare>>>
908925set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
909 -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
926 -> set<__iterator_value_type<_InputIterator>, _Compare, _Allocator>;
910927
911928# if _LIBCPP_STD_VER >= 23
912929template <ranges::input_range _Range,
913930 class _Compare = less<ranges::range_value_t<_Range>>,
914931 class _Allocator = allocator<ranges::range_value_t<_Range>>,
915 class = enable_if_t<__is_allocator<_Allocator>::value, void>,
916 class = enable_if_t<!__is_allocator<_Compare>::value, void>>
932 class = enable_if_t<__is_allocator_v<_Allocator>>,
933 class = enable_if_t<!__is_allocator_v<_Compare>>>
917934set(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
918935 -> set<ranges::range_value_t<_Range>, _Compare, _Allocator>;
919936# endif
......@@ -921,41 +938,43 @@ set(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
921938template <class _Key,
922939 class _Compare = less<_Key>,
923940 class _Allocator = allocator<_Key>,
924 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
925 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
941 class = enable_if_t<!__is_allocator_v<_Compare>>,
942 class = enable_if_t<__is_allocator_v<_Allocator>>>
926943set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) -> set<_Key, _Compare, _Allocator>;
927944
928945template <class _InputIterator,
929946 class _Allocator,
930947 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
931 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
932set(_InputIterator,
933 _InputIterator,
934 _Allocator) -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
948 class = enable_if_t<__is_allocator_v<_Allocator>>>
949set(_InputIterator, _InputIterator, _Allocator)
950 -> set<__iterator_value_type<_InputIterator>, less<__iterator_value_type<_InputIterator>>, _Allocator>;
935951
936952# if _LIBCPP_STD_VER >= 23
937template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
938set(from_range_t,
939 _Range&&,
940 _Allocator) -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
953template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
954set(from_range_t, _Range&&, _Allocator)
955 -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
941956# endif
942957
943template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
958template <class _Key, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
944959set(initializer_list<_Key>, _Allocator) -> set<_Key, less<_Key>, _Allocator>;
945960# endif
946961
947# ifndef _LIBCPP_CXX03_LANG
962# if _LIBCPP_STD_VER >= 14
963template <class _Alg, class _Key, class _Compare, class _Allocator>
964struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocator>>> {
965 using __set _LIBCPP_NODEBUG = set<_Key, _Compare, _Allocator>;
948966
949template <class _Key, class _Compare, class _Allocator>
950set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {
951 if (__a != __s.get_allocator()) {
952 const_iterator __e = cend();
953 while (!__s.empty())
954 insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
955 }
956}
967 static const bool __has_algorithm =
968 __specialized_algorithm<_Alg, __single_range<typename __set::__base>>::__has_algorithm;
957969
958# endif // _LIBCPP_CXX03_LANG
970 // set's begin() and end() are identical with and without const qualification
971 template <class... _Args>
972 _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) {
973 return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()(
974 __set.__tree_, std::forward<_Args>(__args)...);
975 }
976};
977# endif
959978
960979template <class _Key, class _Compare, class _Allocator>
961980inline _LIBCPP_HIDE_FROM_ABI bool
......@@ -1119,24 +1138,17 @@ public:
11191138 : multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
11201139# endif
11211140
1122 _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s)
1123 : __tree_(__s.__tree_.value_comp(),
1124 __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) {
1125 insert(__s.begin(), __s.end());
1126 }
1141 _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s) = default;
11271142
11281143 _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) = default;
11291144
11301145# ifndef _LIBCPP_CXX03_LANG
1131 _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) noexcept(is_nothrow_move_constructible<__base>::value) = default;
1146 _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) = default;
11321147
1133 _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a);
1148 _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {}
11341149# endif // _LIBCPP_CXX03_LANG
11351150 _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {}
1136 _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a)
1137 : __tree_(__s.__tree_.value_comp(), __a) {
1138 insert(__s.begin(), __s.end());
1139 }
1151 _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a) : __tree_(__s.__tree_, __a) {}
11401152
11411153# ifndef _LIBCPP_CXX03_LANG
11421154 _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
......@@ -1156,38 +1168,40 @@ public:
11561168# endif
11571169
11581170 _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) {
1159 __tree_.__assign_multi(__il.begin(), __il.end());
1171 clear();
1172 insert(__il.begin(), __il.end());
11601173 return *this;
11611174 }
11621175
1163 _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
1164 __tree_ = std::move(__s.__tree_);
1165 return *this;
1166 }
1176 _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) = default;
11671177# endif // _LIBCPP_CXX03_LANG
11681178
11691179 _LIBCPP_HIDE_FROM_ABI ~multiset() {
11701180 static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
11711181 }
11721182
1173 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
1174 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
1175 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
1176 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
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(); }
11771187
1178 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
1179 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
1180 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
1181 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
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 {
1190 return const_reverse_iterator(end());
1191 }
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 {
1194 return const_reverse_iterator(begin());
1195 }
11821196
1183 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
1184 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
1185 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
1186 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
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(); }
11871201
11881202 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
1189 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
1190 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
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(); }
11911205
11921206 // modifiers:
11931207# ifndef _LIBCPP_CXX03_LANG
......@@ -1207,18 +1221,14 @@ public:
12071221 }
12081222
12091223 template <class _InputIterator>
1210 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
1211 for (const_iterator __e = cend(); __f != __l; ++__f)
1212 __tree_.__emplace_hint_multi(__e, *__f);
1224 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
1225 __tree_.__insert_range_multi(__first, __last);
12131226 }
12141227
12151228# if _LIBCPP_STD_VER >= 23
12161229 template <_ContainerCompatibleRange<value_type> _Range>
12171230 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
1218 const_iterator __end = cend();
1219 for (auto&& __element : __range) {
1220 __tree_.__emplace_hint_multi(__end, std::forward<decltype(__element)>(__element));
1221 }
1231 __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range));
12221232 }
12231233# endif
12241234
......@@ -1248,10 +1258,10 @@ public:
12481258 "node_type with incompatible allocator passed to multiset::insert()");
12491259 return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
12501260 }
1251 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
12521262 return __tree_.template __node_handle_extract<node_type>(__key);
12531263 }
1254 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1264 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
12551265 return __tree_.template __node_handle_extract<node_type>(__it);
12561266 }
12571267 template <class _Compare2>
......@@ -1284,101 +1294,118 @@ public:
12841294 __tree_.swap(__s.__tree_);
12851295 }
12861296
1287 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
1288 _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
1289 _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
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(); }
12901300
12911301 // set operations:
1292 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
1293 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
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); }
12941304# if _LIBCPP_STD_VER >= 14
12951305 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1296 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1306 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
12971307 return __tree_.find(__k);
12981308 }
12991309 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1300 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1310 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
13011311 return __tree_.find(__k);
13021312 }
13031313# endif
13041314
1305 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
1315 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1316 return __tree_.__count_multi(__k);
1317 }
13061318# if _LIBCPP_STD_VER >= 14
13071319 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1308 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1320 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
13091321 return __tree_.__count_multi(__k);
13101322 }
13111323# endif
13121324
13131325# if _LIBCPP_STD_VER >= 20
1314 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1326 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
13151327 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1316 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1328 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
13171329 return find(__k) != end();
13181330 }
13191331# endif // _LIBCPP_STD_VER >= 20
13201332
1321 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
1322 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
1333 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
1334 return __tree_.__lower_bound_multi(__k);
1335 }
1336
1337 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
1338 return __tree_.__lower_bound_multi(__k);
1339 }
1340
13231341# if _LIBCPP_STD_VER >= 14
13241342 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1325 _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1326 return __tree_.lower_bound(__k);
1343 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1344 return __tree_.__lower_bound_multi(__k);
13271345 }
13281346
13291347 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1330 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1331 return __tree_.lower_bound(__k);
1348 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1349 return __tree_.__lower_bound_multi(__k);
13321350 }
13331351# endif
13341352
1335 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
1336 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
1353 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
1354 return __tree_.__upper_bound_multi(__k);
1355 }
1356
1357 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
1358 return __tree_.__upper_bound_multi(__k);
1359 }
1360
13371361# if _LIBCPP_STD_VER >= 14
13381362 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1339 _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1340 return __tree_.upper_bound(__k);
1363 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1364 return __tree_.__upper_bound_multi(__k);
13411365 }
13421366 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1343 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1344 return __tree_.upper_bound(__k);
1367 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1368 return __tree_.__upper_bound_multi(__k);
13451369 }
13461370# endif
13471371
1348 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1372 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
13491373 return __tree_.__equal_range_multi(__k);
13501374 }
1351 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1375 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
13521376 return __tree_.__equal_range_multi(__k);
13531377 }
13541378# if _LIBCPP_STD_VER >= 14
13551379 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1356 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1380 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
13571381 return __tree_.__equal_range_multi(__k);
13581382 }
13591383 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1360 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1384 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
13611385 return __tree_.__equal_range_multi(__k);
13621386 }
13631387# endif
1388
1389 template <class, class...>
1390 friend struct __specialized_algorithm;
13641391};
13651392
13661393# if _LIBCPP_STD_VER >= 17
13671394template <class _InputIterator,
1368 class _Compare = less<__iter_value_type<_InputIterator>>,
1369 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
1395 class _Compare = less<__iterator_value_type<_InputIterator>>,
1396 class _Allocator = allocator<__iterator_value_type<_InputIterator>>,
13701397 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
1371 class = enable_if_t<__is_allocator<_Allocator>::value, void>,
1372 class = enable_if_t<!__is_allocator<_Compare>::value, void>>
1398 class = enable_if_t<__is_allocator_v<_Allocator>>,
1399 class = enable_if_t<!__is_allocator_v<_Compare>>>
13731400multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1374 -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
1401 -> multiset<__iterator_value_type<_InputIterator>, _Compare, _Allocator>;
13751402
13761403# if _LIBCPP_STD_VER >= 23
13771404template <ranges::input_range _Range,
13781405 class _Compare = less<ranges::range_value_t<_Range>>,
13791406 class _Allocator = allocator<ranges::range_value_t<_Range>>,
1380 class = enable_if_t<__is_allocator<_Allocator>::value, void>,
1381 class = enable_if_t<!__is_allocator<_Compare>::value, void>>
1407 class = enable_if_t<__is_allocator_v<_Allocator>>,
1408 class = enable_if_t<!__is_allocator_v<_Compare>>>
13821409multiset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
13831410 -> multiset<ranges::range_value_t<_Range>, _Compare, _Allocator>;
13841411# endif
......@@ -1386,43 +1413,44 @@ multiset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator(
13861413template <class _Key,
13871414 class _Compare = less<_Key>,
13881415 class _Allocator = allocator<_Key>,
1389 class = enable_if_t<__is_allocator<_Allocator>::value, void>,
1390 class = enable_if_t<!__is_allocator<_Compare>::value, void>>
1391multiset(initializer_list<_Key>,
1392 _Compare = _Compare(),
1393 _Allocator = _Allocator()) -> multiset<_Key, _Compare, _Allocator>;
1416 class = enable_if_t<__is_allocator_v<_Allocator>>,
1417 class = enable_if_t<!__is_allocator_v<_Compare>>>
1418multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
1419 -> multiset<_Key, _Compare, _Allocator>;
13941420
13951421template <class _InputIterator,
13961422 class _Allocator,
13971423 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
1398 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1424 class = enable_if_t<__is_allocator_v<_Allocator>>>
13991425multiset(_InputIterator, _InputIterator, _Allocator)
1400 -> multiset<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
1426 -> multiset<__iterator_value_type<_InputIterator>, less<__iterator_value_type<_InputIterator>>, _Allocator>;
14011427
14021428# if _LIBCPP_STD_VER >= 23
1403template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1404multiset(from_range_t,
1405 _Range&&,
1406 _Allocator) -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
1429template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
1430multiset(from_range_t, _Range&&, _Allocator)
1431 -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
14071432# endif
14081433
1409template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1434template <class _Key, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
14101435multiset(initializer_list<_Key>, _Allocator) -> multiset<_Key, less<_Key>, _Allocator>;
14111436# endif
14121437
1413# ifndef _LIBCPP_CXX03_LANG
1438# if _LIBCPP_STD_VER >= 14
1439template <class _Alg, class _Key, class _Compare, class _Allocator>
1440struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Allocator>>> {
1441 using __set _LIBCPP_NODEBUG = multiset<_Key, _Compare, _Allocator>;
14141442
1415template <class _Key, class _Compare, class _Allocator>
1416multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
1417 : __tree_(std::move(__s.__tree_), __a) {
1418 if (__a != __s.get_allocator()) {
1419 const_iterator __e = cend();
1420 while (!__s.empty())
1421 insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
1422 }
1423}
1443 static const bool __has_algorithm =
1444 __specialized_algorithm<_Alg, __single_range<typename __set::__base>>::__has_algorithm;
14241445
1425# endif // _LIBCPP_CXX03_LANG
1446 // set's begin() and end() are identical with and without const qualification
1447 template <class... _Args>
1448 _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) {
1449 return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()(
1450 __set.__tree_, std::forward<_Args>(__args)...);
1451 }
1452};
1453# endif
14261454
14271455template <class _Key, class _Compare, class _Allocator>
14281456inline _LIBCPP_HIDE_FROM_ABI bool
lib/libcxx/include/shared_mutex+3-8
......@@ -138,6 +138,7 @@ template <class Mutex>
138138# include <__mutex/tag_types.h>
139139# include <__mutex/unique_lock.h>
140140# include <__system_error/throw_system_error.h>
141# include <__utility/move.h>
141142# include <__utility/swap.h>
142143# include <cerrno>
143144# include <version>
......@@ -340,14 +341,8 @@ public:
340341 }
341342
342343 _LIBCPP_HIDE_FROM_ABI shared_lock& operator=(shared_lock&& __u) _NOEXCEPT {
343 if (__owns_)
344 __m_->unlock_shared();
345 __m_ = nullptr;
346 __owns_ = false;
347 __m_ = __u.__m_;
348 __owns_ = __u.__owns_;
349 __u.__m_ = nullptr;
350 __u.__owns_ = false;
344 if (this != std::addressof(__u))
345 shared_lock(std::move(__u)).swap(*this);
351346 return *this;
352347 }
353348
lib/libcxx/include/span+53-37
......@@ -310,30 +310,32 @@ public:
310310 }
311311
312312 template <size_t _Count>
313 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
313 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
314314 static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
315315 return span<element_type, _Count>{data(), _Count};
316316 }
317317
318318 template <size_t _Count>
319 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
319 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
320320 static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
321321 return span<element_type, _Count>{data() + size() - _Count, _Count};
322322 }
323323
324 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
324 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
325 first(size_type __count) const noexcept {
325326 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of range");
326327 return {data(), __count};
327328 }
328329
329 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
330 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
331 last(size_type __count) const noexcept {
330332 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of range");
331333 return {data() + size() - __count, __count};
332334 }
333335
334336 template <size_t _Offset, size_t _Count = dynamic_extent>
335 _LIBCPP_HIDE_FROM_ABI constexpr auto
336 subspan() const noexcept -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
337 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto subspan() const noexcept
338 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
337339 static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
338340 static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
339341 "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
......@@ -342,7 +344,7 @@ public:
342344 return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
343345 }
344346
345 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
347 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
346348 subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
347349 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
348350 if (__count == dynamic_extent)
......@@ -352,52 +354,58 @@ public:
352354 return {data() + __offset, __count};
353355 }
354356
355 _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
356 _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
357 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
358 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept {
359 return _Extent * sizeof(element_type);
360 }
357361 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return _Extent == 0; }
358362
359 _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
363 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
360364 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of range");
361365 return __data_[__idx];
362366 }
363367
364368# if _LIBCPP_STD_VER >= 26
365 _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
369 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
366370 if (__index >= size())
367371 std::__throw_out_of_range("span");
368372 return __data_[__index];
369373 }
370374# endif
371375
372 _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
376 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
373377 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
374378 return __data_[0];
375379 }
376380
377 _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
381 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
378382 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
379383 return __data_[size() - 1];
380384 }
381385
382 _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
386 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
383387
384388 // [span.iter], span iterator support
385 _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
389 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
386390# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
387391 return std::__make_bounded_iter(data(), data(), data() + size());
388392# else
389393 return iterator(data());
390394# endif
391395 }
392 _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
396 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
393397# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
394398 return std::__make_bounded_iter(data() + size(), data(), data() + size());
395399# else
396400 return iterator(data() + size());
397401# endif
398402 }
399 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
400 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
403 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept {
404 return reverse_iterator(end());
405 }
406 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept {
407 return reverse_iterator(begin());
408 }
401409
402410 _LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept {
403411 return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte*>(data()), size_bytes()};
......@@ -478,36 +486,38 @@ public:
478486 : __data_{__other.data()}, __size_{__other.size()} {}
479487
480488 template <size_t _Count>
481 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
489 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
482490 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range");
483491 return span<element_type, _Count>{data(), _Count};
484492 }
485493
486494 template <size_t _Count>
487 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
495 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
488496 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range");
489497 return span<element_type, _Count>{data() + size() - _Count, _Count};
490498 }
491499
492 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
500 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
501 first(size_type __count) const noexcept {
493502 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range");
494503 return {data(), __count};
495504 }
496505
497 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
506 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
507 last(size_type __count) const noexcept {
498508 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
499509 return {data() + size() - __count, __count};
500510 }
501511
502512 template <size_t _Offset, size_t _Count = dynamic_extent>
503 _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> subspan() const noexcept {
513 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> subspan() const noexcept {
504514 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
505515 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
506516 "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
507517 return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
508518 }
509519
510 constexpr span<element_type, dynamic_extent> _LIBCPP_HIDE_FROM_ABI
520 [[nodiscard]] constexpr span<element_type, dynamic_extent> _LIBCPP_HIDE_FROM_ABI
511521 subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
512522 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
513523 if (__count == dynamic_extent)
......@@ -517,52 +527,58 @@ public:
517527 return {data() + __offset, __count};
518528 }
519529
520 _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
521 _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); }
530 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
531 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept {
532 return __size_ * sizeof(element_type);
533 }
522534 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return __size_ == 0; }
523535
524 _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
536 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
525537 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of range");
526538 return __data_[__idx];
527539 }
528540
529541# if _LIBCPP_STD_VER >= 26
530 _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
542 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
531543 if (__index >= size())
532544 std::__throw_out_of_range("span");
533545 return __data_[__index];
534546 }
535547# endif
536548
537 _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
549 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
538550 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
539551 return __data_[0];
540552 }
541553
542 _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
554 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
543555 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
544556 return __data_[size() - 1];
545557 }
546558
547 _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
559 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
548560
549561 // [span.iter], span iterator support
550 _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
562 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
551563# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
552564 return std::__make_bounded_iter(data(), data(), data() + size());
553565# else
554566 return iterator(data());
555567# endif
556568 }
557 _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
569 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
558570# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
559571 return std::__make_bounded_iter(data() + size(), data(), data() + size());
560572# else
561573 return iterator(data() + size());
562574# endif
563575 }
564 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
565 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
576 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept {
577 return reverse_iterator(end());
578 }
579 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept {
580 return reverse_iterator(begin());
581 }
566582
567583 _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept {
568584 return {reinterpret_cast<const byte*>(data()), size_bytes()};
......@@ -585,13 +601,13 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
585601
586602// as_bytes & as_writable_bytes
587603template <class _Tp, size_t _Extent>
588_LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
604[[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
589605 return __s.__as_bytes();
590606}
591607
592608template <class _Tp, size_t _Extent>
593609 requires(!is_const_v<_Tp>)
594_LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
610[[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
595611 return __s.__as_writable_bytes();
596612}
597613
lib/libcxx/include/sstream+34-28
......@@ -461,15 +461,15 @@ public:
461461 // [stringbuf.members] Member functions:
462462
463463# if _LIBCPP_STD_VER >= 20
464 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
464 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
465465# endif
466466
467467# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
468 string_type str() const;
468 [[__nodiscard__]] string_type str() const;
469469# else
470 _LIBCPP_HIDE_FROM_ABI string_type str() const& { return str(__str_.get_allocator()); }
470 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() const& { return str(__str_.get_allocator()); }
471471
472 _LIBCPP_HIDE_FROM_ABI string_type str() && {
472 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() && {
473473 const basic_string_view<_CharT, _Traits> __view = view();
474474 typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data();
475475 // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator());
......@@ -484,12 +484,12 @@ public:
484484
485485# if _LIBCPP_STD_VER >= 20
486486 template <class _SAlloc>
487 requires __is_allocator<_SAlloc>::value
488 _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
487 requires __is_allocator_v<_SAlloc>
488 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
489489 return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
490490 }
491491
492 _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
492 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
493493# endif // _LIBCPP_STD_VER >= 20
494494
495495 void str(const string_type& __s) {
......@@ -949,26 +949,28 @@ public:
949949 }
950950
951951 // [istringstream.members] Member functions:
952 _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
952 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
953953 return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(std::addressof(__sb_));
954954 }
955955
956956# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
957 _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
957 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
958958# else
959 _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); }
959 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); }
960960
961 _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); }
961 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); }
962962# endif
963963
964964# if _LIBCPP_STD_VER >= 20
965965 template <class _SAlloc>
966 requires __is_allocator<_SAlloc>::value
967 _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
966 requires __is_allocator_v<_SAlloc>
967 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
968968 return __sb_.str(__sa);
969969 }
970970
971 _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
971 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept {
972 return __sb_.view();
973 }
972974# endif // _LIBCPP_STD_VER >= 20
973975
974976 _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
......@@ -1087,26 +1089,28 @@ public:
10871089 }
10881090
10891091 // [ostringstream.members] Member functions:
1090 _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
1092 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
10911093 return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(std::addressof(__sb_));
10921094 }
10931095
10941096# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
1095 _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
1097 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
10961098# else
1097 _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); }
1099 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); }
10981100
1099 _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); }
1101 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); }
11001102# endif
11011103
11021104# if _LIBCPP_STD_VER >= 20
11031105 template <class _SAlloc>
1104 requires __is_allocator<_SAlloc>::value
1105 _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
1106 requires __is_allocator_v<_SAlloc>
1107 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
11061108 return __sb_.str(__sa);
11071109 }
11081110
1109 _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
1111 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept {
1112 return __sb_.view();
1113 }
11101114# endif // _LIBCPP_STD_VER >= 20
11111115
11121116 _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
......@@ -1227,26 +1231,28 @@ public:
12271231 }
12281232
12291233 // [stringstream.members] Member functions:
1230 _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
1234 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
12311235 return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(std::addressof(__sb_));
12321236 }
12331237
12341238# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
1235 _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
1239 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
12361240# else
1237 _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); }
1241 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); }
12381242
1239 _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); }
1243 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); }
12401244# endif
12411245
12421246# if _LIBCPP_STD_VER >= 20
12431247 template <class _SAlloc>
1244 requires __is_allocator<_SAlloc>::value
1245 _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
1248 requires __is_allocator_v<_SAlloc>
1249 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
12461250 return __sb_.str(__sa);
12471251 }
12481252
1249 _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
1253 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept {
1254 return __sb_.view();
1255 }
12501256# endif // _LIBCPP_STD_VER >= 20
12511257
12521258 _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
lib/libcxx/include/stack+13-15
......@@ -235,9 +235,9 @@ public:
235235# endif
236236
237237 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
238 _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
239 _LIBCPP_HIDE_FROM_ABI reference top() { return c.back(); }
240 _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.back(); }
238 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
239 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference top() { return c.back(); }
240 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.back(); }
241241
242242 _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v) { c.push_back(__v); }
243243# ifndef _LIBCPP_CXX03_LANG
......@@ -294,19 +294,19 @@ public:
294294};
295295
296296# if _LIBCPP_STD_VER >= 17
297template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
297template <class _Container, class = enable_if_t<!__is_allocator_v<_Container>>>
298298stack(_Container) -> stack<typename _Container::value_type, _Container>;
299299
300300template <class _Container,
301301 class _Alloc,
302 class = enable_if_t<!__is_allocator<_Container>::value>,
302 class = enable_if_t<!__is_allocator_v<_Container>>,
303303 class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
304304stack(_Container, _Alloc) -> stack<typename _Container::value_type, _Container>;
305305# endif
306306
307307# if _LIBCPP_STD_VER >= 23
308308template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
309stack(_InputIterator, _InputIterator) -> stack<__iter_value_type<_InputIterator>>;
309stack(_InputIterator, _InputIterator) -> stack<__iterator_value_type<_InputIterator>>;
310310
311311template <ranges::input_range _Range>
312312stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>;
......@@ -314,15 +314,13 @@ stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>;
314314template <class _InputIterator,
315315 class _Alloc,
316316 __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
317 __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
318stack(_InputIterator,
319 _InputIterator,
320 _Alloc) -> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
321
322template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
323stack(from_range_t,
324 _Range&&,
325 _Alloc) -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
317 __enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
318stack(_InputIterator, _InputIterator, _Alloc)
319 -> stack<__iterator_value_type<_InputIterator>, deque<__iterator_value_type<_InputIterator>, _Alloc>>;
320
321template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
322stack(from_range_t, _Range&&, _Alloc)
323 -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
326324
327325# endif
328326
lib/libcxx/include/stddef.h+10-10
......@@ -25,24 +25,24 @@ Types:
2525*/
2626
2727#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
28# include <__cxx03/stddef.h>
28# include <__cxx03/__config>
2929#else
3030# include <__config>
31#endif
3132
32# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
33# pragma GCC system_header
34# endif
33#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
34# pragma GCC system_header
35#endif
3536
3637// Note: This include is outside of header guards because we sometimes get included multiple times
3738// with different defines and the underlying <stddef.h> will know how to deal with that.
38# include_next <stddef.h>
39#include_next <stddef.h>
3940
40# ifndef _LIBCPP_STDDEF_H
41# define _LIBCPP_STDDEF_H
41#ifndef _LIBCPP_STDDEF_H
42# define _LIBCPP_STDDEF_H
4243
43# ifdef __cplusplus
44# ifdef __cplusplus
4445typedef decltype(nullptr) nullptr_t;
45# endif
46# endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
46# endif
4747
4848#endif // _LIBCPP_STDDEF_H
lib/libcxx/include/stdexcept+2-2
......@@ -91,7 +91,7 @@ public:
9191
9292 ~logic_error() _NOEXCEPT override;
9393
94 const char* what() const _NOEXCEPT override;
94 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
9595# else
9696
9797public:
......@@ -115,7 +115,7 @@ public:
115115
116116 ~runtime_error() _NOEXCEPT override;
117117
118 const char* what() const _NOEXCEPT override;
118 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
119119# else
120120
121121public:
lib/libcxx/include/stdio.h+20-21
......@@ -88,35 +88,34 @@ void perror(const char* s);
8888*/
8989
9090#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
91# include <__cxx03/stdio.h>
91# include <__cxx03/__config>
9292#else
9393# include <__config>
94#endif
9495
95# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
96# pragma GCC system_header
97# endif
96#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
97# pragma GCC system_header
98#endif
9899
99100// The inclusion of the system's <stdio.h> is intentionally done once outside of any include
100101// guards because some code expects to be able to include the underlying system header multiple
101102// times to get different definitions based on the macros that are set before inclusion.
102# if __has_include_next(<stdio.h>)
103# include_next <stdio.h>
104# endif
103#if __has_include_next(<stdio.h>)
104# include_next <stdio.h>
105#endif
105106
106# ifndef _LIBCPP_STDIO_H
107# define _LIBCPP_STDIO_H
107#ifndef _LIBCPP_STDIO_H
108# define _LIBCPP_STDIO_H
108109
109# ifdef __cplusplus
110# ifdef __cplusplus
110111
111# undef getc
112# undef putc
113# undef clearerr
114# undef feof
115# undef ferror
116# undef putchar
117# undef getchar
112# undef getc
113# undef putc
114# undef clearerr
115# undef feof
116# undef ferror
117# undef putchar
118# undef getchar
118119
119# endif // __cplusplus
120# endif // _LIBCPP_STDIO_H
121
122#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
120# endif // __cplusplus
121#endif // _LIBCPP_STDIO_H
lib/libcxx/include/streambuf+59-19
......@@ -119,6 +119,7 @@ protected:
119119# include <__locale>
120120# include <__type_traits/is_same.h>
121121# include <__utility/is_valid_range.h>
122# include <__utility/scope_guard.h>
122123# include <climits>
123124# include <ios>
124125# include <iosfwd>
......@@ -149,47 +150,56 @@ public:
149150 virtual ~basic_streambuf() {}
150151
151152 // 27.6.2.2.1 locales:
152 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 locale pubimbue(const locale& __loc) {
153 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 locale pubimbue(const locale& __loc) {
153154 imbue(__loc);
154155 locale __r = __loc_;
155156 __loc_ = __loc;
156157 return __r;
157158 }
158159
159 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 locale getloc() const { return __loc_; }
160 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 locale getloc() const { return __loc_; }
160161
161162 // 27.6.2.2.2 buffer and positioning:
162 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) {
163 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) {
163164 return setbuf(__s, __n);
164165 }
165166
166 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type
167 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 pos_type
167168 pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) {
168169 return seekoff(__off, __way, __which);
169170 }
170171
171 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type
172 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 pos_type
172173 pubseekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) {
173174 return seekpos(__sp, __which);
174175 }
175176
176 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int pubsync() { return sync(); }
177 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int pubsync() { return sync(); }
177178
178179 // Get and put areas:
179180 // 27.6.2.2.3 Get area:
180 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize in_avail() {
181 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 streamsize in_avail() {
182 __check_invariants();
183 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
184
181185 if (gptr() < egptr())
182186 return static_cast<streamsize>(egptr() - gptr());
183187 return showmanyc();
184188 }
185189
186 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type snextc() {
190 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int_type snextc() {
191 __check_invariants();
192 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
193
187194 if (sbumpc() == traits_type::eof())
188195 return traits_type::eof();
189196 return sgetc();
190197 }
191198
192 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sbumpc() {
199 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int_type sbumpc() {
200 __check_invariants();
201 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
202
193203 if (gptr() == egptr())
194204 return uflow();
195205 int_type __c = traits_type::to_int_type(*gptr());
......@@ -197,23 +207,32 @@ public:
197207 return __c;
198208 }
199209
200 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sgetc() {
210 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int_type sgetc() {
211 __check_invariants();
212 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
213
201214 if (gptr() == egptr())
202215 return underflow();
203216 return traits_type::to_int_type(*gptr());
204217 }
205218
206 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize sgetn(char_type* __s, streamsize __n) { return xsgetn(__s, __n); }
219 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 streamsize sgetn(char_type* __s, streamsize __n) { return xsgetn(__s, __n); }
207220
208221 // 27.6.2.2.4 Putback:
209 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sputbackc(char_type __c) {
222 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int_type sputbackc(char_type __c) {
223 __check_invariants();
224 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
225
210226 if (eback() == gptr() || !traits_type::eq(__c, *(gptr() - 1)))
211227 return pbackfail(traits_type::to_int_type(__c));
212228 this->gbump(-1);
213229 return traits_type::to_int_type(*gptr());
214230 }
215231
216 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sungetc() {
232 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int_type sungetc() {
233 __check_invariants();
234 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
235
217236 if (eback() == gptr())
218237 return pbackfail();
219238 this->gbump(-1);
......@@ -221,7 +240,10 @@ public:
221240 }
222241
223242 // 27.6.2.2.5 Put area:
224 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sputc(char_type __c) {
243 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 int_type sputc(char_type __c) {
244 __check_invariants();
245 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
246
225247 if (pptr() == epptr())
226248 return overflow(traits_type::to_int_type(__c));
227249 *pptr() = __c;
......@@ -229,7 +251,7 @@ public:
229251 return traits_type::to_int_type(__c);
230252 }
231253
232 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize sputn(const char_type* __s, streamsize __n) {
254 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 streamsize sputn(const char_type* __s, streamsize __n) {
233255 return xsputn(__s, __n);
234256 }
235257
......@@ -270,12 +292,12 @@ protected:
270292 _LIBCPP_HIDE_FROM_ABI char_type* gptr() const { return __ninp_; }
271293 _LIBCPP_HIDE_FROM_ABI char_type* egptr() const { return __einp_; }
272294
273 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void gbump(int __n) { __ninp_ += __n; }
295 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void gbump(int __n) { __ninp_ += __n; }
274296
275297 // gbump takes an int, so it might not be able to represent the offset we want to add.
276298 _LIBCPP_HIDE_FROM_ABI void __gbump_ptrdiff(ptrdiff_t __n) { __ninp_ += __n; }
277299
278 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
300 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
279301 _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__gbeg, __gnext), "[gbeg, gnext) must be a valid range");
280302 _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__gbeg, __gend), "[gbeg, gend) must be a valid range");
281303 _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__gnext, __gend), "[gnext, gend) must be a valid range");
......@@ -289,11 +311,11 @@ protected:
289311 _LIBCPP_HIDE_FROM_ABI char_type* pptr() const { return __nout_; }
290312 _LIBCPP_HIDE_FROM_ABI char_type* epptr() const { return __eout_; }
291313
292 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void pbump(int __n) { __nout_ += __n; }
314 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void pbump(int __n) { __nout_ += __n; }
293315
294316 _LIBCPP_HIDE_FROM_ABI void __pbump(streamsize __n) { __nout_ += __n; }
295317
296 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void setp(char_type* __pbeg, char_type* __pend) {
318 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 void setp(char_type* __pbeg, char_type* __pend) {
297319 _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__pbeg, __pend), "[pbeg, pend) must be a valid range");
298320 __bout_ = __nout_ = __pbeg;
299321 __eout_ = __pend;
......@@ -317,6 +339,9 @@ protected:
317339 virtual streamsize showmanyc() { return 0; }
318340
319341 virtual streamsize xsgetn(char_type* __s, streamsize __n) {
342 __check_invariants();
343 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
344
320345 int_type __c;
321346 streamsize __i = 0;
322347 while (__i < __n) {
......@@ -338,6 +363,9 @@ protected:
338363
339364 virtual int_type underflow() { return traits_type::eof(); }
340365 virtual int_type uflow() {
366 __check_invariants();
367 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
368
341369 if (underflow() == traits_type::eof())
342370 return traits_type::eof();
343371 int_type __c = traits_type::to_int_type(*gptr());
......@@ -350,6 +378,9 @@ protected:
350378
351379 // 27.6.2.4.5 Put area:
352380 virtual streamsize xsputn(const char_type* __s, streamsize __n) {
381 __check_invariants();
382 auto __guard = std::__make_scope_guard([this] { this->__check_invariants(); });
383
353384 streamsize __i = 0;
354385 while (__i < __n) {
355386 if (pptr() >= epptr()) {
......@@ -370,6 +401,15 @@ protected:
370401
371402 virtual int_type overflow(int_type = traits_type::eof()) { return traits_type::eof(); }
372403
404 // This function checks some invariants of the class (it isn't exhaustive).
405 _LIBCPP_HIDE_FROM_ABI void __check_invariants() const {
406 _LIBCPP_ASSERT_INTERNAL(pbase() <= pptr(), "this is an invariant of the class");
407 _LIBCPP_ASSERT_INTERNAL(pptr() <= epptr(), "this is an invariant of the class");
408
409 _LIBCPP_ASSERT_INTERNAL(eback() <= gptr(), "this is an invariant of the class");
410 _LIBCPP_ASSERT_INTERNAL(gptr() <= egptr(), "this is an invariant of the class");
411 }
412
373413private:
374414 locale __loc_;
375415 char_type* __binp_ = nullptr;
lib/libcxx/include/string+574-573
......@@ -280,6 +280,8 @@ public:
280280 basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr in C++20, removed in C++23
281281 basic_string substr(size_type pos = 0, size_type n = npos) const&; // since C++23
282282 constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&; // since C++23
283 constexpr basic_string_view<charT, traits> subview(size_type pos = 0,
284 size_type n = npos) const; // since C++26
283285 void swap(basic_string& str)
284286 noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
285287 allocator_traits<allocator_type>::is_always_equal::value); // C++17, constexpr since C++20
......@@ -598,9 +600,9 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
598600# include <__debug_utils/sanitizers.h>
599601# include <__format/enable_insertable.h>
600602# include <__functional/hash.h>
603# include <__functional/is_transparent.h>
601604# include <__functional/unary_function.h>
602605# include <__fwd/string.h>
603# include <__ios/fpos.h>
604606# include <__iterator/bounded_iter.h>
605607# include <__iterator/distance.h>
606608# include <__iterator/iterator_traits.h>
......@@ -620,7 +622,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
620622# include <__ranges/concepts.h>
621623# include <__ranges/container_compatible_range.h>
622624# include <__ranges/from_range.h>
623# include <__ranges/size.h>
624625# include <__string/char_traits.h>
625626# include <__string/extern_template_lists.h>
626627# include <__type_traits/conditional.h>
......@@ -628,24 +629,23 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
628629# include <__type_traits/is_allocator.h>
629630# include <__type_traits/is_array.h>
630631# include <__type_traits/is_convertible.h>
632# include <__type_traits/is_generic_transparent_comparator.h>
631633# include <__type_traits/is_nothrow_assignable.h>
632634# include <__type_traits/is_nothrow_constructible.h>
633# include <__type_traits/is_replaceable.h>
634635# include <__type_traits/is_same.h>
635636# include <__type_traits/is_standard_layout.h>
636637# include <__type_traits/is_trivially_constructible.h>
637638# include <__type_traits/is_trivially_copyable.h>
638639# include <__type_traits/is_trivially_relocatable.h>
639640# include <__type_traits/remove_cvref.h>
640# include <__type_traits/void_t.h>
641# include <__utility/auto_cast.h>
642# include <__utility/declval.h>
641# include <__utility/default_three_way_comparator.h>
642# include <__utility/exception_guard.h>
643643# include <__utility/forward.h>
644644# include <__utility/is_pointer_in_range.h>
645645# include <__utility/move.h>
646# include <__utility/no_destroy.h>
646647# include <__utility/scope_guard.h>
647648# include <__utility/swap.h>
648# include <__utility/unreachable.h>
649649# include <climits>
650650# include <cstdio> // EOF
651651# include <cstring>
......@@ -700,18 +700,18 @@ __concatenate_strings(const _Allocator& __alloc,
700700 __type_identity_t<basic_string_view<_CharT, _Traits> > __str2);
701701
702702template <class _Iter>
703struct __string_is_trivial_iterator : public false_type {};
703inline const bool __string_is_trivial_iterator_v = false;
704704
705705template <class _Tp>
706struct __string_is_trivial_iterator<_Tp*> : public is_arithmetic<_Tp> {};
706inline const bool __string_is_trivial_iterator_v<_Tp*> = is_arithmetic<_Tp>::value;
707707
708708template <class _Iter>
709struct __string_is_trivial_iterator<__wrap_iter<_Iter> > : public __string_is_trivial_iterator<_Iter> {};
709inline const bool __string_is_trivial_iterator_v<__wrap_iter<_Iter> > = __string_is_trivial_iterator_v<_Iter>;
710710
711711template <class _CharT, class _Traits, class _Tp>
712struct __can_be_converted_to_string_view
713 : public _BoolConstant< is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
714 !is_convertible<const _Tp&, const _CharT*>::value > {};
712inline const bool __can_be_converted_to_string_view_v =
713 is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
714 !is_convertible<const _Tp&, const _CharT*>::value;
715715
716716struct __uninitialized_size_tag {};
717717struct __init_with_sentinel_tag {};
......@@ -756,20 +756,13 @@ public:
756756 // external memory. In such cases, the destructor is responsible for unpoisoning
757757 // the memory to avoid triggering false positives.
758758 // Therefore it's crucial to ensure the destructor is called.
759 //
760 // However, it is replaceable since implementing move-assignment as a destroy + move-construct
761 // will maintain the right ASAN state.
762 using __trivially_relocatable = void;
759 using __trivially_relocatable _LIBCPP_NODEBUG = void;
763760# else
764761 using __trivially_relocatable _LIBCPP_NODEBUG = __conditional_t<
765762 __libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value,
766763 basic_string,
767764 void>;
768765# endif
769 using __replaceable _LIBCPP_NODEBUG =
770 __conditional_t<__is_replaceable_v<pointer> && __container_allocator_is_replaceable<__alloc_traits>::value,
771 basic_string,
772 void>;
773766
774767# if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN
775768 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __asan_volatile_wrapper(pointer const& __ptr) const {
......@@ -819,12 +812,21 @@ public:
819812 using reverse_iterator = std::reverse_iterator<iterator>;
820813 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
821814
815 using __alloc_result _LIBCPP_NODEBUG = __allocation_result<pointer, size_type>;
816
822817private:
823818 static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
824819
825820# ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
826821
827822 struct __long {
823 __long() = default;
824
825 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size)
826 : __data_(__alloc.ptr), __size_(__size), __cap_(__alloc.count / __endian_factor), __is_long_(true) {
827 _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__alloc.count), "Long capacity should always be larger than the SSO");
828 }
829
828830 pointer __data_;
829831 size_type __size_;
830832 size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
......@@ -872,6 +874,13 @@ private:
872874 // some platforms bit fields have a default size rather than the actual
873875 // size used, e.g., it is 4 bytes on AIX. See D128285 for details.
874876 struct __long {
877 __long() = default;
878
879 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size)
880 : __is_long_(true), __cap_(__alloc.count / __endian_factor), __size_(__size), __data_(__alloc.ptr) {
881 _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__alloc.count), "Long capacity should always be larger than the SSO");
882 }
883
875884 struct _LIBCPP_PACKED {
876885 size_type __is_long_ : 1;
877886 size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
......@@ -898,6 +907,11 @@ private:
898907 union __rep {
899908 __short __s;
900909 __long __l;
910
911 __rep() = default;
912 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __rep(__short __r) : __s(__r) {}
913 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __rep(__long __r) : __l(__r) {}
914 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __rep(__uninitialized_tag) {}
901915 };
902916
903917 _LIBCPP_COMPRESSED_PAIR(__rep, __rep_, allocator_type, __alloc_);
......@@ -917,20 +931,7 @@ private:
917931 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(
918932 __uninitialized_size_tag, size_type __size, const allocator_type& __a)
919933 : __alloc_(__a) {
920 if (__size > max_size())
921 this->__throw_length_error();
922 if (__fits_in_sso(__size)) {
923 __rep_ = __rep();
924 __set_short_size(__size);
925 } else {
926 auto __capacity = __recommend(__size) + 1;
927 auto __allocation = __alloc_traits::allocate(__alloc_, __capacity);
928 __begin_lifetime(__allocation, __capacity);
929 __set_long_cap(__capacity);
930 __set_long_pointer(__allocation);
931 __set_long_size(__size);
932 }
933 __annotate_new(__size);
934 __init_internal_buffer(__size);
934935 }
935936
936937 template <class _Iter, class _Sent>
......@@ -966,7 +967,7 @@ private:
966967 std::__wrap_iter<const_pointer>(__get_pointer() + size()));
967968# else
968969 return const_iterator(__p);
969# endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
970# endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
970971 }
971972
972973public:
......@@ -1057,13 +1058,13 @@ public:
10571058 }
10581059# endif // _LIBCPP_CXX03_LANG
10591060
1060 template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
1061 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
10611062 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s) {
10621063 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*) detected nullptr");
10631064 __init(__s, traits_type::length(__s));
10641065 }
10651066
1066 template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
1067 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
10671068 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
10681069 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, const _Allocator& __a)
10691070 : __alloc_(__a) {
......@@ -1075,13 +1076,15 @@ public:
10751076 basic_string(nullptr_t) = delete;
10761077# endif
10771078
1078 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) {
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") {
10791081 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
10801082 __init(__s, __n);
10811083 }
10821084
10831085 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
10841086 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
1087 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero")
10851088 : __alloc_(__a) {
10861089 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
10871090 __init(__s, __n);
......@@ -1110,7 +1113,7 @@ public:
11101113 }
11111114# endif
11121115
1113 template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
1116 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
11141117 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a)
11151118 : __alloc_(__a) {
11161119 __init(__n, __c);
......@@ -1135,7 +1138,7 @@ public:
11351138 }
11361139
11371140 template <class _Tp,
1138 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1141 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
11391142 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
11401143 int> = 0>
11411144 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
......@@ -1147,7 +1150,7 @@ public:
11471150 }
11481151
11491152 template <class _Tp,
1150 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1153 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
11511154 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
11521155 int> = 0>
11531156 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) {
......@@ -1156,7 +1159,7 @@ public:
11561159 }
11571160
11581161 template <class _Tp,
1159 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1162 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
11601163 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
11611164 int> = 0>
11621165 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a)
......@@ -1201,11 +1204,10 @@ public:
12011204 }
12021205# endif // _LIBCPP_CXX03_LANG
12031206
1204 inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() {
1205 __annotate_delete();
1206 if (__is_long())
1207 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
1208 }
1207 // TODO(boomanaiden154): Once we mark this in destructors as dead on return,
1208 // we can use a normal call to __reset_internal_buffer and remove the extra
1209 // __rep constructor.
1210 inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() { __reset_internal_buffer(__rep(__uninitialized_tag())); }
12091211
12101212 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT {
12111213 return __self_view(typename __self_view::__assume_valid(), data(), size());
......@@ -1215,7 +1217,7 @@ public:
12151217 operator=(const basic_string& __str);
12161218
12171219 template <class _Tp,
1218 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1220 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
12191221 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
12201222 int> = 0>
12211223 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
......@@ -1243,45 +1245,55 @@ public:
12431245# endif
12441246 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c);
12451247
1246 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
1248 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
12471249 return __make_iterator(__get_pointer());
12481250 }
1249 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
1251 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
12501252 return __make_const_iterator(__get_pointer());
12511253 }
1252 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
1254 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
12531255 return __make_iterator(__get_pointer() + size());
12541256 }
1255 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
1257 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
12561258 return __make_const_iterator(__get_pointer() + size());
12571259 }
12581260
1259 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
1261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
12601262 return reverse_iterator(end());
12611263 }
1262 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rbegin() const _NOEXCEPT {
1264 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
1265 rbegin() const _NOEXCEPT {
12631266 return const_reverse_iterator(end());
12641267 }
1265 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
1268 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
12661269 return reverse_iterator(begin());
12671270 }
1268 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
1271 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
12691272 return const_reverse_iterator(begin());
12701273 }
12711274
1272 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT { return begin(); }
1273 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT { return end(); }
1274 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crbegin() const _NOEXCEPT {
1275 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT {
1276 return begin();
1277 }
1278 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT {
1279 return end();
1280 }
1281 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
1282 crbegin() const _NOEXCEPT {
12751283 return rbegin();
12761284 }
1277 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
1285 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT {
1286 return rend();
1287 }
12781288
1279 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
1289 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
12801290 return __is_long() ? __get_long_size() : __get_short_size();
12811291 }
1282 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT { return size(); }
1292 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {
1293 return size();
1294 }
12831295
1284 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT {
1296 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT {
12851297 if (size_type __m = __alloc_traits::max_size(__alloc_); __m <= std::numeric_limits<size_type>::max() / 2) {
12861298 size_type __res = __m - __alignment;
12871299
......@@ -1299,7 +1311,7 @@ public:
12991311 }
13001312 }
13011313
1302 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
1314 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
13031315 return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
13041316 }
13051317
......@@ -1311,13 +1323,19 @@ public:
13111323# if _LIBCPP_STD_VER >= 23
13121324 template <class _Op>
13131325 _LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) {
1314 __resize_default_init(__n);
1315 __erase_to_end(std::move(__op)(data(), _LIBCPP_AUTO_CAST(__n)));
1326 using __result_type = decltype(std::move(__op)(data(), auto(__n)));
1327 static_assert(__integer_like<__result_type>, "Operation return type must be integer-like");
1328 size_type __sz = size();
1329 size_type __cap = capacity();
1330 if (__n > __cap)
1331 __grow_by_without_replace(__cap, __n - __cap, __sz, __sz, 0);
1332 __annotate_delete();
1333 __set_size(__n);
1334 __annotate_new(__n);
1335 __erase_to_end(std::move(__op)(data(), auto(__n)));
13161336 }
13171337# endif
13181338
1319 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
1320
13211339# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE)
13221340 _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
13231341# endif
......@@ -1328,7 +1346,8 @@ public:
13281346 return size() == 0;
13291347 }
13301348
1331 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __pos) const _NOEXCEPT {
1349 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference
1350 operator[](size_type __pos) const _NOEXCEPT {
13321351 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos <= size(), "string index out of bounds");
13331352 if (__builtin_constant_p(__pos) && !__fits_in_sso(__pos)) {
13341353 return *(__get_long_pointer() + __pos);
......@@ -1336,7 +1355,8 @@ public:
13361355 return *(data() + __pos);
13371356 }
13381357
1339 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __pos) _NOEXCEPT {
1358 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference
1359 operator[](size_type __pos) _NOEXCEPT {
13401360 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos <= size(), "string index out of bounds");
13411361 if (__builtin_constant_p(__pos) && !__fits_in_sso(__pos)) {
13421362 return *(__get_long_pointer() + __pos);
......@@ -1344,15 +1364,15 @@ public:
13441364 return *(__get_pointer() + __pos);
13451365 }
13461366
1347 _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
1348 _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
1367 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
1368 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
13491369
13501370 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {
13511371 return append(__str);
13521372 }
13531373
13541374 template <class _Tp,
1355 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1375 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
13561376 !is_same<__remove_cvref_t<_Tp>, basic_string >::value,
13571377 int> = 0>
13581378 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const _Tp& __t) {
......@@ -1381,7 +1401,7 @@ public:
13811401 }
13821402
13831403 template <class _Tp,
1384 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1404 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
13851405 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
13861406 int> = 0>
13871407 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const _Tp& __t) {
......@@ -1392,7 +1412,7 @@ public:
13921412 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n = npos);
13931413
13941414 template <class _Tp,
1395 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1415 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
13961416 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
13971417 int> = 0>
13981418 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
......@@ -1404,12 +1424,11 @@ public:
14041424 return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
14051425 }
14061426
1407 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n);
1427 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n)
1428 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
14081429 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
14091430 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
14101431
1411 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append_default_init(size_type __n);
1412
14131432 template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
14141433 _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
14151434 append(_InputIterator __first, _InputIterator __last) {
......@@ -1424,20 +1443,21 @@ public:
14241443 size_type __sz = size();
14251444 size_type __cap = capacity();
14261445 size_type __n = static_cast<size_type>(std::distance(__first, __last));
1427 if (__n) {
1428 if (__string_is_trivial_iterator<_ForwardIterator>::value && !__addr_in_range(*__first)) {
1429 if (__cap - __sz < __n)
1430 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
1431 __annotate_increase(__n);
1432 auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__get_pointer() + __sz));
1433 traits_type::assign(*__end, value_type());
1434 __set_size(__sz + __n);
1435 } else {
1436 const basic_string __temp(__first, __last, __alloc_);
1437 append(__temp.data(), __temp.size());
1438 }
1446 if (__n == 0)
1447 return *this;
1448
1449 if (__string_is_trivial_iterator_v<_ForwardIterator> && !__addr_in_range(*__first)) {
1450 if (__cap - __sz < __n)
1451 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
1452 __annotate_increase(__n);
1453 auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__get_pointer() + __sz));
1454 traits_type::assign(*__end, value_type());
1455 __set_size(__sz + __n);
1456 return *this;
1457 } else {
1458 const basic_string __temp(__first, __last, __alloc_);
1459 return append(__temp.data(), __temp.size());
14391460 }
1440 return *this;
14411461 }
14421462
14431463# if _LIBCPP_STD_VER >= 23
......@@ -1457,27 +1477,27 @@ public:
14571477 _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c);
14581478 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back();
14591479
1460 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT {
1480 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT {
14611481 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::front(): string is empty");
14621482 return *__get_pointer();
14631483 }
14641484
1465 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT {
1485 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT {
14661486 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::front(): string is empty");
14671487 return *data();
14681488 }
14691489
1470 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT {
1490 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT {
14711491 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::back(): string is empty");
14721492 return *(__get_pointer() + size() - 1);
14731493 }
14741494
1475 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT {
1495 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT {
14761496 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::back(): string is empty");
14771497 return *(data() + size() - 1);
14781498 }
14791499
1480 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1500 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
14811501 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const _Tp& __t) {
14821502 __self_view __sv = __t;
14831503 return assign(__sv.data(), __sv.size());
......@@ -1519,7 +1539,7 @@ public:
15191539 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n = npos);
15201540
15211541 template <class _Tp,
1522 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1542 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
15231543 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
15241544 int> = 0>
15251545 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
......@@ -1531,8 +1551,9 @@ public:
15311551 return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
15321552 }
15331553
1534 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n);
1535 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s);
1554 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n)
1555 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
1556 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
15361557 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
15371558
15381559 template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
......@@ -1545,7 +1566,7 @@ public:
15451566 template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
15461567 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
15471568 assign(_ForwardIterator __first, _ForwardIterator __last) {
1548 if (__string_is_trivial_iterator<_ForwardIterator>::value) {
1569 if (__string_is_trivial_iterator_v<_ForwardIterator>) {
15491570 size_type __n = static_cast<size_type>(std::distance(__first, __last));
15501571 __assign_trivial(__first, __last, __n);
15511572 } else {
......@@ -1558,7 +1579,7 @@ public:
15581579# if _LIBCPP_STD_VER >= 23
15591580 template <_ContainerCompatibleRange<_CharT> _Range>
15601581 _LIBCPP_HIDE_FROM_ABI constexpr basic_string& assign_range(_Range&& __range) {
1561 if constexpr (__string_is_trivial_iterator<ranges::iterator_t<_Range>>::value &&
1582 if constexpr (__string_is_trivial_iterator_v<ranges::iterator_t<_Range>> &&
15621583 (ranges::forward_range<_Range> || ranges::sized_range<_Range>)) {
15631584 size_type __n = static_cast<size_type>(ranges::distance(__range));
15641585 __assign_trivial(ranges::begin(__range), ranges::end(__range), __n);
......@@ -1582,14 +1603,14 @@ public:
15821603 return insert(__pos1, __str.data(), __str.size());
15831604 }
15841605
1585 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1606 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
15861607 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos1, const _Tp& __t) {
15871608 __self_view __sv = __t;
15881609 return insert(__pos1, __sv.data(), __sv.size());
15891610 }
15901611
15911612 template <class _Tp,
1592 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1613 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
15931614 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
15941615 int> = 0>
15951616 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
......@@ -1603,7 +1624,8 @@ public:
16031624
16041625 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
16051626 insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n = npos);
1606 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
1627 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n)
1628 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
16071629 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
16081630 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, size_type __n, value_type __c);
16091631 _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c);
......@@ -1659,7 +1681,7 @@ public:
16591681 return replace(__pos1, __n1, __str.data(), __str.size());
16601682 }
16611683
1662 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1684 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
16631685 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
16641686 replace(size_type __pos1, size_type __n1, const _Tp& __t) {
16651687 __self_view __sv = __t;
......@@ -1670,7 +1692,7 @@ public:
16701692 replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos);
16711693
16721694 template <class _Tp,
1673 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
1695 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
16741696 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
16751697 int> = 0>
16761698 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
......@@ -1683,8 +1705,10 @@ public:
16831705 }
16841706
16851707 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
1686 replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
1687 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
1708 replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
1709 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n2 != 0 && __s == nullptr, " if n2 is not zero");
1710 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
1711 replace(size_type __pos, size_type __n1, const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
16881712 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
16891713
16901714 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
......@@ -1693,7 +1717,7 @@ public:
16931717 static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __str.data(), __str.size());
16941718 }
16951719
1696 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1720 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
16971721 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
16981722 replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) {
16991723 __self_view __sv = __t;
......@@ -1741,19 +1765,24 @@ public:
17411765 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
17421766
17431767# if _LIBCPP_STD_VER <= 20
1744 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string
1745 substr(size_type __pos = 0, size_type __n = npos) const {
1768 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
1769 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string substr(size_type __pos = 0, size_type __n = npos) const {
17461770 return basic_string(*this, __pos, __n);
17471771 }
17481772# else
1749 _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
1773 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
17501774 return basic_string(*this, __pos, __n);
17511775 }
17521776
1753 _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) && {
1777 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) && {
17541778 return basic_string(std::move(*this), __pos, __n);
17551779 }
17561780# endif
1781# if _LIBCPP_STD_VER >= 26
1782 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __self_view subview(size_type __pos = 0, size_type __n = npos) const {
1783 return __self_view(*this).subview(__pos, __n);
1784 }
1785# endif
17571786
17581787 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(basic_string& __str)
17591788# if _LIBCPP_STD_VER >= 14
......@@ -1765,225 +1794,238 @@ public:
17651794 // [string.ops]
17661795 // ------------
17671796
1768 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT { return data(); }
1769 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {
1797 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT {
1798 return data();
1799 }
1800
1801 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {
17701802 return std::__to_address(__get_pointer());
17711803 }
17721804# if _LIBCPP_STD_VER >= 17
1773 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
1805 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
17741806 return std::__to_address(__get_pointer());
17751807 }
17761808# endif
17771809
1778 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
1810 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
17791811 return __alloc_;
17801812 }
17811813
17821814 // find
17831815
1784 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1816 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
17851817 find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
17861818 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
17871819 }
17881820
1789 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1790 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1821 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
1822 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
17911823 find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
17921824 __self_view __sv = __t;
17931825 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
17941826 }
17951827
1796 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
1828 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1829 find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
1830 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
17971831 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find(): received nullptr");
17981832 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
17991833 }
18001834
1801 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1835 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18021836 find(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
18031837 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
18041838 return std::__str_find<value_type, size_type, traits_type, npos>(
18051839 data(), size(), __s, __pos, traits_type::length(__s));
18061840 }
18071841
1808 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT {
1842 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT {
18091843 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
18101844 }
18111845
18121846 // rfind
18131847
1814 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1848 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18151849 rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
18161850 return std::__str_rfind<value_type, size_type, traits_type, npos>(
18171851 data(), size(), __str.data(), __pos, __str.size());
18181852 }
18191853
1820 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1821 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1854 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
1855 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18221856 rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
18231857 __self_view __sv = __t;
18241858 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
18251859 }
18261860
1827 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
1861 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1862 rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
1863 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
18281864 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
18291865 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
18301866 }
18311867
1832 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1868 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18331869 rfind(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
18341870 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
18351871 return std::__str_rfind<value_type, size_type, traits_type, npos>(
18361872 data(), size(), __s, __pos, traits_type::length(__s));
18371873 }
18381874
1839 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT {
1875 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1876 rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT {
18401877 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
18411878 }
18421879
18431880 // find_first_of
18441881
1845 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1882 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18461883 find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
18471884 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
18481885 data(), size(), __str.data(), __pos, __str.size());
18491886 }
18501887
1851 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1852 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1888 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
1889 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18531890 find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
18541891 __self_view __sv = __t;
18551892 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
18561893 data(), size(), __sv.data(), __pos, __sv.size());
18571894 }
18581895
1859 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1860 find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
1896 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1897 find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
1898 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
18611899 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
18621900 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
18631901 }
18641902
1865 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1903 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18661904 find_first_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
18671905 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
18681906 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
18691907 data(), size(), __s, __pos, traits_type::length(__s));
18701908 }
18711909
1872 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1910 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18731911 find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT {
18741912 return find(__c, __pos);
18751913 }
18761914
18771915 // find_last_of
18781916
1879 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1917 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18801918 find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
18811919 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
18821920 data(), size(), __str.data(), __pos, __str.size());
18831921 }
18841922
1885 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1886 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1923 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
1924 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18871925 find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
18881926 __self_view __sv = __t;
18891927 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
18901928 data(), size(), __sv.data(), __pos, __sv.size());
18911929 }
18921930
1893 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1894 find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
1931 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1932 find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
1933 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
18951934 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
18961935 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
18971936 }
18981937
1899 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1938 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19001939 find_last_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
19011940 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
19021941 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
19031942 data(), size(), __s, __pos, traits_type::length(__s));
19041943 }
19051944
1906 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1945 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19071946 find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT {
19081947 return rfind(__c, __pos);
19091948 }
19101949
19111950 // find_first_not_of
19121951
1913 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1952 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19141953 find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
19151954 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
19161955 data(), size(), __str.data(), __pos, __str.size());
19171956 }
19181957
1919 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1920 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1958 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
1959 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19211960 find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
19221961 __self_view __sv = __t;
19231962 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
19241963 data(), size(), __sv.data(), __pos, __sv.size());
19251964 }
19261965
1927 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1928 find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
1966 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1967 find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
1968 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
19291969 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
19301970 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
19311971 }
19321972
1933 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1973 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19341974 find_first_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
19351975 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
19361976 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
19371977 data(), size(), __s, __pos, traits_type::length(__s));
19381978 }
19391979
1940 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1980 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19411981 find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT {
19421982 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
19431983 }
19441984
19451985 // find_last_not_of
19461986
1947 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1987 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19481988 find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
19491989 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
19501990 data(), size(), __str.data(), __pos, __str.size());
19511991 }
19521992
1953 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1954 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1993 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
1994 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19551995 find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
19561996 __self_view __sv = __t;
19571997 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
19581998 data(), size(), __sv.data(), __pos, __sv.size());
19591999 }
19602000
1961 _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
1962 find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
2001 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
2002 find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
2003 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
19632004 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
19642005 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
19652006 }
19662007
1967 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
2008 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19682009 find_last_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
19692010 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
19702011 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
19712012 data(), size(), __s, __pos, traits_type::length(__s));
19722013 }
19732014
1974 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
2015 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19752016 find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT {
19762017 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
19772018 }
19782019
19792020 // compare
19802021
1981 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const basic_string& __str) const _NOEXCEPT {
2022 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2023 compare(const basic_string& __str) const _NOEXCEPT {
19822024 return compare(__self_view(__str));
19832025 }
19842026
1985 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
1986 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const _Tp& __t) const _NOEXCEPT {
2027 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
2028 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const _Tp& __t) const _NOEXCEPT {
19872029 __self_view __sv = __t;
19882030 size_t __lhs_sz = size();
19892031 size_t __rhs_sz = __sv.size();
......@@ -1997,73 +2039,77 @@ public:
19972039 return 0;
19982040 }
19992041
2000 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
2001 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2042 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
2043 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
20022044 compare(size_type __pos1, size_type __n1, const _Tp& __t) const {
20032045 __self_view __sv = __t;
20042046 return compare(__pos1, __n1, __sv.data(), __sv.size());
20052047 }
20062048
2007 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2049 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
20082050 compare(size_type __pos1, size_type __n1, const basic_string& __str) const {
20092051 return compare(__pos1, __n1, __str.data(), __str.size());
20102052 }
20112053
2012 _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2054 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
20132055 compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos) const {
20142056 return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
20152057 }
20162058
20172059 template <class _Tp,
2018 __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
2060 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
20192061 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
20202062 int> = 0>
2021 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2063 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
20222064 compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const {
20232065 __self_view __sv = __t;
20242066 return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
20252067 }
20262068
2027 _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const _NOEXCEPT {
2069 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2070 compare(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const _NOEXCEPT {
20282071 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
20292072 return compare(0, npos, __s, traits_type::length(__s));
20302073 }
20312074
2032 _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2075 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
20332076 compare(size_type __pos1, size_type __n1, const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
20342077 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
20352078 return compare(__pos1, __n1, __s, traits_type::length(__s));
20362079 }
20372080
2038 _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2039 compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
2081 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
2082 compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const
2083 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n2 != 0 && __s == nullptr, " if n2 is not zero");
20402084
20412085 // starts_with
20422086
20432087# if _LIBCPP_STD_VER >= 20
2044 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept {
2088 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept {
20452089 return __self_view(typename __self_view::__assume_valid(), data(), size()).starts_with(__sv);
20462090 }
20472091
2048 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
2092 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
20492093 return !empty() && _Traits::eq(front(), __c);
20502094 }
20512095
2052 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
2096 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool
2097 starts_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
20532098 return starts_with(__self_view(__s));
20542099 }
20552100
20562101 // ends_with
20572102
2058 constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept {
2103 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept {
20592104 return __self_view(typename __self_view::__assume_valid(), data(), size()).ends_with(__sv);
20602105 }
20612106
2062 constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
2107 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
20632108 return !empty() && _Traits::eq(back(), __c);
20642109 }
20652110
2066 constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
2111 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool
2112 ends_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
20672113 return ends_with(__self_view(__s));
20682114 }
20692115# endif
......@@ -2071,15 +2117,16 @@ public:
20712117 // contains
20722118
20732119# if _LIBCPP_STD_VER >= 23
2074 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
2120 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
20752121 return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__sv);
20762122 }
20772123
2078 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
2124 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
20792125 return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__c);
20802126 }
20812127
2082 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
2128 [[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool
2129 contains(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
20832130 return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__s);
20842131 }
20852132# endif
......@@ -2095,18 +2142,6 @@ private:
20952142 return __rep_.__s.__is_long_;
20962143 }
20972144
2098 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {
2099# if _LIBCPP_STD_VER >= 20
2100 if (__libcpp_is_constant_evaluated()) {
2101 for (size_type __i = 0; __i != __n; ++__i)
2102 std::construct_at(std::addressof(__begin[__i]));
2103 }
2104# else
2105 (void)__begin;
2106 (void)__n;
2107# endif // _LIBCPP_STD_VER >= 20
2108 }
2109
21102145 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { return __sz < __min_cap; }
21112146
21122147 template <class _Iterator, class _Sentinel>
......@@ -2165,6 +2200,9 @@ private:
21652200 _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
21662201 __insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
21672202
2203 // internal buffer accessors
2204 // -------------------------
2205
21682206 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
21692207 __set_short_size(size_type __s) _NOEXCEPT {
21702208 _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");
......@@ -2194,21 +2232,11 @@ private:
21942232 __set_short_size(__s);
21952233 }
21962234
2197 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_cap(size_type __s) _NOEXCEPT {
2198 _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__s), "Long capacity should always be larger than the SSO");
2199 __rep_.__l.__cap_ = __s / __endian_factor;
2200 __rep_.__l.__is_long_ = true;
2201 }
2202
22032235 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_cap() const _NOEXCEPT {
22042236 _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long capacity");
22052237 return __rep_.__l.__cap_ * __endian_factor;
22062238 }
22072239
2208 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_pointer(pointer __p) _NOEXCEPT {
2209 __rep_.__l.__data_ = __p;
2210 }
2211
22122240 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT {
22132241 _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer");
22142242 return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_);
......@@ -2236,6 +2264,58 @@ private:
22362264 return __is_long() ? __get_long_pointer() : __get_short_pointer();
22372265 }
22382266
2267 // Internal buffer management
2268 // --------------------------
2269 //
2270 // These functions are only responsible for managing the buffer itself, not the value inside the buffer. As such,
2271 // none of these facilities ensure that there is a null terminator at `data()[size()]`.
2272
2273 // Allocate a buffer of __capacity size with __alloc and return it
2274 _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),
2277 "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));
2279
2280 if (__libcpp_is_constant_evaluated()) {
2281 for (size_type __i = 0; __i != __buffer.count; ++__i)
2282 std::__construct_at(std::addressof(__buffer.ptr[__i]));
2283 }
2284
2285 return __long(__buffer, __capacity);
2286 }
2287
2288 // Replace the current buffer with __new_rep. Deallocate the old long buffer if it exists.
2289 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __reset_internal_buffer(__rep __new_rep = __short()) {
2290 __annotate_delete();
2291 if (__is_long())
2292 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
2293 __rep_ = __new_rep;
2294 }
2295
2296 // Initialize the internal buffer to hold __size elements
2297 // The elements and null terminator have to be set by the caller
2298 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __init_internal_buffer(size_type __size) {
2299 if (__libcpp_is_constant_evaluated())
2300 __rep_ = __rep();
2301
2302 if (__size > max_size())
2303 __throw_length_error();
2304
2305 if (__fits_in_sso(__size)) {
2306 __set_short_size(__size);
2307 __annotate_new(__size);
2308 return __get_short_pointer();
2309 } else {
2310 __rep_.__l = __allocate_long_buffer(__alloc_, __size);
2311 __annotate_new(__size);
2312 return __get_long_pointer();
2313 }
2314 }
2315
2316 // ASan annotation helpers
2317 // -----------------------
2318
22392319 // The following functions are no-ops outside of AddressSanitizer mode.
22402320 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
22412321 __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
......@@ -2243,7 +2323,7 @@ private:
22432323 (void)__new_mid;
22442324# if _LIBCPP_INSTRUMENTED_WITH_ASAN
22452325# if defined(__APPLE__)
2246 // TODO: remove after addressing issue #96099 (https://github.com/llvm/llvm-project/issues/96099)
2326 // TODO: remove after addressing issue #96099 (https://llvm.org/PR96099)
22472327 if (!__is_long())
22482328 return;
22492329# endif
......@@ -2287,19 +2367,36 @@ private:
22872367 return (__s + (__a - 1)) & ~(__a - 1);
22882368 }
22892369 enum { __alignment = 8 };
2290 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __s) _NOEXCEPT {
2291 if (__s < __min_cap) {
2292 return static_cast<size_type>(__min_cap) - 1;
2293 }
2370
2371 // This makes sure that we're using a capacity with some extra alignment, since allocators almost always over-align
2372 // the allocations anyways, improving memory usage. More importantly, this ensures that the lowest bit is never set
2373 // if __endian_factor == 2, allowing us to store whether we're in the long string inside the lowest bit.
2374 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
2375 __align_allocation_size(size_type __size) _NOEXCEPT {
2376 _LIBCPP_ASSERT_INTERNAL(
2377 !__fits_in_sso(__size), "Trying to align allocation of a size which would fit into the SSO");
22942378 const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : __endian_factor;
2295 size_type __guess = __align_it<__boundary>(__s + 1) - 1;
2296 if (__guess == __min_cap)
2379 size_type __guess = __align_it<__boundary>(__size + 1);
2380 if (__guess == __min_cap + 1)
22972381 __guess += __endian_factor;
22982382
2299 _LIBCPP_ASSERT_INTERNAL(__guess >= __s, "recommendation is below the requested size");
2383 _LIBCPP_ASSERT_INTERNAL(__guess >= __size, "aligned allocation size is below the requested size");
23002384 return __guess;
23012385 }
23022386
2387 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
2388 __get_amortized_growth_capacity(size_type __required_capacity) {
2389 size_type __max_size = max_size();
2390 if (__required_capacity > __max_size)
2391 __throw_length_error();
2392 size_type __current_cap = capacity();
2393 _LIBCPP_ASSERT_INTERNAL(
2394 __current_cap < __required_capacity, "Trying to grow string even though there is enough capacity already?");
2395 if (__current_cap > __max_size / 2 - __alignment)
2396 return __max_size;
2397 return std::max(__required_capacity, 2 * __current_cap);
2398 }
2399
23032400 inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(const value_type* __s, size_type __sz);
23042401 inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(size_type __n, value_type __c);
23052402
......@@ -2366,7 +2463,8 @@ private:
23662463
23672464 // __erase_external_with_move is invoked for erase() invocations where
23682465 // `n ~= npos`, likely requiring memory moves on the string data.
2369 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __erase_external_with_move(size_type __pos, size_type __n);
2466 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
2467 __erase_external_with_move(size_type __pos, size_type __n) _NOEXCEPT;
23702468
23712469 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str) {
23722470 __copy_assign_alloc(
......@@ -2378,24 +2476,14 @@ private:
23782476 __alloc_ = __str.__alloc_;
23792477 else {
23802478 if (!__str.__is_long()) {
2381 if (__is_long()) {
2382 __annotate_delete();
2383 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
2384 __rep_ = __rep();
2385 }
2479 __reset_internal_buffer();
23862480 __alloc_ = __str.__alloc_;
23872481 } else {
23882482 __annotate_delete();
2389 auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
2390 allocator_type __a = __str.__alloc_;
2391 auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
2392 __begin_lifetime(__allocation.ptr, __allocation.count);
2393 if (__is_long())
2394 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
2395 __alloc_ = std::move(__a);
2396 __set_long_pointer(__allocation.ptr);
2397 __set_long_cap(__allocation.count);
2398 __set_long_size(__str.__get_long_size());
2483 auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
2484 auto __alloc = __str.__alloc_;
2485 __reset_internal_buffer(__allocate_long_buffer(__alloc, __str.size()));
2486 __alloc_ = std::move(__alloc);
23992487 }
24002488 }
24012489 }
......@@ -2507,26 +2595,55 @@ _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
25072595# endif
25082596# undef _LIBCPP_DECLARE
25092597
2598# if _LIBCPP_STD_VER <= 17 || !__has_builtin(__builtin_lt_synthesizes_from_spaceship)
2599template <class _CharT, class _Traits, class _Alloc>
2600struct __default_three_way_comparator<basic_string<_CharT, _Traits, _Alloc>, basic_string<_CharT, _Traits, _Alloc> > {
2601 using __string_t _LIBCPP_NODEBUG = basic_string<_CharT, _Traits, _Alloc>;
2602
2603 _LIBCPP_HIDE_FROM_ABI static int operator()(const __string_t& __lhs, const __string_t& __rhs) {
2604 auto __min_len = std::min(__lhs.size(), __rhs.size());
2605 auto __ret = _Traits::compare(__lhs.data(), __rhs.data(), __min_len);
2606 if (__ret == 0)
2607 return __lhs.size() == __rhs.size() ? 0 : __lhs.size() < __rhs.size() ? -1 : 1;
2608 return __ret;
2609 }
2610};
2611# endif
2612
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;
2619
2620template <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;
2626
25102627# if _LIBCPP_STD_VER >= 17
25112628template <class _InputIterator,
2512 class _CharT = __iter_value_type<_InputIterator>,
2629 class _CharT = __iterator_value_type<_InputIterator>,
25132630 class _Allocator = allocator<_CharT>,
25142631 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
2515 class = enable_if_t<__is_allocator<_Allocator>::value> >
2632 class = enable_if_t<__is_allocator_v<_Allocator>>>
25162633basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
25172634 -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
25182635
25192636template <class _CharT,
25202637 class _Traits,
25212638 class _Allocator = allocator<_CharT>,
2522 class = enable_if_t<__is_allocator<_Allocator>::value> >
2639 class = enable_if_t<__is_allocator_v<_Allocator>>>
25232640explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
25242641 -> basic_string<_CharT, _Traits, _Allocator>;
25252642
25262643template <class _CharT,
25272644 class _Traits,
25282645 class _Allocator = allocator<_CharT>,
2529 class = enable_if_t<__is_allocator<_Allocator>::value>,
2646 class = enable_if_t<__is_allocator_v<_Allocator>>,
25302647 class _Sz = typename allocator_traits<_Allocator>::size_type >
25312648basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
25322649 -> basic_string<_CharT, _Traits, _Allocator>;
......@@ -2535,7 +2652,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
25352652# if _LIBCPP_STD_VER >= 23
25362653template <ranges::input_range _Range,
25372654 class _Allocator = allocator<ranges::range_value_t<_Range>>,
2538 class = enable_if_t<__is_allocator<_Allocator>::value> >
2655 class = enable_if_t<__is_allocator_v<_Allocator>>>
25392656basic_string(from_range_t, _Range&&, _Allocator = _Allocator())
25402657 -> basic_string<ranges::range_value_t<_Range>, char_traits<ranges::range_value_t<_Range>>, _Allocator>;
25412658# endif
......@@ -2543,73 +2660,23 @@ basic_string(from_range_t, _Range&&, _Allocator = _Allocator())
25432660template <class _CharT, class _Traits, class _Allocator>
25442661_LIBCPP_CONSTEXPR_SINCE_CXX20 void
25452662basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) {
2546 if (__libcpp_is_constant_evaluated())
2547 __rep_ = __rep();
2548 if (__sz > max_size())
2549 this->__throw_length_error();
2550 pointer __p;
2551 if (__fits_in_sso(__sz)) {
2552 __set_short_size(__sz);
2553 __p = __get_short_pointer();
2554 } else {
2555 auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
2556 __p = __allocation.ptr;
2557 __begin_lifetime(__p, __allocation.count);
2558 __set_long_pointer(__p);
2559 __set_long_cap(__allocation.count);
2560 __set_long_size(__sz);
2561 }
2663 pointer __p = __init_internal_buffer(__sz);
25622664 traits_type::copy(std::__to_address(__p), __s, __sz);
25632665 traits_type::assign(__p[__sz], value_type());
2564 __annotate_new(__sz);
25652666}
25662667
25672668template <class _CharT, class _Traits, class _Allocator>
25682669_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
25692670basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value_type* __s, size_type __sz) {
2570 if (__libcpp_is_constant_evaluated())
2571 __rep_ = __rep();
2572
2573 pointer __p;
2574 if (__fits_in_sso(__sz)) {
2575 __p = __get_short_pointer();
2576 __set_short_size(__sz);
2577 } else {
2578 if (__sz > max_size())
2579 this->__throw_length_error();
2580 auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
2581 __p = __allocation.ptr;
2582 __begin_lifetime(__p, __allocation.count);
2583 __set_long_pointer(__p);
2584 __set_long_cap(__allocation.count);
2585 __set_long_size(__sz);
2586 }
2671 pointer __p = __init_internal_buffer(__sz);
25872672 traits_type::copy(std::__to_address(__p), __s, __sz + 1);
2588 __annotate_new(__sz);
25892673}
25902674
25912675template <class _CharT, class _Traits, class _Allocator>
25922676_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) {
2593 if (__libcpp_is_constant_evaluated())
2594 __rep_ = __rep();
2595
2596 if (__n > max_size())
2597 this->__throw_length_error();
2598 pointer __p;
2599 if (__fits_in_sso(__n)) {
2600 __set_short_size(__n);
2601 __p = __get_short_pointer();
2602 } else {
2603 auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__n) + 1);
2604 __p = __allocation.ptr;
2605 __begin_lifetime(__p, __allocation.count);
2606 __set_long_pointer(__p);
2607 __set_long_cap(__allocation.count);
2608 __set_long_size(__n);
2609 }
2677 pointer __p = __init_internal_buffer(__n);
26102678 traits_type::assign(std::__to_address(__p), __n, __c);
26112679 traits_type::assign(__p[__n], value_type());
2612 __annotate_new(__n);
26132680}
26142681
26152682template <class _CharT, class _Traits, class _Allocator>
......@@ -2626,19 +2693,10 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator _
26262693 __rep_ = __rep();
26272694 __annotate_new(0);
26282695
2629# if _LIBCPP_HAS_EXCEPTIONS
2630 try {
2631# endif // _LIBCPP_HAS_EXCEPTIONS
2632 for (; __first != __last; ++__first)
2633 push_back(*__first);
2634# if _LIBCPP_HAS_EXCEPTIONS
2635 } catch (...) {
2636 __annotate_delete();
2637 if (__is_long())
2638 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
2639 throw;
2640 }
2641# endif // _LIBCPP_HAS_EXCEPTIONS
2696 auto __guard = std::__make_exception_guard([this] { __reset_internal_buffer(); });
2697 for (; __first != __last; ++__first)
2698 push_back(*__first);
2699 __guard.__complete();
26422700}
26432701
26442702template <class _CharT, class _Traits, class _Allocator>
......@@ -2653,39 +2711,12 @@ template <class _CharT, class _Traits, class _Allocator>
26532711template <class _InputIterator, class _Sentinel>
26542712_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
26552713basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz) {
2656 if (__libcpp_is_constant_evaluated())
2657 __rep_ = __rep();
2714 pointer __p = __init_internal_buffer(__sz);
26582715
2659 if (__sz > max_size())
2660 this->__throw_length_error();
2661
2662 pointer __p;
2663 if (__fits_in_sso(__sz)) {
2664 __set_short_size(__sz);
2665 __p = __get_short_pointer();
2666
2667 } else {
2668 auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
2669 __p = __allocation.ptr;
2670 __begin_lifetime(__p, __allocation.count);
2671 __set_long_pointer(__p);
2672 __set_long_cap(__allocation.count);
2673 __set_long_size(__sz);
2674 }
2675
2676# if _LIBCPP_HAS_EXCEPTIONS
2677 try {
2678# endif // _LIBCPP_HAS_EXCEPTIONS
2679 auto __end = __copy_non_overlapping_range(std::move(__first), std::move(__last), std::__to_address(__p));
2680 traits_type::assign(*__end, value_type());
2681# if _LIBCPP_HAS_EXCEPTIONS
2682 } catch (...) {
2683 if (__is_long())
2684 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
2685 throw;
2686 }
2687# endif // _LIBCPP_HAS_EXCEPTIONS
2688 __annotate_new(__sz);
2716 auto __guard = std::__make_exception_guard([this] { __reset_internal_buffer(); });
2717 auto __end = __copy_non_overlapping_range(std::move(__first), std::move(__last), std::__to_address(__p));
2718 traits_type::assign(*__end, value_type());
2719 __guard.__complete();
26892720}
26902721
26912722template <class _CharT, class _Traits, class _Allocator>
......@@ -2697,32 +2728,22 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
26972728 size_type __n_del,
26982729 size_type __n_add,
26992730 const value_type* __p_new_stuff) {
2700 size_type __ms = max_size();
2701 if (__delta_cap > __ms - __old_cap)
2702 __throw_length_error();
2731 __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
27032732 pointer __old_p = __get_pointer();
2704 size_type __cap =
2705 __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms;
27062733 __annotate_delete();
2707 auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
2708 auto __allocation = std::__allocate_at_least(__alloc_, __cap + 1);
2709 pointer __p = __allocation.ptr;
2710 __begin_lifetime(__p, __allocation.count);
2734 auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
27112735 if (__n_copy != 0)
2712 traits_type::copy(std::__to_address(__p), std::__to_address(__old_p), __n_copy);
2736 traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy);
27132737 if (__n_add != 0)
2714 traits_type::copy(std::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
2738 traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy, __p_new_stuff, __n_add);
27152739 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
27162740 if (__sec_cp_sz != 0)
2717 traits_type::copy(
2718 std::__to_address(__p) + __n_copy + __n_add, std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
2719 if (__old_cap + 1 != __min_cap)
2720 __alloc_traits::deallocate(__alloc_, __old_p, __old_cap + 1);
2721 __set_long_pointer(__p);
2722 __set_long_cap(__allocation.count);
2723 __old_sz = __n_copy + __n_add + __sec_cp_sz;
2724 __set_long_size(__old_sz);
2725 traits_type::assign(__p[__old_sz], value_type());
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);
2744 __buffer.__size_ = __n_copy + __n_add + __sec_cp_sz;
2745 traits_type::assign(__buffer.__data_[__buffer.__size_], value_type());
2746 __reset_internal_buffer(__buffer);
27262747}
27272748
27282749// __grow_by is deprecated because it does not set the size. It may not update the size when the size is changed, and it
......@@ -2740,25 +2761,20 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
27402761 size_type __n_copy,
27412762 size_type __n_del,
27422763 size_type __n_add) {
2743 size_type __ms = max_size();
2744 if (__delta_cap > __ms - __old_cap)
2745 this->__throw_length_error();
2764 __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
27462765 pointer __old_p = __get_pointer();
2747 size_type __cap =
2748 __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms;
2749 auto __allocation = std::__allocate_at_least(__alloc_, __cap + 1);
2750 pointer __p = __allocation.ptr;
2751 __begin_lifetime(__p, __allocation.count);
27522766 if (__n_copy != 0)
2753 traits_type::copy(std::__to_address(__p), std::__to_address(__old_p), __n_copy);
2767 traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy);
27542768 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
27552769 if (__sec_cp_sz != 0)
2756 traits_type::copy(
2757 std::__to_address(__p) + __n_copy + __n_add, std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
2758 if (__old_cap + 1 != __min_cap)
2759 __alloc_traits::deallocate(__alloc_, __old_p, __old_cap + 1);
2760 __set_long_pointer(__p);
2761 __set_long_cap(__allocation.count);
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
2774 // This is -1 to make sure the caller sets the size properly, since old versions of this function didn't set the size
2775 // at all.
2776 __buffer.__size_ = -1;
2777 __reset_internal_buffer(__buffer);
27622778}
27632779
27642780template <class _CharT, class _Traits, class _Allocator>
......@@ -2775,6 +2791,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_without_replace(
27752791 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
27762792 __grow_by(__old_cap, __delta_cap, __old_sz, __n_copy, __n_del, __n_add);
27772793 _LIBCPP_SUPPRESS_DEPRECATED_POP
2794 // Due to the ABI of __grow_by we have to set the size after calling it.
27782795 __set_long_size(__old_sz - __n_del + __n_add);
27792796}
27802797
......@@ -2786,24 +2803,23 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Al
27862803basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(const value_type* __s, size_type __n) {
27872804 const auto __cap = __is_short ? static_cast<size_type>(__min_cap) : __get_long_cap();
27882805 const auto __size = __is_short ? __get_short_size() : __get_long_size();
2789 if (__n < __cap) {
2790 if (__n > __size)
2791 __annotate_increase(__n - __size);
2792 pointer __p;
2793 if (__is_short) {
2794 __p = __get_short_pointer();
2795 __set_short_size(__n);
2796 } else {
2797 __p = __get_long_pointer();
2798 __set_long_size(__n);
2799 }
2800 traits_type::copy(std::__to_address(__p), __s, __n);
2801 traits_type::assign(__p[__n], value_type());
2802 if (__size > __n)
2803 __annotate_shrink(__size);
2804 } else {
2806 if (__n >= __cap) {
28052807 __grow_by_and_replace(__cap - 1, __n - __cap + 1, __size, 0, __size, __n, __s);
2808 return *this;
28062809 }
2810
2811 __annotate_delete();
2812 auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
2813 pointer __p;
2814 if (__is_short) {
2815 __p = __get_short_pointer();
2816 __set_short_size(__n);
2817 } else {
2818 __p = __get_long_pointer();
2819 __set_long_size(__n);
2820 }
2821 traits_type::copy(std::__to_address(__p), __s, __n);
2822 traits_type::assign(__p[__n], value_type());
28072823 return *this;
28082824}
28092825
......@@ -2910,7 +2926,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
29102926{
29112927 __annotate_delete();
29122928 if (__is_long()) {
2913 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
2929 __reset_internal_buffer();
29142930# if _LIBCPP_STD_VER <= 14
29152931 if (!is_nothrow_move_assignable<allocator_type>::value) {
29162932 __set_short_size(0);
......@@ -2961,7 +2977,7 @@ template <class _Iterator, class _Sentinel>
29612977_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
29622978basic_string<_CharT, _Traits, _Allocator>::__assign_trivial(_Iterator __first, _Sentinel __last, size_type __n) {
29632979 _LIBCPP_ASSERT_INTERNAL(
2964 __string_is_trivial_iterator<_Iterator>::value, "The iterator type given to `__assign_trivial` must be trivial");
2980 __string_is_trivial_iterator_v<_Iterator>, "The iterator type given to `__assign_trivial` must be trivial");
29652981
29662982 size_type __old_size = size();
29672983 size_type __cap = capacity();
......@@ -3017,52 +3033,40 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty
30173033 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
30183034 size_type __cap = capacity();
30193035 size_type __sz = size();
3020 if (__cap - __sz >= __n) {
3021 if (__n) {
3022 __annotate_increase(__n);
3023 value_type* __p = std::__to_address(__get_pointer());
3024 traits_type::copy(__p + __sz, __s, __n);
3025 __sz += __n;
3026 __set_size(__sz);
3027 traits_type::assign(__p[__sz], value_type());
3028 }
3029 } else
3036 if (__cap - __sz < __n) {
30303037 __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
3038 return *this;
3039 }
3040
3041 if (__n == 0)
3042 return *this;
3043
3044 __annotate_increase(__n);
3045 value_type* __p = std::__to_address(__get_pointer());
3046 traits_type::copy(__p + __sz, __s, __n);
3047 __sz += __n;
3048 __set_size(__sz);
3049 traits_type::assign(__p[__sz], value_type());
30313050 return *this;
30323051}
30333052
30343053template <class _CharT, class _Traits, class _Allocator>
30353054_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
30363055basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) {
3037 if (__n) {
3038 size_type __cap = capacity();
3039 size_type __sz = size();
3040 if (__cap - __sz < __n)
3041 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
3042 __annotate_increase(__n);
3043 pointer __p = __get_pointer();
3044 traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
3045 __sz += __n;
3046 __set_size(__sz);
3047 traits_type::assign(__p[__sz], value_type());
3048 }
3049 return *this;
3050}
3056 if (__n == 0)
3057 return *this;
30513058
3052template <class _CharT, class _Traits, class _Allocator>
3053_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
3054basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) {
3055 if (__n) {
3056 size_type __cap = capacity();
3057 size_type __sz = size();
3058 if (__cap - __sz < __n)
3059 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
3060 __annotate_increase(__n);
3061 pointer __p = __get_pointer();
3062 __sz += __n;
3063 __set_size(__sz);
3064 traits_type::assign(__p[__sz], value_type());
3065 }
3059 size_type __cap = capacity();
3060 size_type __sz = size();
3061 if (__cap - __sz < __n)
3062 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
3063 __annotate_increase(__n);
3064 pointer __p = __get_pointer();
3065 traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
3066 __sz += __n;
3067 __set_size(__sz);
3068 traits_type::assign(__p[__sz], value_type());
3069 return *this;
30663070}
30673071
30683072template <class _CharT, class _Traits, class _Allocator>
......@@ -3120,23 +3124,27 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
31203124 if (__pos > __sz)
31213125 this->__throw_out_of_range();
31223126 size_type __cap = capacity();
3123 if (__cap - __sz >= __n) {
3124 if (__n) {
3125 __annotate_increase(__n);
3126 value_type* __p = std::__to_address(__get_pointer());
3127 size_type __n_move = __sz - __pos;
3128 if (__n_move != 0) {
3129 if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
3130 __s += __n;
3131 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
3132 }
3133 traits_type::move(__p + __pos, __s, __n);
3134 __sz += __n;
3135 __set_size(__sz);
3136 traits_type::assign(__p[__sz], value_type());
3137 }
3138 } else
3127
3128 if (__cap - __sz < __n) {
31393129 __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
3130 return *this;
3131 }
3132
3133 if (__n == 0)
3134 return *this;
3135
3136 __annotate_increase(__n);
3137 value_type* __p = std::__to_address(__get_pointer());
3138 size_type __n_move = __sz - __pos;
3139 if (__n_move != 0) {
3140 if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
3141 __s += __n;
3142 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
3143 }
3144 traits_type::move(__p + __pos, __s, __n);
3145 __sz += __n;
3146 __set_size(__sz);
3147 traits_type::assign(__p[__sz], value_type());
31403148 return *this;
31413149}
31423150
......@@ -3146,24 +3154,26 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
31463154 size_type __sz = size();
31473155 if (__pos > __sz)
31483156 this->__throw_out_of_range();
3149 if (__n) {
3150 size_type __cap = capacity();
3151 value_type* __p;
3152 if (__cap - __sz >= __n) {
3153 __annotate_increase(__n);
3154 __p = std::__to_address(__get_pointer());
3155 size_type __n_move = __sz - __pos;
3156 if (__n_move != 0)
3157 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
3158 } else {
3159 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
3160 __p = std::__to_address(__get_long_pointer());
3161 }
3162 traits_type::assign(__p + __pos, __n, __c);
3163 __sz += __n;
3164 __set_size(__sz);
3165 traits_type::assign(__p[__sz], value_type());
3157
3158 if (__n == 0)
3159 return *this;
3160
3161 size_type __cap = capacity();
3162 value_type* __p;
3163 if (__cap - __sz >= __n) {
3164 __annotate_increase(__n);
3165 __p = std::__to_address(__get_pointer());
3166 size_type __n_move = __sz - __pos;
3167 if (__n_move != 0)
3168 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
3169 } else {
3170 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
3171 __p = std::__to_address(__get_long_pointer());
31663172 }
3173 traits_type::assign(__p + __pos, __n, __c);
3174 __sz += __n;
3175 __set_size(__sz);
3176 traits_type::assign(__p[__sz], value_type());
31673177 return *this;
31683178}
31693179
......@@ -3176,7 +3186,7 @@ basic_string<_CharT, _Traits, _Allocator>::__insert_with_size(
31763186 if (__n == 0)
31773187 return begin() + __ip;
31783188
3179 if (__string_is_trivial_iterator<_Iterator>::value && !__addr_in_range(*__first)) {
3189 if (__string_is_trivial_iterator_v<_Iterator> && !__addr_in_range(*__first)) {
31803190 return __insert_from_safe_copy(__n, __ip, std::move(__first), std::move(__last));
31813191 } else {
31823192 const basic_string __temp(__init_with_sentinel_tag(), std::move(__first), std::move(__last), __alloc_);
......@@ -3237,38 +3247,38 @@ basic_string<_CharT, _Traits, _Allocator>::replace(
32373247 this->__throw_out_of_range();
32383248 __n1 = std::min(__n1, __sz - __pos);
32393249 size_type __cap = capacity();
3240 if (__cap - __sz + __n1 >= __n2) {
3241 value_type* __p = std::__to_address(__get_pointer());
3242 if (__n1 != __n2) {
3243 if (__n2 > __n1)
3244 __annotate_increase(__n2 - __n1);
3245 size_type __n_move = __sz - __pos - __n1;
3246 if (__n_move != 0) {
3247 if (__n1 > __n2) {
3248 traits_type::move(__p + __pos, __s, __n2);
3249 traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
3250 return __null_terminate_at(__p, __sz + (__n2 - __n1));
3251 }
3252 if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s)) {
3253 if (__p + __pos + __n1 <= __s)
3254 __s += __n2 - __n1;
3255 else // __p + __pos < __s < __p + __pos + __n1
3256 {
3257 traits_type::move(__p + __pos, __s, __n1);
3258 __pos += __n1;
3259 __s += __n2;
3260 __n2 -= __n1;
3261 __n1 = 0;
3262 }
3263 }
3250 if (__cap - __sz + __n1 < __n2) {
3251 __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
3252 return *this;
3253 }
3254
3255 value_type* __p = std::__to_address(__get_pointer());
3256 if (__n1 != __n2) {
3257 if (__n2 > __n1)
3258 __annotate_increase(__n2 - __n1);
3259 size_type __n_move = __sz - __pos - __n1;
3260 if (__n_move != 0) {
3261 if (__n1 > __n2) {
3262 traits_type::move(__p + __pos, __s, __n2);
32643263 traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
3264 return __null_terminate_at(__p, __sz + (__n2 - __n1));
3265 }
3266 if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s)) {
3267 if (__p + __pos + __n1 <= __s) {
3268 __s += __n2 - __n1;
3269 } else { // __p + __pos < __s < __p + __pos + __n1
3270 traits_type::move(__p + __pos, __s, __n1);
3271 __pos += __n1;
3272 __s += __n2;
3273 __n2 -= __n1;
3274 __n1 = 0;
3275 }
32653276 }
3277 traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
32663278 }
3267 traits_type::move(__p + __pos, __s, __n2);
3268 return __null_terminate_at(__p, __sz + (__n2 - __n1));
3269 } else
3270 __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
3271 return *this;
3279 }
3280 traits_type::move(__p + __pos, __s, __n2);
3281 return __null_terminate_at(__p, __sz + (__n2 - __n1));
32723282}
32733283
32743284template <class _CharT, class _Traits, class _Allocator>
......@@ -3320,16 +3330,17 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
33203330// Does not check __pos against size()
33213331template <class _CharT, class _Traits, class _Allocator>
33223332_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
3323basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) {
3324 if (__n) {
3325 size_type __sz = size();
3326 value_type* __p = std::__to_address(__get_pointer());
3327 __n = std::min(__n, __sz - __pos);
3328 size_type __n_move = __sz - __pos - __n;
3329 if (__n_move != 0)
3330 traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
3331 __null_terminate_at(__p, __sz - __n);
3332 }
3333basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) _NOEXCEPT {
3334 if (__n == 0)
3335 return;
3336
3337 size_type __sz = size();
3338 value_type* __p = std::__to_address(__get_pointer());
3339 __n = std::min(__n, __sz - __pos);
3340 size_type __n_move = __sz - __pos - __n;
3341 if (__n_move != 0)
3342 traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
3343 __null_terminate_at(__p, __sz - __n);
33333344}
33343345
33353346template <class _CharT, class _Traits, class _Allocator>
......@@ -3396,16 +3407,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re
33963407 __erase_to_end(__n);
33973408}
33983409
3399template <class _CharT, class _Traits, class _Allocator>
3400_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
3401basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) {
3402 size_type __sz = size();
3403 if (__n > __sz) {
3404 __append_default_init(__n - __sz);
3405 } else
3406 __erase_to_end(__n);
3407}
3408
34093410template <class _CharT, class _Traits, class _Allocator>
34103411_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) {
34113412 if (__requested_capacity > max_size())
......@@ -3418,31 +3419,23 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re
34183419 return;
34193420
34203421 __annotation_guard __g(*this);
3421 auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__requested_capacity) + 1);
3422 auto __size = size();
3423 __begin_lifetime(__allocation.ptr, __allocation.count);
3424 traits_type::copy(std::__to_address(__allocation.ptr), data(), __size + 1);
3425 if (__is_long())
3426 __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
3427 __set_long_cap(__allocation.count);
3428 __set_long_size(__size);
3429 __set_long_pointer(__allocation.ptr);
3422 __long __buffer = __allocate_long_buffer(__alloc_, __requested_capacity);
3423 __buffer.__size_ = size();
3424 traits_type::copy(std::__to_address(__buffer.__data_), data(), __buffer.__size_ + 1);
3425 __reset_internal_buffer(__buffer);
34303426}
34313427
34323428template <class _CharT, class _Traits, class _Allocator>
34333429inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT {
3434 size_type __target_capacity = __recommend(size());
3435 if (__target_capacity == capacity())
3430 if (!__is_long())
34363431 return;
34373432
3438 _LIBCPP_ASSERT_INTERNAL(__is_long(), "Trying to shrink small string");
3439
3440 // We're a long string and we're shrinking into the small buffer.
34413433 const auto __ptr = __get_long_pointer();
34423434 const auto __size = __get_long_size();
34433435 const auto __cap = __get_long_cap();
34443436
3445 if (__fits_in_sso(__target_capacity)) {
3437 // We're a long string and we're shrinking into the small buffer.
3438 if (__fits_in_sso(__size)) {
34463439 __annotation_guard __g(*this);
34473440 __set_short_size(__size);
34483441 traits_type::copy(std::__to_address(__get_short_pointer()), std::__to_address(__ptr), __size + 1);
......@@ -3450,25 +3443,25 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
34503443 return;
34513444 }
34523445
3446 if (__align_allocation_size(__size) == __cap)
3447 return;
3448
34533449# if _LIBCPP_HAS_EXCEPTIONS
34543450 try {
34553451# endif // _LIBCPP_HAS_EXCEPTIONS
34563452 __annotation_guard __g(*this);
3457 auto __allocation = std::__allocate_at_least(__alloc_, __target_capacity + 1);
3453 __long __buffer = __allocate_long_buffer(__alloc_, __size);
34583454
34593455 // The Standard mandates shrink_to_fit() does not increase the capacity.
34603456 // With equal capacity keep the existing buffer. This avoids extra work
34613457 // due to swapping the elements.
3462 if (__allocation.count - 1 >= capacity()) {
3463 __alloc_traits::deallocate(__alloc_, __allocation.ptr, __allocation.count);
3458 if (__buffer.__cap_ * __endian_factor - 1 >= capacity()) {
3459 __alloc_traits::deallocate(__alloc_, __buffer.__data_, __buffer.__cap_ * __endian_factor);
34643460 return;
34653461 }
34663462
3467 __begin_lifetime(__allocation.ptr, __allocation.count);
3468 traits_type::copy(std::__to_address(__allocation.ptr), std::__to_address(__ptr), __size + 1);
3469 __alloc_traits::deallocate(__alloc_, __ptr, __cap);
3470 __set_long_cap(__allocation.count);
3471 __set_long_pointer(__allocation.ptr);
3463 traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__get_long_pointer()), __size + 1);
3464 __reset_internal_buffer(__buffer);
34723465# if _LIBCPP_HAS_EXCEPTIONS
34733466 } catch (...) {
34743467 return;
......@@ -3574,7 +3567,8 @@ operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
35743567
35753568template <class _CharT, class _Traits, class _Allocator>
35763569inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
3577operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
3570operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3571 const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __rhs) _NOEXCEPT {
35783572 _LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
35793573
35803574 using _String = basic_string<_CharT, _Traits, _Allocator>;
......@@ -3858,46 +3852,52 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Tra
38583852 __lhs.swap(__rhs);
38593853}
38603854
3861_LIBCPP_EXPORTED_FROM_ABI int stoi(const string& __str, size_t* __idx = nullptr, int __base = 10);
3862_LIBCPP_EXPORTED_FROM_ABI long stol(const string& __str, size_t* __idx = nullptr, int __base = 10);
3863_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const string& __str, size_t* __idx = nullptr, int __base = 10);
3864_LIBCPP_EXPORTED_FROM_ABI long long stoll(const string& __str, size_t* __idx = nullptr, int __base = 10);
3865_LIBCPP_EXPORTED_FROM_ABI unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
3866
3867_LIBCPP_EXPORTED_FROM_ABI float stof(const string& __str, size_t* __idx = nullptr);
3868_LIBCPP_EXPORTED_FROM_ABI double stod(const string& __str, size_t* __idx = nullptr);
3869_LIBCPP_EXPORTED_FROM_ABI long double stold(const string& __str, size_t* __idx = nullptr);
3870
3871_LIBCPP_EXPORTED_FROM_ABI string to_string(int __val);
3872_LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned __val);
3873_LIBCPP_EXPORTED_FROM_ABI string to_string(long __val);
3874_LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned long __val);
3875_LIBCPP_EXPORTED_FROM_ABI string to_string(long long __val);
3876_LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned long long __val);
3877_LIBCPP_EXPORTED_FROM_ABI string to_string(float __val);
3878_LIBCPP_EXPORTED_FROM_ABI string to_string(double __val);
3879_LIBCPP_EXPORTED_FROM_ABI string to_string(long double __val);
3855[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI int stoi(const string& __str, size_t* __idx = nullptr, int __base = 10);
3856[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long
3857stoul(const string& __str, size_t* __idx = nullptr, int __base = 10);
3858[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long stol(const string& __str, size_t* __idx = nullptr, int __base = 10);
3859[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long long
3860stoll(const string& __str, size_t* __idx = nullptr, int __base = 10);
3861[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long long
3862stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
3863
3864[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI float stof(const string& __str, size_t* __idx = nullptr);
3865[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI double stod(const string& __str, size_t* __idx = nullptr);
3866[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long double stold(const string& __str, size_t* __idx = nullptr);
3867
3868[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(int __val);
3869[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned __val);
3870[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(long __val);
3871[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned long __val);
3872[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(long long __val);
3873[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned long long __val);
3874[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(float __val);
3875[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(double __val);
3876[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(long double __val);
38803877
38813878# if _LIBCPP_HAS_WIDE_CHARACTERS
3882_LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3883_LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3884_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3885_LIBCPP_EXPORTED_FROM_ABI long long stoll(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3886_LIBCPP_EXPORTED_FROM_ABI unsigned long long stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3887
3888_LIBCPP_EXPORTED_FROM_ABI float stof(const wstring& __str, size_t* __idx = nullptr);
3889_LIBCPP_EXPORTED_FROM_ABI double stod(const wstring& __str, size_t* __idx = nullptr);
3890_LIBCPP_EXPORTED_FROM_ABI long double stold(const wstring& __str, size_t* __idx = nullptr);
3891
3892_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(int __val);
3893_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned __val);
3894_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long __val);
3895_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long __val);
3896_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long long __val);
3897_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long long __val);
3898_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(float __val);
3899_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(double __val);
3900_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long double __val);
3879[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3880[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3881[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long
3882stoul(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3883[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long long
3884stoll(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3885[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long long
3886stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
3887
3888[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI float stof(const wstring& __str, size_t* __idx = nullptr);
3889[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI double stod(const wstring& __str, size_t* __idx = nullptr);
3890[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long double stold(const wstring& __str, size_t* __idx = nullptr);
3891
3892[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(int __val);
3893[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned __val);
3894[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long __val);
3895[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long __val);
3896[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long long __val);
3897[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long long __val);
3898[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(float __val);
3899[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(double __val);
3900[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long double __val);
39013901# endif // _LIBCPP_HAS_WIDE_CHARACTERS
39023902
39033903template <class _CharT, class _Traits, class _Allocator>
......@@ -3906,7 +3906,7 @@ _LIBCPP_TEMPLATE_DATA_VIS const typename basic_string<_CharT, _Traits, _Allocato
39063906
39073907template <class _CharT, class _Allocator>
39083908struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> {
3909 _LIBCPP_HIDE_FROM_ABI size_t
3909 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t
39103910 operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT {
39113911 return std::__do_string_hash(__val.data(), __val.data() + __val.size());
39123912 }
......@@ -3977,30 +3977,31 @@ erase_if(basic_string<_CharT, _Traits, _Allocator>& __str, _Predicate __pred) {
39773977// Literal suffixes for basic_string [basic.string.literals]
39783978inline namespace literals {
39793979inline namespace string_literals {
3980inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char>
3980[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char>
39813981operator""s(const char* __str, size_t __len) {
39823982 return basic_string<char>(__str, __len);
39833983}
39843984
39853985# if _LIBCPP_HAS_WIDE_CHARACTERS
3986inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<wchar_t>
3987operator""s(const wchar_t* __str, size_t __len) {
3986[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
3987_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<wchar_t> operator""s(const wchar_t* __str, size_t __len) {
39883988 return basic_string<wchar_t>(__str, __len);
39893989}
39903990# endif
39913991
39923992# if _LIBCPP_HAS_CHAR8_T
3993inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string<char8_t> operator""s(const char8_t* __str, size_t __len) {
3993[[__nodiscard__]] inline
3994 _LIBCPP_HIDE_FROM_ABI constexpr basic_string<char8_t> operator""s(const char8_t* __str, size_t __len) {
39943995 return basic_string<char8_t>(__str, __len);
39953996}
39963997# endif
39973998
3998inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char16_t>
3999operator""s(const char16_t* __str, size_t __len) {
3999[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
4000_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char16_t> operator""s(const char16_t* __str, size_t __len) {
40004001 return basic_string<char16_t>(__str, __len);
40014002}
40024003
4003inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char32_t>
4004[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char32_t>
40044005operator""s(const char32_t* __str, size_t __len) {
40054006 return basic_string<char32_t>(__str, __len);
40064007}
lib/libcxx/include/string_view+113-89
......@@ -130,6 +130,8 @@ namespace std {
130130 size_type copy(charT* s, size_type n, size_type pos = 0) const; // constexpr in C++20
131131
132132 constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
133 constexpr basic_string_view subview(size_type pos = 0,
134 size_type n = npos) const; // freestanding-deleted, since C++26
133135 constexpr int compare(basic_string_view s) const noexcept;
134136 constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
135137 constexpr int compare(size_type pos1, size_type n1,
......@@ -318,9 +320,9 @@ public:
318320 _LIBCPP_HIDE_FROM_ABI basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
319321
320322 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
321 : __data_(__s),
322 __size_(__len) {
323# if _LIBCPP_STD_VER >= 14
323 _LIBCPP_DIAGNOSE_NULLPTR_IF(__len != 0 && __s == nullptr, " if len is not zero")
324 : __data_(__s), __size_(__len) {
325# if !defined(_LIBCPP_CXX03_LANG) && (!defined(_LIBCPP_COMPILER_GCC) || _LIBCPP_STD_VER >= 14)
324326 // Allocations must fit in `ptrdiff_t` for pointer arithmetic to work. If `__len` exceeds it, the input
325327 // range could not have been valid. Most likely the caller underflowed some arithmetic and inadvertently
326328 // passed in a negative length.
......@@ -352,7 +354,7 @@ public:
352354 : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {}
353355# endif // _LIBCPP_STD_VER >= 23
354356
355 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s)
357 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s)
356358 : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
357359
358360# if _LIBCPP_STD_VER >= 23
......@@ -360,11 +362,11 @@ public:
360362# endif
361363
362364 // [string.view.iterators], iterators
363 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return cbegin(); }
365 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return cbegin(); }
364366
365 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return cend(); }
367 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return cend(); }
366368
367 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
369 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
368370# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
369371 return std::__make_bounded_iter(data(), data(), data() + size());
370372# else
......@@ -372,7 +374,7 @@ public:
372374# endif
373375 }
374376
375 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
377 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
376378# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
377379 return std::__make_bounded_iter(data() + size(), data(), data() + size());
378380# else
......@@ -380,51 +382,54 @@ public:
380382# endif
381383 }
382384
383 _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
385 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
386 rbegin() const _NOEXCEPT {
384387 return const_reverse_iterator(cend());
385388 }
386389
387 _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
390 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
388391 return const_reverse_iterator(cbegin());
389392 }
390393
391 _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
394 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
395 crbegin() const _NOEXCEPT {
392396 return const_reverse_iterator(cend());
393397 }
394398
395 _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
399 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
396400 return const_reverse_iterator(cbegin());
397401 }
398402
399403 // [string.view.capacity], capacity
400 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
404 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
401405
402 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type length() const _NOEXCEPT { return __size_; }
406 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type length() const _NOEXCEPT { return __size_; }
403407
404 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
408 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
405409 return numeric_limits<size_type>::max() / sizeof(value_type);
406410 }
407411
408412 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return __size_ == 0; }
409413
410414 // [string.view.access], element access
411 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __pos) const _NOEXCEPT {
415 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference
416 operator[](size_type __pos) const _NOEXCEPT {
412417 return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos < size(), "string_view[] index out of bounds"), __data_[__pos];
413418 }
414419
415 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __pos) const {
420 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __pos) const {
416421 return __pos >= size() ? (__throw_out_of_range("string_view::at"), __data_[0]) : __data_[__pos];
417422 }
418423
419 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
424 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
420425 return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::front(): string is empty"), __data_[0];
421426 }
422427
423 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
428 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
424429 return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::back(): string is empty"), __data_[__size_ - 1];
425430 }
426431
427 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_pointer data() const _NOEXCEPT { return __data_; }
432 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_pointer data() const _NOEXCEPT { return __data_; }
428433
429434 // [string.view.modifiers], modifiers:
430435 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void remove_prefix(size_type __n) _NOEXCEPT {
......@@ -457,15 +462,23 @@ public:
457462 return __rlen;
458463 }
459464
460 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view substr(size_type __pos = 0, size_type __n = npos) const {
465 [[__nodiscard__]] _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view
466 substr(size_type __pos = 0, size_type __n = npos) const {
461467 // Use the `__assume_valid` form of the constructor to avoid an unnecessary check. Any substring of a view is a
462468 // valid view. In particular, `size()` is known to be smaller than `numeric_limits<difference_type>::max()`, so the
463 // new size is also smaller. See also https://github.com/llvm/llvm-project/issues/91634.
469 // new size is also smaller. See also https://llvm.org/PR91634.
464470 return __pos > size() ? (__throw_out_of_range("string_view::substr"), basic_string_view())
465471 : basic_string_view(__assume_valid(), data() + __pos, std::min(__n, size() - __pos));
466472 }
467473
468 _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT {
474# if _LIBCPP_STD_VER >= 26
475 [[nodiscard]]
476 _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view subview(size_type __pos = 0, size_type __n = npos) const {
477 return substr(__pos, __n);
478 }
479# endif
480
481 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT {
469482 size_type __rlen = std::min(size(), __sv.size());
470483 int __retval = _Traits::compare(data(), __sv.data(), __rlen);
471484 if (__retval == 0) // first __rlen chars matched
......@@ -473,217 +486,226 @@ public:
473486 return __retval;
474487 }
475488
476 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
489 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
477490 compare(size_type __pos1, size_type __n1, basic_string_view __sv) const {
478491 return substr(__pos1, __n1).compare(__sv);
479492 }
480493
481 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
494 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
482495 compare(size_type __pos1, size_type __n1, basic_string_view __sv, size_type __pos2, size_type __n2) const {
483496 return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
484497 }
485498
486 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int compare(const _CharT* __s) const _NOEXCEPT {
499 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
500 compare(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s) const _NOEXCEPT {
487501 return compare(basic_string_view(__s));
488502 }
489503
490 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
491 compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
504 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
505 compare(size_type __pos1, size_type __n1, const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
492506 return substr(__pos1, __n1).compare(basic_string_view(__s));
493507 }
494508
495 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
496 compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const {
509 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
510 compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
511 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n2 != 0 && __s == nullptr, " if n2 is not zero") {
497512 return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
498513 }
499514
500515 // find
501 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
516 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
502517 find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
503 _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
504518 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s.data(), __pos, __s.size());
505519 }
506520
507 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
521 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
522 find(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
508523 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
509524 }
510525
511 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
512 find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
526 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
527 find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
528 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
513529 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
514530 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
515531 }
516532
517 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
518 find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
533 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
534 find(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
519535 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find(): received nullptr");
520536 return std::__str_find<value_type, size_type, traits_type, npos>(
521537 data(), size(), __s, __pos, traits_type::length(__s));
522538 }
523539
524540 // rfind
525 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
541 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
526542 rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
527 _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
528543 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s.data(), __pos, __s.size());
529544 }
530545
531 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
546 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
532547 rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
533548 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
534549 }
535550
536 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
537 rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
551 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
552 rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
553 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
538554 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
539555 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
540556 }
541557
542 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
543 rfind(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
558 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
559 rfind(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
544560 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::rfind(): received nullptr");
545561 return std::__str_rfind<value_type, size_type, traits_type, npos>(
546562 data(), size(), __s, __pos, traits_type::length(__s));
547563 }
548564
549565 // find_first_of
550 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
566 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
551567 find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
552 _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
553568 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
554569 data(), size(), __s.data(), __pos, __s.size());
555570 }
556571
557 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
572 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
558573 find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
559574 return find(__c, __pos);
560575 }
561576
562 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
563 find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
577 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
578 find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
579 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
564580 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
565581 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
566582 }
567583
568 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
569 find_first_of(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
584 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
585 find_first_of(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
570586 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_of(): received nullptr");
571587 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
572588 data(), size(), __s, __pos, traits_type::length(__s));
573589 }
574590
575591 // find_last_of
576 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
592 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
577593 find_last_of(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
578 _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
579594 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
580595 data(), size(), __s.data(), __pos, __s.size());
581596 }
582597
583 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
598 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
584599 find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
585600 return rfind(__c, __pos);
586601 }
587602
588 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
589 find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
603 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
604 find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
605 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
590606 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
591607 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
592608 }
593609
594 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
595 find_last_of(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
610 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
611 find_last_of(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
596612 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_of(): received nullptr");
597613 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
598614 data(), size(), __s, __pos, traits_type::length(__s));
599615 }
600616
601617 // find_first_not_of
602 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
618 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
603619 find_first_not_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
604 _LIBCPP_ASSERT_NON_NULL(
605 __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
606620 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
607621 data(), size(), __s.data(), __pos, __s.size());
608622 }
609623
610 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
624 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
611625 find_first_not_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
612626 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
613627 }
614628
615 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
616 find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
629 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
630 find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
631 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
617632 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
618633 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
619634 }
620635
621 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
622 find_first_not_of(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
636 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
637 find_first_not_of(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
623638 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
624639 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
625640 data(), size(), __s, __pos, traits_type::length(__s));
626641 }
627642
628643 // find_last_not_of
629 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
644 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
630645 find_last_not_of(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
631 _LIBCPP_ASSERT_NON_NULL(
632 __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
633646 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
634647 data(), size(), __s.data(), __pos, __s.size());
635648 }
636649
637 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
650 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
638651 find_last_not_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
639652 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
640653 }
641654
642 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
643 find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
655 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
656 find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
657 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
644658 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
645659 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
646660 }
647661
648 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
649 find_last_not_of(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
662 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
663 find_last_not_of(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
650664 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
651665 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
652666 data(), size(), __s, __pos, traits_type::length(__s));
653667 }
654668
655669# if _LIBCPP_STD_VER >= 20
656 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(basic_string_view __s) const noexcept {
670 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(basic_string_view __s) const noexcept {
657671 return size() >= __s.size() && compare(0, __s.size(), __s) == 0;
658672 }
659673
660 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
674 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
661675 return !empty() && _Traits::eq(front(), __c);
662676 }
663677
664 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(const value_type* __s) const noexcept {
678 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool
679 starts_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
665680 return starts_with(basic_string_view(__s));
666681 }
667682
668 constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(basic_string_view __s) const noexcept {
683 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(basic_string_view __s) const noexcept {
669684 return size() >= __s.size() && compare(size() - __s.size(), npos, __s) == 0;
670685 }
671686
672 constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
687 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
673688 return !empty() && _Traits::eq(back(), __c);
674689 }
675690
676 constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept {
691 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool
692 ends_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
677693 return ends_with(basic_string_view(__s));
678694 }
679695# endif
680696
681697# if _LIBCPP_STD_VER >= 23
682 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(basic_string_view __sv) const noexcept { return find(__sv) != npos; }
698 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(basic_string_view __sv) const noexcept {
699 return find(__sv) != npos;
700 }
683701
684 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept { return find(__c) != npos; }
702 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
703 return find(__c) != npos;
704 }
685705
686 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* __s) const { return find(__s) != npos; }
706 [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
707 return find(__s) != npos;
708 }
687709# endif
688710
689711private:
......@@ -886,7 +908,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Trai
886908// [string.view.hash]
887909template <class _CharT>
888910struct __string_view_hash : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t> {
889 _LIBCPP_HIDE_FROM_ABI size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
911 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t
912 operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
890913 return std::__do_string_hash(__val.data(), __val.data() + __val.size());
891914 }
892915};
......@@ -913,30 +936,31 @@ struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_
913936# if _LIBCPP_STD_VER >= 14
914937inline namespace literals {
915938inline namespace string_view_literals {
916inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char> operator""sv(const char* __str, size_t __len) noexcept {
939[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char>
940operator""sv(const char* __str, size_t __len) noexcept {
917941 return basic_string_view<char>(__str, __len);
918942}
919943
920944# if _LIBCPP_HAS_WIDE_CHARACTERS
921inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<wchar_t>
945[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<wchar_t>
922946operator""sv(const wchar_t* __str, size_t __len) noexcept {
923947 return basic_string_view<wchar_t>(__str, __len);
924948}
925949# endif
926950
927951# if _LIBCPP_HAS_CHAR8_T
928inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char8_t>
952[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char8_t>
929953operator""sv(const char8_t* __str, size_t __len) noexcept {
930954 return basic_string_view<char8_t>(__str, __len);
931955}
932956# endif
933957
934inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char16_t>
958[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char16_t>
935959operator""sv(const char16_t* __str, size_t __len) noexcept {
936960 return basic_string_view<char16_t>(__str, __len);
937961}
938962
939inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char32_t>
963[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char32_t>
940964operator""sv(const char32_t* __str, size_t __len) noexcept {
941965 return basic_string_view<char32_t>(__str, __len);
942966}
lib/libcxx/include/strstream+10-10
......@@ -179,8 +179,8 @@ public:
179179 void swap(strstreambuf& __rhs);
180180
181181 void freeze(bool __freezefl = true);
182 char* str();
183 int pcount() const;
182 [[__nodiscard__]] char* str();
183 [[__nodiscard__]] int pcount() const;
184184
185185protected:
186186 int_type overflow(int_type __c = EOF) override;
......@@ -264,8 +264,8 @@ public:
264264 __sb_.swap(__rhs.__sb_);
265265 }
266266
267 _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
268 _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
267 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
268 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
269269
270270private:
271271 strstreambuf __sb_;
......@@ -297,10 +297,10 @@ public:
297297 __sb_.swap(__rhs.__sb_);
298298 }
299299
300 _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
300 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
301301 _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
302 _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
303 _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
302 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
303 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
304304
305305private:
306306 strstreambuf __sb_; // exposition only
......@@ -340,10 +340,10 @@ public:
340340 }
341341
342342 // Members:
343 _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
343 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
344344 _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
345 _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
346 _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
345 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
346 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
347347
348348private:
349349 strstreambuf __sb_; // exposition only
lib/libcxx/include/syncstream+4-4
......@@ -317,9 +317,9 @@ public:
317317
318318 _LIBCPP_HIDE_FROM_ABI bool emit() { return emit(false); }
319319
320 _LIBCPP_HIDE_FROM_ABI streambuf_type* get_wrapped() const noexcept { return __wrapped_; }
320 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI streambuf_type* get_wrapped() const noexcept { return __wrapped_; }
321321
322 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
322 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
323323
324324 _LIBCPP_HIDE_FROM_ABI void set_emit_on_sync(bool __b) noexcept { __emit_on_sync_ = __b; }
325325
......@@ -496,9 +496,9 @@ public:
496496 }
497497 }
498498
499 _LIBCPP_HIDE_FROM_ABI streambuf_type* get_wrapped() const noexcept { return __sb_.get_wrapped(); }
499 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI streambuf_type* get_wrapped() const noexcept { return __sb_.get_wrapped(); }
500500
501 _LIBCPP_HIDE_FROM_ABI syncbuf_type* rdbuf() const noexcept {
501 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI syncbuf_type* rdbuf() const noexcept {
502502 return const_cast<syncbuf_type*>(std::addressof(__sb_));
503503 }
504504
lib/libcxx/include/tgmath.h+12-12
......@@ -18,22 +18,22 @@
1818*/
1919
2020#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
21# include <__cxx03/tgmath.h>
21# include <__cxx03/__config>
2222#else
2323# include <__config>
24#endif
2425
25# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
26# pragma GCC system_header
27# endif
26#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
27# pragma GCC system_header
28#endif
2829
29# ifdef __cplusplus
30# include <cmath>
31# include <complex>
32# else
33# if __has_include_next(<tgmath.h>)
34# include_next <tgmath.h>
35# endif
30#ifdef __cplusplus
31# include <cmath>
32# include <complex>
33#else
34# if __has_include_next(<tgmath.h>)
35# include_next <tgmath.h>
3636# endif
37#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
37#endif
3838
3939#endif // _LIBCPP_TGMATH_H
lib/libcxx/include/tuple+242-212
......@@ -106,6 +106,11 @@ public:
106106
107107 void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...)); // constexpr in C++20
108108 constexpr void swap(const tuple&) const noexcept(see-below); // C++23
109
110 template<tuple-like UTuple>
111 friend constexpr bool operator==(const tuple& t, const UTuple& u); // C++23
112 template<tuple-like UTuple>
113 friend constexpr auto operator<=>(const tuple& t, const UTuple& u); // C++23
109114};
110115
111116
......@@ -220,19 +225,16 @@ template <class... Types>
220225# include <__config>
221226# include <__cstddef/size_t.h>
222227# include <__fwd/array.h>
228# include <__fwd/get.h>
223229# include <__fwd/pair.h>
224230# include <__fwd/tuple.h>
225231# include <__memory/allocator_arg_t.h>
226232# include <__memory/uses_allocator.h>
227233# include <__tuple/find_index.h>
228234# include <__tuple/ignore.h>
229# include <__tuple/make_tuple_types.h>
230# include <__tuple/sfinae_helpers.h>
231235# include <__tuple/tuple_element.h>
232# include <__tuple/tuple_indices.h>
233# include <__tuple/tuple_like_ext.h>
236# include <__tuple/tuple_like.h>
234237# include <__tuple/tuple_size.h>
235# include <__tuple/tuple_types.h>
236238# include <__type_traits/common_reference.h>
237239# include <__type_traits/common_type.h>
238240# include <__type_traits/conditional.h>
......@@ -241,7 +243,6 @@ template <class... Types>
241243# include <__type_traits/disjunction.h>
242244# include <__type_traits/enable_if.h>
243245# include <__type_traits/invoke.h>
244# include <__type_traits/is_arithmetic.h>
245246# include <__type_traits/is_assignable.h>
246247# include <__type_traits/is_constructible.h>
247248# include <__type_traits/is_convertible.h>
......@@ -251,7 +252,6 @@ template <class... Types>
251252# include <__type_traits/is_nothrow_assignable.h>
252253# include <__type_traits/is_nothrow_constructible.h>
253254# include <__type_traits/is_reference.h>
254# include <__type_traits/is_replaceable.h>
255255# include <__type_traits/is_same.h>
256256# include <__type_traits/is_swappable.h>
257257# include <__type_traits/is_trivially_relocatable.h>
......@@ -263,12 +263,12 @@ template <class... Types>
263263# include <__type_traits/remove_cv.h>
264264# include <__type_traits/remove_cvref.h>
265265# include <__type_traits/remove_reference.h>
266# include <__type_traits/type_list.h>
266267# include <__type_traits/unwrap_ref.h>
267268# include <__utility/declval.h>
268269# include <__utility/forward.h>
269270# include <__utility/integer_sequence.h>
270271# include <__utility/move.h>
271# include <__utility/piecewise_construct.h>
272272# include <__utility/swap.h>
273273# include <version>
274274
......@@ -288,9 +288,65 @@ _LIBCPP_BEGIN_NAMESPACE_STD
288288
289289# ifndef _LIBCPP_CXX03_LANG
290290
291template <size_t _Ip, class _Tp, class _Up>
292_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(const _Tp& __x, const _Up& __y) {
293 if constexpr (_Ip == 0)
294 return true;
295 else
296 return std::__tuple_compare_equal<_Ip - 1>(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y);
297}
298
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
313# if _LIBCPP_STD_VER >= 20
314template <class _Ret, class _Tp, class _Up, size_t... _Is>
315_LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, const _Up& __y, index_sequence<_Is...>) {
316 _Ret __result = strong_ordering::equal;
317 static_cast<void>(
318 ((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
319 return __result;
320}
321# endif // _LIBCPP_STD_VER >= 20
322
323# if _LIBCPP_STD_VER >= 23
324template <class _Tp>
325concept __tuple_like_no_tuple = __tuple_like<_Tp> && !__is_tuple_v<_Tp>;
326
327template <class _Tp, class _Up, class _IndexSeq>
328struct __tuple_common_comparison_category_impl {};
329
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>>...>;
340};
341
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;
345# endif // _LIBCPP_STD_VER >= 23
346
291347// __tuple_leaf
292348
293template <size_t _Ip, class _Hp, bool = is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value >
349template <size_t _Ip, class _Hp, bool = is_empty<_Hp>::value && !__is_final_v<_Hp> >
294350class __tuple_leaf;
295351
296352template <size_t _Ip, class _Hp, bool _Ep>
......@@ -444,62 +500,52 @@ public:
444500template <class... _Tp>
445501_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swallow(_Tp&&...) _NOEXCEPT {}
446502
447template <class _Tp>
448struct __all_default_constructible;
449
450template <class... _Tp>
451struct __all_default_constructible<__tuple_types<_Tp...>> : __all<is_default_constructible<_Tp>::value...> {};
452
453503// __tuple_impl
454504
455505template <class _Indx, class... _Tp>
456506struct __tuple_impl;
457507
508struct __forward_args {};
509struct __value_init {};
510struct __from_tuple {};
511
458512template <size_t... _Indx, class... _Tp>
459513struct _LIBCPP_DECLSPEC_EMPTY_BASES
460 __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
514 __tuple_impl<__index_sequence<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
461515 _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl() noexcept(
462516 __all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
463517
464 template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
465 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
466 __tuple_indices<_Uf...>,
467 __tuple_types<_Tf...>,
468 __tuple_indices<_Ul...>,
469 __tuple_types<_Tl...>,
470 _Up&&... __u) noexcept(__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
471 __all<is_nothrow_default_constructible<_Tl>::value...>::value)
472 : __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {}
473
474 template <class _Alloc, size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
518 template <class... _Args>
519 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(__forward_args, _Args&&... __args)
520 : __tuple_leaf<_Indx, _Tp>(std::forward<_Args>(__args))... {}
521
522 template <class _Alloc>
523 _LIBCPP_HIDE_FROM_ABI
524 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(allocator_arg_t, const _Alloc& __alloc, __value_init)
525 : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc>(), __alloc)... {}
526
527 template <class _Alloc, class... _Args>
475528 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
476 allocator_arg_t,
477 const _Alloc& __a,
478 __tuple_indices<_Uf...>,
479 __tuple_types<_Tf...>,
480 __tuple_indices<_Ul...>,
481 __tuple_types<_Tl...>,
482 _Up&&... __u)
483 : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))...,
484 __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {}
485
486 template <class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0>
487 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) noexcept(
488 (__all<is_nothrow_constructible<
489 _Tp,
490 typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
529 allocator_arg_t, const _Alloc& __alloc, __forward_args, _Args&&... __args)
530 : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, _Args>(), __alloc, std::forward<_Args>(__args))... {}
531
532 template <class _Tuple>
533 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(__from_tuple, _Tuple&& __t) noexcept(
534 (__all<is_nothrow_constructible<_Tp, __copy_cvref_t<_Tuple, __tuple_element_t<_Indx, __remove_cvref_t<_Tuple>>>>::
535 value...>::value))
491536 : __tuple_leaf<_Indx, _Tp>(
492 std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
537 std::forward<__copy_cvref_t<_Tuple, __tuple_element_t<_Indx, __remove_cvref_t<_Tuple>>>>(
493538 std::get<_Indx>(__t)))... {}
494539
495 template <class _Alloc, class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0>
496 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
540 template <class _Alloc, class _Tuple>
541 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
542 __tuple_impl(allocator_arg_t, const _Alloc& __a, __from_tuple, _Tuple&& __t)
497543 : __tuple_leaf<_Indx, _Tp>(
498544 __uses_alloc_ctor<_Tp,
499545 _Alloc,
500 typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(),
546 __copy_cvref_t<_Tuple, __tuple_element_t<_Indx, __remove_cvref_t<_Tuple>>>>(),
501547 __a,
502 std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
548 std::forward<__copy_cvref_t<_Tuple, __tuple_element_t<_Indx, __remove_cvref_t<_Tuple>>>>(
503549 std::get<_Indx>(__t)))... {}
504550
505551 __tuple_impl(const __tuple_impl&) = default;
......@@ -518,19 +564,19 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES
518564
519565template <class _Dest, class _Source, size_t... _Np>
520566_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
521__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
567__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __index_sequence<_Np...>) {
522568 std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
523569}
524570
525571template <class _Dest, class _Source, class... _Up, size_t... _Np>
526572_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
527__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
573__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __type_list<_Up...>, __index_sequence<_Np...>) {
528574 std::__swallow(((std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))), void(), 0)...);
529575}
530576
531577template <class... _Tp>
532578class _LIBCPP_NO_SPECIALIZATIONS tuple {
533 typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
579 typedef __tuple_impl<__index_sequence_for<_Tp...>, _Tp...> _BaseT;
534580
535581 _BaseT __base_;
536582
......@@ -549,7 +595,6 @@ class _LIBCPP_NO_SPECIALIZATIONS tuple {
549595public:
550596 using __trivially_relocatable _LIBCPP_NODEBUG =
551597 __conditional_t<_And<__libcpp_is_trivially_relocatable<_Tp>...>::value, tuple, void>;
552 using __replaceable _LIBCPP_NODEBUG = __conditional_t<_And<__is_replaceable<_Tp>...>::value, tuple, void>;
553598
554599 // [tuple.cnstr]
555600
......@@ -566,12 +611,7 @@ public:
566611 __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
567612 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
568613 tuple(allocator_arg_t, _Alloc const& __a)
569 : __base_(allocator_arg_t(),
570 __a,
571 __tuple_indices<>(),
572 __tuple_types<>(),
573 typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
574 __tuple_types<_Tp...>()) {}
614 : __base_(allocator_arg_t(), __a, __value_init{}) {}
575615
576616 // tuple(const T&...) constructors (including allocator_arg_t variants)
577617 template <template <class...> class _And = _And,
......@@ -579,11 +619,7 @@ public:
579619 _LIBCPP_HIDE_FROM_ABI
580620 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
581621 tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value)
582 : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
583 typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
584 typename __make_tuple_indices<0>::type(),
585 typename __make_tuple_types<tuple, 0>::type(),
586 __t...) {}
622 : __base_(__forward_args{}, __t...) {}
587623
588624 template <class _Alloc,
589625 template <class...> class _And = _And,
......@@ -591,13 +627,7 @@ public:
591627 _LIBCPP_HIDE_FROM_ABI
592628 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
593629 tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
594 : __base_(allocator_arg_t(),
595 __a,
596 typename __make_tuple_indices<sizeof...(_Tp)>::type(),
597 typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
598 typename __make_tuple_indices<0>::type(),
599 typename __make_tuple_types<tuple, 0>::type(),
600 __t...) {}
630 : __base_(allocator_arg_t(), __a, __forward_args{}, __t...) {}
601631
602632 // tuple(U&& ...) constructors (including allocator_arg_t variants)
603633 template <class... _Up>
......@@ -616,11 +646,7 @@ public:
616646 int> = 0>
617647 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
618648 tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
619 : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
620 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
621 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
622 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
623 std::forward<_Up>(__u)...) {}
649 : __base_(__forward_args{}, std::forward<_Up>(__u)...) {}
624650
625651 template <class _Alloc,
626652 class... _Up,
......@@ -628,13 +654,7 @@ public:
628654 int> = 0>
629655 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
630656 tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
631 : __base_(allocator_arg_t(),
632 __a,
633 typename __make_tuple_indices<sizeof...(_Up)>::type(),
634 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
635 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
636 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
637 std::forward<_Up>(__u)...) {}
657 : __base_(allocator_arg_t(), __a, __forward_args{}, std::forward<_Up>(__u)...) {}
638658
639659 // Copy and move constructors (including the allocator_arg_t variants)
640660 tuple(const tuple&) = default;
......@@ -644,13 +664,13 @@ public:
644664 template <class...> class _And = _And,
645665 __enable_if_t< _And<is_copy_constructible<_Tp>...>::value, int> = 0>
646666 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t)
647 : __base_(allocator_arg_t(), __alloc, __t) {}
667 : __base_(allocator_arg_t(), __alloc, __from_tuple(), __t) {}
648668
649669 template <class _Alloc,
650670 template <class...> class _And = _And,
651671 __enable_if_t< _And<is_move_constructible<_Tp>...>::value, int> = 0>
652672 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t)
653 : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
673 : __base_(allocator_arg_t(), __alloc, __from_tuple(), std::move(__t)) {}
654674
655675 // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants)
656676
......@@ -683,7 +703,7 @@ public:
683703 _LIBCPP_HIDE_FROM_ABI
684704 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
685705 tuple(const tuple<_Up...>& __t) noexcept(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)
686 : __base_(__t) {}
706 : __base_(__from_tuple(), __t) {}
687707
688708 template <class... _Up,
689709 class _Alloc,
......@@ -691,33 +711,33 @@ public:
691711 _LIBCPP_HIDE_FROM_ABI
692712 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
693713 tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
694 : __base_(allocator_arg_t(), __a, __t) {}
714 : __base_(allocator_arg_t(), __a, __from_tuple(), __t) {}
695715
696716# if _LIBCPP_STD_VER >= 23
697717 // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
698718
699719 template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
700720 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t)
701 : __base_(__t) {}
721 : __base_(__from_tuple(), __t) {}
702722
703723 template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
704724 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
705725 tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t)
706 : __base_(allocator_arg_t(), __alloc, __t) {}
726 : __base_(allocator_arg_t(), __alloc, __from_tuple(), __t) {}
707727# endif // _LIBCPP_STD_VER >= 23
708728
709729 // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
710730 template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
711731 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
712732 tuple(tuple<_Up...>&& __t) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
713 : __base_(std::move(__t)) {}
733 : __base_(__from_tuple(), std::move(__t)) {}
714734
715735 template <class _Alloc,
716736 class... _Up,
717737 __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
718738 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
719739 tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
720 : __base_(allocator_arg_t(), __a, std::move(__t)) {}
740 : __base_(allocator_arg_t(), __a, __from_tuple(), std::move(__t)) {}
721741
722742# if _LIBCPP_STD_VER >= 23
723743 // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
......@@ -725,14 +745,14 @@ public:
725745 template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
726746 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
727747 tuple(const tuple<_Up...>&& __t)
728 : __base_(std::move(__t)) {}
748 : __base_(__from_tuple(), std::move(__t)) {}
729749
730750 template <class _Alloc,
731751 class... _Up,
732752 enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
733753 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
734754 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
735 : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
755 : __base_(allocator_arg_t(), __alloc, __from_tuple(), std::move(__t)) {}
736756# endif // _LIBCPP_STD_VER >= 23
737757
738758 // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
......@@ -767,7 +787,7 @@ public:
767787 _LIBCPP_HIDE_FROM_ABI
768788 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
769789 tuple(const pair<_Up1, _Up2>& __p) noexcept(_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)
770 : __base_(__p) {}
790 : __base_(__from_tuple(), __p) {}
771791
772792 template <class _Alloc,
773793 class _Up1,
......@@ -777,7 +797,7 @@ public:
777797 _LIBCPP_HIDE_FROM_ABI
778798 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
779799 tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
780 : __base_(allocator_arg_t(), __a, __p) {}
800 : __base_(allocator_arg_t(), __a, __from_tuple(), __p) {}
781801
782802# if _LIBCPP_STD_VER >= 23
783803 // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants)
......@@ -785,7 +805,7 @@ public:
785805 template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr>
786806 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
787807 tuple(pair<_U1, _U2>& __p)
788 : __base_(__p) {}
808 : __base_(__from_tuple(), __p) {}
789809
790810 template <class _Alloc,
791811 class _U1,
......@@ -793,7 +813,7 @@ public:
793813 enable_if_t< _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr>
794814 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
795815 tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p)
796 : __base_(allocator_arg_t(), __alloc, __p) {}
816 : __base_(allocator_arg_t(), __alloc, __from_tuple(), __p) {}
797817# endif
798818
799819 // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants)
......@@ -805,7 +825,7 @@ public:
805825 _LIBCPP_HIDE_FROM_ABI
806826 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
807827 tuple(pair<_Up1, _Up2>&& __p) noexcept(_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)
808 : __base_(std::move(__p)) {}
828 : __base_(__from_tuple(), std::move(__p)) {}
809829
810830 template <class _Alloc,
811831 class _Up1,
......@@ -815,7 +835,7 @@ public:
815835 _LIBCPP_HIDE_FROM_ABI
816836 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
817837 tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
818 : __base_(allocator_arg_t(), __a, std::move(__p)) {}
838 : __base_(allocator_arg_t(), __a, __from_tuple(), std::move(__p)) {}
819839
820840# if _LIBCPP_STD_VER >= 23
821841 // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants)
......@@ -823,7 +843,7 @@ public:
823843 template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
824844 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
825845 tuple(const pair<_U1, _U2>&& __p)
826 : __base_(std::move(__p)) {}
846 : __base_(__from_tuple(), std::move(__p)) {}
827847
828848 template <class _Alloc,
829849 class _U1,
......@@ -831,14 +851,14 @@ public:
831851 enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
832852 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
833853 tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p)
834 : __base_(allocator_arg_t(), __alloc, std::move(__p)) {}
854 : __base_(allocator_arg_t(), __alloc, __from_tuple(), std::move(__p)) {}
835855# endif // _LIBCPP_STD_VER >= 23
836856
837857 // [tuple.assign]
838858 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
839859 operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) noexcept(
840860 _And<is_nothrow_copy_assignable<_Tp>...>::value) {
841 std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
861 std::__memberwise_copy_assign(*this, __tuple, __index_sequence_for<_Tp...>());
842862 return *this;
843863 }
844864
......@@ -846,15 +866,14 @@ public:
846866 _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple const& __tuple) const
847867 requires(_And<is_copy_assignable<const _Tp>...>::value)
848868 {
849 std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
869 std::__memberwise_copy_assign(*this, __tuple, __index_sequence_for<_Tp...>());
850870 return *this;
851871 }
852872
853873 _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple&& __tuple) const
854874 requires(_And<is_assignable<const _Tp&, _Tp>...>::value)
855875 {
856 std::__memberwise_forward_assign(
857 *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
876 std::__memberwise_forward_assign(*this, std::move(__tuple), __type_list<_Tp...>(), __index_sequence_for<_Tp...>());
858877 return *this;
859878 }
860879# endif // _LIBCPP_STD_VER >= 23
......@@ -862,8 +881,7 @@ public:
862881 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
863882 operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) noexcept(
864883 _And<is_nothrow_move_assignable<_Tp>...>::value) {
865 std::__memberwise_forward_assign(
866 *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
884 std::__memberwise_forward_assign(*this, std::move(__tuple), __type_list<_Tp...>(), __index_sequence_for<_Tp...>());
867885 return *this;
868886 }
869887
......@@ -873,7 +891,7 @@ public:
873891 int> = 0>
874892 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
875893 operator=(tuple<_Up...> const& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
876 std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
894 std::__memberwise_copy_assign(*this, __tuple, __index_sequence_for<_Tp...>());
877895 return *this;
878896 }
879897
......@@ -882,8 +900,7 @@ public:
882900 int> = 0>
883901 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
884902 operator=(tuple<_Up...>&& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
885 std::__memberwise_forward_assign(
886 *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
903 std::__memberwise_forward_assign(*this, std::move(__tuple), __type_list<_Up...>(), __index_sequence_for<_Tp...>());
887904 return *this;
888905 }
889906
......@@ -892,7 +909,7 @@ public:
892909 enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
893910 is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
894911 _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const tuple<_UTypes...>& __u) const {
895 std::__memberwise_copy_assign(*this, __u, typename __make_tuple_indices<sizeof...(_Tp)>::type());
912 std::__memberwise_copy_assign(*this, __u, index_sequence_for<_Tp...>());
896913 return *this;
897914 }
898915
......@@ -900,8 +917,7 @@ public:
900917 enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
901918 is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
902919 _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple<_UTypes...>&& __u) const {
903 std::__memberwise_forward_assign(
904 *this, __u, __tuple_types<_UTypes...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
920 std::__memberwise_forward_assign(*this, __u, __type_list<_UTypes...>(), index_sequence_for<_Tp...>());
905921 return *this;
906922 }
907923# endif // _LIBCPP_STD_VER >= 23
......@@ -967,7 +983,7 @@ public:
967983 __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0>
968984 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
969985 operator=(array<_Up, _Np> const& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
970 std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type());
986 std::__memberwise_copy_assign(*this, __array, __index_sequence_for<_Tp...>());
971987 return *this;
972988 }
973989
......@@ -979,10 +995,7 @@ public:
979995 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
980996 operator=(array<_Up, _Np>&& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
981997 std::__memberwise_forward_assign(
982 *this,
983 std::move(__array),
984 __tuple_types<_If<true, _Up, _Tp>...>(),
985 typename __make_tuple_indices<sizeof...(_Tp)>::type());
998 *this, std::move(__array), __type_list<_If<true, _Up, _Tp>...>(), __index_sequence_for<_Tp...>());
986999 return *this;
9871000 }
9881001
......@@ -997,7 +1010,24 @@ public:
9971010 noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) {
9981011 __base_.swap(__t.__base_);
9991012 }
1000# endif // _LIBCPP_STD_VER >= 23
1013
1014 template <__tuple_like_no_tuple _UTuple>
1015# if _LIBCPP_STD_VER >= 26
1016 requires __can_tuple_compare_equal<tuple, _UTuple> && (sizeof...(_Tp) == tuple_size_v<_UTuple>)
1017# endif // _LIBCPP_STD_VER >= 26
1018 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const tuple& __x, const _UTuple& __y) {
1019 static_assert(sizeof...(_Tp) == tuple_size_v<_UTuple>, "Can't compare tuple-like values of different sizes");
1020 return std::__tuple_compare_equal<sizeof...(_Tp)>(__x, __y);
1021 }
1022
1023 template <__tuple_like_no_tuple _UTuple>
1024 requires(sizeof...(_Tp) == tuple_size_v<_UTuple>)
1025 _LIBCPP_HIDE_FROM_ABI friend constexpr __tuple_common_comparison_category<tuple, _UTuple>
1026 operator<=>(const tuple& __x, const _UTuple& __y) {
1027 return std::__tuple_compare_three_way<__tuple_common_comparison_category<tuple, _UTuple>>(
1028 __x, __y, index_sequence_for<_Tp...>{});
1029 }
1030# endif // _LIBCPP_STD_VER >= 23
10011031};
10021032
10031033_LIBCPP_DIAGNOSTIC_PUSH
......@@ -1019,6 +1049,21 @@ public:
10191049 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple&) _NOEXCEPT {}
10201050# if _LIBCPP_STD_VER >= 23
10211051 _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {}
1052
1053 template <__tuple_like_no_tuple _UTuple>
1054# if _LIBCPP_STD_VER >= 26
1055 requires(tuple_size_v<_UTuple> == 0)
1056# endif // _LIBCPP_STD_VER >= 26
1057 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const tuple&, const _UTuple&) {
1058 static_assert(tuple_size_v<_UTuple> == 0, "Can't compare tuple-like values of different sizes");
1059 return true;
1060 }
1061
1062 template <__tuple_like_no_tuple _UTuple>
1063 requires(tuple_size_v<_UTuple> == 0)
1064 _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(const tuple&, const _UTuple&) {
1065 return strong_ordering::equal;
1066 }
10221067# endif
10231068};
10241069_LIBCPP_DIAGNOSTIC_POP
......@@ -1068,28 +1113,32 @@ swap(const tuple<_Tp...>& __lhs,
10681113// get
10691114
10701115template <size_t _Ip, class... _Tp>
1071inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
1116[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
1117typename tuple_element<_Ip, tuple<_Tp...> >::type&
10721118get(tuple<_Tp...>& __t) _NOEXCEPT {
10731119 using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type;
10741120 return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
10751121}
10761122
10771123template <size_t _Ip, class... _Tp>
1078inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
1124[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
1125_LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
10791126get(const tuple<_Tp...>& __t) _NOEXCEPT {
10801127 using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type;
10811128 return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
10821129}
10831130
10841131template <size_t _Ip, class... _Tp>
1085inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
1132[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
1133typename tuple_element<_Ip, tuple<_Tp...> >::type&&
10861134get(tuple<_Tp...>&& __t) _NOEXCEPT {
10871135 using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type;
10881136 return static_cast<type&&>(static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
10891137}
10901138
10911139template <size_t _Ip, class... _Tp>
1092inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
1140[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
1141_LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
10931142get(const tuple<_Tp...>&& __t) _NOEXCEPT {
10941143 using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type;
10951144 return static_cast<const type&&>(static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
......@@ -1098,22 +1147,22 @@ get(const tuple<_Tp...>&& __t) _NOEXCEPT {
10981147# if _LIBCPP_STD_VER >= 14
10991148
11001149template <class _T1, class... _Args>
1101inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(tuple<_Args...>& __tup) noexcept {
1150[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(tuple<_Args...>& __tup) noexcept {
11021151 return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
11031152}
11041153
11051154template <class _T1, class... _Args>
1106inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept {
1155[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept {
11071156 return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
11081157}
11091158
11101159template <class _T1, class... _Args>
1111inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept {
1160[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept {
11121161 return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
11131162}
11141163
11151164template <class _T1, class... _Args>
1116inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept {
1165[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept {
11171166 return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
11181167}
11191168
......@@ -1122,37 +1171,22 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(tuple<_Args...> const&& _
11221171// tie
11231172
11241173template <class... _Tp>
1125inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT {
1174[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT {
11261175 return tuple<_Tp&...>(__t...);
11271176}
11281177
11291178template <class... _Tp>
1130inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<__unwrap_ref_decay_t<_Tp>...>
1179[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<__unwrap_ref_decay_t<_Tp>...>
11311180make_tuple(_Tp&&... __t) {
11321181 return tuple<__unwrap_ref_decay_t<_Tp>...>(std::forward<_Tp>(__t)...);
11331182}
11341183
11351184template <class... _Tp>
1136inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT {
1185[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&&...>
1186forward_as_tuple(_Tp&&... __t) _NOEXCEPT {
11371187 return tuple<_Tp&&...>(std::forward<_Tp>(__t)...);
11381188}
11391189
1140template <size_t _Ip>
1141struct __tuple_equal {
1142 template <class _Tp, class _Up>
1143 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
1144 return __tuple_equal<_Ip - 1>()(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y);
1145 }
1146};
1147
1148template <>
1149struct __tuple_equal<0> {
1150 template <class _Tp, class _Up>
1151 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
1152 return true;
1153 }
1154};
1155
11561190template <class... _Tp, class... _Up>
11571191# if _LIBCPP_STD_VER >= 26
11581192 requires(__all<requires(const _Tp& __t, const _Up& __u) {
......@@ -1162,27 +1196,19 @@ template <class... _Tp, class... _Up>
11621196inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
11631197operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
11641198 static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
1165 return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
1199 return std::__tuple_compare_equal<sizeof...(_Tp)>(__x, __y);
11661200}
11671201
11681202# if _LIBCPP_STD_VER >= 20
11691203
11701204// operator<=>
11711205
1172template <class... _Tp, class... _Up, size_t... _Is>
1173_LIBCPP_HIDE_FROM_ABI constexpr auto
1174__tuple_compare_three_way(const tuple<_Tp...>& __x, const tuple<_Up...>& __y, index_sequence<_Is...>) {
1175 common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal;
1176 static_cast<void>(
1177 ((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
1178 return __result;
1179}
1180
11811206template <class... _Tp, class... _Up>
11821207 requires(sizeof...(_Tp) == sizeof...(_Up))
11831208_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>
11841209operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
1185 return std::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
1210 return std::__tuple_compare_three_way<common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>>(
1211 __x, __y, index_sequence_for<_Tp...>{});
11861212}
11871213
11881214# else // _LIBCPP_STD_VER >= 20
......@@ -1243,65 +1269,59 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
12431269
12441270// tuple_cat
12451271
1246template <class _Tp, class _Up>
1247struct __tuple_cat_type;
1272template <class... _Tuples>
1273struct __tuple_cat_return_impl;
12481274
1249template <class... _Ttypes, class... _Utypes>
1250struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> > {
1251 using type _LIBCPP_NODEBUG = tuple<_Ttypes..., _Utypes...>;
1275template <class... _Types>
1276struct __tuple_cat_return_impl<tuple<_Types...>> {
1277 using type _LIBCPP_NODEBUG = tuple<_Types...>;
12521278};
12531279
1254template <class _ResultTuple, bool _Is_Tuple0TupleLike, class... _Tuples>
1255struct __tuple_cat_return_1 {};
1280template <class... _Types0, class... _Types1, class... _Tuples>
1281struct __tuple_cat_return_impl<tuple<_Types0...>, tuple<_Types1...>, _Tuples...>
1282 : __tuple_cat_return_impl<tuple<_Types0..., _Types1...>, _Tuples...> {};
12561283
1257template <class... _Types, class _Tuple0>
1258struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> {
1259 using type _LIBCPP_NODEBUG =
1260 typename __tuple_cat_type< tuple<_Types...>,
1261 typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type;
1262};
1263
1264template <class... _Types, class _Tuple0, class _Tuple1, class... _Tuples>
1265struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
1266 : public __tuple_cat_return_1<
1267 typename __tuple_cat_type< tuple<_Types...>,
1268 typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type,
1269 __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value,
1270 _Tuple1,
1271 _Tuples...> {};
1284template <class... _Types0, class _Tp, class _Up, class... _Tuples>
1285struct __tuple_cat_return_impl<tuple<_Types0...>, pair<_Tp, _Up>, _Tuples...>
1286 : __tuple_cat_return_impl<tuple<_Types0..., _Tp, _Up>, _Tuples...> {};
12721287
1273template <class... _Tuples>
1274struct __tuple_cat_return;
1288template <class, class, class>
1289struct __tuple_cat_array;
12751290
1276template <class _Tuple0, class... _Tuples>
1277struct __tuple_cat_return<_Tuple0, _Tuples...>
1278 : public __tuple_cat_return_1<tuple<>,
1279 __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value,
1280 _Tuple0,
1281 _Tuples...> {};
1291template <class... _Types, class _ValueT, size_t... _Indices>
1292struct __tuple_cat_array<tuple<_Types...>, _ValueT, __index_sequence<_Indices...>> {
1293 template <size_t>
1294 using __value_type _LIBCPP_NODEBUG = _ValueT;
12821295
1283template <>
1284struct __tuple_cat_return<> {
1285 using type _LIBCPP_NODEBUG = tuple<>;
1296 using type _LIBCPP_NODEBUG = tuple<_Types..., __value_type<_Indices>...>;
12861297};
12871298
1288inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<> tuple_cat() { return tuple<>(); }
1299template <class... _Types, class _ValueT, size_t _Np, class... _Tuples>
1300struct __tuple_cat_return_impl<tuple<_Types...>, array<_ValueT, _Np>, _Tuples...>
1301 : __tuple_cat_return_impl<typename __tuple_cat_array<tuple<_Types...>, _ValueT, __make_index_sequence<_Np>>::type,
1302 _Tuples...> {};
1303
1304template <class... _Tuples>
1305using __tuple_cat_return_t _LIBCPP_NODEBUG =
1306 typename __tuple_cat_return_impl<tuple<>, __remove_cvref_t<_Tuples>...>::type;
1307
1308[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<> tuple_cat() { return tuple<>(); }
12891309
12901310template <class _Rp, class _Indices, class _Tuple0, class... _Tuples>
12911311struct __tuple_cat_return_ref_imp;
12921312
12931313template <class... _Types, size_t... _I0, class _Tuple0>
1294struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> {
1314struct __tuple_cat_return_ref_imp<tuple<_Types...>, __index_sequence<_I0...>, _Tuple0> {
12951315 using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
12961316 typedef tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
12971317};
12981318
12991319template <class... _Types, size_t... _I0, class _Tuple0, class _Tuple1, class... _Tuples>
1300struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...>
1320struct __tuple_cat_return_ref_imp<tuple<_Types...>, __index_sequence<_I0...>, _Tuple0, _Tuple1, _Tuples...>
13011321 : public __tuple_cat_return_ref_imp<
13021322 tuple<_Types...,
13031323 __copy_cvref_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
1304 typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
1324 __make_index_sequence<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>,
13051325 _Tuple1,
13061326 _Tuples...> {};
13071327
......@@ -1309,7 +1329,7 @@ template <class _Tuple0, class... _Tuples>
13091329struct __tuple_cat_return_ref
13101330 : public __tuple_cat_return_ref_imp<
13111331 tuple<>,
1312 typename __make_tuple_indices< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >::type,
1332 __make_index_sequence< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >,
13131333 _Tuple0,
13141334 _Tuples...> {};
13151335
......@@ -1317,7 +1337,7 @@ template <class _Types, class _I0, class _J0>
13171337struct __tuple_cat;
13181338
13191339template <class... _Types, size_t... _I0, size_t... _J0>
1320struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > {
1340struct __tuple_cat<tuple<_Types...>, __index_sequence<_I0...>, __index_sequence<_J0...>> {
13211341 template <class _Tuple0>
13221342 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
13231343 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
......@@ -1335,8 +1355,8 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13351355 using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
13361356 using _T1 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple1>;
13371357 return __tuple_cat<tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
1338 typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
1339 typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
1358 __make_index_sequence<sizeof...(_Types) + tuple_size<_T0>::value>,
1359 __make_index_sequence<tuple_size<_T1>::value>>()(
13401360 std::forward_as_tuple(
13411361 std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...),
13421362 std::forward<_Tuple1>(__t1),
......@@ -1346,21 +1366,21 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13461366
13471367template <class _TupleDst, class _TupleSrc, size_t... _Indices>
13481368inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _TupleDst
1349__tuple_cat_select_element_wise(_TupleSrc&& __src, __tuple_indices<_Indices...>) {
1369__tuple_cat_select_element_wise(_TupleSrc&& __src, __index_sequence<_Indices...>) {
13501370 static_assert(tuple_size<_TupleDst>::value == tuple_size<_TupleSrc>::value,
13511371 "misuse of __tuple_cat_select_element_wise with tuples of different sizes");
13521372 return _TupleDst(std::get<_Indices>(std::forward<_TupleSrc>(__src))...);
13531373}
13541374
13551375template <class _Tuple0, class... _Tuples>
1356inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __tuple_cat_return<_Tuple0, _Tuples...>::type
1376[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_cat_return_t<_Tuple0, _Tuples...>
13571377tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
13581378 using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
1359 using _TRet _LIBCPP_NODEBUG = typename __tuple_cat_return<_Tuple0, _Tuples...>::type;
1360 using _T0Indices _LIBCPP_NODEBUG = typename __make_tuple_indices<tuple_size<_T0>::value>::type;
1361 using _TRetIndices _LIBCPP_NODEBUG = typename __make_tuple_indices<tuple_size<_TRet>::value>::type;
1379 using _TRet _LIBCPP_NODEBUG = __tuple_cat_return_t<_Tuple0, _Tuples...>;
1380 using _T0Indices _LIBCPP_NODEBUG = __make_index_sequence<tuple_size<_T0>::value>;
1381 using _TRetIndices _LIBCPP_NODEBUG = __make_index_sequence<tuple_size<_TRet>::value>;
13621382 return std::__tuple_cat_select_element_wise<_TRet>(
1363 __tuple_cat<tuple<>, __tuple_indices<>, _T0Indices>()(
1383 __tuple_cat<tuple<>, __index_sequence<>, _T0Indices>()(
13641384 tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...),
13651385 _TRetIndices());
13661386}
......@@ -1376,7 +1396,7 @@ struct uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
13761396// clang-format off
13771397template <class _Fn, class _Tuple, size_t... _Id>
13781398inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
1379__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
1399__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Id...>)
13801400 _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
13811401
13821402template <class _Fn, class _Tuple>
......@@ -1384,28 +1404,29 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&&
13841404 _LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl(
13851405 std::forward<_Fn>(__f),
13861406 std::forward<_Tuple>(__t),
1387 typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
1407 make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))
13881408
13891409#if _LIBCPP_STD_VER >= 20
13901410template <class _Tp, class _Tuple, size_t... _Idx>
1391inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
1411inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
13921412 noexcept(noexcept(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)))
13931413 requires is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...> {
13941414 return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...);
13951415}
13961416#else
13971417template <class _Tp, class _Tuple, size_t... _Idx>
1398inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>,
1418inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>,
13991419 enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...>> * = nullptr)
14001420 _LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
14011421#endif // _LIBCPP_STD_VER >= 20
1422#undef _LIBCPP_NOEXCEPT_RETURN
14021423
14031424template <class _Tp, class _Tuple,
1404 class _Seq = typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type, class = void>
1425 class _Seq = make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>, class = void>
14051426inline constexpr bool __can_make_from_tuple = false;
14061427
14071428template <class _Tp, class _Tuple, size_t... _Idx>
1408inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, __tuple_indices<_Idx...>,
1429inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, index_sequence<_Idx...>,
14091430 enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::declval<_Tuple>()))...>>> = true;
14101431
14111432// Based on LWG3528(https://wg21.link/LWG3528) and http://eel.is/c++draft/description#structure.requirements-9,
......@@ -1418,10 +1439,19 @@ template <class _Tp, class _Tuple>
14181439#else
14191440template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp, _Tuple>>> // strengthen
14201441#endif // _LIBCPP_STD_VER >= 20
1421inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
1422 _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
1423 std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
1424# undef _LIBCPP_NOEXCEPT_RETURN
1442
1443[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
1444 noexcept(noexcept(std::__make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
1445 make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))) {
1446#if _LIBCPP_STD_VER >= 23
1447 if constexpr (tuple_size_v<remove_reference_t<_Tuple>> == 1) {
1448 static_assert(!std::reference_constructs_from_temporary_v<_Tp, decltype(std::get<0>(std::declval<_Tuple>()))>,
1449 "Attempted construction of reference element binds to a temporary whose lifetime has ended");
1450 }
1451#endif // _LIBCPP_STD_VER >= 23
1452 return std::__make_from_tuple_impl<_Tp>(
1453 std::forward<_Tuple>(__t), make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>());
1454}
14251455
14261456# endif // _LIBCPP_STD_VER >= 17
14271457
lib/libcxx/include/type_traits+8-2
......@@ -454,6 +454,10 @@ namespace std
454454 template<class B> inline constexpr bool negation_v
455455 = negation<B>::value; // since C++17
456456
457 // [meta.const.eval], constant evaluation context
458 constexpr bool is_constant_evaluated() noexcept; // C++20
459 template<class T>
460 consteval bool is_within_lifetime(const T*) noexcept; // C++26
457461}
458462
459463*/
......@@ -546,9 +550,7 @@ namespace std
546550
547551# if _LIBCPP_STD_VER >= 20
548552# include <__type_traits/common_reference.h>
549# include <__type_traits/is_bounded_array.h>
550553# include <__type_traits/is_constant_evaluated.h>
551# include <__type_traits/is_unbounded_array.h>
552554# include <__type_traits/type_identity.h>
553555# include <__type_traits/unwrap_ref.h>
554556# endif
......@@ -559,6 +561,10 @@ namespace std
559561# include <__type_traits/reference_converts_from_temporary.h>
560562# endif
561563
564# if _LIBCPP_STD_VER >= 26
565# include <__type_traits/is_within_lifetime.h>
566# endif
567
562568# include <version>
563569
564570# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/typeindex+5-3
......@@ -86,8 +86,8 @@ public:
8686 }
8787# endif
8888
89 _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __t_->hash_code(); }
90 _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __t_->name(); }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __t_->hash_code(); }
90 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __t_->name(); }
9191};
9292
9393template <class _Tp>
......@@ -95,7 +95,9 @@ struct hash;
9595
9696template <>
9797struct hash<type_index> : public __unary_function<type_index, size_t> {
98 _LIBCPP_HIDE_FROM_ABI size_t operator()(type_index __index) const _NOEXCEPT { return __index.hash_code(); }
98 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(type_index __index) const _NOEXCEPT {
99 return __index.hash_code();
100 }
99101};
100102
101103_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/typeinfo+92-89
......@@ -95,11 +95,13 @@ class _LIBCPP_EXPORTED_FROM_ABI type_info {
9595public:
9696 virtual ~type_info();
9797
98 const char* name() const _NOEXCEPT;
98 [[__nodiscard__]] const char* name() const _NOEXCEPT;
9999
100 _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT { return __compare(__arg) < 0; }
100 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT {
101 return __compare(__arg) < 0;
102 }
101103
102 size_t hash_code() const _NOEXCEPT;
104 [[__nodiscard__]] size_t hash_code() const _NOEXCEPT;
103105
104106 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT {
105107 // When evaluated in a constant expression, both type infos simply can't come
......@@ -186,99 +188,99 @@ public:
186188# endif
187189# endif
188190
189struct __type_info_implementations {
190 struct __string_impl_base {
191 typedef const char* __type_name_t;
192 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static const char*
193 __type_name_to_string(__type_name_t __v) _NOEXCEPT {
194 return __v;
195 }
196 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static __type_name_t
197 __string_to_type_name(const char* __v) _NOEXCEPT {
198 return __v;
199 }
200 };
191namespace __type_info_implementations {
192struct __string_impl_base {
193 typedef const char* __type_name_t;
194 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static const char*
195 __type_name_to_string(__type_name_t __v) _NOEXCEPT {
196 return __v;
197 }
198 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static __type_name_t
199 __string_to_type_name(const char* __v) _NOEXCEPT {
200 return __v;
201 }
202};
201203
202 struct __unique_impl : __string_impl_base {
203 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
204 return reinterpret_cast<size_t>(__v);
205 }
206 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
207 return __lhs == __rhs;
208 }
209 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
210 return __lhs < __rhs;
211 }
212 };
213
214 struct __non_unique_impl : __string_impl_base {
215 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
216 size_t __hash = 5381;
217 while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
218 __hash = (__hash * 33) ^ __c;
219 return __hash;
220 }
221 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
222 return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0;
223 }
224 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
225 return __builtin_strcmp(__lhs, __rhs) < 0;
226 }
227 };
204struct __unique_impl : __string_impl_base {
205 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
206 return reinterpret_cast<size_t>(__v);
207 }
208 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
209 return __lhs == __rhs;
210 }
211 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
212 return __lhs < __rhs;
213 }
214};
228215
229 struct __non_unique_arm_rtti_bit_impl {
230 typedef uintptr_t __type_name_t;
216struct __non_unique_impl : __string_impl_base {
217 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
218 size_t __hash = 5381;
219 while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
220 __hash = (__hash * 33) ^ __c;
221 return __hash;
222 }
223 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
224 return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0;
225 }
226 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
227 return __builtin_strcmp(__lhs, __rhs) < 0;
228 }
229};
231230
232 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
233 return reinterpret_cast<const char*>(__v & ~__non_unique_rtti_bit::value);
234 }
235 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
236 return reinterpret_cast<__type_name_t>(__v);
237 }
231struct __non_unique_arm_rtti_bit_impl {
232 typedef uintptr_t __type_name_t;
238233
239 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
240 if (__is_type_name_unique(__v))
241 return __v;
242 return __non_unique_impl::__hash(__type_name_to_string(__v));
243 }
244 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
245 if (__lhs == __rhs)
246 return true;
247 if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
248 // Either both are unique and have a different address, or one of them
249 // is unique and the other one isn't. In both cases they are unequal.
250 return false;
251 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
252 }
253 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
254 if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
255 return __lhs < __rhs;
256 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
257 }
234 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
235 return reinterpret_cast<const char*>(__v & ~__non_unique_rtti_bit::value);
236 }
237 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
238 return reinterpret_cast<__type_name_t>(__v);
239 }
258240
259 private:
260 // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
261 // this implementation is actually used.
262 typedef integral_constant<__type_name_t, (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))>
263 __non_unique_rtti_bit;
241 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
242 if (__is_type_name_unique(__v))
243 return __v;
244 return __non_unique_impl::__hash(__type_name_to_string(__v));
245 }
246 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
247 if (__lhs == __rhs)
248 return true;
249 if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
250 // Either both are unique and have a different address, or one of them
251 // is unique and the other one isn't. In both cases they are unequal.
252 return false;
253 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
254 }
255 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
256 if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
257 return __lhs < __rhs;
258 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
259 }
264260
265 _LIBCPP_HIDE_FROM_ABI static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
266 return !(__lhs & __non_unique_rtti_bit::value);
267 }
268 };
261private:
262 // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
263 // this implementation is actually used.
264 typedef integral_constant<__type_name_t, (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))>
265 __non_unique_rtti_bit;
266
267 _LIBCPP_HIDE_FROM_ABI static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
268 return !(__lhs & __non_unique_rtti_bit::value);
269 }
270};
269271
270 typedef
272typedef
271273# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
272 __unique_impl
274 __unique_impl
273275# elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
274 __non_unique_impl
276 __non_unique_impl
275277# elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
276 __non_unique_arm_rtti_bit_impl
278 __non_unique_arm_rtti_bit_impl
277279# else
278280# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
279281# endif
280 __impl;
281};
282 __impl;
283} // namespace __type_info_implementations
282284
283285# if __has_cpp_attribute(_Clang::__ptrauth_vtable_pointer__)
284286# if __has_feature(ptrauth_type_info_vtable_pointer_discrimination)
......@@ -306,14 +308,15 @@ protected:
306308
307309public:
308310 virtual ~type_info();
311 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT {
312 return __impl::__type_name_to_string(__type_name);
313 }
309314
310 _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __impl::__type_name_to_string(__type_name); }
311
312 _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT {
315 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT {
313316 return __impl::__lt(__type_name, __arg.__type_name);
314317 }
315318
316 _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __impl::__hash(__type_name); }
319 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __impl::__hash(__type_name); }
317320
318321 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT {
319322 // When evaluated in a constant expression, both type infos simply can't come
......@@ -336,7 +339,7 @@ public:
336339 _LIBCPP_HIDE_FROM_ABI bad_cast(const bad_cast&) _NOEXCEPT = default;
337340 _LIBCPP_HIDE_FROM_ABI bad_cast& operator=(const bad_cast&) _NOEXCEPT = default;
338341 ~bad_cast() _NOEXCEPT override;
339 const char* what() const _NOEXCEPT override;
342 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
340343};
341344
342345class _LIBCPP_EXPORTED_FROM_ABI bad_typeid : public exception {
......@@ -345,7 +348,7 @@ public:
345348 _LIBCPP_HIDE_FROM_ABI bad_typeid(const bad_typeid&) _NOEXCEPT = default;
346349 _LIBCPP_HIDE_FROM_ABI bad_typeid& operator=(const bad_typeid&) _NOEXCEPT = default;
347350 ~bad_typeid() _NOEXCEPT override;
348 const char* what() const _NOEXCEPT override;
351 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
349352};
350353
351354} // namespace std
lib/libcxx/include/unordered_map+179-304
......@@ -600,6 +600,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
600600# include <__memory/addressof.h>
601601# include <__memory/allocator.h>
602602# include <__memory/allocator_traits.h>
603# include <__memory/compressed_pair.h>
603604# include <__memory/pointer_traits.h>
604605# include <__memory/unique_ptr.h>
605606# include <__memory_resource/polymorphic_allocator.h>
......@@ -643,34 +644,9 @@ _LIBCPP_PUSH_MACROS
643644
644645_LIBCPP_BEGIN_NAMESPACE_STD
645646
646template <class _Key,
647 class _Cp,
648 class _Hash,
649 class _Pred,
650 bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
651class __unordered_map_hasher : private _Hash {
652public:
653 _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher() _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) : _Hash() {}
654 _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher(const _Hash& __h) _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
655 : _Hash(__h) {}
656 _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const _NOEXCEPT { return *this; }
657 _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Cp& __x) const { return static_cast<const _Hash&>(*this)(__x.first); }
658 _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Key& __x) const { return static_cast<const _Hash&>(*this)(__x); }
659# if _LIBCPP_STD_VER >= 20
660 template <typename _K2>
661 _LIBCPP_HIDE_FROM_ABI size_t operator()(const _K2& __x) const {
662 return static_cast<const _Hash&>(*this)(__x);
663 }
664# endif
665 _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Hash>) {
666 using std::swap;
667 swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
668 }
669};
670
671647template <class _Key, class _Cp, class _Hash, class _Pred>
672class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false> {
673 _Hash __hash_;
648class __unordered_map_hasher {
649 _LIBCPP_COMPRESSED_ELEMENT(_Hash, __hash_);
674650
675651public:
676652 _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher() _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
......@@ -692,60 +668,16 @@ public:
692668 }
693669};
694670
695template <class _Key, class _Cp, class _Hash, class _Pred, bool __b>
671template <class _Key, class _Cp, class _Hash, class _Pred>
696672inline _LIBCPP_HIDE_FROM_ABI void
697swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x,
698 __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
673swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred>& __x, __unordered_map_hasher<_Key, _Cp, _Hash, _Pred>& __y)
674 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
699675 __x.swap(__y);
700676}
701677
702template <class _Key,
703 class _Cp,
704 class _Pred,
705 class _Hash,
706 bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
707class __unordered_map_equal : private _Pred {
708public:
709 _LIBCPP_HIDE_FROM_ABI __unordered_map_equal() _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) : _Pred() {}
710 _LIBCPP_HIDE_FROM_ABI __unordered_map_equal(const _Pred& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
711 : _Pred(__p) {}
712 _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const _NOEXCEPT { return *this; }
713 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Cp& __y) const {
714 return static_cast<const _Pred&>(*this)(__x.first, __y.first);
715 }
716 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Key& __y) const {
717 return static_cast<const _Pred&>(*this)(__x.first, __y);
718 }
719 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _Cp& __y) const {
720 return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);
721 }
722# if _LIBCPP_STD_VER >= 20
723 template <typename _K2>
724 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _K2& __y) const {
725 return static_cast<const _Pred&>(*this)(__x.first, __y);
726 }
727 template <typename _K2>
728 _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Cp& __y) const {
729 return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);
730 }
731 template <typename _K2>
732 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _K2& __y) const {
733 return static_cast<const _Pred&>(*this)(__x, __y);
734 }
735 template <typename _K2>
736 _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Key& __y) const {
737 return static_cast<const _Pred&>(*this)(__x, __y);
738 }
739# endif
740 _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Pred>) {
741 using std::swap;
742 swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
743 }
744};
745
746678template <class _Key, class _Cp, class _Pred, class _Hash>
747class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false> {
748 _Pred __pred_;
679class __unordered_map_equal {
680 _LIBCPP_COMPRESSED_ELEMENT(_Pred, __pred_);
749681
750682public:
751683 _LIBCPP_HIDE_FROM_ABI __unordered_map_equal() _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
......@@ -780,9 +712,9 @@ public:
780712 }
781713};
782714
783template <class _Key, class _Cp, class _Pred, class _Hash, bool __b>
715template <class _Key, class _Cp, class _Pred, class _Hash>
784716inline _LIBCPP_HIDE_FROM_ABI void
785swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x, __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
717swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash>& __x, __unordered_map_equal<_Key, _Cp, _Pred, _Hash>& __y)
786718 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
787719 __x.swap(__y);
788720}
......@@ -844,10 +776,10 @@ class __hash_map_iterator {
844776
845777public:
846778 typedef forward_iterator_tag iterator_category;
847 typedef typename _NodeTypes::__map_value_type value_type;
848 typedef typename _NodeTypes::difference_type difference_type;
779 using value_type = typename _HashIterator::value_type;
780 using difference_type = ptrdiff_t;
849781 typedef value_type& reference;
850 typedef typename _NodeTypes::__map_value_type_pointer pointer;
782 using pointer = typename _HashIterator::pointer;
851783
852784 _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() _NOEXCEPT {}
853785
......@@ -895,10 +827,10 @@ class __hash_map_const_iterator {
895827
896828public:
897829 typedef forward_iterator_tag iterator_category;
898 typedef typename _NodeTypes::__map_value_type value_type;
899 typedef typename _NodeTypes::difference_type difference_type;
830 using value_type = typename _HashIterator::value_type;
831 using difference_type = ptrdiff_t;
900832 typedef const value_type& reference;
901 typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
833 using pointer = typename _HashIterator::pointer;
902834
903835 _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() _NOEXCEPT {}
904836
......@@ -972,9 +904,6 @@ private:
972904
973905 __table __table_;
974906
975 typedef typename __table::_NodeTypes _NodeTypes;
976 typedef typename __table::__node_pointer __node_pointer;
977 typedef typename __table::__node_const_pointer __node_const_pointer;
978907 typedef typename __table::__node_traits __node_traits;
979908 typedef typename __table::__node_allocator __node_allocator;
980909 typedef typename __table::__node __node;
......@@ -1046,10 +975,10 @@ public:
1046975# endif
1047976
1048977 _LIBCPP_HIDE_FROM_ABI explicit unordered_map(const allocator_type& __a);
1049 _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u);
978 _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u) = default;
1050979 _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u, const allocator_type& __a);
1051980# ifndef _LIBCPP_CXX03_LANG
1052 _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
981 _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u) = default;
1053982 _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u, const allocator_type& __a);
1054983 _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il);
1055984 _LIBCPP_HIDE_FROM_ABI
......@@ -1099,41 +1028,26 @@ public:
10991028 static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
11001029 }
11011030
1102 _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(const unordered_map& __u) {
1103# ifndef _LIBCPP_CXX03_LANG
1104 __table_ = __u.__table_;
1105# else
1106 if (this != std::addressof(__u)) {
1107 __table_.clear();
1108 __table_.hash_function() = __u.__table_.hash_function();
1109 __table_.key_eq() = __u.__table_.key_eq();
1110 __table_.max_load_factor() = __u.__table_.max_load_factor();
1111 __table_.__copy_assign_alloc(__u.__table_);
1112 insert(__u.begin(), __u.end());
1113 }
1114# endif
1115 return *this;
1116 }
1031 _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(const unordered_map& __u) = default;
11171032# ifndef _LIBCPP_CXX03_LANG
1118 _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(unordered_map&& __u)
1119 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
1033 _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(unordered_map&& __u) = default;
11201034 _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(initializer_list<value_type> __il);
11211035# endif // _LIBCPP_CXX03_LANG
11221036
1123 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1037 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
11241038 return allocator_type(__table_.__node_alloc());
11251039 }
11261040
11271041 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
1128 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
1129 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
1042 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
1043 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
11301044
1131 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
1132 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
1133 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
1134 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
1135 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
1136 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
1045 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
1046 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
1047 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
1048 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
1049 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
1050 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
11371051
11381052 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__emplace_unique(__x); }
11391053
......@@ -1187,14 +1101,13 @@ public:
11871101# if _LIBCPP_STD_VER >= 17
11881102 template <class... _Args>
11891103 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
1190 return __table_.__emplace_unique_key_args(
1191 __k, piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
1104 return __table_.__emplace_unique(
1105 piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
11921106 }
11931107
11941108 template <class... _Args>
11951109 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
1196 return __table_.__emplace_unique_key_args(
1197 __k,
1110 return __table_.__emplace_unique(
11981111 piecewise_construct,
11991112 std::forward_as_tuple(std::move(__k)),
12001113 std::forward_as_tuple(std::forward<_Args>(__args)...));
......@@ -1212,7 +1125,7 @@ public:
12121125
12131126 template <class _Vp>
12141127 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
1215 pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, __k, std::forward<_Vp>(__v));
1128 pair<iterator, bool> __res = __table_.__emplace_unique(__k, std::forward<_Vp>(__v));
12161129 if (!__res.second) {
12171130 __res.first->second = std::forward<_Vp>(__v);
12181131 }
......@@ -1221,7 +1134,7 @@ public:
12211134
12221135 template <class _Vp>
12231136 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
1224 pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, std::move(__k), std::forward<_Vp>(__v));
1137 pair<iterator, bool> __res = __table_.__emplace_unique(std::move(__k), std::forward<_Vp>(__v));
12251138 if (!__res.second) {
12261139 __res.first->second = std::forward<_Vp>(__v);
12271140 }
......@@ -1258,10 +1171,10 @@ public:
12581171 "node_type with incompatible allocator passed to unordered_map::insert()");
12591172 return __table_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
12601173 }
1261 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1174 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
12621175 return __table_.template __node_handle_extract<node_type>(__key);
12631176 }
1264 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1177 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
12651178 return __table_.template __node_handle_extract<node_type>(__it.__i_);
12661179 }
12671180
......@@ -1295,52 +1208,56 @@ public:
12951208 __table_.swap(__u.__table_);
12961209 }
12971210
1298 _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
1299 _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
1211 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI hasher hash_function() const {
1212 return __table_.hash_function().hash_function();
1213 }
1214 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
13001215
1301 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
1302 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
1216 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
1217 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
13031218# if _LIBCPP_STD_VER >= 20
13041219 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1305 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1220 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
13061221 return __table_.find(__k);
13071222 }
13081223 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1309 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1224 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
13101225 return __table_.find(__k);
13111226 }
13121227# endif // _LIBCPP_STD_VER >= 20
13131228
1314 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
1229 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1230 return __table_.__count_unique(__k);
1231 }
13151232# if _LIBCPP_STD_VER >= 20
13161233 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1317 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1234 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
13181235 return __table_.__count_unique(__k);
13191236 }
13201237# endif // _LIBCPP_STD_VER >= 20
13211238
13221239# if _LIBCPP_STD_VER >= 20
1323 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1240 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
13241241
13251242 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1326 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1243 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
13271244 return find(__k) != end();
13281245 }
13291246# endif // _LIBCPP_STD_VER >= 20
13301247
1331 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1248 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
13321249 return __table_.__equal_range_unique(__k);
13331250 }
1334 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1251 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
13351252 return __table_.__equal_range_unique(__k);
13361253 }
13371254# if _LIBCPP_STD_VER >= 20
13381255 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1339 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1256 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
13401257 return __table_.__equal_range_unique(__k);
13411258 }
13421259 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1343 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1260 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
13441261 return __table_.__equal_range_unique(__k);
13451262 }
13461263# endif // _LIBCPP_STD_VER >= 20
......@@ -1350,24 +1267,32 @@ public:
13501267 _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
13511268# endif
13521269
1353 _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
1354 _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
1270 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
1271 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
13551272
1356 _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
1357 _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
1273 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
1274 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT {
1275 return __table_.max_bucket_count();
1276 }
13581277
1359 _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
1360 _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
1278 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const {
1279 return __table_.bucket_size(__n);
1280 }
1281 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
13611282
1362 _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
1363 _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
1364 _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
1365 _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
1366 _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
1367 _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
1283 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
1284 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
1285 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const {
1286 return __table_.cbegin(__n);
1287 }
1288 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
1289 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
1290 return __table_.cbegin(__n);
1291 }
1292 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
13681293
1369 _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
1370 _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
1294 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
1295 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
13711296 _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
13721297 _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
13731298 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
......@@ -1384,10 +1309,10 @@ template <class _InputIterator,
13841309 class _Pred = equal_to<__iter_key_type<_InputIterator>>,
13851310 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
13861311 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1387 class = enable_if_t<!__is_allocator<_Hash>::value>,
1312 class = enable_if_t<!__is_allocator_v<_Hash>>,
13881313 class = enable_if_t<!is_integral<_Hash>::value>,
1389 class = enable_if_t<!__is_allocator<_Pred>::value>,
1390 class = enable_if_t<__is_allocator<_Allocator>::value>>
1314 class = enable_if_t<!__is_allocator_v<_Pred>>,
1315 class = enable_if_t<__is_allocator_v<_Allocator>>>
13911316unordered_map(_InputIterator,
13921317 _InputIterator,
13931318 typename allocator_traits<_Allocator>::size_type = 0,
......@@ -1401,10 +1326,10 @@ template <ranges::input_range _Range,
14011326 class _Hash = hash<__range_key_type<_Range>>,
14021327 class _Pred = equal_to<__range_key_type<_Range>>,
14031328 class _Allocator = allocator<__range_to_alloc_type<_Range>>,
1404 class = enable_if_t<!__is_allocator<_Hash>::value>,
1329 class = enable_if_t<!__is_allocator_v<_Hash>>,
14051330 class = enable_if_t<!is_integral<_Hash>::value>,
1406 class = enable_if_t<!__is_allocator<_Pred>::value>,
1407 class = enable_if_t<__is_allocator<_Allocator>::value>>
1331 class = enable_if_t<!__is_allocator_v<_Pred>>,
1332 class = enable_if_t<__is_allocator_v<_Allocator>>>
14081333unordered_map(from_range_t,
14091334 _Range&&,
14101335 typename allocator_traits<_Allocator>::size_type = 0,
......@@ -1419,10 +1344,10 @@ template <class _Key,
14191344 class _Hash = hash<remove_const_t<_Key>>,
14201345 class _Pred = equal_to<remove_const_t<_Key>>,
14211346 class _Allocator = allocator<pair<const _Key, _Tp>>,
1422 class = enable_if_t<!__is_allocator<_Hash>::value>,
1347 class = enable_if_t<!__is_allocator_v<_Hash>>,
14231348 class = enable_if_t<!is_integral<_Hash>::value>,
1424 class = enable_if_t<!__is_allocator<_Pred>::value>,
1425 class = enable_if_t<__is_allocator<_Allocator>::value>>
1349 class = enable_if_t<!__is_allocator_v<_Pred>>,
1350 class = enable_if_t<__is_allocator_v<_Allocator>>>
14261351unordered_map(initializer_list<pair<_Key, _Tp>>,
14271352 typename allocator_traits<_Allocator>::size_type = 0,
14281353 _Hash = _Hash(),
......@@ -1432,7 +1357,7 @@ unordered_map(initializer_list<pair<_Key, _Tp>>,
14321357template <class _InputIterator,
14331358 class _Allocator,
14341359 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1435 class = enable_if_t<__is_allocator<_Allocator>::value>>
1360 class = enable_if_t<__is_allocator_v<_Allocator>>>
14361361unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
14371362 -> unordered_map<__iter_key_type<_InputIterator>,
14381363 __iter_mapped_type<_InputIterator>,
......@@ -1443,7 +1368,7 @@ unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocat
14431368template <class _InputIterator,
14441369 class _Allocator,
14451370 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1446 class = enable_if_t<__is_allocator<_Allocator>::value>>
1371 class = enable_if_t<__is_allocator_v<_Allocator>>>
14471372unordered_map(_InputIterator, _InputIterator, _Allocator)
14481373 -> unordered_map<__iter_key_type<_InputIterator>,
14491374 __iter_mapped_type<_InputIterator>,
......@@ -1455,9 +1380,9 @@ template <class _InputIterator,
14551380 class _Hash,
14561381 class _Allocator,
14571382 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1458 class = enable_if_t<!__is_allocator<_Hash>::value>,
1383 class = enable_if_t<!__is_allocator_v<_Hash>>,
14591384 class = enable_if_t<!is_integral<_Hash>::value>,
1460 class = enable_if_t<__is_allocator<_Allocator>::value>>
1385 class = enable_if_t<__is_allocator_v<_Allocator>>>
14611386unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
14621387 -> unordered_map<__iter_key_type<_InputIterator>,
14631388 __iter_mapped_type<_InputIterator>,
......@@ -1467,7 +1392,7 @@ unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocat
14671392
14681393# if _LIBCPP_STD_VER >= 23
14691394
1470template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1395template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
14711396unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
14721397 -> unordered_map<__range_key_type<_Range>,
14731398 __range_mapped_type<_Range>,
......@@ -1475,7 +1400,7 @@ unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::siz
14751400 equal_to<__range_key_type<_Range>>,
14761401 _Allocator>;
14771402
1478template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1403template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
14791404unordered_map(from_range_t, _Range&&, _Allocator)
14801405 -> unordered_map<__range_key_type<_Range>,
14811406 __range_mapped_type<_Range>,
......@@ -1486,9 +1411,9 @@ unordered_map(from_range_t, _Range&&, _Allocator)
14861411template <ranges::input_range _Range,
14871412 class _Hash,
14881413 class _Allocator,
1489 class = enable_if_t<!__is_allocator<_Hash>::value>,
1414 class = enable_if_t<!__is_allocator_v<_Hash>>,
14901415 class = enable_if_t<!is_integral<_Hash>::value>,
1491 class = enable_if_t<__is_allocator<_Allocator>::value>>
1416 class = enable_if_t<__is_allocator_v<_Allocator>>>
14921417unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
14931418 -> unordered_map<__range_key_type<_Range>,
14941419 __range_mapped_type<_Range>,
......@@ -1498,11 +1423,11 @@ unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::siz
14981423
14991424# endif
15001425
1501template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1426template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
15021427unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
15031428 -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>;
15041429
1505template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1430template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
15061431unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
15071432 -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>;
15081433
......@@ -1510,9 +1435,9 @@ template <class _Key,
15101435 class _Tp,
15111436 class _Hash,
15121437 class _Allocator,
1513 class = enable_if_t<!__is_allocator<_Hash>::value>,
1438 class = enable_if_t<!__is_allocator_v<_Hash>>,
15141439 class = enable_if_t<!is_integral<_Hash>::value>,
1515 class = enable_if_t<__is_allocator<_Allocator>::value>>
1440 class = enable_if_t<__is_allocator_v<_Allocator>>>
15161441unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
15171442 -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>;
15181443# endif
......@@ -1563,12 +1488,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15631488 insert(__first, __last);
15641489}
15651490
1566template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
1567unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_map& __u) : __table_(__u.__table_) {
1568 __table_.__rehash_unique(__u.bucket_count());
1569 insert(__u.begin(), __u.end());
1570}
1571
15721491template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
15731492unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_map& __u, const allocator_type& __a)
15741493 : __table_(__u.__table_, typename __table::allocator_type(__a)) {
......@@ -1578,11 +1497,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_ma
15781497
15791498# ifndef _LIBCPP_CXX03_LANG
15801499
1581template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
1582inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __u)
1583 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
1584 : __table_(std::move(__u.__table_)) {}
1585
15861500template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
15871501unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __u, const allocator_type& __a)
15881502 : __table_(std::move(__u.__table_), typename __table::allocator_type(__a)) {
......@@ -1618,14 +1532,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
16181532 insert(__il.begin(), __il.end());
16191533}
16201534
1621template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
1622inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
1623unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
1624 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
1625 __table_ = std::move(__u.__table_);
1626 return *this;
1627}
1628
16291535template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
16301536inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
16311537unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
......@@ -1646,16 +1552,13 @@ inline void unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterato
16461552
16471553template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
16481554_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
1649 return __table_
1650 .__emplace_unique_key_args(__k, piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
1555 return __table_.__emplace_unique(piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
16511556 .first->second;
16521557}
16531558
16541559template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
16551560_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) {
1656 return __table_
1657 .__emplace_unique_key_args(
1658 __k, piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
1561 return __table_.__emplace_unique(piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
16591562 .first->second;
16601563}
16611564# else // _LIBCPP_CXX03_LANG
......@@ -1781,12 +1684,8 @@ private:
17811684
17821685 __table __table_;
17831686
1784 typedef typename __table::_NodeTypes _NodeTypes;
17851687 typedef typename __table::__node_traits __node_traits;
1786 typedef typename __table::__node_allocator __node_allocator;
17871688 typedef typename __table::__node __node;
1788 typedef __hash_map_node_destructor<__node_allocator> _Dp;
1789 typedef unique_ptr<__node, _Dp> __node_holder;
17901689 typedef allocator_traits<allocator_type> __alloc_traits;
17911690 static_assert(is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value,
17921691 "Allocator uses different size_type for different types");
......@@ -1852,11 +1751,10 @@ public:
18521751# endif
18531752
18541753 _LIBCPP_HIDE_FROM_ABI explicit unordered_multimap(const allocator_type& __a);
1855 _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u);
1754 _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u) = default;
18561755 _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
18571756# ifndef _LIBCPP_CXX03_LANG
1858 _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u)
1859 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
1757 _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u) = default;
18601758 _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
18611759 _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il);
18621760 _LIBCPP_HIDE_FROM_ABI unordered_multimap(
......@@ -1906,41 +1804,26 @@ public:
19061804 static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
19071805 }
19081806
1909 _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(const unordered_multimap& __u) {
1910# ifndef _LIBCPP_CXX03_LANG
1911 __table_ = __u.__table_;
1912# else
1913 if (this != std::addressof(__u)) {
1914 __table_.clear();
1915 __table_.hash_function() = __u.__table_.hash_function();
1916 __table_.key_eq() = __u.__table_.key_eq();
1917 __table_.max_load_factor() = __u.__table_.max_load_factor();
1918 __table_.__copy_assign_alloc(__u.__table_);
1919 insert(__u.begin(), __u.end());
1920 }
1921# endif
1922 return *this;
1923 }
1807 _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(const unordered_multimap& __u) = default;
19241808# ifndef _LIBCPP_CXX03_LANG
1925 _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(unordered_multimap&& __u)
1926 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
1809 _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(unordered_multimap&& __u) = default;
19271810 _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(initializer_list<value_type> __il);
19281811# endif // _LIBCPP_CXX03_LANG
19291812
1930 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1813 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
19311814 return allocator_type(__table_.__node_alloc());
19321815 }
19331816
19341817 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
1935 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
1936 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
1818 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
1819 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
19371820
1938 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
1939 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
1940 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
1941 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
1942 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
1943 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
1821 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
1822 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
1823 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
1824 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
1825 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
1826 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
19441827
19451828 _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__emplace_multi(__x); }
19461829
......@@ -2008,10 +1891,10 @@ public:
20081891 "node_type with incompatible allocator passed to unordered_multimap::insert()");
20091892 return __table_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
20101893 }
2011 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1894 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
20121895 return __table_.template __node_handle_extract<node_type>(__key);
20131896 }
2014 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1897 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
20151898 return __table_.template __node_handle_extract<node_type>(__it.__i_);
20161899 }
20171900
......@@ -2045,71 +1928,83 @@ public:
20451928 __table_.swap(__u.__table_);
20461929 }
20471930
2048 _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
2049 _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
1931 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI hasher hash_function() const {
1932 return __table_.hash_function().hash_function();
1933 }
1934 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
20501935
2051 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
2052 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
1936 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
1937 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
20531938# if _LIBCPP_STD_VER >= 20
20541939 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2055 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1940 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
20561941 return __table_.find(__k);
20571942 }
20581943 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2059 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1944 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
20601945 return __table_.find(__k);
20611946 }
20621947# endif // _LIBCPP_STD_VER >= 20
20631948
2064 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
1949 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1950 return __table_.__count_multi(__k);
1951 }
20651952# if _LIBCPP_STD_VER >= 20
20661953 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2067 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1954 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
20681955 return __table_.__count_multi(__k);
20691956 }
20701957# endif // _LIBCPP_STD_VER >= 20
20711958
20721959# if _LIBCPP_STD_VER >= 20
2073 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1960 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
20741961
20751962 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2076 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1963 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
20771964 return find(__k) != end();
20781965 }
20791966# endif // _LIBCPP_STD_VER >= 20
20801967
2081 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1968 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
20821969 return __table_.__equal_range_multi(__k);
20831970 }
2084 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1971 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
20851972 return __table_.__equal_range_multi(__k);
20861973 }
20871974# if _LIBCPP_STD_VER >= 20
20881975 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2089 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1976 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
20901977 return __table_.__equal_range_multi(__k);
20911978 }
20921979 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2093 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1980 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
20941981 return __table_.__equal_range_multi(__k);
20951982 }
20961983# endif // _LIBCPP_STD_VER >= 20
20971984
2098 _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
2099 _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
1985 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
1986 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT {
1987 return __table_.max_bucket_count();
1988 }
21001989
2101 _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
2102 _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
1990 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const {
1991 return __table_.bucket_size(__n);
1992 }
1993 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
21031994
2104 _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
2105 _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
2106 _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
2107 _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
2108 _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
2109 _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
1995 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
1996 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
1997 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const {
1998 return __table_.cbegin(__n);
1999 }
2000 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
2001 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
2002 return __table_.cbegin(__n);
2003 }
2004 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
21102005
2111 _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
2112 _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
2006 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
2007 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
21132008 _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
21142009 _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
21152010 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
......@@ -2121,10 +2016,10 @@ template <class _InputIterator,
21212016 class _Pred = equal_to<__iter_key_type<_InputIterator>>,
21222017 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
21232018 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
2124 class = enable_if_t<!__is_allocator<_Hash>::value>,
2019 class = enable_if_t<!__is_allocator_v<_Hash>>,
21252020 class = enable_if_t<!is_integral<_Hash>::value>,
2126 class = enable_if_t<!__is_allocator<_Pred>::value>,
2127 class = enable_if_t<__is_allocator<_Allocator>::value>>
2021 class = enable_if_t<!__is_allocator_v<_Pred>>,
2022 class = enable_if_t<__is_allocator_v<_Allocator>>>
21282023unordered_multimap(_InputIterator,
21292024 _InputIterator,
21302025 typename allocator_traits<_Allocator>::size_type = 0,
......@@ -2142,10 +2037,10 @@ template <ranges::input_range _Range,
21422037 class _Hash = hash<__range_key_type<_Range>>,
21432038 class _Pred = equal_to<__range_key_type<_Range>>,
21442039 class _Allocator = allocator<__range_to_alloc_type<_Range>>,
2145 class = enable_if_t<!__is_allocator<_Hash>::value>,
2040 class = enable_if_t<!__is_allocator_v<_Hash>>,
21462041 class = enable_if_t<!is_integral<_Hash>::value>,
2147 class = enable_if_t<!__is_allocator<_Pred>::value>,
2148 class = enable_if_t<__is_allocator<_Allocator>::value>>
2042 class = enable_if_t<!__is_allocator_v<_Pred>>,
2043 class = enable_if_t<__is_allocator_v<_Allocator>>>
21492044unordered_multimap(from_range_t,
21502045 _Range&&,
21512046 typename allocator_traits<_Allocator>::size_type = 0,
......@@ -2160,21 +2055,21 @@ template <class _Key,
21602055 class _Hash = hash<remove_const_t<_Key>>,
21612056 class _Pred = equal_to<remove_const_t<_Key>>,
21622057 class _Allocator = allocator<pair<const _Key, _Tp>>,
2163 class = enable_if_t<!__is_allocator<_Hash>::value>,
2058 class = enable_if_t<!__is_allocator_v<_Hash>>,
21642059 class = enable_if_t<!is_integral<_Hash>::value>,
2165 class = enable_if_t<!__is_allocator<_Pred>::value>,
2166 class = enable_if_t<__is_allocator<_Allocator>::value>>
2167unordered_multimap(
2168 initializer_list<pair<_Key, _Tp>>,
2169 typename allocator_traits<_Allocator>::size_type = 0,
2170 _Hash = _Hash(),
2171 _Pred = _Pred(),
2172 _Allocator = _Allocator()) -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
2060 class = enable_if_t<!__is_allocator_v<_Pred>>,
2061 class = enable_if_t<__is_allocator_v<_Allocator>>>
2062unordered_multimap(initializer_list<pair<_Key, _Tp>>,
2063 typename allocator_traits<_Allocator>::size_type = 0,
2064 _Hash = _Hash(),
2065 _Pred = _Pred(),
2066 _Allocator = _Allocator())
2067 -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
21732068
21742069template <class _InputIterator,
21752070 class _Allocator,
21762071 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
2177 class = enable_if_t<__is_allocator<_Allocator>::value>>
2072 class = enable_if_t<__is_allocator_v<_Allocator>>>
21782073unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
21792074 -> unordered_multimap<__iter_key_type<_InputIterator>,
21802075 __iter_mapped_type<_InputIterator>,
......@@ -2185,7 +2080,7 @@ unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Al
21852080template <class _InputIterator,
21862081 class _Allocator,
21872082 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
2188 class = enable_if_t<__is_allocator<_Allocator>::value>>
2083 class = enable_if_t<__is_allocator_v<_Allocator>>>
21892084unordered_multimap(_InputIterator, _InputIterator, _Allocator)
21902085 -> unordered_multimap<__iter_key_type<_InputIterator>,
21912086 __iter_mapped_type<_InputIterator>,
......@@ -2197,9 +2092,9 @@ template <class _InputIterator,
21972092 class _Hash,
21982093 class _Allocator,
21992094 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
2200 class = enable_if_t<!__is_allocator<_Hash>::value>,
2095 class = enable_if_t<!__is_allocator_v<_Hash>>,
22012096 class = enable_if_t<!is_integral<_Hash>::value>,
2202 class = enable_if_t<__is_allocator<_Allocator>::value>>
2097 class = enable_if_t<__is_allocator_v<_Allocator>>>
22032098unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
22042099 -> unordered_multimap<__iter_key_type<_InputIterator>,
22052100 __iter_mapped_type<_InputIterator>,
......@@ -2209,7 +2104,7 @@ unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Al
22092104
22102105# if _LIBCPP_STD_VER >= 23
22112106
2212template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
2107template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
22132108unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
22142109 -> unordered_multimap<__range_key_type<_Range>,
22152110 __range_mapped_type<_Range>,
......@@ -2217,7 +2112,7 @@ unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>
22172112 equal_to<__range_key_type<_Range>>,
22182113 _Allocator>;
22192114
2220template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
2115template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
22212116unordered_multimap(from_range_t, _Range&&, _Allocator)
22222117 -> unordered_multimap<__range_key_type<_Range>,
22232118 __range_mapped_type<_Range>,
......@@ -2228,9 +2123,9 @@ unordered_multimap(from_range_t, _Range&&, _Allocator)
22282123template <ranges::input_range _Range,
22292124 class _Hash,
22302125 class _Allocator,
2231 class = enable_if_t<!__is_allocator<_Hash>::value>,
2126 class = enable_if_t<!__is_allocator_v<_Hash>>,
22322127 class = enable_if_t<!is_integral<_Hash>::value>,
2233 class = enable_if_t<__is_allocator<_Allocator>::value>>
2128 class = enable_if_t<__is_allocator_v<_Allocator>>>
22342129unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
22352130 -> unordered_multimap<__range_key_type<_Range>,
22362131 __range_mapped_type<_Range>,
......@@ -2240,7 +2135,7 @@ unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>
22402135
22412136# endif
22422137
2243template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
2138template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
22442139unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
22452140 -> unordered_multimap<remove_const_t<_Key>,
22462141 _Tp,
......@@ -2248,7 +2143,7 @@ unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<
22482143 equal_to<remove_const_t<_Key>>,
22492144 _Allocator>;
22502145
2251template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
2146template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
22522147unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
22532148 -> unordered_multimap<remove_const_t<_Key>,
22542149 _Tp,
......@@ -2260,9 +2155,9 @@ template <class _Key,
22602155 class _Tp,
22612156 class _Hash,
22622157 class _Allocator,
2263 class = enable_if_t<!__is_allocator<_Hash>::value>,
2158 class = enable_if_t<!__is_allocator_v<_Hash>>,
22642159 class = enable_if_t<!is_integral<_Hash>::value>,
2265 class = enable_if_t<__is_allocator<_Allocator>::value>>
2160 class = enable_if_t<__is_allocator_v<_Allocator>>>
22662161unordered_multimap(
22672162 initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
22682163 -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>;
......@@ -2315,13 +2210,6 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
23152210inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const allocator_type& __a)
23162211 : __table_(typename __table::allocator_type(__a)) {}
23172212
2318template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
2319unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const unordered_multimap& __u)
2320 : __table_(__u.__table_) {
2321 __table_.__rehash_multi(__u.bucket_count());
2322 insert(__u.begin(), __u.end());
2323}
2324
23252213template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
23262214unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23272215 const unordered_multimap& __u, const allocator_type& __a)
......@@ -2332,11 +2220,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23322220
23332221# ifndef _LIBCPP_CXX03_LANG
23342222
2335template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
2336inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(unordered_multimap&& __u)
2337 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
2338 : __table_(std::move(__u.__table_)) {}
2339
23402223template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
23412224unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23422225 unordered_multimap&& __u, const allocator_type& __a)
......@@ -2373,14 +2256,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23732256 insert(__il.begin(), __il.end());
23742257}
23752258
2376template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
2377inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
2378unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
2379 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
2380 __table_ = std::move(__u.__table_);
2381 return *this;
2382}
2383
23842259template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
23852260inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
23862261unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
lib/libcxx/include/unordered_set+168-195
......@@ -544,8 +544,6 @@ template <class Value, class Hash, class Pred, class Alloc>
544544# include <__iterator/distance.h>
545545# include <__iterator/erase_if_container.h>
546546# include <__iterator/iterator_traits.h>
547# include <__iterator/ranges_iterator_traits.h>
548# include <__memory/addressof.h>
549547# include <__memory/allocator.h>
550548# include <__memory/allocator_traits.h>
551549# include <__memory_resource/polymorphic_allocator.h>
......@@ -558,7 +556,6 @@ template <class Value, class Hash, class Pred, class Alloc>
558556# include <__type_traits/invoke.h>
559557# include <__type_traits/is_allocator.h>
560558# include <__type_traits/is_integral.h>
561# include <__type_traits/is_nothrow_assignable.h>
562559# include <__type_traits/is_nothrow_constructible.h>
563560# include <__type_traits/is_same.h>
564561# include <__type_traits/is_swappable.h>
......@@ -703,10 +700,10 @@ public:
703700# endif
704701
705702 _LIBCPP_HIDE_FROM_ABI explicit unordered_set(const allocator_type& __a);
706 _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u);
703 _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u) = default;
707704 _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u, const allocator_type& __a);
708705# ifndef _LIBCPP_CXX03_LANG
709 _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
706 _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u) = default;
710707 _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u, const allocator_type& __a);
711708 _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il);
712709 _LIBCPP_HIDE_FROM_ABI
......@@ -733,30 +730,26 @@ public:
733730 static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
734731 }
735732
736 _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(const unordered_set& __u) {
737 __table_ = __u.__table_;
738 return *this;
739 }
733 _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(const unordered_set& __u) = default;
740734# ifndef _LIBCPP_CXX03_LANG
741 _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(unordered_set&& __u)
742 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
735 _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(unordered_set&& __u) = default;
743736 _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(initializer_list<value_type> __il);
744737# endif // _LIBCPP_CXX03_LANG
745738
746 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
739 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
747740 return allocator_type(__table_.__node_alloc());
748741 }
749742
750743 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
751 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
752 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
744 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
745 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
753746
754 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
755 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
756 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
757 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
758 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
759 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
747 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
748 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
749 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
750 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
751 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
752 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
760753
761754# ifndef _LIBCPP_CXX03_LANG
762755 template <class... _Args>
......@@ -808,10 +801,10 @@ public:
808801 "node_type with incompatible allocator passed to unordered_set::insert()");
809802 return __table_.template __node_handle_insert_unique<node_type>(__h, std::move(__nh));
810803 }
811 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
804 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
812805 return __table_.template __node_handle_extract<node_type>(__key);
813806 }
814 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
807 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
815808 return __table_.template __node_handle_extract<node_type>(__it);
816809 }
817810
......@@ -845,71 +838,81 @@ public:
845838 __table_.swap(__u.__table_);
846839 }
847840
848 _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
849 _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
841 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
842 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
850843
851 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
852 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
844 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
845 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
853846# if _LIBCPP_STD_VER >= 20
854847 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
855 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
848 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
856849 return __table_.find(__k);
857850 }
858851 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
859 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
852 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
860853 return __table_.find(__k);
861854 }
862855# endif // _LIBCPP_STD_VER >= 20
863856
864 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
857 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
858 return __table_.__count_unique(__k);
859 }
865860# if _LIBCPP_STD_VER >= 20
866861 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
867 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
862 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
868863 return __table_.__count_unique(__k);
869864 }
870865# endif // _LIBCPP_STD_VER >= 20
871866
872867# if _LIBCPP_STD_VER >= 20
873 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
868 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
874869
875870 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
876 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
871 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
877872 return find(__k) != end();
878873 }
879874# endif // _LIBCPP_STD_VER >= 20
880875
881 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
876 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
882877 return __table_.__equal_range_unique(__k);
883878 }
884 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
879 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
885880 return __table_.__equal_range_unique(__k);
886881 }
887882# if _LIBCPP_STD_VER >= 20
888883 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
889 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
884 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
890885 return __table_.__equal_range_unique(__k);
891886 }
892887 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
893 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
888 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
894889 return __table_.__equal_range_unique(__k);
895890 }
896891# endif // _LIBCPP_STD_VER >= 20
897892
898 _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
899 _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
893 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
894 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT {
895 return __table_.max_bucket_count();
896 }
900897
901 _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
902 _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
898 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const {
899 return __table_.bucket_size(__n);
900 }
901 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
903902
904 _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
905 _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
906 _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
907 _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
908 _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
909 _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
903 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
904 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
905 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const {
906 return __table_.cbegin(__n);
907 }
908 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
909 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
910 return __table_.cbegin(__n);
911 }
912 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
910913
911 _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
912 _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
914 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
915 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
913916 _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
914917 _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
915918 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
......@@ -917,47 +920,48 @@ public:
917920
918921# if _LIBCPP_STD_VER >= 17
919922template <class _InputIterator,
920 class _Hash = hash<__iter_value_type<_InputIterator>>,
921 class _Pred = equal_to<__iter_value_type<_InputIterator>>,
922 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
923 class _Hash = hash<__iterator_value_type<_InputIterator>>,
924 class _Pred = equal_to<__iterator_value_type<_InputIterator>>,
925 class _Allocator = allocator<__iterator_value_type<_InputIterator>>,
923926 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
924 class = enable_if_t<!__is_allocator<_Hash>::value>,
927 class = enable_if_t<!__is_allocator_v<_Hash>>,
925928 class = enable_if_t<!is_integral<_Hash>::value>,
926 class = enable_if_t<!__is_allocator<_Pred>::value>,
927 class = enable_if_t<__is_allocator<_Allocator>::value>>
929 class = enable_if_t<!__is_allocator_v<_Pred>>,
930 class = enable_if_t<__is_allocator_v<_Allocator>>>
928931unordered_set(_InputIterator,
929932 _InputIterator,
930933 typename allocator_traits<_Allocator>::size_type = 0,
931934 _Hash = _Hash(),
932935 _Pred = _Pred(),
933 _Allocator = _Allocator()) -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
936 _Allocator = _Allocator())
937 -> unordered_set<__iterator_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
934938
935939# if _LIBCPP_STD_VER >= 23
936940template <ranges::input_range _Range,
937941 class _Hash = hash<ranges::range_value_t<_Range>>,
938942 class _Pred = equal_to<ranges::range_value_t<_Range>>,
939943 class _Allocator = allocator<ranges::range_value_t<_Range>>,
940 class = enable_if_t<!__is_allocator<_Hash>::value>,
944 class = enable_if_t<!__is_allocator_v<_Hash>>,
941945 class = enable_if_t<!is_integral<_Hash>::value>,
942 class = enable_if_t<!__is_allocator<_Pred>::value>,
943 class = enable_if_t<__is_allocator<_Allocator>::value>>
944unordered_set(
945 from_range_t,
946 _Range&&,
947 typename allocator_traits<_Allocator>::size_type = 0,
948 _Hash = _Hash(),
949 _Pred = _Pred(),
950 _Allocator = _Allocator()) -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
946 class = enable_if_t<!__is_allocator_v<_Pred>>,
947 class = enable_if_t<__is_allocator_v<_Allocator>>>
948unordered_set(from_range_t,
949 _Range&&,
950 typename allocator_traits<_Allocator>::size_type = 0,
951 _Hash = _Hash(),
952 _Pred = _Pred(),
953 _Allocator = _Allocator())
954 -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
951955# endif
952956
953957template <class _Tp,
954958 class _Hash = hash<_Tp>,
955959 class _Pred = equal_to<_Tp>,
956960 class _Allocator = allocator<_Tp>,
957 class = enable_if_t<!__is_allocator<_Hash>::value>,
961 class = enable_if_t<!__is_allocator_v<_Hash>>,
958962 class = enable_if_t<!is_integral<_Hash>::value>,
959 class = enable_if_t<!__is_allocator<_Pred>::value>,
960 class = enable_if_t<__is_allocator<_Allocator>::value>>
963 class = enable_if_t<!__is_allocator_v<_Pred>>,
964 class = enable_if_t<__is_allocator_v<_Allocator>>>
961965unordered_set(initializer_list<_Tp>,
962966 typename allocator_traits<_Allocator>::size_type = 0,
963967 _Hash = _Hash(),
......@@ -967,33 +971,36 @@ unordered_set(initializer_list<_Tp>,
967971template <class _InputIterator,
968972 class _Allocator,
969973 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
970 class = enable_if_t<__is_allocator<_Allocator>::value>>
974 class = enable_if_t<__is_allocator_v<_Allocator>>>
971975unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
972 -> unordered_set<__iter_value_type<_InputIterator>,
973 hash<__iter_value_type<_InputIterator>>,
974 equal_to<__iter_value_type<_InputIterator>>,
976 -> unordered_set<__iterator_value_type<_InputIterator>,
977 hash<__iterator_value_type<_InputIterator>>,
978 equal_to<__iterator_value_type<_InputIterator>>,
975979 _Allocator>;
976980
977981template <class _InputIterator,
978982 class _Hash,
979983 class _Allocator,
980984 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
981 class = enable_if_t<!__is_allocator<_Hash>::value>,
985 class = enable_if_t<!__is_allocator_v<_Hash>>,
982986 class = enable_if_t<!is_integral<_Hash>::value>,
983 class = enable_if_t<__is_allocator<_Allocator>::value>>
987 class = enable_if_t<__is_allocator_v<_Allocator>>>
984988unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
985 -> unordered_set<__iter_value_type<_InputIterator>, _Hash, equal_to<__iter_value_type<_InputIterator>>, _Allocator>;
989 -> unordered_set<__iterator_value_type<_InputIterator>,
990 _Hash,
991 equal_to<__iterator_value_type<_InputIterator>>,
992 _Allocator>;
986993
987994# if _LIBCPP_STD_VER >= 23
988995
989template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
996template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
990997unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
991998 -> unordered_set<ranges::range_value_t<_Range>,
992999 hash<ranges::range_value_t<_Range>>,
9931000 equal_to<ranges::range_value_t<_Range>>,
9941001 _Allocator>;
9951002
996template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1003template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
9971004unordered_set(from_range_t, _Range&&, _Allocator)
9981005 -> unordered_set<ranges::range_value_t<_Range>,
9991006 hash<ranges::range_value_t<_Range>>,
......@@ -1003,24 +1010,24 @@ unordered_set(from_range_t, _Range&&, _Allocator)
10031010template <ranges::input_range _Range,
10041011 class _Hash,
10051012 class _Allocator,
1006 class = enable_if_t<!__is_allocator<_Hash>::value>,
1013 class = enable_if_t<!__is_allocator_v<_Hash>>,
10071014 class = enable_if_t<!is_integral<_Hash>::value>,
1008 class = enable_if_t<__is_allocator<_Allocator>::value>>
1015 class = enable_if_t<__is_allocator_v<_Allocator>>>
10091016unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
10101017 -> unordered_set<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
10111018
10121019# endif
10131020
1014template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1021template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
10151022unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
10161023 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
10171024
10181025template <class _Tp,
10191026 class _Hash,
10201027 class _Allocator,
1021 class = enable_if_t<!__is_allocator<_Hash>::value>,
1028 class = enable_if_t<!__is_allocator_v<_Hash>>,
10221029 class = enable_if_t<!is_integral<_Hash>::value>,
1023 class = enable_if_t<__is_allocator<_Allocator>::value>>
1030 class = enable_if_t<__is_allocator_v<_Allocator>>>
10241031unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
10251032 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
10261033# endif
......@@ -1070,12 +1077,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10701077template <class _Value, class _Hash, class _Pred, class _Alloc>
10711078inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const allocator_type& __a) : __table_(__a) {}
10721079
1073template <class _Value, class _Hash, class _Pred, class _Alloc>
1074unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u) : __table_(__u.__table_) {
1075 __table_.__rehash_unique(__u.bucket_count());
1076 insert(__u.begin(), __u.end());
1077}
1078
10791080template <class _Value, class _Hash, class _Pred, class _Alloc>
10801081unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u, const allocator_type& __a)
10811082 : __table_(__u.__table_, __a) {
......@@ -1085,11 +1086,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set&
10851086
10861087# ifndef _LIBCPP_CXX03_LANG
10871088
1088template <class _Value, class _Hash, class _Pred, class _Alloc>
1089inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(unordered_set&& __u)
1090 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
1091 : __table_(std::move(__u.__table_)) {}
1092
10931089template <class _Value, class _Hash, class _Pred, class _Alloc>
10941090unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(unordered_set&& __u, const allocator_type& __a)
10951091 : __table_(std::move(__u.__table_), __a) {
......@@ -1125,14 +1121,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
11251121 insert(__il.begin(), __il.end());
11261122}
11271123
1128template <class _Value, class _Hash, class _Pred, class _Alloc>
1129inline unordered_set<_Value, _Hash, _Pred, _Alloc>&
1130unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
1131 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
1132 __table_ = std::move(__u.__table_);
1133 return *this;
1134}
1135
11361124template <class _Value, class _Hash, class _Pred, class _Alloc>
11371125inline unordered_set<_Value, _Hash, _Pred, _Alloc>&
11381126unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
......@@ -1308,11 +1296,10 @@ public:
13081296# endif
13091297
13101298 _LIBCPP_HIDE_FROM_ABI explicit unordered_multiset(const allocator_type& __a);
1311 _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u);
1299 _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u) = default;
13121300 _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
13131301# ifndef _LIBCPP_CXX03_LANG
1314 _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u)
1315 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
1302 _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u) = default;
13161303 _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
13171304 _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il);
13181305 _LIBCPP_HIDE_FROM_ABI unordered_multiset(
......@@ -1339,30 +1326,26 @@ public:
13391326 static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
13401327 }
13411328
1342 _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(const unordered_multiset& __u) {
1343 __table_ = __u.__table_;
1344 return *this;
1345 }
1329 _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(const unordered_multiset& __u) = default;
13461330# ifndef _LIBCPP_CXX03_LANG
1347 _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(unordered_multiset&& __u)
1348 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
1331 _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(unordered_multiset&& __u) = default;
13491332 _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(initializer_list<value_type> __il);
13501333# endif // _LIBCPP_CXX03_LANG
13511334
1352 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1335 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
13531336 return allocator_type(__table_.__node_alloc());
13541337 }
13551338
13561339 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
1357 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
1358 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
1340 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
1341 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
13591342
1360 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
1361 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
1362 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
1363 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
1364 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
1365 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
1343 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
1344 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
1345 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
1346 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
1347 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
1348 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
13661349
13671350# ifndef _LIBCPP_CXX03_LANG
13681351 template <class... _Args>
......@@ -1410,10 +1393,10 @@ public:
14101393 "node_type with incompatible allocator passed to unordered_multiset::insert()");
14111394 return __table_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
14121395 }
1413 _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __position) {
1396 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __position) {
14141397 return __table_.template __node_handle_extract<node_type>(__position);
14151398 }
1416 _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1399 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
14171400 return __table_.template __node_handle_extract<node_type>(__key);
14181401 }
14191402
......@@ -1454,71 +1437,81 @@ public:
14541437 __table_.swap(__u.__table_);
14551438 }
14561439
1457 _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
1458 _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
1440 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
1441 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
14591442
1460 _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
1461 _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
1443 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
1444 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
14621445# if _LIBCPP_STD_VER >= 20
14631446 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1464 _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1447 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
14651448 return __table_.find(__k);
14661449 }
14671450 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1468 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1451 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
14691452 return __table_.find(__k);
14701453 }
14711454# endif // _LIBCPP_STD_VER >= 20
14721455
1473 _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
1456 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1457 return __table_.__count_multi(__k);
1458 }
14741459# if _LIBCPP_STD_VER >= 20
14751460 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1476 _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1461 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
14771462 return __table_.__count_multi(__k);
14781463 }
14791464# endif // _LIBCPP_STD_VER >= 20
14801465
14811466# if _LIBCPP_STD_VER >= 20
1482 _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1467 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
14831468
14841469 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1485 _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1470 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
14861471 return find(__k) != end();
14871472 }
14881473# endif // _LIBCPP_STD_VER >= 20
14891474
1490 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1475 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
14911476 return __table_.__equal_range_multi(__k);
14921477 }
1493 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1478 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
14941479 return __table_.__equal_range_multi(__k);
14951480 }
14961481# if _LIBCPP_STD_VER >= 20
14971482 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1498 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1483 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
14991484 return __table_.__equal_range_multi(__k);
15001485 }
15011486 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1502 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1487 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
15031488 return __table_.__equal_range_multi(__k);
15041489 }
15051490# endif // _LIBCPP_STD_VER >= 20
15061491
1507 _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
1508 _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
1492 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
1493 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT {
1494 return __table_.max_bucket_count();
1495 }
15091496
1510 _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
1511 _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
1497 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const {
1498 return __table_.bucket_size(__n);
1499 }
1500 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
15121501
1513 _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
1514 _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
1515 _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
1516 _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
1517 _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
1518 _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
1502 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
1503 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
1504 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const {
1505 return __table_.cbegin(__n);
1506 }
1507 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
1508 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
1509 return __table_.cbegin(__n);
1510 }
1511 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
15191512
1520 _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
1521 _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
1513 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
1514 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
15221515 _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
15231516 _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
15241517 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
......@@ -1526,31 +1519,31 @@ public:
15261519
15271520# if _LIBCPP_STD_VER >= 17
15281521template <class _InputIterator,
1529 class _Hash = hash<__iter_value_type<_InputIterator>>,
1530 class _Pred = equal_to<__iter_value_type<_InputIterator>>,
1531 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
1522 class _Hash = hash<__iterator_value_type<_InputIterator>>,
1523 class _Pred = equal_to<__iterator_value_type<_InputIterator>>,
1524 class _Allocator = allocator<__iterator_value_type<_InputIterator>>,
15321525 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1533 class = enable_if_t<!__is_allocator<_Hash>::value>,
1526 class = enable_if_t<!__is_allocator_v<_Hash>>,
15341527 class = enable_if_t<!is_integral<_Hash>::value>,
1535 class = enable_if_t<!__is_allocator<_Pred>::value>,
1536 class = enable_if_t<__is_allocator<_Allocator>::value>>
1528 class = enable_if_t<!__is_allocator_v<_Pred>>,
1529 class = enable_if_t<__is_allocator_v<_Allocator>>>
15371530unordered_multiset(
15381531 _InputIterator,
15391532 _InputIterator,
15401533 typename allocator_traits<_Allocator>::size_type = 0,
15411534 _Hash = _Hash(),
15421535 _Pred = _Pred(),
1543 _Allocator = _Allocator()) -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
1536 _Allocator = _Allocator()) -> unordered_multiset<__iterator_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
15441537
15451538# if _LIBCPP_STD_VER >= 23
15461539template <ranges::input_range _Range,
15471540 class _Hash = hash<ranges::range_value_t<_Range>>,
15481541 class _Pred = equal_to<ranges::range_value_t<_Range>>,
15491542 class _Allocator = allocator<ranges::range_value_t<_Range>>,
1550 class = enable_if_t<!__is_allocator<_Hash>::value>,
1543 class = enable_if_t<!__is_allocator_v<_Hash>>,
15511544 class = enable_if_t<!is_integral<_Hash>::value>,
1552 class = enable_if_t<!__is_allocator<_Pred>::value>,
1553 class = enable_if_t<__is_allocator<_Allocator>::value>>
1545 class = enable_if_t<!__is_allocator_v<_Pred>>,
1546 class = enable_if_t<__is_allocator_v<_Allocator>>>
15541547unordered_multiset(
15551548 from_range_t,
15561549 _Range&&,
......@@ -1564,10 +1557,10 @@ template <class _Tp,
15641557 class _Hash = hash<_Tp>,
15651558 class _Pred = equal_to<_Tp>,
15661559 class _Allocator = allocator<_Tp>,
1567 class = enable_if_t<!__is_allocator<_Hash>::value>,
1560 class = enable_if_t<!__is_allocator_v<_Hash>>,
15681561 class = enable_if_t<!is_integral<_Hash>::value>,
1569 class = enable_if_t<!__is_allocator<_Pred>::value>,
1570 class = enable_if_t<__is_allocator<_Allocator>::value>>
1562 class = enable_if_t<!__is_allocator_v<_Pred>>,
1563 class = enable_if_t<__is_allocator_v<_Allocator>>>
15711564unordered_multiset(initializer_list<_Tp>,
15721565 typename allocator_traits<_Allocator>::size_type = 0,
15731566 _Hash = _Hash(),
......@@ -1577,36 +1570,36 @@ unordered_multiset(initializer_list<_Tp>,
15771570template <class _InputIterator,
15781571 class _Allocator,
15791572 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1580 class = enable_if_t<__is_allocator<_Allocator>::value>>
1573 class = enable_if_t<__is_allocator_v<_Allocator>>>
15811574unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
1582 -> unordered_multiset<__iter_value_type<_InputIterator>,
1583 hash<__iter_value_type<_InputIterator>>,
1584 equal_to<__iter_value_type<_InputIterator>>,
1575 -> unordered_multiset<__iterator_value_type<_InputIterator>,
1576 hash<__iterator_value_type<_InputIterator>>,
1577 equal_to<__iterator_value_type<_InputIterator>>,
15851578 _Allocator>;
15861579
15871580template <class _InputIterator,
15881581 class _Hash,
15891582 class _Allocator,
15901583 class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
1591 class = enable_if_t<!__is_allocator<_Hash>::value>,
1584 class = enable_if_t<!__is_allocator_v<_Hash>>,
15921585 class = enable_if_t<!is_integral<_Hash>::value>,
1593 class = enable_if_t<__is_allocator<_Allocator>::value>>
1586 class = enable_if_t<__is_allocator_v<_Allocator>>>
15941587unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1595 -> unordered_multiset<__iter_value_type<_InputIterator>,
1588 -> unordered_multiset<__iterator_value_type<_InputIterator>,
15961589 _Hash,
1597 equal_to<__iter_value_type<_InputIterator>>,
1590 equal_to<__iterator_value_type<_InputIterator>>,
15981591 _Allocator>;
15991592
16001593# if _LIBCPP_STD_VER >= 23
16011594
1602template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1595template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
16031596unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
16041597 -> unordered_multiset<ranges::range_value_t<_Range>,
16051598 hash<ranges::range_value_t<_Range>>,
16061599 equal_to<ranges::range_value_t<_Range>>,
16071600 _Allocator>;
16081601
1609template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1602template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
16101603unordered_multiset(from_range_t, _Range&&, _Allocator)
16111604 -> unordered_multiset<ranges::range_value_t<_Range>,
16121605 hash<ranges::range_value_t<_Range>>,
......@@ -1616,24 +1609,24 @@ unordered_multiset(from_range_t, _Range&&, _Allocator)
16161609template <ranges::input_range _Range,
16171610 class _Hash,
16181611 class _Allocator,
1619 class = enable_if_t<!__is_allocator<_Hash>::value>,
1612 class = enable_if_t<!__is_allocator_v<_Hash>>,
16201613 class = enable_if_t<!is_integral<_Hash>::value>,
1621 class = enable_if_t<__is_allocator<_Allocator>::value>>
1614 class = enable_if_t<__is_allocator_v<_Allocator>>>
16221615unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
16231616 -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
16241617
16251618# endif
16261619
1627template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
1620template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
16281621unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
16291622 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
16301623
16311624template <class _Tp,
16321625 class _Hash,
16331626 class _Allocator,
1634 class = enable_if_t<!__is_allocator<_Hash>::value>,
1627 class = enable_if_t<!__is_allocator_v<_Hash>>,
16351628 class = enable_if_t<!is_integral<_Hash>::value>,
1636 class = enable_if_t<__is_allocator<_Allocator>::value>>
1629 class = enable_if_t<__is_allocator_v<_Allocator>>>
16371630unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
16381631 -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
16391632# endif
......@@ -1685,13 +1678,6 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
16851678inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const allocator_type& __a)
16861679 : __table_(__a) {}
16871680
1688template <class _Value, class _Hash, class _Pred, class _Alloc>
1689unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const unordered_multiset& __u)
1690 : __table_(__u.__table_) {
1691 __table_.__rehash_multi(__u.bucket_count());
1692 insert(__u.begin(), __u.end());
1693}
1694
16951681template <class _Value, class _Hash, class _Pred, class _Alloc>
16961682unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16971683 const unordered_multiset& __u, const allocator_type& __a)
......@@ -1702,11 +1688,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17021688
17031689# ifndef _LIBCPP_CXX03_LANG
17041690
1705template <class _Value, class _Hash, class _Pred, class _Alloc>
1706inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(unordered_multiset&& __u)
1707 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
1708 : __table_(std::move(__u.__table_)) {}
1709
17101691template <class _Value, class _Hash, class _Pred, class _Alloc>
17111692unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17121693 unordered_multiset&& __u, const allocator_type& __a)
......@@ -1743,14 +1724,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17431724 insert(__il.begin(), __il.end());
17441725}
17451726
1746template <class _Value, class _Hash, class _Pred, class _Alloc>
1747inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
1748unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_multiset&& __u)
1749 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
1750 __table_ = std::move(__u.__table_);
1751 return *this;
1752}
1753
17541727template <class _Value, class _Hash, class _Pred, class _Alloc>
17551728inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
17561729unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
lib/libcxx/include/utility+12
......@@ -216,6 +216,18 @@ template<size_t N>
216216template<class... T>
217217 using index_sequence_for = make_index_sequence<sizeof...(T)>;
218218
219template<class T, T... Values> // C++26
220 struct tuple_size<integer_sequence<T, Values...>>;
221
222template<size_t I, class T, T... Values> // C++26
223 struct tuple_element<I, integer_sequence<T, Values...>>;
224
225template<size_t I, class T, T... Values> // C++26
226 struct tuple_element<I, const integer_sequence<T, Values...>>;
227
228template<size_t I, class T, T... Values> // C++26
229 constexpr T get(integer_sequence<T, Values...>) noexcept;
230
219231template<class T, class U=T>
220232 constexpr T exchange(T& obj, U&& new_value) // constexpr in C++17, noexcept in C++23
221233 noexcept(is_nothrow_move_constructible<T>::value && is_nothrow_assignable<T&, U>::value);
lib/libcxx/include/valarray+106-161
......@@ -362,6 +362,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
362362# include <__memory/uninitialized_algorithms.h>
363363# include <__type_traits/decay.h>
364364# include <__type_traits/remove_reference.h>
365# include <__utility/exception_guard.h>
365366# include <__utility/move.h>
366367# include <__utility/swap.h>
367368# include <cmath>
......@@ -395,9 +396,9 @@ public:
395396 _LIBCPP_HIDE_FROM_ABI slice(size_t __start, size_t __size, size_t __stride)
396397 : __start_(__start), __size_(__size), __stride_(__stride) {}
397398
398 _LIBCPP_HIDE_FROM_ABI size_t start() const { return __start_; }
399 _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
400 _LIBCPP_HIDE_FROM_ABI size_t stride() const { return __stride_; }
399 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t start() const { return __start_; }
400 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
401 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t stride() const { return __stride_; }
401402
402403# if _LIBCPP_STD_VER >= 20
403404
......@@ -792,7 +793,7 @@ private:
792793public:
793794 // construct/destroy:
794795 _LIBCPP_HIDE_FROM_ABI valarray() : __begin_(nullptr), __end_(nullptr) {}
795 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit valarray(size_t __n);
796 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 explicit valarray(size_t __n);
796797 _LIBCPP_HIDE_FROM_ABI valarray(const value_type& __x, size_t __n);
797798 valarray(const value_type* __p, size_t __n);
798799 valarray(const valarray& __v);
......@@ -804,7 +805,7 @@ public:
804805 valarray(const gslice_array<value_type>& __ga);
805806 valarray(const mask_array<value_type>& __ma);
806807 valarray(const indirect_array<value_type>& __ia);
807 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 ~valarray();
808 inline _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 ~valarray();
808809
809810 // assignment:
810811 valarray& operator=(const valarray& __v);
......@@ -821,36 +822,41 @@ public:
821822 _LIBCPP_HIDE_FROM_ABI valarray& operator=(const __val_expr<_ValExpr>& __v);
822823
823824 // element access:
824 _LIBCPP_HIDE_FROM_ABI const value_type& operator[](size_t __i) const {
825 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const value_type& operator[](size_t __i) const {
825826 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "valarray::operator[] index out of bounds");
826827 return __begin_[__i];
827828 }
828829
829 _LIBCPP_HIDE_FROM_ABI value_type& operator[](size_t __i) {
830 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_type& operator[](size_t __i) {
830831 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "valarray::operator[] index out of bounds");
831832 return __begin_[__i];
832833 }
833834
834835 // subset operations:
835 _LIBCPP_HIDE_FROM_ABI __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
836 _LIBCPP_HIDE_FROM_ABI slice_array<value_type> operator[](slice __s);
837 _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
838 _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](const gslice& __gs);
836 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
837 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI slice_array<value_type> operator[](slice __s);
838 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> >
839 operator[](const gslice& __gs) const;
840 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](const gslice& __gs);
839841# ifndef _LIBCPP_CXX03_LANG
840 _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
841 _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](gslice&& __gs);
842 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
843 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](gslice&& __gs);
842844# endif // _LIBCPP_CXX03_LANG
845 [[__nodiscard__]]
843846 _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
844 _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](const valarray<bool>& __vb);
847 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](const valarray<bool>& __vb);
845848# ifndef _LIBCPP_CXX03_LANG
849 [[__nodiscard__]]
846850 _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
847 _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](valarray<bool>&& __vb);
851 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](valarray<bool>&& __vb);
848852# endif // _LIBCPP_CXX03_LANG
853 [[__nodiscard__]]
849854 _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
850 _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](const valarray<size_t>& __vs);
855 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](const valarray<size_t>& __vs);
851856# ifndef _LIBCPP_CXX03_LANG
857 [[__nodiscard__]]
852858 _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
853 _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](valarray<size_t>&& __vs);
859 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](valarray<size_t>&& __vs);
854860# endif // _LIBCPP_CXX03_LANG
855861
856862 // unary operators:
......@@ -904,16 +910,16 @@ public:
904910 // member functions:
905911 _LIBCPP_HIDE_FROM_ABI void swap(valarray& __v) _NOEXCEPT;
906912
907 _LIBCPP_HIDE_FROM_ABI size_t size() const { return static_cast<size_t>(__end_ - __begin_); }
913 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t size() const { return static_cast<size_t>(__end_ - __begin_); }
908914
909 _LIBCPP_HIDE_FROM_ABI value_type sum() const;
910 _LIBCPP_HIDE_FROM_ABI value_type min() const;
911 _LIBCPP_HIDE_FROM_ABI value_type max() const;
915 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_type sum() const;
916 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_type min() const;
917 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_type max() const;
912918
913 valarray shift(int __i) const;
914 valarray cshift(int __i) const;
915 valarray apply(value_type __f(value_type)) const;
916 valarray apply(value_type __f(const value_type&)) const;
919 [[__nodiscard__]] valarray shift(int __i) const;
920 [[__nodiscard__]] valarray cshift(int __i) const;
921 [[__nodiscard__]] valarray apply(value_type __f(value_type)) const;
922 [[__nodiscard__]] valarray apply(value_type __f(const value_type&)) const;
917923 void resize(size_t __n, value_type __x = value_type());
918924
919925private:
......@@ -1248,11 +1254,11 @@ public:
12481254
12491255# endif // _LIBCPP_CXX03_LANG
12501256
1251 _LIBCPP_HIDE_FROM_ABI size_t start() const { return __1d_.size() ? __1d_[0] : 0; }
1257 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t start() const { return __1d_.size() ? __1d_[0] : 0; }
12521258
1253 _LIBCPP_HIDE_FROM_ABI valarray<size_t> size() const { return __size_; }
1259 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI valarray<size_t> size() const { return __size_; }
12541260
1255 _LIBCPP_HIDE_FROM_ABI valarray<size_t> stride() const { return __stride_; }
1261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI valarray<size_t> stride() const { return __stride_; }
12561262
12571263private:
12581264 void __init(size_t __start);
......@@ -1992,17 +1998,10 @@ template <class _Tp>
19921998inline valarray<_Tp>::valarray(size_t __n) : __begin_(nullptr), __end_(nullptr) {
19931999 if (__n) {
19942000 __begin_ = __end_ = allocator<value_type>().allocate(__n);
1995# if _LIBCPP_HAS_EXCEPTIONS
1996 try {
1997# endif // _LIBCPP_HAS_EXCEPTIONS
1998 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
1999 ::new ((void*)__end_) value_type();
2000# if _LIBCPP_HAS_EXCEPTIONS
2001 } catch (...) {
2002 __clear(__n);
2003 throw;
2004 }
2005# endif // _LIBCPP_HAS_EXCEPTIONS
2001 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2002 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
2003 ::new ((void*)__end_) value_type();
2004 __guard.__complete();
20062005 }
20072006}
20082007
......@@ -2015,17 +2014,10 @@ template <class _Tp>
20152014valarray<_Tp>::valarray(const value_type* __p, size_t __n) : __begin_(nullptr), __end_(nullptr) {
20162015 if (__n) {
20172016 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2018# if _LIBCPP_HAS_EXCEPTIONS
2019 try {
2020# endif // _LIBCPP_HAS_EXCEPTIONS
2021 for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
2022 ::new ((void*)__end_) value_type(*__p);
2023# if _LIBCPP_HAS_EXCEPTIONS
2024 } catch (...) {
2025 __clear(__n);
2026 throw;
2027 }
2028# endif // _LIBCPP_HAS_EXCEPTIONS
2017 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2018 for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
2019 ::new ((void*)__end_) value_type(*__p);
2020 __guard.__complete();
20292021 }
20302022}
20312023
......@@ -2033,17 +2025,10 @@ template <class _Tp>
20332025valarray<_Tp>::valarray(const valarray& __v) : __begin_(nullptr), __end_(nullptr) {
20342026 if (__v.size()) {
20352027 __begin_ = __end_ = allocator<value_type>().allocate(__v.size());
2036# if _LIBCPP_HAS_EXCEPTIONS
2037 try {
2038# endif // _LIBCPP_HAS_EXCEPTIONS
2039 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2040 ::new ((void*)__end_) value_type(*__p);
2041# if _LIBCPP_HAS_EXCEPTIONS
2042 } catch (...) {
2043 __clear(__v.size());
2044 throw;
2045 }
2046# endif // _LIBCPP_HAS_EXCEPTIONS
2028 auto __guard = std::__make_exception_guard([&] { __clear(__v.size()); });
2029 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2030 ::new ((void*)__end_) value_type(*__p);
2031 __guard.__complete();
20472032 }
20482033}
20492034
......@@ -2059,18 +2044,11 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il) : __begin_(nullptr),
20592044 const size_t __n = __il.size();
20602045 if (__n) {
20612046 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2062# if _LIBCPP_HAS_EXCEPTIONS
2063 try {
2064# endif // _LIBCPP_HAS_EXCEPTIONS
2065 size_t __n_left = __n;
2066 for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
2067 ::new ((void*)__end_) value_type(*__p);
2068# if _LIBCPP_HAS_EXCEPTIONS
2069 } catch (...) {
2070 __clear(__n);
2071 throw;
2072 }
2073# endif // _LIBCPP_HAS_EXCEPTIONS
2047 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2048 size_t __n_left = __n;
2049 for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
2050 ::new ((void*)__end_) value_type(*__p);
2051 __guard.__complete();
20742052 }
20752053}
20762054
......@@ -2081,18 +2059,11 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa) : __begin_(nullptr)
20812059 const size_t __n = __sa.__size_;
20822060 if (__n) {
20832061 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2084# if _LIBCPP_HAS_EXCEPTIONS
2085 try {
2086# endif // _LIBCPP_HAS_EXCEPTIONS
2087 size_t __n_left = __n;
2088 for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
2089 ::new ((void*)__end_) value_type(*__p);
2090# if _LIBCPP_HAS_EXCEPTIONS
2091 } catch (...) {
2092 __clear(__n);
2093 throw;
2094 }
2095# endif // _LIBCPP_HAS_EXCEPTIONS
2062 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2063 size_t __n_left = __n;
2064 for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
2065 ::new ((void*)__end_) value_type(*__p);
2066 __guard.__complete();
20962067 }
20972068}
20982069
......@@ -2101,19 +2072,12 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) : __begin_(nullptr
21012072 const size_t __n = __ga.__1d_.size();
21022073 if (__n) {
21032074 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2104# if _LIBCPP_HAS_EXCEPTIONS
2105 try {
2106# endif // _LIBCPP_HAS_EXCEPTIONS
2107 typedef const size_t* _Ip;
2108 const value_type* __s = __ga.__vp_;
2109 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_)
2110 ::new ((void*)__end_) value_type(__s[*__i]);
2111# if _LIBCPP_HAS_EXCEPTIONS
2112 } catch (...) {
2113 __clear(__n);
2114 throw;
2115 }
2116# endif // _LIBCPP_HAS_EXCEPTIONS
2075 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2076 typedef const size_t* _Ip;
2077 const value_type* __s = __ga.__vp_;
2078 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_)
2079 ::new ((void*)__end_) value_type(__s[*__i]);
2080 __guard.__complete();
21172081 }
21182082}
21192083
......@@ -2122,19 +2086,12 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma) : __begin_(nullptr),
21222086 const size_t __n = __ma.__1d_.size();
21232087 if (__n) {
21242088 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2125# if _LIBCPP_HAS_EXCEPTIONS
2126 try {
2127# endif // _LIBCPP_HAS_EXCEPTIONS
2128 typedef const size_t* _Ip;
2129 const value_type* __s = __ma.__vp_;
2130 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_)
2131 ::new ((void*)__end_) value_type(__s[*__i]);
2132# if _LIBCPP_HAS_EXCEPTIONS
2133 } catch (...) {
2134 __clear(__n);
2135 throw;
2136 }
2137# endif // _LIBCPP_HAS_EXCEPTIONS
2089 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2090 typedef const size_t* _Ip;
2091 const value_type* __s = __ma.__vp_;
2092 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_)
2093 ::new ((void*)__end_) value_type(__s[*__i]);
2094 __guard.__complete();
21382095 }
21392096}
21402097
......@@ -2143,19 +2100,12 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia) : __begin_(nullp
21432100 const size_t __n = __ia.__1d_.size();
21442101 if (__n) {
21452102 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2146# if _LIBCPP_HAS_EXCEPTIONS
2147 try {
2148# endif // _LIBCPP_HAS_EXCEPTIONS
2149 typedef const size_t* _Ip;
2150 const value_type* __s = __ia.__vp_;
2151 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_)
2152 ::new ((void*)__end_) value_type(__s[*__i]);
2153# if _LIBCPP_HAS_EXCEPTIONS
2154 } catch (...) {
2155 __clear(__n);
2156 throw;
2157 }
2158# endif // _LIBCPP_HAS_EXCEPTIONS
2103 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2104 typedef const size_t* _Ip;
2105 const value_type* __s = __ia.__vp_;
2106 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_)
2107 ::new ((void*)__end_) value_type(__s[*__i]);
2108 __guard.__complete();
21592109 }
21602110}
21612111
......@@ -2644,17 +2594,10 @@ void valarray<_Tp>::resize(size_t __n, value_type __x) {
26442594 __clear(size());
26452595 if (__n) {
26462596 __begin_ = __end_ = allocator<value_type>().allocate(__n);
2647# if _LIBCPP_HAS_EXCEPTIONS
2648 try {
2649# endif // _LIBCPP_HAS_EXCEPTIONS
2650 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
2651 ::new ((void*)__end_) value_type(__x);
2652# if _LIBCPP_HAS_EXCEPTIONS
2653 } catch (...) {
2654 __clear(__n);
2655 throw;
2656 }
2657# endif // _LIBCPP_HAS_EXCEPTIONS
2597 auto __guard = std::__make_exception_guard([&] { __clear(__n); });
2598 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
2599 ::new ((void*)__end_) value_type(__x);
2600 __guard.__complete();
26582601 }
26592602}
26602603
......@@ -3168,7 +3111,7 @@ operator>=(const typename _Expr::value_type& __x, const _Expr& __y) {
31683111}
31693112
31703113template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3171inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
3114[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
31723115abs(const _Expr& __x) {
31733116 typedef typename _Expr::value_type value_type;
31743117 typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
......@@ -3176,7 +3119,7 @@ abs(const _Expr& __x) {
31763119}
31773120
31783121template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3179inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
3122[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
31803123acos(const _Expr& __x) {
31813124 typedef typename _Expr::value_type value_type;
31823125 typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
......@@ -3184,7 +3127,7 @@ acos(const _Expr& __x) {
31843127}
31853128
31863129template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3187inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
3130[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
31883131asin(const _Expr& __x) {
31893132 typedef typename _Expr::value_type value_type;
31903133 typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
......@@ -3192,7 +3135,7 @@ asin(const _Expr& __x) {
31923135}
31933136
31943137template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3195inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
3138[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
31963139atan(const _Expr& __x) {
31973140 typedef typename _Expr::value_type value_type;
31983141 typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
......@@ -3202,15 +3145,16 @@ atan(const _Expr& __x) {
32023145template <class _Expr1,
32033146 class _Expr2,
32043147 __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
3205inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
3206atan2(const _Expr1& __x, const _Expr2& __y) {
3148[[__nodiscard__]] inline
3149 _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
3150 atan2(const _Expr1& __x, const _Expr2& __y) {
32073151 typedef typename _Expr1::value_type value_type;
32083152 typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
32093153 return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
32103154}
32113155
32123156template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3213inline _LIBCPP_HIDE_FROM_ABI
3157[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
32143158__val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
32153159atan2(const _Expr& __x, const typename _Expr::value_type& __y) {
32163160 typedef typename _Expr::value_type value_type;
......@@ -3219,7 +3163,7 @@ atan2(const _Expr& __x, const typename _Expr::value_type& __y) {
32193163}
32203164
32213165template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3222inline _LIBCPP_HIDE_FROM_ABI
3166[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
32233167__val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
32243168atan2(const typename _Expr::value_type& __x, const _Expr& __y) {
32253169 typedef typename _Expr::value_type value_type;
......@@ -3228,7 +3172,7 @@ atan2(const typename _Expr::value_type& __x, const _Expr& __y) {
32283172}
32293173
32303174template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3231inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
3175[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
32323176cos(const _Expr& __x) {
32333177 typedef typename _Expr::value_type value_type;
32343178 typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
......@@ -3236,7 +3180,7 @@ cos(const _Expr& __x) {
32363180}
32373181
32383182template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3239inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
3183[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
32403184cosh(const _Expr& __x) {
32413185 typedef typename _Expr::value_type value_type;
32423186 typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
......@@ -3244,7 +3188,7 @@ cosh(const _Expr& __x) {
32443188}
32453189
32463190template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3247inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
3191[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
32483192exp(const _Expr& __x) {
32493193 typedef typename _Expr::value_type value_type;
32503194 typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
......@@ -3252,7 +3196,7 @@ exp(const _Expr& __x) {
32523196}
32533197
32543198template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3255inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
3199[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
32563200log(const _Expr& __x) {
32573201 typedef typename _Expr::value_type value_type;
32583202 typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
......@@ -3260,7 +3204,7 @@ log(const _Expr& __x) {
32603204}
32613205
32623206template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3263inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
3207[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
32643208log10(const _Expr& __x) {
32653209 typedef typename _Expr::value_type value_type;
32663210 typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
......@@ -3270,15 +3214,16 @@ log10(const _Expr& __x) {
32703214template <class _Expr1,
32713215 class _Expr2,
32723216 __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
3273inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
3274pow(const _Expr1& __x, const _Expr2& __y) {
3217[[__nodiscard__]] inline
3218 _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
3219 pow(const _Expr1& __x, const _Expr2& __y) {
32753220 typedef typename _Expr1::value_type value_type;
32763221 typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
32773222 return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
32783223}
32793224
32803225template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3281inline _LIBCPP_HIDE_FROM_ABI
3226[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
32823227__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
32833228pow(const _Expr& __x, const typename _Expr::value_type& __y) {
32843229 typedef typename _Expr::value_type value_type;
......@@ -3287,7 +3232,7 @@ pow(const _Expr& __x, const typename _Expr::value_type& __y) {
32873232}
32883233
32893234template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3290inline _LIBCPP_HIDE_FROM_ABI
3235[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
32913236__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
32923237pow(const typename _Expr::value_type& __x, const _Expr& __y) {
32933238 typedef typename _Expr::value_type value_type;
......@@ -3296,7 +3241,7 @@ pow(const typename _Expr::value_type& __x, const _Expr& __y) {
32963241}
32973242
32983243template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3299inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
3244[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
33003245sin(const _Expr& __x) {
33013246 typedef typename _Expr::value_type value_type;
33023247 typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
......@@ -3304,7 +3249,7 @@ sin(const _Expr& __x) {
33043249}
33053250
33063251template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3307inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
3252[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
33083253sinh(const _Expr& __x) {
33093254 typedef typename _Expr::value_type value_type;
33103255 typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
......@@ -3312,7 +3257,7 @@ sinh(const _Expr& __x) {
33123257}
33133258
33143259template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3315inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
3260[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
33163261sqrt(const _Expr& __x) {
33173262 typedef typename _Expr::value_type value_type;
33183263 typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
......@@ -3320,7 +3265,7 @@ sqrt(const _Expr& __x) {
33203265}
33213266
33223267template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3323inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
3268[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
33243269tan(const _Expr& __x) {
33253270 typedef typename _Expr::value_type value_type;
33263271 typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
......@@ -3328,7 +3273,7 @@ tan(const _Expr& __x) {
33283273}
33293274
33303275template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
3331inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
3276[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
33323277tanh(const _Expr& __x) {
33333278 typedef typename _Expr::value_type value_type;
33343279 typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
......@@ -3336,22 +3281,22 @@ tanh(const _Expr& __x) {
33363281}
33373282
33383283template <class _Tp>
3339inline _LIBCPP_HIDE_FROM_ABI _Tp* begin(valarray<_Tp>& __v) {
3284[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _Tp* begin(valarray<_Tp>& __v) {
33403285 return __v.__begin_;
33413286}
33423287
33433288template <class _Tp>
3344inline _LIBCPP_HIDE_FROM_ABI const _Tp* begin(const valarray<_Tp>& __v) {
3289[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI const _Tp* begin(const valarray<_Tp>& __v) {
33453290 return __v.__begin_;
33463291}
33473292
33483293template <class _Tp>
3349inline _LIBCPP_HIDE_FROM_ABI _Tp* end(valarray<_Tp>& __v) {
3294[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _Tp* end(valarray<_Tp>& __v) {
33503295 return __v.__end_;
33513296}
33523297
33533298template <class _Tp>
3354inline _LIBCPP_HIDE_FROM_ABI const _Tp* end(const valarray<_Tp>& __v) {
3299[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI const _Tp* end(const valarray<_Tp>& __v) {
33553300 return __v.__end_;
33563301}
33573302
lib/libcxx/include/variant+25-33
......@@ -247,7 +247,6 @@ namespace std {
247247# include <__type_traits/is_nothrow_assignable.h>
248248# include <__type_traits/is_nothrow_constructible.h>
249249# include <__type_traits/is_reference.h>
250# include <__type_traits/is_replaceable.h>
251250# include <__type_traits/is_same.h>
252251# include <__type_traits/is_swappable.h>
253252# include <__type_traits/is_trivially_assignable.h>
......@@ -289,7 +288,7 @@ _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
289288
290289class _LIBCPP_EXPORTED_FROM_ABI bad_variant_access : public exception {
291290public:
292 const char* what() const _NOEXCEPT override;
291 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
293292};
294293
295294_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
......@@ -918,18 +917,10 @@ protected:
918917 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
919918 if (this->index() == _Ip) {
920919 __a.__value = std::forward<_Arg>(__arg);
920 } else if constexpr (is_nothrow_constructible_v<_Tp, _Arg> || !is_nothrow_move_constructible_v<_Tp>) {
921 this->__emplace<_Ip>(std::forward<_Arg>(__arg));
921922 } else {
922 struct {
923 _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()(true_type) const {
924 __this->__emplace<_Ip>(std::forward<_Arg>(__arg));
925 }
926 _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()(false_type) const {
927 __this->__emplace<_Ip>(_Tp(std::forward<_Arg>(__arg)));
928 }
929 __assignment* __this;
930 _Arg&& __arg;
931 } __impl{this, std::forward<_Arg>(__arg)};
932 __impl(bool_constant < is_nothrow_constructible_v<_Tp, _Arg> || !is_nothrow_move_constructible_v < _Tp >> {});
923 this->__emplace<_Ip>(_Tp(std::forward<_Arg>(__arg)));
933924 }
934925 }
935926
......@@ -1127,14 +1118,14 @@ template <class _IdxSeq>
11271118struct __make_overloads_imp;
11281119
11291120template <size_t... _Idx>
1130struct __make_overloads_imp<__tuple_indices<_Idx...> > {
1121struct __make_overloads_imp<index_sequence<_Idx...> > {
11311122 template <class... _Types>
11321123 using _Apply _LIBCPP_NODEBUG = __all_overloads<__overload<_Types, _Idx>...>;
11331124};
11341125
11351126template <class... _Types>
11361127using _MakeOverloads _LIBCPP_NODEBUG =
1137 typename __make_overloads_imp< __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
1128 typename __make_overloads_imp<make_index_sequence<sizeof...(_Types)>>::template _Apply<_Types...>;
11381129
11391130template <class _Tp, class... _Types>
11401131using __best_match_t _LIBCPP_NODEBUG = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
......@@ -1172,7 +1163,6 @@ class _LIBCPP_DECLSPEC_EMPTY_BASES _LIBCPP_NO_SPECIALIZATIONS variant
11721163public:
11731164 using __trivially_relocatable _LIBCPP_NODEBUG =
11741165 conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>;
1175 using __replaceable _LIBCPP_NODEBUG = conditional_t<_And<__is_replaceable<_Types>...>::value, variant, void>;
11761166
11771167 template <bool _Dummy = true,
11781168 enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
......@@ -1284,11 +1274,11 @@ public:
12841274 return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
12851275 }
12861276
1287 _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept {
1277 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept {
12881278 return __impl_.valueless_by_exception();
12891279 }
12901280
1291 _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }
1281 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }
12921282
12931283 template < bool _Dummy = true,
12941284 enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
......@@ -1299,7 +1289,7 @@ public:
12991289 __impl_.__swap(__that.__impl_);
13001290 }
13011291
1302# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
1292# if _LIBCPP_STD_VER >= 26
13031293 // Helper class to implement [variant.visit]/10
13041294 // Constraints: The call to visit does not use an explicit template-argument-list
13051295 // that begins with a type template-argument.
......@@ -1331,7 +1321,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __holds_alternative(const variant<_Types...
13311321}
13321322
13331323template <class _Tp, class... _Types>
1334_LIBCPP_HIDE_FROM_ABI constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
1324[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
13351325 return std::__holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
13361326}
13371327
......@@ -1345,21 +1335,23 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __generic_get(_Vp&& __v) {
13451335}
13461336
13471337template <size_t _Ip, class... _Types>
1348_LIBCPP_HIDE_FROM_ABI constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(variant<_Types...>& __v) {
1338[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr variant_alternative_t<_Ip, variant<_Types...>>&
1339get(variant<_Types...>& __v) {
13491340 static_assert(_Ip < sizeof...(_Types));
13501341 static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
13511342 return std::__generic_get<_Ip>(__v);
13521343}
13531344
13541345template <size_t _Ip, class... _Types>
1355_LIBCPP_HIDE_FROM_ABI constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(variant<_Types...>&& __v) {
1346[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr variant_alternative_t<_Ip, variant<_Types...>>&&
1347get(variant<_Types...>&& __v) {
13561348 static_assert(_Ip < sizeof...(_Types));
13571349 static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
13581350 return std::__generic_get<_Ip>(std::move(__v));
13591351}
13601352
13611353template <size_t _Ip, class... _Types>
1362_LIBCPP_HIDE_FROM_ABI constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
1354[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
13631355get(const variant<_Types...>& __v) {
13641356 static_assert(_Ip < sizeof...(_Types));
13651357 static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
......@@ -1367,7 +1359,7 @@ get(const variant<_Types...>& __v) {
13671359}
13681360
13691361template <size_t _Ip, class... _Types>
1370_LIBCPP_HIDE_FROM_ABI constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
1362[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
13711363get(const variant<_Types...>&& __v) {
13721364 static_assert(_Ip < sizeof...(_Types));
13731365 static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
......@@ -1375,25 +1367,25 @@ get(const variant<_Types...>&& __v) {
13751367}
13761368
13771369template <class _Tp, class... _Types>
1378_LIBCPP_HIDE_FROM_ABI constexpr _Tp& get(variant<_Types...>& __v) {
1370[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& get(variant<_Types...>& __v) {
13791371 static_assert(!is_void_v<_Tp>);
13801372 return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
13811373}
13821374
13831375template <class _Tp, class... _Types>
1384_LIBCPP_HIDE_FROM_ABI constexpr _Tp&& get(variant<_Types...>&& __v) {
1376[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& get(variant<_Types...>&& __v) {
13851377 static_assert(!is_void_v<_Tp>);
13861378 return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
13871379}
13881380
13891381template <class _Tp, class... _Types>
1390_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const variant<_Types...>& __v) {
1382[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const variant<_Types...>& __v) {
13911383 static_assert(!is_void_v<_Tp>);
13921384 return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
13931385}
13941386
13951387template <class _Tp, class... _Types>
1396_LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const variant<_Types...>&& __v) {
1388[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const variant<_Types...>&& __v) {
13971389 static_assert(!is_void_v<_Tp>);
13981390 return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
13991391}
......@@ -1405,7 +1397,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto* __generic_get_if(_Vp* __v) noexcept {
14051397}
14061398
14071399template <size_t _Ip, class... _Types>
1408_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
1400[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
14091401get_if(variant<_Types...>* __v) noexcept {
14101402 static_assert(_Ip < sizeof...(_Types));
14111403 static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
......@@ -1413,7 +1405,7 @@ get_if(variant<_Types...>* __v) noexcept {
14131405}
14141406
14151407template <size_t _Ip, class... _Types>
1416_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
1408[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
14171409get_if(const variant<_Types...>* __v) noexcept {
14181410 static_assert(_Ip < sizeof...(_Types));
14191411 static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
......@@ -1421,13 +1413,13 @@ get_if(const variant<_Types...>* __v) noexcept {
14211413}
14221414
14231415template <class _Tp, class... _Types>
1424_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept {
1416[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept {
14251417 static_assert(!is_void_v<_Tp>);
14261418 return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
14271419}
14281420
14291421template <class _Tp, class... _Types>
1430_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __v) noexcept {
1422[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __v) noexcept {
14311423 static_assert(!is_void_v<_Tp>);
14321424 return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
14331425}
......@@ -1608,7 +1600,7 @@ struct hash< __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>
16081600 using result_type _LIBCPP_DEPRECATED_IN_CXX17 = size_t;
16091601# endif
16101602
1611 _LIBCPP_HIDE_FROM_ABI size_t operator()(const variant<_Types...>& __v) const {
1603 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const variant<_Types...>& __v) const {
16121604 using __variant_detail::__visitation::__variant;
16131605 size_t __res =
16141606 __v.valueless_by_exception()
lib/libcxx/include/version+41-24
......@@ -37,7 +37,8 @@ __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 201806L <atomic>
40__cpp_lib_atomic_ref 202411L <atomic>
41 201806L // C++20
4142__cpp_lib_atomic_shared_ptr 201711L <atomic>
4243__cpp_lib_atomic_value_initialization 201911L <atomic> <memory>
4344__cpp_lib_atomic_wait 201907L <atomic>
......@@ -62,7 +63,7 @@ __cpp_lib_clamp 201603L <algorithm>
6263__cpp_lib_common_reference 202302L <type_traits>
6364__cpp_lib_common_reference_wrapper 202302L <functional>
6465__cpp_lib_complex_udls 201309L <complex>
65__cpp_lib_concepts 202002L <concepts>
66__cpp_lib_concepts 202207L <concepts>
6667__cpp_lib_constexpr_algorithms 202306L <algorithm> <utility>
6768 201806L // C++20
6869__cpp_lib_constexpr_bitset 202207L <bitset>
......@@ -70,6 +71,8 @@ __cpp_lib_constexpr_charconv 202207L <charconv>
7071__cpp_lib_constexpr_cmath 202202L <cmath> <cstdlib>
7172__cpp_lib_constexpr_complex 201711L <complex>
7273__cpp_lib_constexpr_dynamic_alloc 201907L <memory>
74__cpp_lib_constexpr_flat_map 202502L <flat_map>
75__cpp_lib_constexpr_flat_set 202502L <flat_set>
7376__cpp_lib_constexpr_forward_list 202502L <forward_list>
7477__cpp_lib_constexpr_functional 201907L <functional>
7578__cpp_lib_constexpr_iterator 201811L <iterator>
......@@ -108,8 +111,8 @@ __cpp_lib_execution 201902L <execution>
108111 201603L // C++17
109112__cpp_lib_expected 202211L <expected>
110113__cpp_lib_filesystem 201703L <filesystem>
111__cpp_lib_flat_map 202207L <flat_map>
112__cpp_lib_flat_set 202207L <flat_set>
114__cpp_lib_flat_map 202511L <flat_map>
115__cpp_lib_flat_set 202511L <flat_set>
113116__cpp_lib_format 202110L <format>
114117__cpp_lib_format_path 202403L <filesystem>
115118__cpp_lib_format_ranges 202207L <format>
......@@ -138,7 +141,8 @@ __cpp_lib_incomplete_container_elements 201505L <forward_list> <
138141__cpp_lib_inplace_vector 202406L <inplace_vector>
139142__cpp_lib_int_pow2 202002L <bit>
140143__cpp_lib_integer_comparison_functions 202002L <utility>
141__cpp_lib_integer_sequence 201304L <utility>
144__cpp_lib_integer_sequence 202511L <utility>
145 201304L // C++14
142146__cpp_lib_integral_constant_callable 201304L <type_traits>
143147__cpp_lib_interpolate 201902L <cmath> <numeric>
144148__cpp_lib_invoke 201411L <functional>
......@@ -184,7 +188,8 @@ __cpp_lib_nonmember_container_access 201411L <array> <deque>
184188__cpp_lib_not_fn 202306L <functional>
185189 201603L // C++17
186190__cpp_lib_null_iterators 201304L <iterator>
187__cpp_lib_optional 202110L <optional>
191__cpp_lib_optional 202506L <optional>
192 202110L // C++23
188193 202106L // C++20
189194 201606L // C++17
190195__cpp_lib_optional_range_support 202406L <optional>
......@@ -205,6 +210,7 @@ __cpp_lib_ranges_chunk_by 202202L <ranges>
205210__cpp_lib_ranges_concat 202403L <ranges>
206211__cpp_lib_ranges_contains 202207L <algorithm>
207212__cpp_lib_ranges_find_last 202207L <algorithm>
213__cpp_lib_ranges_indices 202506L <ranges>
208214__cpp_lib_ranges_iota 202202L <numeric>
209215__cpp_lib_ranges_join_with 202202L <ranges>
210216__cpp_lib_ranges_repeat 202207L <ranges>
......@@ -245,6 +251,7 @@ __cpp_lib_starts_ends_with 201711L <string> <string
245251__cpp_lib_stdatomic_h 202011L <stdatomic.h>
246252__cpp_lib_string_contains 202011L <string> <string_view>
247253__cpp_lib_string_resize_and_overwrite 202110L <string>
254__cpp_lib_string_subview 202506L <string> <string_view>
248255__cpp_lib_string_udls 201304L <string>
249256__cpp_lib_string_view 202403L <string> <string_view>
250257 201803L // C++20
......@@ -333,13 +340,11 @@ __cpp_lib_void_t 201411L <type_traits>
333340# define __cpp_lib_clamp 201603L
334341# define __cpp_lib_enable_shared_from_this 201603L
335342// # define __cpp_lib_execution 201603L
336# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY
343# if _LIBCPP_HAS_FILESYSTEM
337344# define __cpp_lib_filesystem 201703L
338345# endif
339346# define __cpp_lib_gcd_lcm 201606L
340# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
341# define __cpp_lib_hardware_interference_size 201703L
342# endif
347# define __cpp_lib_hardware_interference_size 201703L
343348# define __cpp_lib_has_unique_object_representations 201606L
344349# define __cpp_lib_hypot 201603L
345350# define __cpp_lib_incomplete_container_elements 201505L
......@@ -391,10 +396,8 @@ __cpp_lib_void_t 201411L <type_traits>
391396# define __cpp_lib_atomic_ref 201806L
392397// # define __cpp_lib_atomic_shared_ptr 201711L
393398# define __cpp_lib_atomic_value_initialization 201911L
394# if _LIBCPP_AVAILABILITY_HAS_SYNC
395# define __cpp_lib_atomic_wait 201907L
396# endif
397# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
399# define __cpp_lib_atomic_wait 201907L
400# if _LIBCPP_HAS_THREADS
398401# define __cpp_lib_barrier 201907L
399402# endif
400403# define __cpp_lib_bind_front 201907L
......@@ -406,7 +409,7 @@ __cpp_lib_void_t 201411L <type_traits>
406409# endif
407410# define __cpp_lib_common_reference 202302L
408411# define __cpp_lib_common_reference_wrapper 202302L
409# define __cpp_lib_concepts 202002L
412# define __cpp_lib_concepts 202207L
410413# define __cpp_lib_constexpr_algorithms 201806L
411414# define __cpp_lib_constexpr_complex 201711L
412415# define __cpp_lib_constexpr_dynamic_alloc 201907L
......@@ -439,10 +442,10 @@ __cpp_lib_void_t 201411L <type_traits>
439442// # define __cpp_lib_is_layout_compatible 201907L
440443# define __cpp_lib_is_nothrow_convertible 201806L
441444// # define __cpp_lib_is_pointer_interconvertible 201907L
442# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
445# if _LIBCPP_HAS_THREADS
443446# define __cpp_lib_jthread 201911L
444447# endif
445# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
448# if _LIBCPP_HAS_THREADS
446449# define __cpp_lib_latch 201907L
447450# endif
448451# define __cpp_lib_list_remove_return_type 201806L
......@@ -455,7 +458,7 @@ __cpp_lib_void_t 201411L <type_traits>
455458# endif
456459# define __cpp_lib_ranges 202110L
457460# define __cpp_lib_remove_cvref 201711L
458# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
461# if _LIBCPP_HAS_THREADS
459462# define __cpp_lib_semaphore 201907L
460463# endif
461464# undef __cpp_lib_shared_ptr_arrays
......@@ -494,8 +497,8 @@ __cpp_lib_void_t 201411L <type_traits>
494497# define __cpp_lib_constexpr_typeinfo 202106L
495498# define __cpp_lib_containers_ranges 202202L
496499# define __cpp_lib_expected 202211L
497# define __cpp_lib_flat_map 202207L
498# define __cpp_lib_flat_set 202207L
500# define __cpp_lib_flat_map 202511L
501# define __cpp_lib_flat_set 202511L
499502# define __cpp_lib_format_ranges 202207L
500503// # define __cpp_lib_formatters 202302L
501504# define __cpp_lib_forward_like 202207L
......@@ -528,7 +531,7 @@ __cpp_lib_void_t 201411L <type_traits>
528531// # define __cpp_lib_ranges_slide 202202L
529532# define __cpp_lib_ranges_starts_ends_with 202106L
530533# define __cpp_lib_ranges_to_container 202202L
531// # define __cpp_lib_ranges_zip 202110L
534# define __cpp_lib_ranges_zip 202110L
532535// # define __cpp_lib_reference_from_temporary 202202L
533536// # define __cpp_lib_spanstream 202106L
534537// # define __cpp_lib_stacktrace 202011L
......@@ -544,18 +547,22 @@ __cpp_lib_void_t 201411L <type_traits>
544547# define __cpp_lib_aligned_accessor 202411L
545548// # define __cpp_lib_associative_heterogeneous_insertion 202306L
546549// # define __cpp_lib_atomic_min_max 202403L
550# undef __cpp_lib_atomic_ref
551# define __cpp_lib_atomic_ref 202411L
547552# undef __cpp_lib_bind_front
548553# define __cpp_lib_bind_front 202306L
549554# define __cpp_lib_bitset 202306L
550555# undef __cpp_lib_constexpr_algorithms
551556# define __cpp_lib_constexpr_algorithms 202306L
557# define __cpp_lib_constexpr_flat_map 202502L
558# define __cpp_lib_constexpr_flat_set 202502L
552559# define __cpp_lib_constexpr_forward_list 202502L
553560# define __cpp_lib_constexpr_list 202502L
554561# if !defined(_LIBCPP_ABI_VCRUNTIME)
555562# define __cpp_lib_constexpr_new 202406L
556563# endif
557564# define __cpp_lib_constexpr_queue 202502L
558// # define __cpp_lib_constrained_equality 202411L
565# define __cpp_lib_constrained_equality 202411L
559566// # define __cpp_lib_copyable_function 202306L
560567// # define __cpp_lib_debugging 202311L
561568// # define __cpp_lib_default_template_type_for_algorithm_values 202403L
......@@ -575,21 +582,30 @@ __cpp_lib_void_t 201411L <type_traits>
575582// # define __cpp_lib_generate_random 202403L
576583// # define __cpp_lib_hazard_pointer 202306L
577584// # define __cpp_lib_inplace_vector 202406L
585# undef __cpp_lib_integer_sequence
586# define __cpp_lib_integer_sequence 202511L
578587# define __cpp_lib_is_sufficiently_aligned 202411L
579588# if __has_builtin(__builtin_is_virtual_base_of)
580589# define __cpp_lib_is_virtual_base_of 202406L
581590# endif
582// # define __cpp_lib_is_within_lifetime 202306L
591# if __has_builtin(__builtin_is_within_lifetime)
592# define __cpp_lib_is_within_lifetime 202306L
593# endif
583594// # define __cpp_lib_linalg 202311L
584595# undef __cpp_lib_mdspan
585596# define __cpp_lib_mdspan 202406L
586597# undef __cpp_lib_not_fn
587598# define __cpp_lib_not_fn 202306L
588// # define __cpp_lib_optional_range_support 202406L
599# undef __cpp_lib_optional
600# define __cpp_lib_optional 202506L
601# if _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
602# define __cpp_lib_optional_range_support 202406L
603# endif
589604# undef __cpp_lib_out_ptr
590605# define __cpp_lib_out_ptr 202311L
591606// # define __cpp_lib_philox_engine 202406L
592607// # define __cpp_lib_ranges_concat 202403L
608# define __cpp_lib_ranges_indices 202506L
593609# define __cpp_lib_ratio 202306L
594610// # define __cpp_lib_rcu 202306L
595611# define __cpp_lib_reference_wrapper 202403L
......@@ -599,6 +615,7 @@ __cpp_lib_void_t 201411L <type_traits>
599615# define __cpp_lib_span_at 202311L
600616# define __cpp_lib_span_initializer_list 202311L
601617# define __cpp_lib_sstream_from_string_view 202306L
618# define __cpp_lib_string_subview 202506L
602619# undef __cpp_lib_string_view
603620# define __cpp_lib_string_view 202403L
604621// # define __cpp_lib_submdspan 202306L
lib/libcxx/include/wctype.h+29-29
......@@ -45,13 +45,14 @@ wctrans_t wctrans(const char* property);
4545*/
4646
4747#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
48# include <__cxx03/wctype.h>
48# include <__cxx03/__config>
4949#else
5050# include <__config>
51#endif
5152
52# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
53# pragma GCC system_header
54# endif
53#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
54# pragma GCC system_header
55#endif
5556
5657// TODO:
5758// In the future, we should unconditionally include_next <wctype.h> here and instead
......@@ -62,33 +63,32 @@ wctrans_t wctrans(const char* property);
6263// nothing (with using_if_exists), and if we include another header that defines one
6364// of these declarations (e.g. <wchar.h>), the second `using ::wint_t` with using_if_exists
6465// will fail because it does not refer to the same declaration.
65# if __has_include_next(<wctype.h>)
66# include_next <wctype.h>
67# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
68# endif
66#if __has_include_next(<wctype.h>)
67# include_next <wctype.h>
68# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
69#endif
6970
70# ifdef __cplusplus
71#ifdef __cplusplus
7172
72# undef iswalnum
73# undef iswalpha
74# undef iswblank
75# undef iswcntrl
76# undef iswdigit
77# undef iswgraph
78# undef iswlower
79# undef iswprint
80# undef iswpunct
81# undef iswspace
82# undef iswupper
83# undef iswxdigit
84# undef iswctype
85# undef wctype
86# undef towlower
87# undef towupper
88# undef towctrans
89# undef wctrans
73# undef iswalnum
74# undef iswalpha
75# undef iswblank
76# undef iswcntrl
77# undef iswdigit
78# undef iswgraph
79# undef iswlower
80# undef iswprint
81# undef iswpunct
82# undef iswspace
83# undef iswupper
84# undef iswxdigit
85# undef iswctype
86# undef wctype
87# undef towlower
88# undef towupper
89# undef towctrans
90# undef wctrans
9091
91# endif // __cplusplus
92#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
92#endif // __cplusplus
9393
9494#endif // _LIBCPP_WCTYPE_H
lib/libcxx/src/any.cpp+4
......@@ -14,6 +14,8 @@ const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
1414
1515#include <__config>
1616
17#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 7
18
1719// Preserve std::experimental::any_bad_cast for ABI compatibility
1820// Even though it no longer exists in a header file
1921_LIBCPP_BEGIN_NAMESPACE_LFTS
......@@ -25,4 +27,6 @@ public:
2527
2628const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
2729
30#endif
31
2832_LIBCPP_END_NAMESPACE_LFTS
lib/libcxx/src/atomic.cpp+365-80
......@@ -9,8 +9,13 @@
99#include <__thread/timed_backoff_policy.h>
1010#include <atomic>
1111#include <climits>
12#include <cstddef>
13#include <cstdint>
14#include <cstring>
1215#include <functional>
16#include <new>
1317#include <thread>
18#include <type_traits>
1419
1520#include "include/apple_availability.h"
1621
......@@ -41,6 +46,11 @@
4146// OpenBSD has no indirect syscalls
4247# define _LIBCPP_FUTEX(...) futex(__VA_ARGS__)
4348
49#elif defined(_WIN32)
50
51# include <memory>
52# include <windows.h>
53
4454#else // <- Add other operating systems here
4555
4656// Baseline needs no new headers
......@@ -49,17 +59,34 @@
4959
5060#endif
5161
62_LIBCPP_PUSH_MACROS
63#include <__undef_macros>
64
5265_LIBCPP_BEGIN_NAMESPACE_STD
5366
67struct NoTimeout {};
68
5469#ifdef __linux__
5570
56static void
57__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
58 static constexpr timespec __timeout = {2, 0};
59 _LIBCPP_FUTEX(__ptr, FUTEX_WAIT_PRIVATE, __val, &__timeout, 0, 0);
71template <std::size_t _Size, class MaybeTimeout>
72static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
73 static_assert(_Size == 4, "Can only wait on 4 bytes value");
74 alignas(__cxx_contention_t) char buffer[_Size];
75 std::memcpy(&buffer, const_cast<const void*>(__val), _Size);
76 static constexpr timespec __default_timeout = {2, 0};
77 timespec __timeout;
78 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
79 __timeout = __default_timeout;
80 } else {
81 __timeout.tv_sec = maybe_timeout_ns / 1'000'000'000;
82 __timeout.tv_nsec = maybe_timeout_ns % 1'000'000'000;
83 }
84 _LIBCPP_FUTEX(__ptr, FUTEX_WAIT_PRIVATE, *reinterpret_cast<__cxx_contention_t const*>(&buffer), &__timeout, 0, 0);
6085}
6186
62static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, bool __notify_one) {
87template <std::size_t _Size>
88static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
89 static_assert(_Size == 4, "Can only wake up on 4 bytes value");
6390 _LIBCPP_FUTEX(__ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0);
6491}
6592
......@@ -70,19 +97,41 @@ extern "C" int __ulock_wait(
7097extern "C" int __ulock_wake(uint32_t operation, void* addr, uint64_t wake_value);
7198
7299// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/ulock.h#L82
100# define UL_COMPARE_AND_WAIT 1
73101# define UL_COMPARE_AND_WAIT64 5
74102# define ULF_WAKE_ALL 0x00000100
75103
76static void
77__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
78 static_assert(sizeof(__cxx_atomic_contention_t) == 8, "Waiting on 8 bytes value");
79 __ulock_wait(UL_COMPARE_AND_WAIT64, const_cast<__cxx_atomic_contention_t*>(__ptr), __val, 0);
104template <std::size_t _Size, class MaybeTimeout>
105static 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");
107 auto __timeout_us = [&] {
108 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
109 return uint32_t(0);
110 } else {
111 return std::max(static_cast<uint32_t>(maybe_timeout_ns / 1000), uint32_t(1));
112 }
113 }();
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 }
80125}
81126
82static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, bool __notify_one) {
83 static_assert(sizeof(__cxx_atomic_contention_t) == 8, "Waking up on 8 bytes value");
84 __ulock_wake(
85 UL_COMPARE_AND_WAIT64 | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<__cxx_atomic_contention_t*>(__ptr), 0);
127template <std::size_t _Size>
128static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
129 static_assert(_Size == 8 || _Size == 4, "Can only wake up on 8 bytes or 4 bytes value");
130
131 if constexpr (_Size == 4)
132 __ulock_wake(UL_COMPARE_AND_WAIT | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<void*>(__ptr), 0);
133 else
134 __ulock_wake(UL_COMPARE_AND_WAIT64 | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<void*>(__ptr), 0);
86135}
87136
88137#elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8
......@@ -92,119 +141,355 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo
92141 * limit its use to architectures where long and int64_t are synonyms.
93142 */
94143
95static void
96__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
97 _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), UMTX_OP_WAIT, __val, nullptr, nullptr);
144template <std::size_t _Size, class MaybeTimeout>
145static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
146 static_assert(_Size == 8, "Can only wait on 8 bytes value");
147 // At the moment, FreeBSD is stuck on stable ABI, which only supports platform wait with __cxx_contention_t
148 // It is safe to reinterpret_cast the val as it is ever going to be passed a __cxx_contention_t under this ABI
149 // If in the future FreeBSD decides to experiment unstable ABI to support more types, this cast will no longer be
150 // safe.
151 __cxx_contention_t value = *reinterpret_cast<const __cxx_contention_t*>(__val);
152 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
153 _umtx_op(const_cast<void*>(__ptr), UMTX_OP_WAIT, value, nullptr, nullptr);
154 } else {
155 timespec timeout{};
156 timeout.tv_sec = maybe_timeout_ns / 1'000'000'000;
157 timeout.tv_nsec = maybe_timeout_ns % 1'000'000'000;
158
159 _umtx_op(const_cast<void*>(__ptr),
160 UMTX_OP_WAIT,
161 value,
162 reinterpret_cast<void*>(static_cast<uintptr_t>(sizeof(timeout))),
163 &timeout);
164 }
165}
166
167template <std::size_t _Size>
168static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
169 static_assert(_Size == 8, "Can only wake up on 8 bytes value");
170 _umtx_op(const_cast<void*>(__ptr), UMTX_OP_WAKE, __notify_one ? 1 : INT_MAX, nullptr, nullptr);
171}
172
173#elif defined(_WIN32)
174
175static void* win32_get_synch_api_function(const char* function_name) {
176 // Attempt to load the API set. Note that as per the Microsoft STL implementation, we assume this API is already
177 // loaded and accessible. While this isn't explicitly guaranteed by publicly available Win32 API documentation, it is
178 // true in practice, and may be guaranteed by internal documentation not released publicly. In any case the fact that
179 // the Microsoft STL made this assumption is reasonable basis to say that we can too. The alternative to this would be
180 // to use LoadLibrary, but then leak the module handle. We can't call FreeLibrary, as this would have to be triggered
181 // by a global static destructor, which would hang off DllMain, and calling FreeLibrary from DllMain is explicitly
182 // mentioned as not being allowed:
183 // https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain
184 // Given the range of bad options here, we have chosen to mirror what Microsoft did, as it seems fair to assume that
185 // Microsoft will guarantee compatibility for us, as we are exposed to the same conditions as all existing Windows
186 // apps using the Microsoft STL VS2015/2017/2019/2022 runtimes, where Windows 7 support has not been excluded at
187 // compile time.
188 static auto module_handle = GetModuleHandleW(L"api-ms-win-core-synch-l1-2-0.dll");
189 if (module_handle == nullptr) {
190 return nullptr;
191 }
192
193 // Attempt to locate the function in the API and return the result to the caller. Note that the NULL return from this
194 // method is documented as being interchangeable with nullptr.
195 // https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175
196 return reinterpret_cast<void*>(GetProcAddress(module_handle, function_name));
98197}
99198
100static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, bool __notify_one) {
101 _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), UMTX_OP_WAKE, __notify_one ? 1 : INT_MAX, nullptr, nullptr);
199template <std::size_t _Size, class MaybeTimeout>
200static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
201 static_assert(_Size == 8, "Can only wait on 8 bytes value");
202 // WaitOnAddress was added in Windows 8 (build 9200)
203 static auto wait_on_address =
204 reinterpret_cast<BOOL(WINAPI*)(void*, PVOID, SIZE_T, DWORD)>(win32_get_synch_api_function("WaitOnAddress"));
205 if (wait_on_address != nullptr) {
206 auto timeout_ms = [&]() -> DWORD {
207 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
208 return INFINITE;
209 } else {
210 uint64_t ms = maybe_timeout_ns / 1'000'000;
211 if (ms == 0 && maybe_timeout_ns > 100'000)
212 // Round up to 1ms if requested between 100us - 1ms
213 return 1;
214
215 return static_cast<DWORD>(std::min(static_cast<uint64_t>(INFINITE), ms));
216 }
217 }();
218 wait_on_address(const_cast<void*>(__ptr), const_cast<void*>(__val), _Size, timeout_ms);
219 } else {
220 std::chrono::nanoseconds timeout = std::chrono::nanoseconds(0);
221 if constexpr (!is_same_v<MaybeTimeout, NoTimeout>) {
222 timeout = std::chrono::nanoseconds(maybe_timeout_ns);
223 }
224 __libcpp_thread_poll_with_backoff(
225 [=]() -> bool { return std::memcmp(const_cast<const void*>(__ptr), __val, _Size) != 0; },
226 __libcpp_timed_backoff_policy(),
227 timeout);
228 }
229}
230
231template <std::size_t _Size>
232static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
233 static_assert(_Size == 8, "Can only wake up on 8 bytes value");
234 if (__notify_one) {
235 // WakeByAddressSingle was added in Windows 8 (build 9200)
236 static auto wake_by_address_single =
237 reinterpret_cast<void(WINAPI*)(PVOID)>(win32_get_synch_api_function("WakeByAddressSingle"));
238 if (wake_by_address_single != nullptr) {
239 wake_by_address_single(const_cast<void*>(__ptr));
240 } else {
241 // The fallback implementation of waking does nothing, as the fallback wait implementation just does polling, so
242 // there's nothing to do here.
243 }
244 } else {
245 // WakeByAddressAll was added in Windows 8 (build 9200)
246 static auto wake_by_address_all =
247 reinterpret_cast<void(WINAPI*)(PVOID)>(win32_get_synch_api_function("WakeByAddressAll"));
248 if (wake_by_address_all != nullptr) {
249 wake_by_address_all(const_cast<void*>(__ptr));
250 } else {
251 // The fallback implementation of waking does nothing, as the fallback wait implementation just does polling, so
252 // there's nothing to do here.
253 }
254 }
102255}
103256
104257#else // <- Add other operating systems here
105258
106259// Baseline is just a timed backoff
107260
108static void
109__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
261template <std::size_t _Size, class MaybeTimeout>
262static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
263 std::chrono::nanoseconds timeout = std::chrono::nanoseconds(0);
264 if constexpr (!is_same_v<MaybeTimeout, NoTimeout>) {
265 timeout = std::chrono::nanoseconds(maybe_timeout_ns);
266 }
110267 __libcpp_thread_poll_with_backoff(
111 [=]() -> bool { return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__ptr, memory_order_relaxed), __val); },
112 __libcpp_timed_backoff_policy());
268 [=]() -> bool { return std::memcmp(const_cast<const void*>(__ptr), __val, _Size) != 0; },
269 __libcpp_timed_backoff_policy(),
270 timeout);
113271}
114272
115static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile*, bool) {}
273template <std::size_t _Size>
274static void __platform_wake_by_address(void const*, bool) {}
116275
117276#endif // __linux__
118277
119static constexpr size_t __libcpp_contention_table_size = (1 << 8); /* < there's no magic in this number */
120
121struct alignas(64) /* aim to avoid false sharing */ __libcpp_contention_table_entry {
122 __cxx_atomic_contention_t __contention_state;
123 __cxx_atomic_contention_t __platform_state;
124 inline constexpr __libcpp_contention_table_entry() : __contention_state(0), __platform_state(0) {}
125};
126
127static __libcpp_contention_table_entry __libcpp_contention_table[__libcpp_contention_table_size];
128
129static hash<void const volatile*> __libcpp_contention_hasher;
130
131static __libcpp_contention_table_entry* __libcpp_contention_state(void const volatile* p) {
132 return &__libcpp_contention_table[__libcpp_contention_hasher(p) & (__libcpp_contention_table_size - 1)];
133}
278// =============================
279// Local hidden helper functions
280// =============================
134281
135282/* Given an atomic to track contention and an atomic to actually wait on, which may be
136283 the same atomic, we try to detect contention to avoid spuriously calling the platform. */
137284
138static void __libcpp_contention_notify(__cxx_atomic_contention_t volatile* __contention_state,
139 __cxx_atomic_contention_t const volatile* __platform_state,
140 bool __notify_one) {
141 if (0 != __cxx_atomic_load(__contention_state, memory_order_seq_cst))
285template <std::size_t _Size>
286static void
287__contention_notify(__cxx_atomic_contention_t* __waiter_count, void const* __address_to_notify, bool __notify_one) {
288 if (0 != __cxx_atomic_load(__waiter_count, memory_order_seq_cst))
142289 // We only call 'wake' if we consumed a contention bit here.
143 __libcpp_platform_wake_by_address(__platform_state, __notify_one);
144}
145static __cxx_contention_t
146__libcpp_contention_monitor_for_wait(__cxx_atomic_contention_t volatile* /*__contention_state*/,
147 __cxx_atomic_contention_t const volatile* __platform_state) {
148 // We will monitor this value.
149 return __cxx_atomic_load(__platform_state, memory_order_acquire);
150}
151static void __libcpp_contention_wait(__cxx_atomic_contention_t volatile* __contention_state,
152 __cxx_atomic_contention_t const volatile* __platform_state,
153 __cxx_contention_t __old_value) {
154 __cxx_atomic_fetch_add(__contention_state, __cxx_contention_t(1), memory_order_relaxed);
155 // https://github.com/llvm/llvm-project/issues/109290
290 __platform_wake_by_address<_Size>(__address_to_notify, __notify_one);
291}
292
293template <std::size_t _Size, class MaybeTimeout>
294static void __contention_wait(__cxx_atomic_contention_t* __waiter_count,
295 void const* __address_to_wait,
296 void const* __old_value,
297 MaybeTimeout maybe_timeout_ns) {
298 __cxx_atomic_fetch_add(__waiter_count, __cxx_contention_t(1), memory_order_relaxed);
299 // https://llvm.org/PR109290
156300 // There are no platform guarantees of a memory barrier in the platform wait implementation
157301 __cxx_atomic_thread_fence(memory_order_seq_cst);
158302 // We sleep as long as the monitored value hasn't changed.
159 __libcpp_platform_wait_on_address(__platform_state, __old_value);
160 __cxx_atomic_fetch_sub(__contention_state, __cxx_contention_t(1), memory_order_release);
303 __platform_wait_on_address<_Size>(__address_to_wait, __old_value, maybe_timeout_ns);
304 __cxx_atomic_fetch_sub(__waiter_count, __cxx_contention_t(1), memory_order_release);
305}
306
307static constexpr size_t __contention_table_size = (1 << 8); /* < there's no magic in this number */
308
309static constexpr hash<void const*> __contention_hasher;
310
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;
331 __cxx_atomic_contention_t __platform_state;
332 constexpr __contention_state_global() : __waiter_count(0), __platform_state(0) {}
333};
334
335static __contention_state_global __contention_table_global[__contention_table_size];
336
337static __contention_state_global* __get_global_contention_state(void const* p) {
338 return &__contention_table_global[__contention_hasher(p) & (__contention_table_size - 1)];
161339}
162340
163341/* When the incoming atomic is the wrong size for the platform wait size, need to
164342 launder the value sequence through an atomic from our table. */
165343
166static void __libcpp_atomic_notify(void const volatile* __location) {
167 auto const __entry = __libcpp_contention_state(__location);
344static void __atomic_notify_global_table(void const* __location) {
345 auto const __entry = __get_global_contention_state(__location);
168346 // The value sequence laundering happens on the next line below.
169347 __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_seq_cst);
170 __libcpp_contention_notify(
171 &__entry->__contention_state,
172 &__entry->__platform_state,
173 false /* when laundering, we can't handle notify_one */);
348 __contention_notify<sizeof(__cxx_atomic_contention_t)>(
349 &__entry->__waiter_count, &__entry->__platform_state, false /* when laundering, we can't handle notify_one */);
350}
351
352// =============================
353// New dylib exported symbols
354// =============================
355
356// global
357_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __location) noexcept {
358 auto const __entry = __get_global_contention_state(__location);
359 return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire);
360}
361
362_LIBCPP_EXPORTED_FROM_ABI void
363__atomic_wait_global_table(void const* __location, __cxx_contention_t __old_value) noexcept {
364 auto const __entry = __get_global_contention_state(__location);
365 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
366 &__entry->__waiter_count, &__entry->__platform_state, &__old_value, NoTimeout{});
367}
368
369_LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_global_table_with_timeout(
370 void const* __location, __cxx_contention_t __old_value, uint64_t __timeout_ns) _NOEXCEPT {
371 auto const __entry = __get_global_contention_state(__location);
372 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
373 &__entry->__waiter_count, &__entry->__platform_state, &__old_value, __timeout_ns);
374}
375
376_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_global_table(void const* __location) noexcept {
377 __atomic_notify_global_table(__location);
378}
379
380_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_global_table(void const* __location) noexcept {
381 __atomic_notify_global_table(__location);
382}
383
384// native
385
386template <std::size_t _Size>
387_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{});
174389}
390
391template <std::size_t _Size>
392_LIBCPP_EXPORTED_FROM_ABI void
393__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);
395}
396
397template <std::size_t _Size>
398_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_native(void const* __location) noexcept {
399 __contention_notify<_Size>(__get_native_waiter_count(__location), __location, true);
400}
401
402template <std::size_t _Size>
403_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(void const* __location) noexcept {
404 __contention_notify<_Size>(__get_native_waiter_count(__location), __location, false);
405}
406
407// ==================================================
408// Instantiation of the templates with supported size
409// ==================================================
410
411#if defined(_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE)
412
413# define _INSTANTIATE(_SIZE) \
414 template _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_native<_SIZE>(void const*, void const*) noexcept; \
415 template _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_native_with_timeout<_SIZE>( \
416 void const*, void const*, uint64_t) noexcept; \
417 template _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_native<_SIZE>(void const*) noexcept; \
418 template _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native<_SIZE>(void const*) noexcept;
419
420_LIBCPP_NATIVE_PLATFORM_WAIT_SIZES(_INSTANTIATE)
421
422# undef _INSTANTIATE
423
424#else // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
425
426template _LIBCPP_EXPORTED_FROM_ABI void
427__atomic_wait_native<sizeof(__cxx_contention_t)>(void const* __address, void const* __old_value) noexcept;
428
429template _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_native_with_timeout<sizeof(__cxx_contention_t)>(
430 void const* __address, void const* __old_value, uint64_t) noexcept;
431
432template _LIBCPP_EXPORTED_FROM_ABI void
433__atomic_notify_one_native<sizeof(__cxx_contention_t)>(void const* __location) noexcept;
434
435template _LIBCPP_EXPORTED_FROM_ABI void
436__atomic_notify_all_native<sizeof(__cxx_contention_t)>(void const* __location) noexcept;
437
438#endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
439
440// =============================================================
441// Old dylib exported symbols, for backwards compatibility
442// =============================================================
443_LIBCPP_DIAGNOSTIC_PUSH
444_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
445
175446_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) noexcept {
176 __libcpp_atomic_notify(__location);
447 __atomic_notify_global_table(const_cast<void const*>(__location));
177448}
449
178450_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __location) noexcept {
179 __libcpp_atomic_notify(__location);
451 __atomic_notify_global_table(const_cast<void const*>(__location));
180452}
453
181454_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) noexcept {
182 auto const __entry = __libcpp_contention_state(__location);
183 return __libcpp_contention_monitor_for_wait(&__entry->__contention_state, &__entry->__platform_state);
455 auto const __entry = __get_global_contention_state(const_cast<void const*>(__location));
456 return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire);
184457}
458
185459_LIBCPP_EXPORTED_FROM_ABI void
186460__libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) noexcept {
187 auto const __entry = __libcpp_contention_state(__location);
188 __libcpp_contention_wait(&__entry->__contention_state, &__entry->__platform_state, __old_value);
461 auto const __entry = __get_global_contention_state(const_cast<void const*>(__location));
462 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
463 &__entry->__waiter_count, &__entry->__platform_state, &__old_value, NoTimeout{});
189464}
190465
191/* When the incoming atomic happens to be the platform wait size, we still need to use the
192 table for the contention detection, but we can use the atomic directly for the wait. */
193
194466_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) noexcept {
195 __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, true);
467 auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location));
468 __contention_notify<sizeof(__cxx_atomic_contention_t)>(
469 __get_native_waiter_count(__location_cast), __location_cast, true);
196470}
471
197472_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) noexcept {
198 __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, false);
199}
200// This function is never used, but still exported for ABI compatibility.
201_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
202__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) noexcept {
203 return __libcpp_contention_monitor_for_wait(&__libcpp_contention_state(__location)->__contention_state, __location);
473 auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location));
474 __contention_notify<sizeof(__cxx_atomic_contention_t)>(
475 __get_native_waiter_count(__location_cast), __location_cast, false);
204476}
477
205478_LIBCPP_EXPORTED_FROM_ABI void
206479__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) noexcept {
207 __libcpp_contention_wait(&__libcpp_contention_state(__location)->__contention_state, __location, __old_value);
480 auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location));
481 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
482 __get_native_waiter_count(__location_cast), __location_cast, &__old_value, NoTimeout{});
208483}
209484
485// this function is even unused in the old ABI
486_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
487__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) noexcept {
488 return __cxx_atomic_load(__location, memory_order_acquire);
489}
490
491_LIBCPP_DIAGNOSTIC_POP
492
210493_LIBCPP_END_NAMESPACE_STD
494
495_LIBCPP_POP_MACROS
lib/libcxx/src/barrier.cpp+4-3
......@@ -60,11 +60,12 @@ public:
6060_LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected) {
6161 return new __barrier_algorithm_base(__expected);
6262}
63_LIBCPP_EXPORTED_FROM_ABI bool
64__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
63_LIBCPP_EXPORTED_FROM_ABI bool __arrive_barrier_algorithm_base(
64 _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
6565 return __barrier->__arrive(__old_phase);
6666}
67_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept {
67_LIBCPP_EXPORTED_FROM_ABI void
68__destroy_barrier_algorithm_base(_LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept {
6869 delete __barrier;
6970}
7071
lib/libcxx/src/charconv.cpp+6-3
......@@ -14,17 +14,20 @@
1414
1515_LIBCPP_BEGIN_NAMESPACE_STD
1616
17#ifndef _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
17#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
1818
1919namespace __itoa {
2020
21_LIBCPP_DIAGNOSTIC_PUSH
22_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
23// These functions exist for ABI compatibility, so we don't ever want a declaration prior to the definition.
2124_LIBCPP_EXPORTED_FROM_ABI char* __u32toa(uint32_t value, char* buffer) noexcept { return __base_10_u32(buffer, value); }
22
2325_LIBCPP_EXPORTED_FROM_ABI char* __u64toa(uint64_t value, char* buffer) noexcept { return __base_10_u64(buffer, value); }
26_LIBCPP_DIAGNOSTIC_POP
2427
2528} // namespace __itoa
2629
27#endif // _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
30#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
2831
2932// The original version of floating-point to_chars was written by Microsoft and
3033// contributed with the following license.
lib/libcxx/src/condition_variable_destructor.cpp+1-1
......@@ -14,7 +14,7 @@
1414#include <__config>
1515#include <__thread/support.h>
1616
17#if _LIBCPP_ABI_VERSION == 1 || !_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
17#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 9 || !_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
1818# define NEEDS_CONDVAR_DESTRUCTOR
1919#endif
2020
lib/libcxx/src/error_category.cpp+3-1
......@@ -8,7 +8,9 @@
88
99#include <__config>
1010
11#ifdef _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
11// This has technically been removed in LLVM 3.4
12#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && !defined(_LIBCPP_OBJECT_FORMAT_XCOFF) && \
13 _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 4
1214# define _LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS
1315#endif
1416
lib/libcxx/src/exception.cpp+2-10
......@@ -9,20 +9,12 @@
99#define _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION
1010#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
1111
12#include <exception>
13#include <new>
14#include <typeinfo>
15
16#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
17# include <cxxabi.h>
18using namespace __cxxabiv1;
19# define HAVE_DEPENDENT_EH_ABI 1
20#endif
12#include <__config>
2113
2214#if defined(_LIBCPP_ABI_MICROSOFT)
2315# include "support/runtime/exception_msvc.ipp"
2416# include "support/runtime/exception_pointer_msvc.ipp"
25#elif defined(_LIBCPPABI_VERSION)
17#elif defined(LIBCXX_BUILDING_LIBCXXABI)
2618# include "support/runtime/exception_libcxxabi.ipp"
2719# include "support/runtime/exception_pointer_cxxabi.ipp"
2820#elif defined(LIBCXXRT)
lib/libcxx/src/experimental/time_zone.cpp+1-1
......@@ -720,7 +720,7 @@ __get_sys_info(sys_seconds __time,
720720// Iff the "offsets" are the same '__current.__end' is replaced with
721721// '__next.__end', which effectively merges the two objects in one object. The
722722// function returns true if a merge occurred.
723[[nodiscard]] bool __merge_continuation(sys_info& __current, const sys_info& __next) {
723[[nodiscard]] static bool __merge_continuation(sys_info& __current, const sys_info& __next) {
724724 if (__current.end != __next.begin)
725725 return false;
726726
lib/libcxx/src/experimental/tzdb.cpp+4-1
......@@ -49,6 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4949
5050namespace chrono {
5151
52_LIBCPP_DIAGNOSTIC_PUSH
53_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
5254// This function is weak so it can be overriden in the tests. The
5355// declaration is in the test header test/support/test_tzdb.h
5456_LIBCPP_WEAK string_view __libcpp_tzdb_directory() {
......@@ -59,6 +61,7 @@ _LIBCPP_WEAK string_view __libcpp_tzdb_directory() {
5961 abort();
6062#endif
6163}
64_LIBCPP_DIAGNOSTIC_POP
6265
6366//===----------------------------------------------------------------------===//
6467// Details
......@@ -767,7 +770,7 @@ void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& __rules) {
767770 // On Linux systems it seems /etc/timezone is deprecated and being phased out.
768771 // This file is used when /etc/localtime does not exist, or when it exists but
769772 // is not a symlink. For more information and links see
770 // https://github.com/llvm/llvm-project/issues/105634
773 // https://llvm.org/PR105634
771774
772775 string __name = chrono::__current_zone_environment();
773776
lib/libcxx/src/filesystem/error.h+4-22
......@@ -128,17 +128,8 @@ struct ErrorHandler {
128128 T report(const error_code& ec, const char* msg, ...) const {
129129 va_list ap;
130130 va_start(ap, msg);
131#if _LIBCPP_HAS_EXCEPTIONS
132 try {
133#endif // _LIBCPP_HAS_EXCEPTIONS
134 report_impl(ec, msg, ap);
135#if _LIBCPP_HAS_EXCEPTIONS
136 } catch (...) {
137 va_end(ap);
138 throw;
139 }
140#endif // _LIBCPP_HAS_EXCEPTIONS
141 va_end(ap);
131 __scope_guard guard([&] { va_end(ap); });
132 report_impl(ec, msg, ap);
142133 return error_value<T>();
143134 }
144135
......@@ -148,17 +139,8 @@ struct ErrorHandler {
148139 T report(errc const& err, const char* msg, ...) const {
149140 va_list ap;
150141 va_start(ap, msg);
151#if _LIBCPP_HAS_EXCEPTIONS
152 try {
153#endif // _LIBCPP_HAS_EXCEPTIONS
154 report_impl(make_error_code(err), msg, ap);
155#if _LIBCPP_HAS_EXCEPTIONS
156 } catch (...) {
157 va_end(ap);
158 throw;
159 }
160#endif // _LIBCPP_HAS_EXCEPTIONS
161 va_end(ap);
142 __scope_guard guard([&] { va_end(ap); });
143 report_impl(make_error_code(err), msg, ap);
162144 return error_value<T>();
163145 }
164146
lib/libcxx/src/filesystem/format_string.h+9-18
......@@ -11,6 +11,7 @@
1111
1212#include <__assert>
1313#include <__config>
14#include <__utility/scope_guard.h>
1415#include <array>
1516#include <cstdarg>
1617#include <cstddef>
......@@ -34,20 +35,19 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 0) string vformat_string(const ch
3435
3536 va_list apcopy;
3637 va_copy(apcopy, ap);
37 int ret = ::vsnprintf(buf.data(), buf.size(), msg, apcopy);
38 int size = ::vsnprintf(buf.data(), buf.size(), msg, apcopy);
3839 va_end(apcopy);
3940
4041 string result;
41 if (static_cast<size_t>(ret) < buf.size()) {
42 result.assign(buf.data(), static_cast<size_t>(ret));
42 if (static_cast<size_t>(size) < buf.size()) {
43 result.assign(buf.data(), static_cast<size_t>(size));
4344 } else {
4445 // we did not provide a long enough buffer on our first attempt. The
4546 // return value is the number of bytes (excluding the null byte) that are
4647 // needed for formatting.
47 size_t size_with_null = static_cast<size_t>(ret) + 1;
48 result.__resize_default_init(size_with_null - 1);
49 ret = ::vsnprintf(&result[0], size_with_null, msg, ap);
50 _LIBCPP_ASSERT_INTERNAL(static_cast<size_t>(ret) == (size_with_null - 1), "TODO");
48 result.resize_and_overwrite(size, [&](char* res, size_t n) { return ::vsnprintf(res, n, msg, ap); });
49 _LIBCPP_ASSERT_INTERNAL(static_cast<size_t>(size) == result.size(),
50 "vsnprintf did not result in the same number of characters as the first attempt?");
5151 }
5252 return result;
5353}
......@@ -56,17 +56,8 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) string format_string(const cha
5656 string ret;
5757 va_list ap;
5858 va_start(ap, msg);
59#if _LIBCPP_HAS_EXCEPTIONS
60 try {
61#endif // _LIBCPP_HAS_EXCEPTIONS
62 ret = detail::vformat_string(msg, ap);
63#if _LIBCPP_HAS_EXCEPTIONS
64 } catch (...) {
65 va_end(ap);
66 throw;
67 }
68#endif // _LIBCPP_HAS_EXCEPTIONS
69 va_end(ap);
59 __scope_guard guard([&] { va_end(ap); });
60 ret = detail::vformat_string(msg, ap);
7061 return ret;
7162}
7263
lib/libcxx/src/filesystem/int128_builtins.cpp+2
......@@ -16,6 +16,8 @@
1616#include <__config>
1717#include <climits>
1818
19_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes") // See the FIXME above
20
1921#if _LIBCPP_HAS_INT128
2022
2123extern "C" __attribute__((no_sanitize("undefined"))) _LIBCPP_EXPORTED_FROM_ABI __int128_t
lib/libcxx/src/filesystem/operations.cpp+2-9
......@@ -41,17 +41,10 @@
4141#include <time.h>
4242
4343// since Linux 4.5 and FreeBSD 13, but the Linux libc wrapper is only provided by glibc >= 2.27 and musl
44#if defined(__linux__)
45# if defined(_LIBCPP_GLIBC_PREREQ)
46# if _LIBCPP_GLIBC_PREREQ(2, 27)
47# define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
48# endif
49# elif _LIBCPP_HAS_MUSL_LIBC
50# define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
51# endif
52#elif defined(__FreeBSD__)
44#if _LIBCPP_GLIBC_PREREQ(2, 27) || _LIBCPP_HAS_MUSL_LIBC || defined(__FreeBSD__)
5345# define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
5446#endif
47
5548#if __has_include(<sys/sendfile.h>)
5649# include <sys/sendfile.h>
5750# define _LIBCPP_FILESYSTEM_USE_SENDFILE
lib/libcxx/src/filesystem/path.cpp+3-1
......@@ -292,7 +292,9 @@ path path::lexically_relative(const path& base) const {
292292 // return a path constructed with 'n' dot-dot elements, followed by the
293293 // elements of '*this' after the mismatch.
294294 path Result;
295 // FIXME: Reserve enough room in Result that it won't have to re-allocate.
295 constexpr size_t ElemSize = 2; // ".."
296 constexpr size_t SeparatorSize = 1; // separator is always a single char
297 Result.__reserve(ElemCount * (ElemSize + SeparatorSize) + SeparatorSize + PP.Path.size());
296298 while (ElemCount--)
297299 Result /= PATHSTR("..");
298300 for (; PP; ++PP)
lib/libcxx/src/include/aligned_alloc.h created+65
......@@ -0,0 +1,65 @@
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_ALIGNED_ALLOC_H
10#define _LIBCPP_SRC_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
33// Android only provides aligned_alloc when targeting API 28 or higher.
34# elif !defined(__ANDROID__) || __ANDROID_API__ >= 28
35 // aligned_alloc() requires that __size is a multiple of __alignment,
36 // but for C++ [new.delete.general], only states "if the value of an
37 // alignment argument passed to any of these functions is not a valid
38 // alignment value, the behavior is undefined".
39 // To handle calls such as ::operator new(1, std::align_val_t(128)), we
40 // round __size up to the next multiple of __alignment.
41 size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
42 // Rounding up could have wrapped around to zero, so we have to add another
43 // max() ternary to the actual call site to avoid succeeded in that case.
44 return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size);
45# else
46 void* __result = nullptr;
47 (void)::posix_memalign(&__result, __alignment, __size);
48 // If posix_memalign fails, __result is unmodified so we still return `nullptr`.
49 return __result;
50# endif
51}
52
53inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) {
54# if defined(_LIBCPP_MSVCRT_LIKE)
55 ::_aligned_free(__ptr);
56# else
57 ::free(__ptr);
58# endif
59}
60
61#endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
62
63_LIBCPP_END_NAMESPACE_STD
64
65#endif // _LIBCPP_SRC_ALIGNED_ALLOC_H
lib/libcxx/src/include/config_elast.h+1-1
......@@ -23,7 +23,7 @@
2323# define _LIBCPP_ELAST ELAST
2424#elif defined(__LLVM_LIBC__)
2525// No _LIBCPP_ELAST needed for LLVM libc
26#elif defined(_NEWLIB_VERSION)
26#elif _LIBCPP_LIBC_NEWLIB
2727# define _LIBCPP_ELAST __ELASTERROR
2828#elif defined(__NuttX__)
2929// No _LIBCPP_ELAST needed on NuttX
lib/libcxx/src/include/from_chars_floating_point.h+11-7
......@@ -9,11 +9,6 @@
99#ifndef _LIBCPP_SRC_INCLUDE_FROM_CHARS_FLOATING_POINT_H
1010#define _LIBCPP_SRC_INCLUDE_FROM_CHARS_FLOATING_POINT_H
1111
12// These headers are in the shared LLVM-libc header library.
13#include "shared/fp_bits.h"
14#include "shared/str_to_float.h"
15#include "shared/str_to_integer.h"
16
1712#include <__assert>
1813#include <__config>
1914#include <cctype>
......@@ -21,6 +16,15 @@
2116#include <concepts>
2217#include <limits>
2318
19// Make sure we use libc++'s assertion machinery within the shared code we use
20// from LLVM libc.
21#define LIBC_ASSERT(cond) _LIBCPP_ASSERT((cond), _LIBCPP_TOSTRING(cond))
22
23// These headers are in the shared LLVM-libc header library.
24#include "shared/fp_bits.h"
25#include "shared/str_to_float.h"
26#include "shared/str_to_integer.h"
27
2428// Included for the _Floating_type_traits class
2529#include "to_chars_floating_point.h"
2630
......@@ -193,7 +197,7 @@ struct __exponent_result {
193197// __offset, 0, false. This allows using the results unconditionally, the
194198// __present is important for the scientific notation, where the value is
195199// mandatory.
196__exponent_result __parse_exponent(const char* __input, size_t __n, size_t __offset, char __marker) {
200static __exponent_result __parse_exponent(const char* __input, size_t __n, size_t __offset, char __marker) {
197201 if (__offset + 1 < __n && // an exponent always needs at least one digit.
198202 std::tolower(__input[__offset]) == __marker && //
199203 !std::isspace(__input[__offset + 1]) // leading whitespace is not allowed.
......@@ -213,7 +217,7 @@ __exponent_result __parse_exponent(const char* __input, size_t __n, size_t __off
213217}
214218
215219// Here we do this operation as int64 to avoid overflow.
216int32_t __merge_exponents(int64_t __fractional, int64_t __exponent, int __max_biased_exponent) {
220static int32_t __merge_exponents(int64_t __fractional, int64_t __exponent, int __max_biased_exponent) {
217221 int64_t __sum = __fractional + __exponent;
218222
219223 if (__sum > __max_biased_exponent)
lib/libcxx/src/include/overridable_function.h+8-10
......@@ -29,12 +29,12 @@
2929// This is a low-level utility which does not work on all platforms, since it needs
3030// to make assumptions about the object file format in use. Furthermore, it requires
3131// the "base definition" of the function (the one we want to check whether it has been
32// overridden) to be defined using the _LIBCPP_OVERRIDABLE_FUNCTION macro.
32// overridden) to be defined using the OVERRIDABLE_FUNCTION macro.
3333//
3434// This currently works with Mach-O files (used on Darwin) and with ELF files (used on Linux
3535// and others). On platforms where we know how to implement this detection, the macro
3636// _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION is defined to 1, and it is defined to 0 on
37// other platforms. The _LIBCPP_OVERRIDABLE_FUNCTION macro is defined to perform a normal
37// other platforms. The OVERRIDABLE_FUNCTION macro is defined to perform a normal
3838// function definition on unsupported platforms so that it can be used to define functions
3939// regardless of whether detection is actually supported.
4040//
......@@ -44,7 +44,7 @@
4444// Let's say we want to check whether a weak function `f` has been overridden by the user.
4545// The general mechanism works by placing `f`'s definition (in the libc++ built library)
4646// inside a special section, which we do using the `__section__` attribute via the
47// _LIBCPP_OVERRIDABLE_FUNCTION macro.
47// OVERRIDABLE_FUNCTION macro.
4848//
4949// Then, when comes the time to check whether the function has been overridden, we take
5050// the address of the function and we check whether it falls inside the special function
......@@ -66,11 +66,10 @@
6666#if defined(_LIBCPP_OBJECT_FORMAT_MACHO)
6767
6868# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
69# define _LIBCPP_OVERRIDABLE_FUNCTION(type, name, arglist) \
70 __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions"))) _LIBCPP_WEAK type name arglist
69# define OVERRIDABLE_FUNCTION \
70 __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions"))) _LIBCPP_WEAK
7171
72_LIBCPP_BEGIN_NAMESPACE_STD
73template <typename T, T* _Func>
72_LIBCPP_BEGIN_NAMESPACE_STD template <typename T, T* _Func>
7473_LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept {
7574 // Declare two dummy bytes and give them these special `__asm` values. These values are
7675 // defined by the linker, which means that referring to `&__lcxx_override_start` will
......@@ -100,8 +99,7 @@ _LIBCPP_END_NAMESPACE_STD
10099#elif defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__)
101100
102101# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
103# define _LIBCPP_OVERRIDABLE_FUNCTION(type, name, arglist) \
104 __attribute__((__section__("__lcxx_override"))) _LIBCPP_WEAK type name arglist
102# define OVERRIDABLE_FUNCTION __attribute__((__section__("__lcxx_override"))) _LIBCPP_WEAK
105103
106104// This is very similar to what we do for Mach-O above. The ELF linker will implicitly define
107105// variables with those names corresponding to the start and the end of the section.
......@@ -129,7 +127,7 @@ _LIBCPP_END_NAMESPACE_STD
129127#else
130128
131129# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0
132# define _LIBCPP_OVERRIDABLE_FUNCTION(type, name, arglist) _LIBCPP_WEAK type name arglist
130# define OVERRIDABLE_FUNCTION _LIBCPP_WEAK
133131
134132#endif
135133
lib/libcxx/src/iostream.cpp+56-37
......@@ -16,24 +16,40 @@
1616
1717_LIBCPP_BEGIN_NAMESPACE_STD
1818
19// This file implements the various stream objects provided inside <iostream>. We're doing some ODR violations in here,
20// so this quite fragile. Specifically, the size of the stream objects (i.e. cout, cin etc.) needs to stay the same.
21// For that reason, we have `stream` and `stream_data` separated into two objects. The public `stream` objects only
22// contain the actual stream, while the private `stream_data` objects contains the `basic_streambuf` we're using as well
23// as the mbstate_t. `stream_data` objects are only accessible within the library, so they aren't ABI sensitive and we
24// can change them as we want.
25
26template <class StreamT>
27union stream {
28 constexpr stream() {}
29 stream(const stream&) = delete;
30 stream& operator=(const stream&) = delete;
31 constexpr ~stream() {}
32
33 StreamT value;
34};
35
1936template <class StreamT, class BufferT>
2037union stream_data {
2138 constexpr stream_data() {}
2239 constexpr ~stream_data() {}
2340 struct {
24 // The stream has to be the first element, since that's referenced by the stream declarations in <iostream>
25 StreamT stream;
2641 BufferT buffer;
2742 mbstate_t mb;
2843 };
29
30 void init(FILE* stdstream) {
31 mb = {};
32 std::construct_at(&buffer, stdstream, &mb);
33 std::construct_at(&stream, &buffer);
34 }
3544};
3645
46template <class StreamT, class BufferT>
47void init_stream(FILE* stdstream, stream<StreamT>& stream, stream_data<StreamT, BufferT>& data) {
48 data.mb = {};
49 std::construct_at(&data.buffer, stdstream, &data.mb);
50 std::construct_at(&stream.value, &data.buffer);
51}
52
3753#define CHAR_MANGLING_char "D"
3854#define CHAR_MANGLING_wchar_t "_W"
3955#define CHAR_MANGLING(CharT) CHAR_MANGLING_##CharT
......@@ -46,25 +62,28 @@ union stream_data {
4662
4763#ifdef _LIBCPP_ABI_MICROSOFT
4864# define STREAM(StreamT, BufferT, CharT, var) \
49 STRING_DATA_CONSTINIT stream_data<StreamT<CharT>, BufferT<CharT>> var __asm__( \
65 STRING_DATA_CONSTINIT stream_data<StreamT<CharT>, BufferT<CharT>> var##_data; \
66 _LIBCPP_EXPORTED_FROM_ABI STRING_DATA_CONSTINIT stream<StreamT<CharT>> var __asm__( \
5067 "?" #var "@" ABI_NAMESPACE_STR "@std@@3V?$" #StreamT \
5168 "@" CHAR_MANGLING(CharT) "U?$char_traits@" CHAR_MANGLING(CharT) "@" ABI_NAMESPACE_STR "@std@@@12@A")
5269#else
53# define STREAM(StreamT, BufferT, CharT, var) STRING_DATA_CONSTINIT stream_data<StreamT<CharT>, BufferT<CharT>> var
70# define STREAM(StreamT, BufferT, CharT, var) \
71 STRING_DATA_CONSTINIT stream_data<StreamT<CharT>, BufferT<CharT>> var##_data; \
72 _LIBCPP_EXPORTED_FROM_ABI STRING_DATA_CONSTINIT stream<StreamT<CharT>> var
5473#endif
5574
5675// These definitions and the declarations in <iostream> technically cause ODR violations, since they have different
5776// types (stream_data and {i,o}stream respectively). This means that <iostream> should never be included in this TU.
5877
59_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_istream, __stdinbuf, char, cin);
60_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, char, cout);
61_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, char, cerr);
62_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, char, clog);
78STREAM(basic_istream, __stdinbuf, char, cin);
79STREAM(basic_ostream, __stdoutbuf, char, cout);
80STREAM(basic_ostream, __stdoutbuf, char, cerr);
81STREAM(basic_ostream, __stdoutbuf, char, clog);
6382#if _LIBCPP_HAS_WIDE_CHARACTERS
64_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_istream, __stdinbuf, wchar_t, wcin);
65_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, wchar_t, wcout);
66_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, wchar_t, wcerr);
67_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, wchar_t, wclog);
83STREAM(basic_istream, __stdinbuf, wchar_t, wcin);
84STREAM(basic_ostream, __stdoutbuf, wchar_t, wcout);
85STREAM(basic_ostream, __stdoutbuf, wchar_t, wcerr);
86STREAM(basic_ostream, __stdoutbuf, wchar_t, wclog);
6887#endif // _LIBCPP_HAS_WIDE_CHARACTERS
6988
7089// Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority
......@@ -98,34 +117,34 @@ public:
98117DoIOSInit::DoIOSInit() {
99118 force_locale_initialization();
100119
101 cin.init(stdin);
102 cout.init(stdout);
103 cerr.init(stderr);
104 clog.init(stderr);
120 init_stream(stdin, cin, cin_data);
121 init_stream(stdout, cout, cout_data);
122 init_stream(stderr, cerr, cerr_data);
123 init_stream(stderr, clog, clog_data);
105124
106 cin.stream.tie(&cout.stream);
107 std::unitbuf(cerr.stream);
108 cerr.stream.tie(&cout.stream);
125 cin.value.tie(&cout.value);
126 std::unitbuf(cerr.value);
127 cerr.value.tie(&cout.value);
109128
110129#if _LIBCPP_HAS_WIDE_CHARACTERS
111 wcin.init(stdin);
112 wcout.init(stdout);
113 wcerr.init(stderr);
114 wclog.init(stderr);
115
116 wcin.stream.tie(&wcout.stream);
117 std::unitbuf(wcerr.stream);
118 wcerr.stream.tie(&wcout.stream);
130 init_stream(stdin, wcin, wcin_data);
131 init_stream(stdout, wcout, wcout_data);
132 init_stream(stderr, wcerr, wcerr_data);
133 init_stream(stderr, wclog, wclog_data);
134
135 wcin.value.tie(&wcout.value);
136 std::unitbuf(wcerr.value);
137 wcerr.value.tie(&wcout.value);
119138#endif
120139}
121140
122141DoIOSInit::~DoIOSInit() {
123 cout.stream.flush();
124 clog.stream.flush();
142 cout.value.flush();
143 clog.value.flush();
125144
126145#if _LIBCPP_HAS_WIDE_CHARACTERS
127 wcout.stream.flush();
128 wclog.stream.flush();
146 wcout.value.flush();
147 wclog.value.flush();
129148#endif
130149}
131150
lib/libcxx/src/locale.cpp+213-196
......@@ -60,9 +60,8 @@ struct __libcpp_unique_locale {
6060
6161 __locale::__locale_t __loc_;
6262
63private:
64 __libcpp_unique_locale(__libcpp_unique_locale const&);
65 __libcpp_unique_locale& operator=(__libcpp_unique_locale const&);
63 __libcpp_unique_locale(__libcpp_unique_locale const&) = delete;
64 __libcpp_unique_locale& operator=(__libcpp_unique_locale const&) = delete;
6665};
6766
6867#ifdef __cloc_defined
......@@ -88,16 +87,6 @@ T& make(Args... args) {
8887 return *obj;
8988}
9089
91template <typename T, size_t N>
92inline constexpr size_t countof(const T (&)[N]) {
93 return N;
94}
95
96template <typename T>
97inline constexpr size_t countof(const T* const begin, const T* const end) {
98 return static_cast<size_t>(end - begin);
99}
100
10190string build_name(const string& other, const string& one, locale::category c) {
10291 if (other == "*" || one == "*")
10392 return "*";
......@@ -215,63 +204,58 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") {
215204}
216205
217206locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), name_(name) {
218#if _LIBCPP_HAS_EXCEPTIONS
219 try {
220#endif // _LIBCPP_HAS_EXCEPTIONS
221 facets_ = locale::classic().__locale_->facets_;
207 __exception_guard guard([&] {
222208 for (unsigned i = 0; i < facets_.size(); ++i)
223209 if (facets_[i])
224 facets_[i]->__add_shared();
225 install(new collate_byname<char>(name_));
210 facets_[i]->__release_shared();
211 });
212 facets_ = locale::classic().__locale_->facets_;
213 for (unsigned i = 0; i < facets_.size(); ++i)
214 if (facets_[i])
215 facets_[i]->__add_shared();
216 install(new collate_byname<char>(name_));
226217#if _LIBCPP_HAS_WIDE_CHARACTERS
227 install(new collate_byname<wchar_t>(name_));
218 install(new collate_byname<wchar_t>(name_));
228219#endif
229 install(new ctype_byname<char>(name_));
220 install(new ctype_byname<char>(name_));
230221#if _LIBCPP_HAS_WIDE_CHARACTERS
231 install(new ctype_byname<wchar_t>(name_));
222 install(new ctype_byname<wchar_t>(name_));
232223#endif
233 install(new codecvt_byname<char, char, mbstate_t>(name_));
224 install(new codecvt_byname<char, char, mbstate_t>(name_));
234225#if _LIBCPP_HAS_WIDE_CHARACTERS
235 install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
226 install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
236227#endif
237 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
238 install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
239 install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
240 _LIBCPP_SUPPRESS_DEPRECATED_POP
228 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
229 install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
230 install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
231 _LIBCPP_SUPPRESS_DEPRECATED_POP
241232#if _LIBCPP_HAS_CHAR8_T
242 install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_));
243 install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
233 install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_));
234 install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
244235#endif
245 install(new numpunct_byname<char>(name_));
236 install(new numpunct_byname<char>(name_));
246237#if _LIBCPP_HAS_WIDE_CHARACTERS
247 install(new numpunct_byname<wchar_t>(name_));
238 install(new numpunct_byname<wchar_t>(name_));
248239#endif
249 install(new moneypunct_byname<char, false>(name_));
250 install(new moneypunct_byname<char, true>(name_));
240 install(new moneypunct_byname<char, false>(name_));
241 install(new moneypunct_byname<char, true>(name_));
251242#if _LIBCPP_HAS_WIDE_CHARACTERS
252 install(new moneypunct_byname<wchar_t, false>(name_));
253 install(new moneypunct_byname<wchar_t, true>(name_));
243 install(new moneypunct_byname<wchar_t, false>(name_));
244 install(new moneypunct_byname<wchar_t, true>(name_));
254245#endif
255 install(new time_get_byname<char>(name_));
246 install(new time_get_byname<char>(name_));
256247#if _LIBCPP_HAS_WIDE_CHARACTERS
257 install(new time_get_byname<wchar_t>(name_));
248 install(new time_get_byname<wchar_t>(name_));
258249#endif
259 install(new time_put_byname<char>(name_));
250 install(new time_put_byname<char>(name_));
260251#if _LIBCPP_HAS_WIDE_CHARACTERS
261 install(new time_put_byname<wchar_t>(name_));
252 install(new time_put_byname<wchar_t>(name_));
262253#endif
263 install(new messages_byname<char>(name_));
254 install(new messages_byname<char>(name_));
264255#if _LIBCPP_HAS_WIDE_CHARACTERS
265 install(new messages_byname<wchar_t>(name_));
256 install(new messages_byname<wchar_t>(name_));
266257#endif
267#if _LIBCPP_HAS_EXCEPTIONS
268 } catch (...) {
269 for (unsigned i = 0; i < facets_.size(); ++i)
270 if (facets_[i])
271 facets_[i]->__release_shared();
272 throw;
273 }
274#endif // _LIBCPP_HAS_EXCEPTIONS
258 guard.__complete();
275259}
276260
277261locale::__imp::__imp(const __imp& other) : facets_(max<size_t>(N, other.facets_.size())), name_(other.name_) {
......@@ -287,71 +271,66 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
287271 for (unsigned i = 0; i < facets_.size(); ++i)
288272 if (facets_[i])
289273 facets_[i]->__add_shared();
290#if _LIBCPP_HAS_EXCEPTIONS
291 try {
292#endif // _LIBCPP_HAS_EXCEPTIONS
293 if (c & locale::collate) {
294 install(new collate_byname<char>(name));
274 __exception_guard guard([&] {
275 for (unsigned i = 0; i < facets_.size(); ++i)
276 if (facets_[i])
277 facets_[i]->__release_shared();
278 });
279 if (c & locale::collate) {
280 install(new collate_byname<char>(name));
295281#if _LIBCPP_HAS_WIDE_CHARACTERS
296 install(new collate_byname<wchar_t>(name));
282 install(new collate_byname<wchar_t>(name));
297283#endif
298 }
299 if (c & locale::ctype) {
300 install(new ctype_byname<char>(name));
284 }
285 if (c & locale::ctype) {
286 install(new ctype_byname<char>(name));
301287#if _LIBCPP_HAS_WIDE_CHARACTERS
302 install(new ctype_byname<wchar_t>(name));
288 install(new ctype_byname<wchar_t>(name));
303289#endif
304 install(new codecvt_byname<char, char, mbstate_t>(name));
290 install(new codecvt_byname<char, char, mbstate_t>(name));
305291#if _LIBCPP_HAS_WIDE_CHARACTERS
306 install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
292 install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
307293#endif
308 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
309 install(new codecvt_byname<char16_t, char, mbstate_t>(name));
310 install(new codecvt_byname<char32_t, char, mbstate_t>(name));
311 _LIBCPP_SUPPRESS_DEPRECATED_POP
294 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
295 install(new codecvt_byname<char16_t, char, mbstate_t>(name));
296 install(new codecvt_byname<char32_t, char, mbstate_t>(name));
297 _LIBCPP_SUPPRESS_DEPRECATED_POP
312298#if _LIBCPP_HAS_CHAR8_T
313 install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name));
314 install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name));
299 install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name));
300 install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name));
315301#endif
316 }
317 if (c & locale::monetary) {
318 install(new moneypunct_byname<char, false>(name));
319 install(new moneypunct_byname<char, true>(name));
302 }
303 if (c & locale::monetary) {
304 install(new moneypunct_byname<char, false>(name));
305 install(new moneypunct_byname<char, true>(name));
320306#if _LIBCPP_HAS_WIDE_CHARACTERS
321 install(new moneypunct_byname<wchar_t, false>(name));
322 install(new moneypunct_byname<wchar_t, true>(name));
307 install(new moneypunct_byname<wchar_t, false>(name));
308 install(new moneypunct_byname<wchar_t, true>(name));
323309#endif
324 }
325 if (c & locale::numeric) {
326 install(new numpunct_byname<char>(name));
310 }
311 if (c & locale::numeric) {
312 install(new numpunct_byname<char>(name));
327313#if _LIBCPP_HAS_WIDE_CHARACTERS
328 install(new numpunct_byname<wchar_t>(name));
314 install(new numpunct_byname<wchar_t>(name));
329315#endif
330 }
331 if (c & locale::time) {
332 install(new time_get_byname<char>(name));
316 }
317 if (c & locale::time) {
318 install(new time_get_byname<char>(name));
333319#if _LIBCPP_HAS_WIDE_CHARACTERS
334 install(new time_get_byname<wchar_t>(name));
320 install(new time_get_byname<wchar_t>(name));
335321#endif
336 install(new time_put_byname<char>(name));
322 install(new time_put_byname<char>(name));
337323#if _LIBCPP_HAS_WIDE_CHARACTERS
338 install(new time_put_byname<wchar_t>(name));
324 install(new time_put_byname<wchar_t>(name));
339325#endif
340 }
341 if (c & locale::messages) {
342 install(new messages_byname<char>(name));
326 }
327 if (c & locale::messages) {
328 install(new messages_byname<char>(name));
343329#if _LIBCPP_HAS_WIDE_CHARACTERS
344 install(new messages_byname<wchar_t>(name));
330 install(new messages_byname<wchar_t>(name));
345331#endif
346 }
347#if _LIBCPP_HAS_EXCEPTIONS
348 } catch (...) {
349 for (unsigned i = 0; i < facets_.size(); ++i)
350 if (facets_[i])
351 facets_[i]->__release_shared();
352 throw;
353332 }
354#endif // _LIBCPP_HAS_EXCEPTIONS
333 guard.__complete();
355334}
356335
357336template <class F>
......@@ -366,87 +345,83 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
366345 for (unsigned i = 0; i < facets_.size(); ++i)
367346 if (facets_[i])
368347 facets_[i]->__add_shared();
369#if _LIBCPP_HAS_EXCEPTIONS
370 try {
371#endif // _LIBCPP_HAS_EXCEPTIONS
372 if (c & locale::collate) {
373 install_from<std::collate<char> >(one);
348 __exception_guard guard([&] {
349 for (unsigned i = 0; i < facets_.size(); ++i)
350 if (facets_[i])
351 facets_[i]->__release_shared();
352 });
353
354 if (c & locale::collate) {
355 install_from<std::collate<char> >(one);
374356#if _LIBCPP_HAS_WIDE_CHARACTERS
375 install_from<std::collate<wchar_t> >(one);
357 install_from<std::collate<wchar_t> >(one);
376358#endif
377 }
378 if (c & locale::ctype) {
379 install_from<std::ctype<char> >(one);
359 }
360 if (c & locale::ctype) {
361 install_from<std::ctype<char> >(one);
380362#if _LIBCPP_HAS_WIDE_CHARACTERS
381 install_from<std::ctype<wchar_t> >(one);
363 install_from<std::ctype<wchar_t> >(one);
382364#endif
383 install_from<std::codecvt<char, char, mbstate_t> >(one);
384 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
385 install_from<std::codecvt<char16_t, char, mbstate_t> >(one);
386 install_from<std::codecvt<char32_t, char, mbstate_t> >(one);
387 _LIBCPP_SUPPRESS_DEPRECATED_POP
365 install_from<std::codecvt<char, char, mbstate_t> >(one);
366 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
367 install_from<std::codecvt<char16_t, char, mbstate_t> >(one);
368 install_from<std::codecvt<char32_t, char, mbstate_t> >(one);
369 _LIBCPP_SUPPRESS_DEPRECATED_POP
388370#if _LIBCPP_HAS_CHAR8_T
389 install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one);
390 install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one);
371 install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one);
372 install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one);
391373#endif
392374#if _LIBCPP_HAS_WIDE_CHARACTERS
393 install_from<std::codecvt<wchar_t, char, mbstate_t> >(one);
375 install_from<std::codecvt<wchar_t, char, mbstate_t> >(one);
394376#endif
395 }
396 if (c & locale::monetary) {
397 install_from<moneypunct<char, false> >(one);
398 install_from<moneypunct<char, true> >(one);
377 }
378 if (c & locale::monetary) {
379 install_from<moneypunct<char, false> >(one);
380 install_from<moneypunct<char, true> >(one);
399381#if _LIBCPP_HAS_WIDE_CHARACTERS
400 install_from<moneypunct<wchar_t, false> >(one);
401 install_from<moneypunct<wchar_t, true> >(one);
382 install_from<moneypunct<wchar_t, false> >(one);
383 install_from<moneypunct<wchar_t, true> >(one);
402384#endif
403 install_from<money_get<char> >(one);
385 install_from<money_get<char> >(one);
404386#if _LIBCPP_HAS_WIDE_CHARACTERS
405 install_from<money_get<wchar_t> >(one);
387 install_from<money_get<wchar_t> >(one);
406388#endif
407 install_from<money_put<char> >(one);
389 install_from<money_put<char> >(one);
408390#if _LIBCPP_HAS_WIDE_CHARACTERS
409 install_from<money_put<wchar_t> >(one);
391 install_from<money_put<wchar_t> >(one);
410392#endif
411 }
412 if (c & locale::numeric) {
413 install_from<numpunct<char> >(one);
393 }
394 if (c & locale::numeric) {
395 install_from<numpunct<char> >(one);
414396#if _LIBCPP_HAS_WIDE_CHARACTERS
415 install_from<numpunct<wchar_t> >(one);
397 install_from<numpunct<wchar_t> >(one);
416398#endif
417 install_from<num_get<char> >(one);
399 install_from<num_get<char> >(one);
418400#if _LIBCPP_HAS_WIDE_CHARACTERS
419 install_from<num_get<wchar_t> >(one);
401 install_from<num_get<wchar_t> >(one);
420402#endif
421 install_from<num_put<char> >(one);
403 install_from<num_put<char> >(one);
422404#if _LIBCPP_HAS_WIDE_CHARACTERS
423 install_from<num_put<wchar_t> >(one);
405 install_from<num_put<wchar_t> >(one);
424406#endif
425 }
426 if (c & locale::time) {
427 install_from<time_get<char> >(one);
407 }
408 if (c & locale::time) {
409 install_from<time_get<char> >(one);
428410#if _LIBCPP_HAS_WIDE_CHARACTERS
429 install_from<time_get<wchar_t> >(one);
411 install_from<time_get<wchar_t> >(one);
430412#endif
431 install_from<time_put<char> >(one);
413 install_from<time_put<char> >(one);
432414#if _LIBCPP_HAS_WIDE_CHARACTERS
433 install_from<time_put<wchar_t> >(one);
415 install_from<time_put<wchar_t> >(one);
434416#endif
435 }
436 if (c & locale::messages) {
437 install_from<std::messages<char> >(one);
417 }
418 if (c & locale::messages) {
419 install_from<std::messages<char> >(one);
438420#if _LIBCPP_HAS_WIDE_CHARACTERS
439 install_from<std::messages<wchar_t> >(one);
421 install_from<std::messages<wchar_t> >(one);
440422#endif
441 }
442#if _LIBCPP_HAS_EXCEPTIONS
443 } catch (...) {
444 for (unsigned i = 0; i < facets_.size(); ++i)
445 if (facets_[i])
446 facets_[i]->__release_shared();
447 throw;
448423 }
449#endif // _LIBCPP_HAS_EXCEPTIONS
424 guard.__complete();
450425}
451426
452427locale::__imp::__imp(const __imp& other, facet* f, long id)
......@@ -933,7 +908,7 @@ const ctype<char>::mask* ctype<char>::classic_table() noexcept {
933908 return __pctype_func();
934909# elif defined(__EMSCRIPTEN__)
935910 return *__ctype_b_loc();
936# elif defined(_NEWLIB_VERSION)
911# elif _LIBCPP_LIBC_NEWLIB
937912 // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
938913 return _ctype_ + 1;
939914# elif defined(_AIX)
......@@ -3961,13 +3936,7 @@ wstring numpunct<wchar_t>::do_falsename() const { return L"false"; }
39613936
39623937// numpunct_byname<char>
39633938
3964numpunct_byname<char>::numpunct_byname(const char* nm, size_t refs) : numpunct<char>(refs) { __init(nm); }
3965
3966numpunct_byname<char>::numpunct_byname(const string& nm, size_t refs) : numpunct<char>(refs) { __init(nm.c_str()); }
3967
3968numpunct_byname<char>::~numpunct_byname() {}
3969
3970void numpunct_byname<char>::__init(const char* nm) {
3939numpunct_byname<char>::numpunct_byname(const char* nm, size_t refs) : numpunct<char>(refs) {
39713940 typedef numpunct<char> base;
39723941 if (strcmp(nm, "C") != 0) {
39733942 __libcpp_unique_locale loc(nm);
......@@ -3988,18 +3957,14 @@ void numpunct_byname<char>::__init(const char* nm) {
39883957 }
39893958}
39903959
3991// numpunct_byname<wchar_t>
3992
3993#if _LIBCPP_HAS_WIDE_CHARACTERS
3994numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs) : numpunct<wchar_t>(refs) { __init(nm); }
3960numpunct_byname<char>::numpunct_byname(const string& nm, size_t refs) : numpunct_byname<char>(nm.c_str(), refs) {}
39953961
3996numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs) : numpunct<wchar_t>(refs) {
3997 __init(nm.c_str());
3998}
3962numpunct_byname<char>::~numpunct_byname() {}
39993963
4000numpunct_byname<wchar_t>::~numpunct_byname() {}
3964// numpunct_byname<wchar_t>
40013965
4002void numpunct_byname<wchar_t>::__init(const char* nm) {
3966#if _LIBCPP_HAS_WIDE_CHARACTERS
3967numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs) : numpunct<wchar_t>(refs) {
40033968 if (strcmp(nm, "C") != 0) {
40043969 __libcpp_unique_locale loc(nm);
40053970 if (!loc)
......@@ -4016,6 +3981,10 @@ void numpunct_byname<wchar_t>::__init(const char* nm) {
40163981 // localization for truename and falsename is not available
40173982 }
40183983}
3984
3985numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs) : numpunct_byname<wchar_t>(nm.c_str(), refs) {}
3986
3987numpunct_byname<wchar_t>::~numpunct_byname() {}
40193988#endif // _LIBCPP_HAS_WIDE_CHARACTERS
40203989
40213990// num_get helpers
......@@ -4383,7 +4352,7 @@ string __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) {
43834352 char f[3] = {0};
43844353 f[0] = '%';
43854354 f[1] = fmt;
4386 size_t n = __locale::__strftime(buf, countof(buf), f, &t, __loc_);
4355 size_t n = __locale::__strftime(buf, std::size(buf), f, &t, __loc_);
43874356 char* bb = buf;
43884357 char* be = buf + n;
43894358 string result;
......@@ -4514,12 +4483,12 @@ wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& c
45144483 char f[3] = {0};
45154484 f[0] = '%';
45164485 f[1] = fmt;
4517 __locale::__strftime(buf, countof(buf), f, &t, __loc_);
4486 __locale::__strftime(buf, std::size(buf), f, &t, __loc_);
45184487 wchar_t wbuf[100];
45194488 wchar_t* wbb = wbuf;
45204489 mbstate_t mb = {0};
45214490 const char* bb = buf;
4522 size_t j = __locale::__mbsrtowcs(wbb, &bb, countof(wbuf), &mb, __loc_);
4491 size_t j = __locale::__mbsrtowcs(wbb, &bb, std::size(wbuf), &mb, __loc_);
45234492 if (j == size_t(-1))
45244493 std::__throw_runtime_error("locale not supported");
45254494 wchar_t* wbe = wbb + j;
......@@ -4640,25 +4609,25 @@ void __time_get_storage<char>::init(const ctype<char>& ct) {
46404609 // __weeks_
46414610 for (int i = 0; i < 7; ++i) {
46424611 t.tm_wday = i;
4643 __locale::__strftime(buf, countof(buf), "%A", &t, __loc_);
4612 __locale::__strftime(buf, std::size(buf), "%A", &t, __loc_);
46444613 __weeks_[i] = buf;
4645 __locale::__strftime(buf, countof(buf), "%a", &t, __loc_);
4614 __locale::__strftime(buf, std::size(buf), "%a", &t, __loc_);
46464615 __weeks_[i + 7] = buf;
46474616 }
46484617 // __months_
46494618 for (int i = 0; i < 12; ++i) {
46504619 t.tm_mon = i;
4651 __locale::__strftime(buf, countof(buf), "%B", &t, __loc_);
4620 __locale::__strftime(buf, std::size(buf), "%B", &t, __loc_);
46524621 __months_[i] = buf;
4653 __locale::__strftime(buf, countof(buf), "%b", &t, __loc_);
4622 __locale::__strftime(buf, std::size(buf), "%b", &t, __loc_);
46544623 __months_[i + 12] = buf;
46554624 }
46564625 // __am_pm_
46574626 t.tm_hour = 1;
4658 __locale::__strftime(buf, countof(buf), "%p", &t, __loc_);
4627 __locale::__strftime(buf, std::size(buf), "%p", &t, __loc_);
46594628 __am_pm_[0] = buf;
46604629 t.tm_hour = 13;
4661 __locale::__strftime(buf, countof(buf), "%p", &t, __loc_);
4630 __locale::__strftime(buf, std::size(buf), "%p", &t, __loc_);
46624631 __am_pm_[1] = buf;
46634632 __c_ = __analyze('c', ct);
46644633 __r_ = __analyze('r', ct);
......@@ -4677,18 +4646,18 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
46774646 // __weeks_
46784647 for (int i = 0; i < 7; ++i) {
46794648 t.tm_wday = i;
4680 __locale::__strftime(buf, countof(buf), "%A", &t, __loc_);
4649 __locale::__strftime(buf, std::size(buf), "%A", &t, __loc_);
46814650 mb = mbstate_t();
46824651 const char* bb = buf;
4683 size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
4652 size_t j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, __loc_);
46844653 if (j == size_t(-1) || j == 0)
46854654 std::__throw_runtime_error("locale not supported");
46864655 wbe = wbuf + j;
46874656 __weeks_[i].assign(wbuf, wbe);
4688 __locale::__strftime(buf, countof(buf), "%a", &t, __loc_);
4657 __locale::__strftime(buf, std::size(buf), "%a", &t, __loc_);
46894658 mb = mbstate_t();
46904659 bb = buf;
4691 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
4660 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, __loc_);
46924661 if (j == size_t(-1) || j == 0)
46934662 std::__throw_runtime_error("locale not supported");
46944663 wbe = wbuf + j;
......@@ -4697,18 +4666,18 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
46974666 // __months_
46984667 for (int i = 0; i < 12; ++i) {
46994668 t.tm_mon = i;
4700 __locale::__strftime(buf, countof(buf), "%B", &t, __loc_);
4669 __locale::__strftime(buf, std::size(buf), "%B", &t, __loc_);
47014670 mb = mbstate_t();
47024671 const char* bb = buf;
4703 size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
4672 size_t j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, __loc_);
47044673 if (j == size_t(-1) || j == 0)
47054674 std::__throw_runtime_error("locale not supported");
47064675 wbe = wbuf + j;
47074676 __months_[i].assign(wbuf, wbe);
4708 __locale::__strftime(buf, countof(buf), "%b", &t, __loc_);
4677 __locale::__strftime(buf, std::size(buf), "%b", &t, __loc_);
47094678 mb = mbstate_t();
47104679 bb = buf;
4711 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
4680 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, __loc_);
47124681 if (j == size_t(-1) || j == 0)
47134682 std::__throw_runtime_error("locale not supported");
47144683 wbe = wbuf + j;
......@@ -4716,19 +4685,19 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
47164685 }
47174686 // __am_pm_
47184687 t.tm_hour = 1;
4719 __locale::__strftime(buf, countof(buf), "%p", &t, __loc_);
4688 __locale::__strftime(buf, std::size(buf), "%p", &t, __loc_);
47204689 mb = mbstate_t();
47214690 const char* bb = buf;
4722 size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
4691 size_t j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, __loc_);
47234692 if (j == size_t(-1))
47244693 std::__throw_runtime_error("locale not supported");
47254694 wbe = wbuf + j;
47264695 __am_pm_[0].assign(wbuf, wbe);
47274696 t.tm_hour = 13;
4728 __locale::__strftime(buf, countof(buf), "%p", &t, __loc_);
4697 __locale::__strftime(buf, std::size(buf), "%p", &t, __loc_);
47294698 mb = mbstate_t();
47304699 bb = buf;
4731 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
4700 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, __loc_);
47324701 if (j == size_t(-1))
47334702 std::__throw_runtime_error("locale not supported");
47344703 wbe = wbuf + j;
......@@ -4957,7 +4926,7 @@ void __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, c
49574926 char fmt[] = {'%', __fmt, __mod, 0};
49584927 if (__mod != 0)
49594928 swap(fmt[1], fmt[2]);
4960 size_t n = __locale::__strftime(__nb, countof(__nb, __ne), fmt, __tm, __loc_);
4929 size_t n = __locale::__strftime(__nb, std::distance(__nb, __ne), fmt, __tm, __loc_);
49614930 __ne = __nb + n;
49624931}
49634932
......@@ -4968,7 +4937,7 @@ void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __
49684937 __do_put(__nar, __ne, __tm, __fmt, __mod);
49694938 mbstate_t mb = {0};
49704939 const char* __nb = __nar;
4971 size_t j = __locale::__mbsrtowcs(__wb, &__nb, countof(__wb, __we), &mb, __loc_);
4940 size_t j = __locale::__mbsrtowcs(__wb, &__nb, std::distance(__wb, __we), &mb, __loc_);
49724941 if (j == size_t(-1))
49734942 std::__throw_runtime_error("locale not supported");
49744943 __we = __wb + j;
......@@ -5443,7 +5412,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
54435412 wchar_t wbuf[100];
54445413 mbstate_t mb = {0};
54455414 const char* bb = lc->currency_symbol;
5446 size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
5415 size_t j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, loc.get());
54475416 if (j == size_t(-1))
54485417 std::__throw_runtime_error("locale not supported");
54495418 wchar_t* wbe = wbuf + j;
......@@ -5457,7 +5426,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
54575426 else {
54585427 mb = mbstate_t();
54595428 bb = lc->positive_sign;
5460 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
5429 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, loc.get());
54615430 if (j == size_t(-1))
54625431 std::__throw_runtime_error("locale not supported");
54635432 wbe = wbuf + j;
......@@ -5468,7 +5437,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
54685437 else {
54695438 mb = mbstate_t();
54705439 bb = lc->negative_sign;
5471 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
5440 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, loc.get());
54725441 if (j == size_t(-1))
54735442 std::__throw_runtime_error("locale not supported");
54745443 wbe = wbuf + j;
......@@ -5498,7 +5467,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
54985467 wchar_t wbuf[100];
54995468 mbstate_t mb = {0};
55005469 const char* bb = lc->int_curr_symbol;
5501 size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
5470 size_t j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, loc.get());
55025471 if (j == size_t(-1))
55035472 std::__throw_runtime_error("locale not supported");
55045473 wchar_t* wbe = wbuf + j;
......@@ -5516,7 +5485,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
55165485 else {
55175486 mb = mbstate_t();
55185487 bb = lc->positive_sign;
5519 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
5488 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, loc.get());
55205489 if (j == size_t(-1))
55215490 std::__throw_runtime_error("locale not supported");
55225491 wbe = wbuf + j;
......@@ -5531,7 +5500,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
55315500 else {
55325501 mb = mbstate_t();
55335502 bb = lc->negative_sign;
5534 j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
5503 j = __locale::__mbsrtowcs(wbuf, &bb, std::size(wbuf), &mb, loc.get());
55355504 if (j == size_t(-1))
55365505 std::__throw_runtime_error("locale not supported");
55375506 wbe = wbuf + j;
......@@ -5571,6 +5540,54 @@ string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _C
55715540 return __np.grouping();
55725541}
55735542
5543template <class _CharT>
5544int __num_get<_CharT>::__stage2_int_loop(
5545 _CharT __ct,
5546 int __base,
5547 char* __a,
5548 char*& __a_end,
5549 unsigned& __dc,
5550 _CharT __thousands_sep,
5551 const string& __grouping,
5552 unsigned* __g,
5553 unsigned*& __g_end,
5554 _CharT* __atoms) {
5555 if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) {
5556 *__a_end++ = __ct == __atoms[24] ? '+' : '-';
5557 __dc = 0;
5558 return 0;
5559 }
5560 if (__grouping.size() != 0 && __ct == __thousands_sep) {
5561 if (__g_end - __g < __num_get_buf_sz) {
5562 *__g_end++ = __dc;
5563 __dc = 0;
5564 }
5565 return 0;
5566 }
5567 ptrdiff_t __f = __atoms_offset(__atoms, __ct);
5568 if (__f >= 24)
5569 return -1;
5570 switch (__base) {
5571 case 8:
5572 case 10:
5573 if (__f >= __base)
5574 return -1;
5575 break;
5576 case 16:
5577 if (__f < 22)
5578 break;
5579 if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0') {
5580 __dc = 0;
5581 *__a_end++ = __src[__f];
5582 return 0;
5583 }
5584 return -1;
5585 }
5586 *__a_end++ = __src[__f];
5587 ++__dc;
5588 return 0;
5589}
5590
55745591template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<char>;
55755592_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<wchar_t>;)
55765593
lib/libcxx/src/memory.cpp+12-14
......@@ -7,7 +7,8 @@
77//===----------------------------------------------------------------------===//
88
99#include <__config>
10#ifdef _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
10#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && !defined(_LIBCPP_OBJECT_FORMAT_XCOFF) && \
11 _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 5
1112# define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
1213#endif
1314
......@@ -132,19 +133,16 @@ __sp_mut& __get_sp_mut(const void* p) {
132133
133134#endif // _LIBCPP_HAS_THREADS
134135
135void* align(size_t alignment, size_t size, void*& ptr, size_t& space) {
136 void* r = nullptr;
137 if (size <= space) {
138 char* p1 = static_cast<char*>(ptr);
139 char* p2 = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 + (alignment - 1)) & -alignment);
140 size_t d = static_cast<size_t>(p2 - p1);
141 if (d <= space - size) {
142 r = p2;
143 ptr = r;
144 space -= d;
145 }
146 }
147 return r;
136#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 21
137
138_LIBCPP_DIAGNOSTIC_PUSH
139_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
140// This function only exists for ABI compatibility and we therefore don't provide a declaration in the headers
141_LIBCPP_EXPORTED_FROM_ABI void* align(size_t alignment, size_t size, void*& ptr, size_t& space) {
142 return __align_inline::align(alignment, size, ptr, space);
148143}
144_LIBCPP_DIAGNOSTIC_POP
145
146#endif
149147
150148_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/mutex_destructor.cpp+1-1
......@@ -19,7 +19,7 @@
1919#include <__config>
2020#include <__thread/support.h>
2121
22#if _LIBCPP_ABI_VERSION == 1 || !_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
22#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 9 || !_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
2323# define NEEDS_MUTEX_DESTRUCTOR
2424#endif
2525
lib/libcxx/src/new.cpp+5-5
......@@ -6,9 +6,9 @@
66//
77//===----------------------------------------------------------------------===//
88
9#include "include/aligned_alloc.h"
910#include "include/overridable_function.h"
1011#include <__assert>
11#include <__memory/aligned_alloc.h>
1212#include <cstddef>
1313#include <cstdlib>
1414#include <new>
......@@ -43,7 +43,7 @@ static void* operator_new_impl(std::size_t size) {
4343 return p;
4444}
4545
46_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new, (std::size_t size)) _THROW_BAD_ALLOC {
46OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
4747 void* p = operator_new_impl(size);
4848 if (p == nullptr)
4949 __throw_bad_alloc_shim();
......@@ -74,7 +74,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
7474# endif
7575}
7676
77_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size)) _THROW_BAD_ALLOC { return ::operator new(size); }
77OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
7878
7979_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
8080# if !_LIBCPP_HAS_EXCEPTIONS
......@@ -134,7 +134,7 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm
134134 return p;
135135}
136136
137_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new, (std::size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC {
137OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
138138 void* p = operator_new_aligned_impl(size, alignment);
139139 if (p == nullptr)
140140 __throw_bad_alloc_shim();
......@@ -165,7 +165,7 @@ _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const s
165165# endif
166166}
167167
168_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC {
168OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
169169 return ::operator new(size, alignment);
170170}
171171
lib/libcxx/src/optional.cpp+4
......@@ -19,6 +19,8 @@ const char* bad_optional_access::what() const noexcept { return "bad_optional_ac
1919
2020#include <__config>
2121
22#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 7
23
2224// Preserve std::experimental::bad_optional_access for ABI compatibility
2325// Even though it no longer exists in a header file
2426_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
......@@ -34,3 +36,5 @@ public:
3436bad_optional_access::~bad_optional_access() noexcept = default;
3537
3638_LIBCPP_END_NAMESPACE_EXPERIMENTAL
39
40#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 7
lib/libcxx/src/print.cpp+9-1
......@@ -22,6 +22,14 @@
2222# include <windows.h>
2323#elif __has_include(<unistd.h>)
2424# include <unistd.h>
25# if defined(_NEWLIB_VERSION)
26# if defined(_POSIX_C_SOURCE) && __has_include(<stdio.h>)
27# include <stdio.h>
28# define HAS_FILENO_AND_ISATTY
29# endif
30# else
31# define HAS_FILENO_AND_ISATTY
32# endif
2533#endif
2634
2735_LIBCPP_BEGIN_NAMESPACE_STD
......@@ -56,7 +64,7 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst
5664}
5765# endif // _LIBCPP_HAS_WIDE_CHARACTERS
5866
59#elif __has_include(<unistd.h>) // !_LIBCPP_WIN32API
67#elif defined(HAS_FILENO_AND_ISATTY) // !_LIBCPP_WIN32API
6068
6169_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); }
6270#endif
lib/libcxx/src/random.cpp-26
......@@ -31,8 +31,6 @@
3131# include <linux/random.h>
3232# include <sys/ioctl.h>
3333# endif
34#elif defined(_LIBCPP_USING_NACL_RANDOM)
35# include <nacl/nacl_random.h>
3634#elif defined(_LIBCPP_USING_FUCHSIA_CPRNG)
3735# include <zircon/syscalls.h>
3836#endif
......@@ -93,30 +91,6 @@ unsigned random_device::operator()() {
9391 return r;
9492}
9593
96#elif defined(_LIBCPP_USING_NACL_RANDOM)
97
98random_device::random_device(const string& __token) {
99 if (__token != "/dev/urandom")
100 std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
101 int error = nacl_secure_random_init();
102 if (error)
103 std::__throw_system_error(error, ("random device failed to open " + __token).c_str());
104}
105
106random_device::~random_device() {}
107
108unsigned random_device::operator()() {
109 unsigned r;
110 size_t n = sizeof(r);
111 size_t bytes_written;
112 int error = nacl_secure_random(&r, n, &bytes_written);
113 if (error != 0)
114 std::__throw_system_error(error, "random_device failed getting bytes");
115 else if (bytes_written != n)
116 std::__throw_runtime_error("random_device failed to obtain enough bytes");
117 return r;
118}
119
12094#elif defined(_LIBCPP_USING_WIN32_RANDOM)
12195
12296random_device::random_device(const string& __token) {
lib/libcxx/src/string.cpp+10-25
......@@ -20,7 +20,7 @@
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
2222
23#ifndef _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
23#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 14
2424
2525template <bool>
2626struct __basic_string_common;
......@@ -35,45 +35,30 @@ struct __basic_string_common<true> {
3535void __basic_string_common<true>::__throw_length_error() const { std::__throw_length_error("basic_string"); }
3636void __basic_string_common<true>::__throw_out_of_range() const { std::__throw_out_of_range("basic_string"); }
3737
38#endif // _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
38#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 14
3939
4040// Define legacy ABI functions
4141// ---------------------------
4242
43#ifndef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
43#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 21
4444
45// This initializes the string with [__s, __s + __sz), but capacity() == __reserve. Assumes that __reserve >= __sz.
4546template <class _CharT, class _Traits, class _Allocator>
4647void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) {
47 if (__libcpp_is_constant_evaluated())
48 __rep_ = __rep();
49 if (__reserve > max_size())
50 __throw_length_error();
51 pointer __p;
52 if (__fits_in_sso(__reserve)) {
53 __set_short_size(__sz);
54 __p = __get_short_pointer();
55 } else {
56 auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__reserve) + 1);
57 __p = __allocation.ptr;
58 __begin_lifetime(__p, __allocation.count);
59 __set_long_pointer(__p);
60 __set_long_cap(__allocation.count);
61 __set_long_size(__sz);
62 }
48 pointer __p = __init_internal_buffer(__reserve);
49 __annotate_delete();
50 __set_size(__sz);
6351 traits_type::copy(std::__to_address(__p), __s, __sz);
6452 traits_type::assign(__p[__sz], value_type());
6553 __annotate_new(__sz);
6654}
6755
68# define STRING_LEGACY_API(CharT) \
69 template _LIBCPP_EXPORTED_FROM_ABI void basic_string<CharT>::__init(const value_type*, size_type, size_type)
70
71STRING_LEGACY_API(char);
56template _LIBCPP_EXPORTED_FROM_ABI void basic_string<char>::__init(const value_type*, size_type, size_type);
7257# if _LIBCPP_HAS_WIDE_CHARACTERS
73STRING_LEGACY_API(wchar_t);
58template _LIBCPP_EXPORTED_FROM_ABI void basic_string<wchar_t>::__init(const value_type*, size_type, size_type);
7459# endif
7560
76#endif // _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
61#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 21
7762
7863#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template _LIBCPP_EXPORTED_FROM_ABI __VA_ARGS__;
7964#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
lib/libcxx/src/support/runtime/exception_fallback.ipp+2
......@@ -8,6 +8,8 @@
88//===----------------------------------------------------------------------===//
99
1010#include <__verbose_abort>
11#include <exception>
12#include "include/atomic_support.h"
1113
1214namespace std {
1315
lib/libcxx/src/support/runtime/exception_glibcxx.ipp+3
......@@ -11,6 +11,9 @@
1111# error header can only be used when targeting libstdc++ or libsupc++
1212#endif
1313
14#include <exception>
15#include <new>
16
1417namespace std {
1518
1619bad_alloc::bad_alloc() noexcept {}
lib/libcxx/src/support/runtime/exception_libcxxabi.ipp+6-2
......@@ -7,6 +7,10 @@
77//
88//===----------------------------------------------------------------------===//
99
10#include <exception>
11
12#include <cxxabi.h>
13
1014#ifndef _LIBCPPABI_VERSION
1115# error this header can only be used with libc++abi
1216#endif
......@@ -17,9 +21,9 @@ bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
1721
1822int uncaught_exceptions() noexcept {
1923#if _LIBCPPABI_VERSION > 1001
20 return __cxa_uncaught_exceptions();
24 return abi::__cxa_uncaught_exceptions();
2125#else
22 return __cxa_uncaught_exception() ? 1 : 0;
26 return abi::__cxa_uncaught_exception() ? 1 : 0;
2327#endif
2428}
2529
lib/libcxx/src/support/runtime/exception_libcxxrt.ipp+2
......@@ -11,6 +11,8 @@
1111# error this header may only be used when targeting libcxxrt
1212#endif
1313
14#include <exception>
15
1416namespace std {
1517
1618bad_exception::~bad_exception() noexcept {}
lib/libcxx/src/support/runtime/exception_msvc.ipp+2
......@@ -12,6 +12,8 @@
1212#endif
1313
1414#include <__verbose_abort>
15#include <exception>
16#include <new>
1517
1618extern "C" {
1719typedef void(__cdecl* terminate_handler)();
lib/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp+9-10
......@@ -7,22 +7,21 @@
77//
88//===----------------------------------------------------------------------===//
99
10#ifndef HAVE_DEPENDENT_EH_ABI
11# error this header may only be used with libc++abi or libcxxrt
12#endif
10#include <cxxabi.h>
11#include <exception>
1312
1413namespace std {
1514
16exception_ptr::~exception_ptr() noexcept { __cxa_decrement_exception_refcount(__ptr_); }
15exception_ptr::~exception_ptr() noexcept { abi::__cxa_decrement_exception_refcount(__ptr_); }
1716
1817exception_ptr::exception_ptr(const exception_ptr& other) noexcept : __ptr_(other.__ptr_) {
19 __cxa_increment_exception_refcount(__ptr_);
18 abi::__cxa_increment_exception_refcount(__ptr_);
2019}
2120
2221exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
2322 if (__ptr_ != other.__ptr_) {
24 __cxa_increment_exception_refcount(other.__ptr_);
25 __cxa_decrement_exception_refcount(__ptr_);
23 abi::__cxa_increment_exception_refcount(other.__ptr_);
24 abi::__cxa_decrement_exception_refcount(__ptr_);
2625 __ptr_ = other.__ptr_;
2726 }
2827 return *this;
......@@ -31,7 +30,7 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
3130exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept {
3231 exception_ptr ptr;
3332 ptr.__ptr_ = __e;
34 __cxa_increment_exception_refcount(ptr.__ptr_);
33 abi::__cxa_increment_exception_refcount(ptr.__ptr_);
3534
3635 return ptr;
3736}
......@@ -51,12 +50,12 @@ exception_ptr current_exception() noexcept {
5150 // this whole function would be just:
5251 // return exception_ptr(__cxa_current_primary_exception());
5352 exception_ptr ptr;
54 ptr.__ptr_ = __cxa_current_primary_exception();
53 ptr.__ptr_ = abi::__cxa_current_primary_exception();
5554 return ptr;
5655}
5756
5857void rethrow_exception(exception_ptr p) {
59 __cxa_rethrow_primary_exception(p.__ptr_);
58 abi::__cxa_rethrow_primary_exception(p.__ptr_);
6059 // if p.__ptr_ is NULL, above returns so we terminate
6160 terminate();
6261}
lib/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp+2
......@@ -16,6 +16,8 @@
1616// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
1717// function.
1818
19#include <exception>
20
1921namespace std {
2022
2123namespace __exception_ptr {
lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp+1
......@@ -7,6 +7,7 @@
77//
88//===----------------------------------------------------------------------===//
99
10#include <exception>
1011#include <stdio.h>
1112#include <stdlib.h>
1213
lib/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp+1
......@@ -8,6 +8,7 @@
88//===----------------------------------------------------------------------===//
99
1010#include <__verbose_abort>
11#include <exception>
1112
1213namespace std {
1314
lib/libcxx/src/support/win32/locale_win32.cpp+1-1
......@@ -144,7 +144,7 @@ int __snprintf(char* ret, size_t n, __locale_t loc, const char* format, ...) {
144144// Like sprintf, but when return value >= 0 it returns
145145// a pointer to a malloc'd string in *sptr.
146146// If return >= 0, use free to delete *sptr.
147int __libcpp_vasprintf(char** sptr, const char* __restrict format, va_list ap) {
147static int __libcpp_vasprintf(char** sptr, const char* __restrict format, va_list ap) {
148148 *sptr = nullptr;
149149 // Query the count required.
150150 va_list ap_copy;
lib/libcxx/src/system_error.cpp+2
......@@ -95,6 +95,8 @@ std::optional<errc> __win_err_to_errc(int err) {
9595 return errc::no_lock_available;
9696 case ERROR_NEGATIVE_SEEK:
9797 return errc::invalid_argument;
98 case ERROR_NETNAME_DELETED:
99 return errc::no_such_file_or_directory;
98100 case ERROR_NOACCESS:
99101 return errc::permission_denied;
100102 case ERROR_NOT_ENOUGH_MEMORY:
lib/libcxx/src/thread.cpp+1-3
......@@ -74,9 +74,7 @@ unsigned thread::hardware_concurrency() noexcept {
7474 return 0;
7575 return static_cast<unsigned>(result);
7676#elif defined(_LIBCPP_WIN32API)
77 SYSTEM_INFO info;
78 GetSystemInfo(&info);
79 return info.dwNumberOfProcessors;
77 return static_cast<unsigned>(GetActiveProcessorCount(ALL_PROCESSOR_GROUPS));
8078#else // defined(CTL_HW) && defined(HW_NCPU)
8179 // TODO: grovel through /proc or check cpuid on x86 and similar
8280 // instructions on other architectures.
lib/libcxx/src/valarray.cpp+1-2
......@@ -10,8 +10,7 @@
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
1212
13// These two symbols are part of the v1 ABI but not part of the >=v2 ABI.
14#if _LIBCPP_ABI_VERSION == 1
13#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 9
1514template _LIBCPP_EXPORTED_FROM_ABI valarray<size_t>::valarray(size_t);
1615template _LIBCPP_EXPORTED_FROM_ABI valarray<size_t>::~valarray();
1716#endif
lib/libcxx/src/vector.cpp+2-2
......@@ -10,7 +10,7 @@
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
1212
13#ifndef _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
13#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
1414
1515template <bool>
1616struct __vector_base_common;
......@@ -25,6 +25,6 @@ void __vector_base_common<true>::__throw_length_error() const { std::__throw_len
2525
2626void __vector_base_common<true>::__throw_out_of_range() const { std::__throw_out_of_range("vector"); }
2727
28#endif // _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
28#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
2929
3030_LIBCPP_END_NAMESPACE_STD
lib/libcxxabi/include/__cxxabi_config.h+42-23
......@@ -14,10 +14,6 @@
1414#define _LIBCXXABI_ARM_EHABI
1515#endif
1616
17#if !defined(__has_attribute)
18#define __has_attribute(_attribute_) 0
19#endif
20
2117#if defined(__clang__)
2218# define _LIBCXXABI_COMPILER_CLANG
2319# ifndef __apple_build_version__
......@@ -25,10 +21,6 @@
2521# endif
2622#elif defined(__GNUC__)
2723# define _LIBCXXABI_COMPILER_GCC
28#elif defined(_MSC_VER)
29# define _LIBCXXABI_COMPILER_MSVC
30#elif defined(__IBMCPP__)
31# define _LIBCXXABI_COMPILER_IBM
3224#endif
3325
3426#if defined(_WIN32)
......@@ -66,17 +58,7 @@
6658 #endif
6759#endif
6860
69#if defined(_LIBCXXABI_COMPILER_MSVC)
70#define _LIBCXXABI_WEAK
71#else
7261#define _LIBCXXABI_WEAK __attribute__((__weak__))
73#endif
74
75#if defined(__clang__)
76#define _LIBCXXABI_COMPILER_CLANG
77#elif defined(__GNUC__)
78#define _LIBCXXABI_COMPILER_GCC
79#endif
8062
8163#if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG)
8264#define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi")))
......@@ -89,11 +71,7 @@
8971# define _LIBCXXABI_GUARD_ABI_ARM
9072#endif
9173
92#if defined(_LIBCXXABI_COMPILER_CLANG)
93# if !__has_feature(cxx_exceptions)
94# define _LIBCXXABI_NO_EXCEPTIONS
95# endif
96#elif defined(_LIBCXXABI_COMPILER_GCC) && !defined(__EXCEPTIONS)
74#if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
9775# define _LIBCXXABI_NO_EXCEPTIONS
9876#endif
9977
......@@ -103,6 +81,47 @@
10381#define _LIBCXXABI_DTOR_FUNC
10482#endif
10583
84#if __has_include(<ptrauth.h>)
85# include <ptrauth.h>
86#endif
87
88#if __has_feature(ptrauth_calls)
89
90// ptrauth_string_discriminator("__cxa_exception::actionRecord") == 0xFC91
91# define __ptrauth_cxxabi_action_record __ptrauth(ptrauth_key_process_dependent_data, 1, 0xFC91)
92
93// ptrauth_string_discriminator("__cxa_exception::languageSpecificData") == 0xE8EE
94# define __ptrauth_cxxabi_lsd __ptrauth(ptrauth_key_process_dependent_data, 1, 0xE8EE)
95
96// ptrauth_string_discriminator("__cxa_exception::catchTemp") == 0xFA58
97# define __ptrauth_cxxabi_catch_temp_disc 0xFA58
98# define __ptrauth_cxxabi_catch_temp_key ptrauth_key_process_dependent_data
99# define __ptrauth_cxxabi_catch_temp __ptrauth(__ptrauth_cxxabi_catch_temp_key, 1, __ptrauth_cxxabi_catch_temp_disc)
100
101// ptrauth_string_discriminator("__cxa_exception::adjustedPtr") == 0x99E4
102# define __ptrauth_cxxabi_adjusted_ptr __ptrauth(ptrauth_key_process_dependent_data, 1, 0x99E4)
103
104// ptrauth_string_discriminator("__cxa_exception::unexpectedHandler") == 0x99A9
105# define __ptrauth_cxxabi_unexpected_handler __ptrauth(ptrauth_key_function_pointer, 1, 0x99A9)
106
107// ptrauth_string_discriminator("__cxa_exception::terminateHandler") == 0x0886)
108# define __ptrauth_cxxabi_terminate_handler __ptrauth(ptrauth_key_function_pointer, 1, 0x886)
109
110// ptrauth_string_discriminator("__cxa_exception::exceptionDestructor") == 0xC088
111# define __ptrauth_cxxabi_exception_destructor __ptrauth(ptrauth_key_function_pointer, 1, 0xC088)
112
113#else
114
115# define __ptrauth_cxxabi_action_record
116# define __ptrauth_cxxabi_lsd
117# define __ptrauth_cxxabi_catch_temp
118# define __ptrauth_cxxabi_adjusted_ptr
119# define __ptrauth_cxxabi_unexpected_handler
120# define __ptrauth_cxxabi_terminate_handler
121# define __ptrauth_cxxabi_exception_destructor
122
123#endif
124
106125#if __cplusplus < 201103L
107126# define _LIBCXXABI_NOEXCEPT throw()
108127#else
lib/libcxxabi/src/cxa_exception.cpp+4-2
......@@ -192,7 +192,9 @@ void *__cxa_allocate_exception(size_t thrown_size) throw() {
192192 std::terminate();
193193 __cxa_exception *exception_header =
194194 static_cast<__cxa_exception *>((void *)(raw_buffer + header_offset));
195 ::memset(exception_header, 0, actual_size);
195 // We warn on memset to a non-trivially castable type. We might want to
196 // change that diagnostic to not fire on a trivially obvious zero fill.
197 ::memset(static_cast<void*>(exception_header), 0, actual_size);
196198 return thrown_object_from_cxa_exception(exception_header);
197199}
198200
......@@ -226,7 +228,7 @@ __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinf
226228}
227229
228230// This function shall allocate a __cxa_dependent_exception and
229// return a pointer to it. (Really to the object, not past its' end).
231// return a pointer to it. (Really to the object, not past its end).
230232// Otherwise, it will work like __cxa_allocate_exception.
231233void * __cxa_allocate_dependent_exception () {
232234 size_t actual_size = sizeof(__cxa_dependent_exception);
lib/libcxxabi/src/cxa_exception.h+16-14
......@@ -47,10 +47,10 @@ struct _LIBCXXABI_HIDDEN __cxa_exception {
4747 // In Wasm, a destructor returns its argument
4848 void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
4949#else
50 void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
50 void (_LIBCXXABI_DTOR_FUNC *__ptrauth_cxxabi_exception_destructor exceptionDestructor)(void *);
5151#endif
52 std::unexpected_handler unexpectedHandler;
53 std::terminate_handler terminateHandler;
52 std::unexpected_handler __ptrauth_cxxabi_unexpected_handler unexpectedHandler;
53 std::terminate_handler __ptrauth_cxxabi_terminate_handler terminateHandler;
5454
5555 __cxa_exception *nextException;
5656
......@@ -61,10 +61,10 @@ struct _LIBCXXABI_HIDDEN __cxa_exception {
6161 int propagationCount;
6262#else
6363 int handlerSwitchValue;
64 const unsigned char *actionRecord;
65 const unsigned char *languageSpecificData;
66 void *catchTemp;
67 void *adjustedPtr;
64 const unsigned char *__ptrauth_cxxabi_action_record actionRecord;
65 const unsigned char *__ptrauth_cxxabi_lsd languageSpecificData;
66 void *__ptrauth_cxxabi_catch_temp catchTemp;
67 void *__ptrauth_cxxabi_adjusted_ptr adjustedPtr;
6868#endif
6969
7070#if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI)
......@@ -79,6 +79,8 @@ struct _LIBCXXABI_HIDDEN __cxa_exception {
7979// http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html
8080// The layout of this structure MUST match the layout of __cxa_exception, with
8181// primaryException instead of referenceCount.
82// The pointer authentication schemas specified here must also match those of
83// the corresponding members in __cxa_exception.
8284struct _LIBCXXABI_HIDDEN __cxa_dependent_exception {
8385#if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI)
8486 void* reserve; // padding.
......@@ -86,9 +88,9 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception {
8688#endif
8789
8890 std::type_info *exceptionType;
89 void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
90 std::unexpected_handler unexpectedHandler;
91 std::terminate_handler terminateHandler;
91 void (_LIBCXXABI_DTOR_FUNC *__ptrauth_cxxabi_exception_destructor exceptionDestructor)(void *);
92 std::unexpected_handler __ptrauth_cxxabi_unexpected_handler unexpectedHandler;
93 std::terminate_handler __ptrauth_cxxabi_terminate_handler terminateHandler;
9294
9395 __cxa_exception *nextException;
9496
......@@ -99,10 +101,10 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception {
99101 int propagationCount;
100102#else
101103 int handlerSwitchValue;
102 const unsigned char *actionRecord;
103 const unsigned char *languageSpecificData;
104 void * catchTemp;
105 void *adjustedPtr;
104 const unsigned char *__ptrauth_cxxabi_action_record actionRecord;
105 const unsigned char *__ptrauth_cxxabi_lsd languageSpecificData;
106 void *__ptrauth_cxxabi_catch_temp catchTemp;
107 void *__ptrauth_cxxabi_adjusted_ptr adjustedPtr;
106108#endif
107109
108110#if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI)
lib/libcxxabi/src/cxa_personality.cpp+125-12
......@@ -20,7 +20,52 @@
2020#include "cxa_exception.h"
2121#include "cxa_handlers.h"
2222#include "private_typeinfo.h"
23#include "unwind.h"
23
24#if __has_feature(ptrauth_calls)
25
26// CXXABI depends on defintions in libunwind as pointer auth couples the
27// definitions
28# include "libunwind.h"
29
30// The actual value of the discriminators listed below is not important.
31// The derivation of the constants is only being included for the purpose
32// of maintaining a record of how they were originally produced.
33
34// ptrauth_string_discriminator("scan_results::languageSpecificData") == 0xE50D)
35# define __ptrauth_scan_results_lsd __ptrauth(ptrauth_key_process_dependent_code, 1, 0xE50D)
36
37// ptrauth_string_discriminator("scan_results::actionRecord") == 0x9823
38# define __ptrauth_scan_results_action_record __ptrauth(ptrauth_key_process_dependent_code, 1, 0x9823)
39
40// scan result is broken up as we have a manual re-sign that requires each component
41# define __ptrauth_scan_results_landingpad_key ptrauth_key_process_dependent_code
42// ptrauth_string_discriminator("scan_results::landingPad") == 0xD27C
43# define __ptrauth_scan_results_landingpad_disc 0xD27C
44# define __ptrauth_scan_results_landingpad \
45 __ptrauth(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc)
46
47// `__ptrauth_restricted_intptr` is a feature of apple clang that predates
48// support for direct application of `__ptrauth` to integer types. This
49// guard is necessary to support compilation with those compiler.
50# if __has_extension(ptrauth_restricted_intptr_qualifier)
51# define __ptrauth_scan_results_landingpad_intptr \
52 __ptrauth_restricted_intptr(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc)
53# else
54# define __ptrauth_scan_results_landingpad_intptr \
55 __ptrauth(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc)
56# endif
57
58#else
59# define __ptrauth_scan_results_lsd
60# define __ptrauth_scan_results_action_record
61# define __ptrauth_scan_results_landingpad
62# define __ptrauth_scan_results_landingpad_intptr
63#endif
64
65// The functions defined in this file are magic functions called only by the compiler.
66#ifdef __clang__
67# pragma clang diagnostic ignored "-Wmissing-prototypes"
68#endif
2469
2570// TODO: This is a temporary workaround for libc++abi to recognize that it's being
2671// built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION
......@@ -527,12 +572,17 @@ get_thrown_object_ptr(_Unwind_Exception* unwind_exception)
527572namespace
528573{
529574
575typedef const uint8_t *__ptrauth_scan_results_lsd lsd_ptr_t;
576typedef const uint8_t *__ptrauth_scan_results_action_record action_ptr_t;
577typedef uintptr_t __ptrauth_scan_results_landingpad_intptr landing_pad_t;
578typedef void *__ptrauth_scan_results_landingpad landing_pad_ptr_t;
579
530580struct scan_results
531581{
532582 int64_t ttypeIndex; // > 0 catch handler, < 0 exception spec handler, == 0 a cleanup
533 const uint8_t* actionRecord; // Currently unused. Retained to ease future maintenance.
534 const uint8_t* languageSpecificData; // Needed only for __cxa_call_unexpected
535 uintptr_t landingPad; // null -> nothing found, else something found
583 action_ptr_t actionRecord; // Currently unused. Retained to ease future maintenance.
584 lsd_ptr_t languageSpecificData; // Needed only for __cxa_call_unexpected
585 landing_pad_t landingPad; // null -> nothing found, else something found
536586 void* adjustedPtr; // Used in cxa_exception.cpp
537587 _Unwind_Reason_Code reason; // One of _URC_FATAL_PHASE1_ERROR,
538588 // _URC_FATAL_PHASE2_ERROR,
......@@ -557,7 +607,23 @@ set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context,
557607 reinterpret_cast<uintptr_t>(unwind_exception));
558608 _Unwind_SetGR(context, __builtin_eh_return_data_regno(1),
559609 static_cast<uintptr_t>(results.ttypeIndex));
610#if __has_feature(ptrauth_calls)
611 auto stackPointer = _Unwind_GetGR(context, UNW_REG_SP);
612 // We manually re-sign the IP as the __ptrauth qualifiers cannot
613 // express the required relationship with the destination address
614 const auto existingDiscriminator =
615 ptrauth_blend_discriminator(&results.landingPad,
616 __ptrauth_scan_results_landingpad_disc);
617 unw_word_t newIP /* opaque __ptrauth(ptrauth_key_return_address, stackPointer, 0) */ =
618 (unw_word_t)ptrauth_auth_and_resign(*(void* const*)&results.landingPad,
619 __ptrauth_scan_results_landingpad_key,
620 existingDiscriminator,
621 ptrauth_key_return_address,
622 stackPointer);
623 _Unwind_SetIP(context, newIP);
624#else
560625 _Unwind_SetIP(context, results.landingPad);
626#endif
561627}
562628
563629/*
......@@ -691,12 +757,12 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
691757 // The call sites are ordered in increasing value of start
692758 uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding);
693759 uintptr_t length = readEncodedPointer(&callSitePtr, callSiteEncoding);
694 uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
760 landing_pad_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
695761 uintptr_t actionEntry = readULEB128(&callSitePtr);
696762 if ((start <= ipOffset) && (ipOffset < (start + length)))
697763#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
698764 // ip is 1-based index into this table
699 uintptr_t landingPad = readULEB128(&callSitePtr);
765 landing_pad_t landingPad = readULEB128(&callSitePtr);
700766 uintptr_t actionEntry = readULEB128(&callSitePtr);
701767 if (--ip == 0)
702768#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
......@@ -903,6 +969,57 @@ _UA_CLEANUP_PHASE
903969*/
904970
905971#if !defined(_LIBCXXABI_ARM_EHABI)
972
973// We use these helper functions to work around the behavior of casting between
974// integers (even those that are authenticated) and authenticated pointers.
975// Because the schemas being used are address discriminated we cannot use a
976// trivial value union to coerce the types so instead we perform the re-signing
977// manually.
978using __cxa_catch_temp_type = decltype(__cxa_exception::catchTemp);
979static inline void set_landing_pad(scan_results& results,
980 const __cxa_catch_temp_type& source) {
981#if __has_feature(ptrauth_calls)
982 const uintptr_t sourceDiscriminator =
983 ptrauth_blend_discriminator(&source, __ptrauth_cxxabi_catch_temp_disc);
984 const uintptr_t targetDiscriminator =
985 ptrauth_blend_discriminator(&results.landingPad,
986 __ptrauth_scan_results_landingpad_disc);
987 uintptr_t reauthenticatedLandingPad =
988 (uintptr_t)ptrauth_auth_and_resign(*reinterpret_cast<void* const*>(&source),
989 __ptrauth_cxxabi_catch_temp_key,
990 sourceDiscriminator,
991 __ptrauth_scan_results_landingpad_key,
992 targetDiscriminator);
993 memmove(reinterpret_cast<void *>(&results.landingPad),
994 reinterpret_cast<void *>(&reauthenticatedLandingPad),
995 sizeof(reauthenticatedLandingPad));
996#else
997 results.landingPad = reinterpret_cast<landing_pad_t>(source);
998#endif
999}
1000
1001static inline void get_landing_pad(__cxa_catch_temp_type &dest,
1002 const scan_results &results) {
1003#if __has_feature(ptrauth_calls)
1004 const uintptr_t sourceDiscriminator =
1005 ptrauth_blend_discriminator(&results.landingPad,
1006 __ptrauth_scan_results_landingpad_disc);
1007 const uintptr_t targetDiscriminator =
1008 ptrauth_blend_discriminator(&dest, __ptrauth_cxxabi_catch_temp_disc);
1009 uintptr_t reauthenticatedPointer =
1010 (uintptr_t)ptrauth_auth_and_resign(*reinterpret_cast<void* const*>(&results.landingPad),
1011 __ptrauth_scan_results_landingpad_key,
1012 sourceDiscriminator,
1013 __ptrauth_cxxabi_catch_temp_key,
1014 targetDiscriminator);
1015 memmove(reinterpret_cast<void *>(&dest),
1016 reinterpret_cast<void *>(&reauthenticatedPointer),
1017 sizeof(reauthenticatedPointer));
1018#else
1019 dest = reinterpret_cast<__cxa_catch_temp_type>(results.landingPad);
1020#endif
1021}
1022
9061023#ifdef __WASM_EXCEPTIONS__
9071024_Unwind_Reason_Code __gxx_personality_wasm0
9081025#elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
......@@ -935,8 +1052,7 @@ __gxx_personality_v0
9351052 results.ttypeIndex = exception_header->handlerSwitchValue;
9361053 results.actionRecord = exception_header->actionRecord;
9371054 results.languageSpecificData = exception_header->languageSpecificData;
938 results.landingPad =
939 reinterpret_cast<uintptr_t>(exception_header->catchTemp);
1055 set_landing_pad(results, exception_header->catchTemp);
9401056 results.adjustedPtr = exception_header->adjustedPtr;
9411057
9421058 // Jump to the handler.
......@@ -970,7 +1086,7 @@ __gxx_personality_v0
9701086 exc->handlerSwitchValue = static_cast<int>(results.ttypeIndex);
9711087 exc->actionRecord = results.actionRecord;
9721088 exc->languageSpecificData = results.languageSpecificData;
973 exc->catchTemp = reinterpret_cast<void*>(results.landingPad);
1089 get_landing_pad(exc->catchTemp, results);
9741090 exc->adjustedPtr = results.adjustedPtr;
9751091#ifdef __WASM_EXCEPTIONS__
9761092 // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the
......@@ -1009,9 +1125,6 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
10091125
10101126#else
10111127
1012extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*,
1013 _Unwind_Context*);
1014
10151128// Helper function to unwind one frame.
10161129// ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the
10171130// personality routine should update the virtual register set (VRS) according to the
lib/libcxxabi/src/cxa_thread_atexit.cpp+2-1
......@@ -106,6 +106,7 @@ namespace {
106106
107107#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
108108
109#if defined(__linux__) || defined(__Fuchsia__)
109110extern "C" {
110111
111112 _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() {
......@@ -140,6 +141,6 @@ extern "C" {
140141 }
141142#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
142143 }
143
144144} // extern "C"
145#endif // defined(__linux__) || defined(__Fuchsia__)
145146} // namespace __cxxabiv1
lib/libcxxabi/src/demangle/DemangleConfig.h+4
......@@ -115,4 +115,8 @@
115115#define DEMANGLE_NAMESPACE_BEGIN namespace { namespace itanium_demangle {
116116#define DEMANGLE_NAMESPACE_END } }
117117
118// The DEMANGLE_ABI macro resolves to nothing when building libc++abi. Only
119// the llvm copy defines DEMANGLE_ABI as a visibility attribute.
120#define DEMANGLE_ABI
121
118122#endif // LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H
lib/libcxxabi/src/demangle/ItaniumDemangle.h+9-6
......@@ -1366,7 +1366,7 @@ public:
13661366 template <typename Fn> void match(Fn F) const { F(Name, Params, Requires); }
13671367
13681368 void printLeft(OutputBuffer &OB) const override {
1369 ScopedOverride<unsigned> LT(OB.GtIsGt, 0);
1369 ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true);
13701370 OB += "template<";
13711371 Params.printWithComma(OB);
13721372 OB += "> typename ";
......@@ -1550,7 +1550,7 @@ public:
15501550 NodeArray getParams() { return Params; }
15511551
15521552 void printLeft(OutputBuffer &OB) const override {
1553 ScopedOverride<unsigned> LT(OB.GtIsGt, 0);
1553 ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true);
15541554 OB += "<";
15551555 Params.printWithComma(OB);
15561556 OB += ">";
......@@ -1824,7 +1824,7 @@ public:
18241824
18251825 void printDeclarator(OutputBuffer &OB) const {
18261826 if (!TemplateParams.empty()) {
1827 ScopedOverride<unsigned> LT(OB.GtIsGt, 0);
1827 ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true);
18281828 OB += "<";
18291829 TemplateParams.printWithComma(OB);
18301830 OB += ">";
......@@ -1885,7 +1885,9 @@ public:
18851885 }
18861886
18871887 void printLeft(OutputBuffer &OB) const override {
1888 bool ParenAll = OB.isGtInsideTemplateArgs() &&
1888 // If we're printing a '<' inside of a template argument, and we haven't
1889 // yet parenthesized the expression, do so now.
1890 bool ParenAll = !OB.isInParensInTemplateArgs() &&
18891891 (InfixOperator == ">" || InfixOperator == ">>");
18901892 if (ParenAll)
18911893 OB.printOpen();
......@@ -2061,7 +2063,7 @@ public:
20612063 void printLeft(OutputBuffer &OB) const override {
20622064 OB += CastKind;
20632065 {
2064 ScopedOverride<unsigned> LT(OB.GtIsGt, 0);
2066 ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true);
20652067 OB += "<";
20662068 OB.printLeft(*To);
20672069 OB += ">";
......@@ -3049,7 +3051,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
30493051 Node *parse(bool ParseParams = true);
30503052};
30513053
3052const char* parse_discriminator(const char* first, const char* last);
3054DEMANGLE_ABI const char *parse_discriminator(const char *first,
3055 const char *last);
30533056
30543057// <name> ::= <nested-name> // N
30553058// ::= <local-name> # See Scope Encoding below // Z
lib/libcxxabi/src/demangle/Utility.h+21-7
......@@ -81,7 +81,7 @@ public:
8181 OutputBuffer(const OutputBuffer &) = delete;
8282 OutputBuffer &operator=(const OutputBuffer &) = delete;
8383
84 virtual ~OutputBuffer() {}
84 virtual ~OutputBuffer() = default;
8585
8686 operator std::string_view() const {
8787 return std::string_view(Buffer, CurrentPosition);
......@@ -104,18 +104,32 @@ public:
104104 unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max();
105105 unsigned CurrentPackMax = std::numeric_limits<unsigned>::max();
106106
107 /// When zero, we're printing template args and '>' needs to be parenthesized.
108 /// Use a counter so we can simply increment inside parentheses.
109 unsigned GtIsGt = 1;
107 struct {
108 /// The depth of '(' and ')' inside the currently printed template
109 /// arguments.
110 unsigned ParenDepth = 0;
110111
111 bool isGtInsideTemplateArgs() const { return GtIsGt == 0; }
112 /// True if we're currently printing a template argument.
113 bool InsideTemplate = false;
114 } TemplateTracker;
115
116 /// Returns true if we're currently between a '(' and ')' when printing
117 /// template args.
118 bool isInParensInTemplateArgs() const {
119 return TemplateTracker.ParenDepth > 0;
120 }
121
122 /// Returns true if we're printing template args.
123 bool isInsideTemplateArgs() const { return TemplateTracker.InsideTemplate; }
112124
113125 void printOpen(char Open = '(') {
114 GtIsGt++;
126 if (isInsideTemplateArgs())
127 TemplateTracker.ParenDepth++;
115128 *this += Open;
116129 }
117130 void printClose(char Close = ')') {
118 GtIsGt--;
131 if (isInsideTemplateArgs())
132 TemplateTracker.ParenDepth--;
119133 *this += Close;
120134 }
121135
lib/libcxxabi/src/fallback_malloc.cpp+1-1
......@@ -16,7 +16,7 @@
1616#endif
1717#endif
1818
19#include <__memory/aligned_alloc.h>
19#include "include/aligned_alloc.h" // from libc++
2020#include <__assert>
2121#include <stdlib.h> // for malloc, calloc, free
2222#include <string.h> // for memset
lib/libcxxabi/src/private_typeinfo.cpp+6
......@@ -831,6 +831,10 @@ bool __pointer_to_member_type_info::can_catch_nested(
831831#pragma clang diagnostic ignored "-Wmissing-field-initializers"
832832#endif
833833
834#pragma GCC diagnostic push
835// __dynamic_cast is called by the compiler, so there is no prototype
836#pragma GCC diagnostic ignored "-Wmissing-prototypes"
837
834838// __dynamic_cast
835839
836840// static_ptr: pointer to an object of type static_type; nonnull, and since the
......@@ -953,6 +957,8 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type,
953957 return const_cast<void*>(dst_ptr);
954958}
955959
960#pragma GCC diagnostic pop
961
956962#ifdef __clang__
957963#pragma clang diagnostic pop
958964#endif
lib/libcxxabi/src/stdlib_new_delete.cpp+5-5
......@@ -8,8 +8,8 @@
88
99#include "__cxxabi_config.h"
1010#include "abort_message.h"
11#include "include/aligned_alloc.h" // from libc++
1112#include "include/overridable_function.h" // from libc++
12#include <__memory/aligned_alloc.h>
1313#include <cstddef>
1414#include <cstdlib>
1515#include <new>
......@@ -63,7 +63,7 @@ static void* operator_new_impl(std::size_t size) {
6363 return p;
6464}
6565
66_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new, (std::size_t size)) _THROW_BAD_ALLOC {
66OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
6767 void* p = operator_new_impl(size);
6868 if (p == nullptr)
6969 __throw_bad_alloc_shim();
......@@ -94,7 +94,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
9494#endif
9595}
9696
97_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size)) _THROW_BAD_ALLOC { return ::operator new(size); }
97OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
9898
9999_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
100100#if !_LIBCPP_HAS_EXCEPTIONS
......@@ -154,7 +154,7 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm
154154 return p;
155155}
156156
157_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new, (std::size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC {
157OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
158158 void* p = operator_new_aligned_impl(size, alignment);
159159 if (p == nullptr)
160160 __throw_bad_alloc_shim();
......@@ -185,7 +185,7 @@ _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const s
185185# endif
186186}
187187
188_LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC {
188OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
189189 return ::operator new(size, alignment);
190190}
191191
lib/libtsan/LICENSE.TXT created+311
......@@ -0,0 +1,311 @@
1==============================================================================
2The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
3==============================================================================
4
5 Apache License
6 Version 2.0, January 2004
7 http://www.apache.org/licenses/
8
9 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
11 1. Definitions.
12
13 "License" shall mean the terms and conditions for use, reproduction,
14 and distribution as defined by Sections 1 through 9 of this document.
15
16 "Licensor" shall mean the copyright owner or entity authorized by
17 the copyright owner that is granting the License.
18
19 "Legal Entity" shall mean the union of the acting entity and all
20 other entities that control, are controlled by, or are under common
21 control with that entity. For the purposes of this definition,
22 "control" means (i) the power, direct or indirect, to cause the
23 direction or management of such entity, whether by contract or
24 otherwise, or (ii) ownership of fifty percent (50%) or more of the
25 outstanding shares, or (iii) beneficial ownership of such entity.
26
27 "You" (or "Your") shall mean an individual or Legal Entity
28 exercising permissions granted by this License.
29
30 "Source" form shall mean the preferred form for making modifications,
31 including but not limited to software source code, documentation
32 source, and configuration files.
33
34 "Object" form shall mean any form resulting from mechanical
35 transformation or translation of a Source form, including but
36 not limited to compiled object code, generated documentation,
37 and conversions to other media types.
38
39 "Work" shall mean the work of authorship, whether in Source or
40 Object form, made available under the License, as indicated by a
41 copyright notice that is included in or attached to the work
42 (an example is provided in the Appendix below).
43
44 "Derivative Works" shall mean any work, whether in Source or Object
45 form, that is based on (or derived from) the Work and for which the
46 editorial revisions, annotations, elaborations, or other modifications
47 represent, as a whole, an original work of authorship. For the purposes
48 of this License, Derivative Works shall not include works that remain
49 separable from, or merely link (or bind by name) to the interfaces of,
50 the Work and Derivative Works thereof.
51
52 "Contribution" shall mean any work of authorship, including
53 the original version of the Work and any modifications or additions
54 to that Work or Derivative Works thereof, that is intentionally
55 submitted to Licensor for inclusion in the Work by the copyright owner
56 or by an individual or Legal Entity authorized to submit on behalf of
57 the copyright owner. For the purposes of this definition, "submitted"
58 means any form of electronic, verbal, or written communication sent
59 to the Licensor or its representatives, including but not limited to
60 communication on electronic mailing lists, source code control systems,
61 and issue tracking systems that are managed by, or on behalf of, the
62 Licensor for the purpose of discussing and improving the Work, but
63 excluding communication that is conspicuously marked or otherwise
64 designated in writing by the copyright owner as "Not a Contribution."
65
66 "Contributor" shall mean Licensor and any individual or Legal Entity
67 on behalf of whom a Contribution has been received by Licensor and
68 subsequently incorporated within the Work.
69
70 2. Grant of Copyright License. Subject to the terms and conditions of
71 this License, each Contributor hereby grants to You a perpetual,
72 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73 copyright license to reproduce, prepare Derivative Works of,
74 publicly display, publicly perform, sublicense, and distribute the
75 Work and such Derivative Works in Source or Object form.
76
77 3. Grant of Patent License. Subject to the terms and conditions of
78 this License, each Contributor hereby grants to You a perpetual,
79 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80 (except as stated in this section) patent license to make, have made,
81 use, offer to sell, sell, import, and otherwise transfer the Work,
82 where such license applies only to those patent claims licensable
83 by such Contributor that are necessarily infringed by their
84 Contribution(s) alone or by combination of their Contribution(s)
85 with the Work to which such Contribution(s) was submitted. If You
86 institute patent litigation against any entity (including a
87 cross-claim or counterclaim in a lawsuit) alleging that the Work
88 or a Contribution incorporated within the Work constitutes direct
89 or contributory patent infringement, then any patent licenses
90 granted to You under this License for that Work shall terminate
91 as of the date such litigation is filed.
92
93 4. Redistribution. You may reproduce and distribute copies of the
94 Work or Derivative Works thereof in any medium, with or without
95 modifications, and in Source or Object form, provided that You
96 meet the following conditions:
97
98 (a) You must give any other recipients of the Work or
99 Derivative Works a copy of this License; and
100
101 (b) You must cause any modified files to carry prominent notices
102 stating that You changed the files; and
103
104 (c) You must retain, in the Source form of any Derivative Works
105 that You distribute, all copyright, patent, trademark, and
106 attribution notices from the Source form of the Work,
107 excluding those notices that do not pertain to any part of
108 the Derivative Works; and
109
110 (d) If the Work includes a "NOTICE" text file as part of its
111 distribution, then any Derivative Works that You distribute must
112 include a readable copy of the attribution notices contained
113 within such NOTICE file, excluding those notices that do not
114 pertain to any part of the Derivative Works, in at least one
115 of the following places: within a NOTICE text file distributed
116 as part of the Derivative Works; within the Source form or
117 documentation, if provided along with the Derivative Works; or,
118 within a display generated by the Derivative Works, if and
119 wherever such third-party notices normally appear. The contents
120 of the NOTICE file are for informational purposes only and
121 do not modify the License. You may add Your own attribution
122 notices within Derivative Works that You distribute, alongside
123 or as an addendum to the NOTICE text from the Work, provided
124 that such additional attribution notices cannot be construed
125 as modifying the License.
126
127 You may add Your own copyright statement to Your modifications and
128 may provide additional or different license terms and conditions
129 for use, reproduction, or distribution of Your modifications, or
130 for any such Derivative Works as a whole, provided Your use,
131 reproduction, and distribution of the Work otherwise complies with
132 the conditions stated in this License.
133
134 5. Submission of Contributions. Unless You explicitly state otherwise,
135 any Contribution intentionally submitted for inclusion in the Work
136 by You to the Licensor shall be under the terms and conditions of
137 this License, without any additional terms or conditions.
138 Notwithstanding the above, nothing herein shall supersede or modify
139 the terms of any separate license agreement you may have executed
140 with Licensor regarding such Contributions.
141
142 6. Trademarks. This License does not grant permission to use the trade
143 names, trademarks, service marks, or product names of the Licensor,
144 except as required for reasonable and customary use in describing the
145 origin of the Work and reproducing the content of the NOTICE file.
146
147 7. Disclaimer of Warranty. Unless required by applicable law or
148 agreed to in writing, Licensor provides the Work (and each
149 Contributor provides its Contributions) on an "AS IS" BASIS,
150 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151 implied, including, without limitation, any warranties or conditions
152 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153 PARTICULAR PURPOSE. You are solely responsible for determining the
154 appropriateness of using or redistributing the Work and assume any
155 risks associated with Your exercise of permissions under this License.
156
157 8. Limitation of Liability. In no event and under no legal theory,
158 whether in tort (including negligence), contract, or otherwise,
159 unless required by applicable law (such as deliberate and grossly
160 negligent acts) or agreed to in writing, shall any Contributor be
161 liable to You for damages, including any direct, indirect, special,
162 incidental, or consequential damages of any character arising as a
163 result of this License or out of the use or inability to use the
164 Work (including but not limited to damages for loss of goodwill,
165 work stoppage, computer failure or malfunction, or any and all
166 other commercial damages or losses), even if such Contributor
167 has been advised of the possibility of such damages.
168
169 9. Accepting Warranty or Additional Liability. While redistributing
170 the Work or Derivative Works thereof, You may choose to offer,
171 and charge a fee for, acceptance of support, warranty, indemnity,
172 or other liability obligations and/or rights consistent with this
173 License. However, in accepting such obligations, You may act only
174 on Your own behalf and on Your sole responsibility, not on behalf
175 of any other Contributor, and only if You agree to indemnify,
176 defend, and hold each Contributor harmless for any liability
177 incurred by, or claims asserted against, such Contributor by reason
178 of your accepting any such warranty or additional liability.
179
180 END OF TERMS AND CONDITIONS
181
182 APPENDIX: How to apply the Apache License to your work.
183
184 To apply the Apache License to your work, attach the following
185 boilerplate notice, with the fields enclosed by brackets "[]"
186 replaced with your own identifying information. (Don't include
187 the brackets!) The text should be enclosed in the appropriate
188 comment syntax for the file format. We also recommend that a
189 file or class name and description of purpose be included on the
190 same "printed page" as the copyright notice for easier
191 identification within third-party archives.
192
193 Copyright [yyyy] [name of copyright owner]
194
195 Licensed under the Apache License, Version 2.0 (the "License");
196 you may not use this file except in compliance with the License.
197 You may obtain a copy of the License at
198
199 http://www.apache.org/licenses/LICENSE-2.0
200
201 Unless required by applicable law or agreed to in writing, software
202 distributed under the License is distributed on an "AS IS" BASIS,
203 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204 See the License for the specific language governing permissions and
205 limitations under the License.
206
207
208---- LLVM Exceptions to the Apache 2.0 License ----
209
210As an exception, if, as a result of your compiling your source code, portions
211of this Software are embedded into an Object form of such source code, you
212may redistribute such embedded portions in such Object form without complying
213with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
214
215In addition, if you combine or link compiled forms of this Software with
216software that is licensed under the GPLv2 ("Combined Software") and if a
217court of competent jurisdiction determines that the patent provision (Section
2183), the indemnity provision (Section 9) or other Section of the License
219conflicts with the conditions of the GPLv2, you may retroactively and
220prospectively choose to deem waived or otherwise exclude such Section(s) of
221the License, but only in their entirety and only with respect to the Combined
222Software.
223
224==============================================================================
225Software from third parties included in the LLVM Project:
226==============================================================================
227The LLVM Project contains third party software which is under different license
228terms. All such code will be identified clearly using at least one of two
229mechanisms:
2301) It will be in a separate directory tree with its own `LICENSE.txt` or
231 `LICENSE` file at the top containing the specific license and restrictions
232 which apply to that software, or
2332) It will contain specific license and restriction terms at the top of every
234 file.
235
236==============================================================================
237Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
238==============================================================================
239
240The compiler_rt library is dual licensed under both the University of Illinois
241"BSD-Like" license and the MIT license. As a user of this code you may choose
242to use it under either license. As a contributor, you agree to allow your code
243to be used under both.
244
245Full text of the relevant licenses is included below.
246
247==============================================================================
248
249University of Illinois/NCSA
250Open Source License
251
252Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT
253
254All rights reserved.
255
256Developed by:
257
258 LLVM Team
259
260 University of Illinois at Urbana-Champaign
261
262 http://llvm.org
263
264Permission is hereby granted, free of charge, to any person obtaining a copy of
265this software and associated documentation files (the "Software"), to deal with
266the Software without restriction, including without limitation the rights to
267use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
268of the Software, and to permit persons to whom the Software is furnished to do
269so, subject to the following conditions:
270
271 * Redistributions of source code must retain the above copyright notice,
272 this list of conditions and the following disclaimers.
273
274 * Redistributions in binary form must reproduce the above copyright notice,
275 this list of conditions and the following disclaimers in the
276 documentation and/or other materials provided with the distribution.
277
278 * Neither the names of the LLVM Team, University of Illinois at
279 Urbana-Champaign, nor the names of its contributors may be used to
280 endorse or promote products derived from this Software without specific
281 prior written permission.
282
283THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
284IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
285FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
286CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
287LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
288OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
289SOFTWARE.
290
291==============================================================================
292
293Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
294
295Permission is hereby granted, free of charge, to any person obtaining a copy
296of this software and associated documentation files (the "Software"), to deal
297in the Software without restriction, including without limitation the rights
298to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
299copies of the Software, and to permit persons to whom the Software is
300furnished to do so, subject to the following conditions:
301
302The above copyright notice and this permission notice shall be included in
303all copies or substantial portions of the Software.
304
305THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
306IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
307FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
308AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
309LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
310OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
311THE SOFTWARE.
lib/libtsan/builtins/assembly.h+41-8
......@@ -14,7 +14,7 @@
1414#ifndef COMPILERRT_ASSEMBLY_H
1515#define COMPILERRT_ASSEMBLY_H
1616
17#if defined(__linux__) && defined(__CET__)
17#ifdef __CET__
1818#if __has_include(<cet.h>)
1919#include <cet.h>
2020#endif
......@@ -71,19 +71,35 @@
7171
7272#endif
7373
74#if defined(__aarch64__) && defined(__ELF__) && \
75 defined(COMPILER_RT_EXECUTE_ONLY_CODE)
76// The assembler always creates an implicit '.text' section with default flags
77// (SHF_ALLOC | SHF_EXECINSTR), which is incompatible with the execute-only
78// '.text' section we want to create here because of the missing
79// SHF_AARCH64_PURECODE section flag. To solve this, we use 'unique,0' to
80// differentiate the two sections. The output will therefore have two separate
81// sections named '.text', where code will be placed into the execute-only
82// '.text' section, and the implicitly-created one will be empty.
83#define TEXT_SECTION \
84 .section .text,"axy",@progbits,unique,0
85#else
86#define TEXT_SECTION \
87 .text
88#endif
89
7490#if defined(__arm__) || defined(__aarch64__) || defined(__arm64ec__)
7591#define FUNC_ALIGN \
76 .text SEPARATOR \
7792 .balign 16 SEPARATOR
7893#else
7994#define FUNC_ALIGN
8095#endif
8196
82// BTI and PAC gnu property note
97// BTI, PAC, and GCS gnu property note
8398#define NT_GNU_PROPERTY_TYPE_0 5
8499#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
85100#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI 1
86101#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC 2
102#define GNU_PROPERTY_AARCH64_FEATURE_1_GCS 4
87103
88104#if defined(__ARM_FEATURE_BTI_DEFAULT)
89105#define BTI_FLAG GNU_PROPERTY_AARCH64_FEATURE_1_BTI
......@@ -97,6 +113,12 @@
97113#define PAC_FLAG 0
98114#endif
99115
116#if defined(__ARM_FEATURE_GCS_DEFAULT)
117#define GCS_FLAG GNU_PROPERTY_AARCH64_FEATURE_1_GCS
118#else
119#define GCS_FLAG 0
120#endif
121
100122#define GNU_PROPERTY(type, value) \
101123 .pushsection .note.gnu.property, "a" SEPARATOR \
102124 .p2align 3 SEPARATOR \
......@@ -118,11 +140,12 @@
118140#define BTI_J
119141#endif
120142
121#if (BTI_FLAG | PAC_FLAG) != 0
122#define GNU_PROPERTY_BTI_PAC \
123 GNU_PROPERTY(GNU_PROPERTY_AARCH64_FEATURE_1_AND, BTI_FLAG | PAC_FLAG)
143#if (BTI_FLAG | PAC_FLAG | GCS_FLAG) != 0
144#define GNU_PROPERTY_BTI_PAC_GCS \
145 GNU_PROPERTY(GNU_PROPERTY_AARCH64_FEATURE_1_AND, \
146 BTI_FLAG | PAC_FLAG | GCS_FLAG)
124147#else
125#define GNU_PROPERTY_BTI_PAC
148#define GNU_PROPERTY_BTI_PAC_GCS
126149#endif
127150
128151#if defined(__clang__) || defined(__GCC_HAVE_DWARF2_CFI_ASM)
......@@ -247,6 +270,7 @@
247270#endif
248271
249272#define DEFINE_COMPILERRT_FUNCTION(name) \
273 TEXT_SECTION SEPARATOR \
250274 DEFINE_CODE_STATE \
251275 FILE_LEVEL_DIRECTIVE SEPARATOR \
252276 .globl FUNC_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
......@@ -256,6 +280,7 @@
256280 FUNC_SYMBOL(SYMBOL_NAME(name)):
257281
258282#define DEFINE_COMPILERRT_THUMB_FUNCTION(name) \
283 TEXT_SECTION SEPARATOR \
259284 DEFINE_CODE_STATE \
260285 FILE_LEVEL_DIRECTIVE SEPARATOR \
261286 .globl FUNC_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
......@@ -265,6 +290,7 @@
265290 FUNC_SYMBOL(SYMBOL_NAME(name)):
266291
267292#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
293 TEXT_SECTION SEPARATOR \
268294 DEFINE_CODE_STATE \
269295 FILE_LEVEL_DIRECTIVE SEPARATOR \
270296 .globl FUNC_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
......@@ -274,6 +300,7 @@
274300 FUNC_SYMBOL(SYMBOL_NAME(name)):
275301
276302#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
303 TEXT_SECTION SEPARATOR \
277304 DEFINE_CODE_STATE \
278305 .globl FUNC_SYMBOL(name) SEPARATOR \
279306 SYMBOL_IS_FUNC(name) SEPARATOR \
......@@ -282,6 +309,7 @@
282309 FUNC_SYMBOL(name):
283310
284311#define DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(name) \
312 TEXT_SECTION SEPARATOR \
285313 DEFINE_CODE_STATE \
286314 FUNC_ALIGN \
287315 .globl FUNC_SYMBOL(name) SEPARATOR \
......@@ -296,7 +324,7 @@
296324 .globl FUNC_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
297325 SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
298326 DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR \
299 .set FUNC_SYMBOL(SYMBOL_NAME(name)), FUNC_SYMBOL(target) SEPARATOR
327 .set FUNC_SYMBOL(SYMBOL_NAME(name)), FUNC_SYMBOL(SYMBOL_NAME(target)) SEPARATOR
300328
301329#if defined(__ARM_EABI__)
302330#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \
......@@ -329,4 +357,9 @@
329357#endif
330358#endif
331359
360#if defined(__ASSEMBLER__) && (defined(__i386__) || defined(__amd64__)) && \
361 !defined(__arm64ec__)
362.att_syntax
363#endif
364
332365#endif // COMPILERRT_ASSEMBLY_H
lib/libtsan/interception/interception_win.cpp+4
......@@ -646,6 +646,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
646646 case 0xC033: // 33 C0 : xor eax, eax
647647 case 0xC933: // 33 C9 : xor ecx, ecx
648648 case 0xD233: // 33 D2 : xor edx, edx
649 case 0xFF33: // 33 FF : xor edi, edi
649650 case 0x9066: // 66 90 : xchg %ax,%ax (Two-byte NOP)
650651 case 0xDB84: // 84 DB : test bl,bl
651652 case 0xC084: // 84 C0 : test al,al
......@@ -764,6 +765,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
764765
765766 switch (0x00FFFFFF & *(u32 *)address) {
766767 case 0x10b70f: // 0f b7 10 : movzx edx, WORD PTR [rax]
768 case 0x02b70f: // 0f b7 02 : movzx eax, WORD PTR [rdx]
767769 case 0xc00b4d: // 4d 0b c0 : or r8, r8
768770 case 0xc03345: // 45 33 c0 : xor r8d, r8d
769771 case 0xc08548: // 48 85 c0 : test rax, rax
......@@ -799,6 +801,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
799801 case 0xc9854d: // 4d 85 c9 : test r9, r9
800802 case 0xc98b4c: // 4c 8b c9 : mov r9, rcx
801803 case 0xd12948: // 48 29 d1 : sub rcx, rdx
804 case 0xc22b4c: // 4c 2b c2 : sub r8, rdx
802805 case 0xca2b48: // 48 2b ca : sub rcx, rdx
803806 case 0xca3b48: // 48 3b ca : cmp rcx, rdx
804807 case 0xd12b48: // 48 2b d1 : sub rdx, rcx
......@@ -813,6 +816,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
813816 case 0xd9f748: // 48 f7 d9 : neg rcx
814817 case 0xc03145: // 45 31 c0 : xor r8d,r8d
815818 case 0xc93145: // 45 31 c9 : xor r9d,r9d
819 case 0xd23345: // 45 33 d2 : xor r10d, r10d
816820 case 0xdb3345: // 45 33 db : xor r11d, r11d
817821 case 0xc08445: // 45 84 c0 : test r8b,r8b
818822 case 0xd28445: // 45 84 d2 : test r10b,r10b
lib/libtsan/sanitizer_common/sanitizer_allocator_primary32.h+1
......@@ -288,6 +288,7 @@ class SizeClassAllocator32 {
288288 uptr ComputeRegionId(uptr mem) const {
289289 if (SANITIZER_SIGN_EXTENDED_ADDRESSES)
290290 mem &= (kSpaceSize - 1);
291 mem -= kSpaceBeg;
291292 const uptr res = mem >> kRegionSizeLog;
292293 CHECK_LT(res, kNumPossibleRegions);
293294 return res;
lib/libtsan/sanitizer_common/sanitizer_allocator_primary64.h+18
......@@ -113,6 +113,24 @@ class SizeClassAllocator64 {
113113 // ~(uptr)0.
114114 void Init(s32 release_to_os_interval_ms, uptr heap_start = 0) {
115115 uptr TotalSpaceSize = kSpaceSize + AdditionalSize();
116
117 uptr MaxAddr = GetMaxUserVirtualAddress();
118 // VReport does not call the sanitizer allocator.
119 VReport(3, "Max user virtual address: 0x%zx\n", MaxAddr);
120 VReport(3, "Total space size for primary allocator: 0x%zx\n",
121 TotalSpaceSize);
122 // TODO: revise the check if we ever configure sanitizers to deliberately
123 // map beyond the 2**48 barrier (note that Linux pretends the VMA is
124 // limited to 48-bit for backwards compatibility, but allows apps to
125 // explicitly specify an address beyond that).
126 if (heap_start + TotalSpaceSize >= MaxAddr) {
127 // We can't easily adjust the requested heap size, because kSpaceSize is
128 // const (for optimization) and used throughout the code.
129 VReport(0, "Error: heap size %zx exceeds max user virtual address %zx\n",
130 TotalSpaceSize, MaxAddr);
131 VReport(
132 0, "Try using a kernel that allows a larger virtual address space\n");
133 }
116134 PremappedHeap = heap_start != 0;
117135 if (PremappedHeap) {
118136 CHECK(!kUsingConstantSpaceBeg);
lib/libtsan/sanitizer_common/sanitizer_common.h+15-2
......@@ -78,8 +78,8 @@ uptr GetMmapGranularity();
7878uptr GetMaxVirtualAddress();
7979uptr GetMaxUserVirtualAddress();
8080// Threads
81tid_t GetTid();
82int TgKill(pid_t pid, tid_t tid, int sig);
81ThreadID GetTid();
82int TgKill(pid_t pid, ThreadID tid, int sig);
8383uptr GetThreadSelf();
8484void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
8585 uptr *stack_bottom);
......@@ -390,6 +390,9 @@ void ReportDeadlySignal(const SignalContext &sig, u32 tid,
390390void SetAlternateSignalStack();
391391void UnsetAlternateSignalStack();
392392
393bool IsSignalHandlerFromSanitizer(int signum);
394bool SetSignalHandlerFromSanitizer(int signum, bool new_state);
395
393396// Construct a one-line string:
394397// SUMMARY: SanitizerToolName: error_message
395398// and pass it to __sanitizer_report_error_summary.
......@@ -484,6 +487,13 @@ inline uptr Log2(uptr x) {
484487 return LeastSignificantSetBitIndex(x);
485488}
486489
490inline bool IntervalsAreSeparate(uptr start1, uptr end1, uptr start2,
491 uptr end2) {
492 CHECK_LE(start1, end1);
493 CHECK_LE(start2, end2);
494 return (end1 < start2) || (end2 < start1);
495}
496
487497// Don't use std::min, std::max or std::swap, to minimize dependency
488498// on libstdc++.
489499template <class T>
......@@ -734,6 +744,7 @@ enum ModuleArch {
734744 kModuleArchARMV7S,
735745 kModuleArchARMV7K,
736746 kModuleArchARM64,
747 kModuleArchARM64E,
737748 kModuleArchLoongArch64,
738749 kModuleArchRISCV64,
739750 kModuleArchHexagon
......@@ -807,6 +818,8 @@ inline const char *ModuleArchToString(ModuleArch arch) {
807818 return "armv7k";
808819 case kModuleArchARM64:
809820 return "arm64";
821 case kModuleArchARM64E:
822 return "arm64e";
810823 case kModuleArchLoongArch64:
811824 return "loongarch64";
812825 case kModuleArchRISCV64:
lib/libtsan/sanitizer_common/sanitizer_common_interceptors.inc+30-4
......@@ -1285,8 +1285,34 @@ INTERCEPTOR(int, puts, char *s) {
12851285#endif
12861286
12871287#if SANITIZER_INTERCEPT_PRCTL
1288INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
1289 unsigned long arg4, unsigned long arg5) {
1288
1289# if defined(__aarch64__)
1290// https://llvm.org/docs/PointerAuth.html
1291// AArch64 is currently the only architecture with full PAC support.
1292// Avoid adding PAC instructions to prevent crashes caused by
1293// prctl(PR_PAC_RESET_KEYS, ...). Since PR_PAC_RESET_KEYS resets the
1294// authentication key, using the old key afterward will lead to a crash.
1295
1296# if defined(__ARM_FEATURE_BTI_DEFAULT)
1297# define BRANCH_PROTECTION_ATTRIBUTE \
1298 __attribute__((target("branch-protection=bti")))
1299# else
1300# define BRANCH_PROTECTION_ATTRIBUTE \
1301 __attribute__((target("branch-protection=none")))
1302# endif
1303
1304# define PRCTL_INTERCEPTOR(ret_type, func, ...) \
1305 DEFINE_REAL(ret_type, func, __VA_ARGS__) \
1306 DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \
1307 extern "C" INTERCEPTOR_ATTRIBUTE BRANCH_PROTECTION_ATTRIBUTE ret_type \
1308 WRAP(func)(__VA_ARGS__)
1309
1310# else
1311# define PRCTL_INTERCEPTOR INTERCEPTOR
1312# endif
1313
1314PRCTL_INTERCEPTOR(int, prctl, int option, unsigned long arg2,
1315 unsigned long arg3, unsigned long arg4, unsigned long arg5) {
12901316 void *ctx;
12911317 COMMON_INTERCEPTOR_ENTER(ctx, prctl, option, arg2, arg3, arg4, arg5);
12921318 static const int PR_SET_NAME = 15;
......@@ -1300,7 +1326,7 @@ INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
13001326 static const int PR_SET_SECCOMP = 22;
13011327 static const int SECCOMP_MODE_FILTER = 2;
13021328# endif
1303 if (option == PR_SET_VMA && arg2 == 0UL) {
1329 if (option == PR_SET_VMA && arg2 == 0UL && arg5 != 0UL) {
13041330 char *name = (char *)arg5;
13051331 COMMON_INTERCEPTOR_READ_RANGE(ctx, name, internal_strlen(name) + 1);
13061332 }
......@@ -1326,7 +1352,7 @@ INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
13261352 }
13271353 return res;
13281354}
1329#define INIT_PRCTL COMMON_INTERCEPT_FUNCTION(prctl)
1355# define INIT_PRCTL COMMON_INTERCEPT_FUNCTION(prctl)
13301356#else
13311357#define INIT_PRCTL
13321358#endif // SANITIZER_INTERCEPT_PRCTL
lib/libtsan/sanitizer_common/sanitizer_common_interceptors_ioctl.inc+4
......@@ -344,12 +344,16 @@ static void ioctl_table_fill() {
344344 _(SOUND_PCM_WRITE_CHANNELS, WRITE, sizeof(int));
345345 _(SOUND_PCM_WRITE_FILTER, WRITE, sizeof(int));
346346 _(TCFLSH, NONE, 0);
347# if SANITIZER_TERMIOS_IOCTL_CONSTANTS
347348 _(TCGETS, WRITE, struct_termios_sz);
349# endif
348350 _(TCSBRK, NONE, 0);
349351 _(TCSBRKP, NONE, 0);
352# if SANITIZER_TERMIOS_IOCTL_CONSTANTS
350353 _(TCSETS, READ, struct_termios_sz);
351354 _(TCSETSF, READ, struct_termios_sz);
352355 _(TCSETSW, READ, struct_termios_sz);
356# endif
353357 _(TCXONC, NONE, 0);
354358 _(TIOCGLCKTRMIOS, WRITE, struct_termios_sz);
355359 _(TIOCGSOFTCAR, WRITE, sizeof(int));
lib/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S+2-1
......@@ -5,6 +5,7 @@
55
66ASM_HIDDEN(COMMON_INTERCEPTOR_SPILL_AREA)
77
8TEXT_SECTION
89.comm _ZN14__interception10real_vforkE,8,8
910.globl ASM_WRAPPER_NAME(vfork)
1011ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
......@@ -43,6 +44,6 @@ ASM_SIZE(vfork)
4344ASM_INTERCEPTOR_TRAMPOLINE(vfork)
4445ASM_TRAMPOLINE_ALIAS(vfork, vfork)
4546
46GNU_PROPERTY_BTI_PAC
47GNU_PROPERTY_BTI_PAC_GCS
4748
4849#endif
lib/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S+2
......@@ -2,6 +2,8 @@
22
33#include "sanitizer_common/sanitizer_asm.h"
44
5.att_syntax
6
57.comm _ZN14__interception10real_vforkE,4,4
68.globl ASM_WRAPPER_NAME(vfork)
79ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
lib/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S+2
......@@ -2,6 +2,8 @@
22
33#include "sanitizer_common/sanitizer_asm.h"
44
5.att_syntax
6
57.comm _ZN14__interception10real_vforkE,8,8
68.globl ASM_WRAPPER_NAME(vfork)
79ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
lib/libtsan/sanitizer_common/sanitizer_common_syscalls.inc+18
......@@ -143,6 +143,12 @@ struct sanitizer_kernel_sockaddr {
143143 char sa_data[14];
144144};
145145
146struct sanitizer_kernel_open_how {
147 u64 flags;
148 u64 mode;
149 u64 resolve;
150};
151
146152// Real sigset size is always passed as a syscall argument.
147153// Declare it "void" to catch sizeof(kernel_sigset_t).
148154typedef void kernel_sigset_t;
......@@ -2843,6 +2849,18 @@ PRE_SYSCALL(openat)(long dfd, const void *filename, long flags, long mode) {
28432849POST_SYSCALL(openat)
28442850(long res, long dfd, const void *filename, long flags, long mode) {}
28452851
2852PRE_SYSCALL(openat2)(long dfd, const void* filename,
2853 const sanitizer_kernel_open_how* how, uptr howlen) {
2854 if (filename)
2855 PRE_READ(filename, __sanitizer::internal_strlen((const char*)filename) + 1);
2856
2857 if (how)
2858 PRE_READ(how, howlen);
2859}
2860
2861POST_SYSCALL(openat2)(long res, long dfd, const void* filename,
2862 const sanitizer_kernel_open_how* how, uptr howlen) {}
2863
28462864PRE_SYSCALL(newfstatat)
28472865(long dfd, const void *filename, void *statbuf, long flag) {
28482866 if (filename)
lib/libtsan/sanitizer_common/sanitizer_coverage_interface.inc deleted-43
......@@ -1,43 +0,0 @@
1//===-- sanitizer_coverage_interface.inc ----------------------------------===//
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// Sanitizer Coverage interface list.
9//===----------------------------------------------------------------------===//
10INTERFACE_FUNCTION(__sanitizer_cov_dump)
11INTERFACE_FUNCTION(__sanitizer_cov_reset)
12INTERFACE_FUNCTION(__sanitizer_dump_coverage)
13INTERFACE_FUNCTION(__sanitizer_dump_trace_pc_guard_coverage)
14INTERFACE_WEAK_FUNCTION(__sancov_default_options)
15INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp)
16INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp1)
17INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp2)
18INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp4)
19INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp8)
20INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_const_cmp1)
21INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_const_cmp2)
22INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_const_cmp4)
23INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_const_cmp8)
24INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_div4)
25INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_div8)
26INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_gep)
27INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_pc_guard)
28INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_pc_guard_init)
29INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_pc_indir)
30INTERFACE_WEAK_FUNCTION(__sanitizer_cov_load1)
31INTERFACE_WEAK_FUNCTION(__sanitizer_cov_load2)
32INTERFACE_WEAK_FUNCTION(__sanitizer_cov_load4)
33INTERFACE_WEAK_FUNCTION(__sanitizer_cov_load8)
34INTERFACE_WEAK_FUNCTION(__sanitizer_cov_load16)
35INTERFACE_WEAK_FUNCTION(__sanitizer_cov_store1)
36INTERFACE_WEAK_FUNCTION(__sanitizer_cov_store2)
37INTERFACE_WEAK_FUNCTION(__sanitizer_cov_store4)
38INTERFACE_WEAK_FUNCTION(__sanitizer_cov_store8)
39INTERFACE_WEAK_FUNCTION(__sanitizer_cov_store16)
40INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_switch)
41INTERFACE_WEAK_FUNCTION(__sanitizer_cov_8bit_counters_init)
42INTERFACE_WEAK_FUNCTION(__sanitizer_cov_bool_flag_init)
43INTERFACE_WEAK_FUNCTION(__sanitizer_cov_pcs_init)
lib/libtsan/sanitizer_common/sanitizer_file.cpp+40-12
......@@ -36,9 +36,17 @@ void RawWrite(const char *buffer) {
3636
3737void ReportFile::ReopenIfNecessary() {
3838 mu->CheckLocked();
39 if (fd == kStdoutFd || fd == kStderrFd) return;
40
4139 uptr pid = internal_getpid();
40 if (fallbackToStderrActive && fd_pid != pid) {
41 // If fallbackToStderrActive is set then we fellback to stderr. If this is a
42 // new process, mark fd as invalid so we attempt to open again.
43 CHECK_EQ(fd, kStderrFd);
44 fd = kInvalidFd;
45 fallbackToStderrActive = false;
46 }
47 if (fd == kStdoutFd || fd == kStderrFd)
48 return;
49
4250 // If in tracer, use the parent's file.
4351 if (pid == stoptheworld_tracer_pid)
4452 pid = stoptheworld_tracer_ppid;
......@@ -48,8 +56,7 @@ void ReportFile::ReopenIfNecessary() {
4856 // process, close it now.
4957 if (fd_pid == pid)
5058 return;
51 else
52 CloseFile(fd);
59 CloseFile(fd);
5360 }
5461
5562 const char *exe_name = GetProcessName();
......@@ -65,18 +72,24 @@ void ReportFile::ReopenIfNecessary() {
6572 error_t err;
6673 fd = OpenFile(full_path, WrOnly, &err);
6774 if (fd == kInvalidFd) {
68 const char *ErrorMsgPrefix = "ERROR: Can't open file: ";
75 bool fallback = common_flags()->log_fallback_to_stderr;
76 const char *ErrorMsgPrefix =
77 fallback ? "WARNING: Can't open file, falling back to stderr: "
78 : "ERROR: Can't open file: ";
6979 WriteToFile(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix));
7080 WriteToFile(kStderrFd, full_path, internal_strlen(full_path));
7181 char errmsg[100];
7282 internal_snprintf(errmsg, sizeof(errmsg), " (reason: %d)\n", err);
7383 WriteToFile(kStderrFd, errmsg, internal_strlen(errmsg));
74 Die();
84 if (!fallback)
85 Die();
86 fallbackToStderrActive = true;
87 fd = kStderrFd;
7588 }
7689 fd_pid = pid;
7790}
7891
79static void RecursiveCreateParentDirs(char *path) {
92static void RecursiveCreateParentDirs(char *path, fd_t &fd) {
8093 if (path[0] == '\0')
8194 return;
8295 for (int i = 1; path[i] != '\0'; ++i) {
......@@ -85,12 +98,19 @@ static void RecursiveCreateParentDirs(char *path) {
8598 continue;
8699 path[i] = '\0';
87100 if (!DirExists(path) && !CreateDir(path)) {
88 const char *ErrorMsgPrefix = "ERROR: Can't create directory: ";
101 bool fallback = common_flags()->log_fallback_to_stderr;
102 const char *ErrorMsgPrefix =
103 fallback ? "WARNING: Can't create directory, falling back to stderr: "
104 : "ERROR: Can't create directory: ";
89105 WriteToFile(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix));
90106 WriteToFile(kStderrFd, path, internal_strlen(path));
91107 const char *ErrorMsgSuffix = "\n";
92108 WriteToFile(kStderrFd, ErrorMsgSuffix, internal_strlen(ErrorMsgSuffix));
93 Die();
109 if (!fallback)
110 Die();
111 path[i] = save;
112 fd = kStderrFd;
113 return;
94114 }
95115 path[i] = save;
96116 }
......@@ -108,6 +128,9 @@ static void ParseAndSetPath(const char *pattern, char *dest,
108128 CHECK(dest);
109129 CHECK_GE(dest_size, 1);
110130 dest[0] = '\0';
131 // Return empty string if empty string was passed
132 if (internal_strlen(pattern) == 0)
133 return;
111134 uptr next_substr_start_idx = 0;
112135 for (uptr i = 0; i < internal_strlen(pattern) - 1; i++) {
113136 if (pattern[i] != '%')
......@@ -161,12 +184,17 @@ void ReportFile::SetReportPath(const char *path) {
161184 if (path) {
162185 uptr len = internal_strlen(path);
163186 if (len > sizeof(path_prefix) - 100) {
164 const char *message = "ERROR: Path is too long: ";
187 bool fallback = common_flags()->log_fallback_to_stderr;
188 const char *message =
189 fallback ? "WARNING: Path is too long, falling back to stderr: "
190 : "ERROR: Path is too long: ";
165191 WriteToFile(kStderrFd, message, internal_strlen(message));
166192 WriteToFile(kStderrFd, path, 8);
167193 message = "...\n";
168194 WriteToFile(kStderrFd, message, internal_strlen(message));
169 Die();
195 if (!fallback)
196 Die();
197 path = "stderr";
170198 }
171199 }
172200
......@@ -180,7 +208,7 @@ void ReportFile::SetReportPath(const char *path) {
180208 fd = kStdoutFd;
181209 } else {
182210 ParseAndSetPath(path, path_prefix, kMaxPathLength);
183 RecursiveCreateParentDirs(path_prefix);
211 RecursiveCreateParentDirs(path_prefix, fd);
184212 }
185213}
186214
lib/libtsan/sanitizer_common/sanitizer_file.h+3
......@@ -43,6 +43,9 @@ struct ReportFile {
4343 // PID of the process that opened fd. If a fork() occurs,
4444 // the PID of child will be different from fd_pid.
4545 uptr fd_pid;
46 // Set to true if the last attempt to open the logfile failed, perhaps due to
47 // permission errors
48 bool fallbackToStderrActive = false;
4649
4750 private:
4851 void ReopenIfNecessary();
lib/libtsan/sanitizer_common/sanitizer_flags.inc+7
......@@ -65,6 +65,8 @@ COMMON_FLAG(
6565 bool, log_to_syslog, (bool)SANITIZER_ANDROID || (bool)SANITIZER_APPLE,
6666 "Write all sanitizer output to syslog in addition to other means of "
6767 "logging.")
68COMMON_FLAG(bool, log_fallback_to_stderr, false,
69 "When set, fallback to stderr if we are unable to open log path.")
6870COMMON_FLAG(
6971 int, verbosity, 0,
7072 "Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).")
......@@ -111,6 +113,11 @@ COMMON_FLAG(HandleSignalMode, handle_sigfpe, kHandleSignalYes,
111113COMMON_FLAG(bool, allow_user_segv_handler, true,
112114 "Deprecated. True has no effect, use handle_sigbus=1. If false, "
113115 "handle_*=1 will be upgraded to handle_*=2.")
116COMMON_FLAG(bool, cloak_sanitizer_signal_handlers, false,
117 "If set, signal/sigaction will pretend that sanitizers did not "
118 "preinstall any signal handlers. If the user subsequently installs "
119 "a signal handler, this will disable cloaking for the respective "
120 "signal.")
114121COMMON_FLAG(bool, use_sigaltstack, true,
115122 "If set, uses alternate stack for signal handling.")
116123COMMON_FLAG(bool, detect_deadlocks, true,
lib/libtsan/sanitizer_common/sanitizer_fuchsia.cpp+30-3
......@@ -14,6 +14,7 @@
1414#include "sanitizer_fuchsia.h"
1515#if SANITIZER_FUCHSIA
1616
17# include <limits.h>
1718# include <pthread.h>
1819# include <stdlib.h>
1920# include <unistd.h>
......@@ -68,7 +69,7 @@ int internal_dlinfo(void *handle, int request, void *p) { UNIMPLEMENTED(); }
6869
6970uptr GetThreadSelf() { return reinterpret_cast<uptr>(thrd_current()); }
7071
71tid_t GetTid() { return GetThreadSelf(); }
72ThreadID GetTid() { return GetThreadSelf(); }
7273
7374void Abort() { abort(); }
7475
......@@ -117,11 +118,37 @@ uptr GetMmapGranularity() { return _zx_system_get_page_size(); }
117118
118119sanitizer_shadow_bounds_t ShadowBounds;
119120
121// Any sanitizer that utilizes shadow should explicitly call whenever it's
122// appropriate for that sanitizer to reference shadow bounds. For ASan, this is
123// done in `InitializeShadowMemory` and for HWASan, this is done in
124// `InitShadow`.
120125void InitShadowBounds() { ShadowBounds = __sanitizer_shadow_bounds(); }
121126
127// TODO(leonardchan): It's not immediately clear from a user perspective if
128// `GetMaxUserVirtualAddress` should be called exatly once on runtime startup
129// or can be called multiple times. Currently it looks like most instances of
130// `GetMaxUserVirtualAddress` are meant to be called once, but if someone
131// decides to call this multiple times in the future, we should have a separate
132// function that's ok to call multiple times. Ideally we would just invoke this
133// syscall once. Also for Fuchsia, this syscall technically gets invoked twice
134// since `__sanitizer_shadow_bounds` also invokes this syscall under the hood.
122135uptr GetMaxUserVirtualAddress() {
123 InitShadowBounds();
124 return ShadowBounds.memory_limit - 1;
136 zx_info_vmar_t info;
137 zx_status_t status = _zx_object_get_info(_zx_vmar_root_self(), ZX_INFO_VMAR,
138 &info, sizeof(info), NULL, NULL);
139 CHECK_EQ(status, ZX_OK);
140
141 // Find the top of the accessible address space.
142 uintptr_t top = info.base + info.len;
143
144 // Round it up to a power-of-two size. There may be some pages at
145 // the top that can't actually be mapped, but for purposes of the
146 // the shadow, we'll pretend they could be.
147 int bit = (sizeof(uintptr_t) * CHAR_BIT) - __builtin_clzl(top);
148 if (top != (uintptr_t)1 << bit)
149 top = (uintptr_t)1 << (bit + 1);
150
151 return top - 1;
125152}
126153
127154uptr GetMaxVirtualAddress() { return GetMaxUserVirtualAddress(); }
lib/libtsan/sanitizer_common/sanitizer_haiku.cpp+2-2
......@@ -231,12 +231,12 @@ uptr internal_execve(const char *filename, char *const argv[],
231231}
232232
233233# if 0
234tid_t GetTid() {
234ThreadID GetTid() {
235235 DEFINE__REAL(int, _lwp_self);
236236 return _REAL(_lwp_self);
237237}
238238
239int TgKill(pid_t pid, tid_t tid, int sig) {
239int TgKill(pid_t pid, ThreadID tid, int sig) {
240240 DEFINE__REAL(int, _lwp_kill, int a, int b);
241241 (void)pid;
242242 return _REAL(_lwp_kill, tid, sig);
lib/libtsan/sanitizer_common/sanitizer_internal_defs.h+1-1
......@@ -209,7 +209,7 @@ typedef long ssize;
209209typedef sptr ssize;
210210#endif
211211
212typedef u64 tid_t;
212typedef u64 ThreadID;
213213
214214// ----------- ATTENTION -------------
215215// This header should NOT include any other headers to avoid portability issues.
lib/libtsan/sanitizer_common/sanitizer_libc.cpp+8
......@@ -190,6 +190,14 @@ uptr internal_strlcat(char *dst, const char *src, uptr maxlen) {
190190 return dstlen + srclen;
191191}
192192
193char* internal_strcat(char* dst, const char* src) {
194 uptr len = internal_strlen(dst);
195 uptr i;
196 for (i = 0; src[i]; i++) dst[len + i] = src[i];
197 dst[len + i] = 0;
198 return dst;
199}
200
193201char *internal_strncat(char *dst, const char *src, uptr n) {
194202 uptr len = internal_strlen(dst);
195203 uptr i;
lib/libtsan/sanitizer_common/sanitizer_libc.h+1
......@@ -59,6 +59,7 @@ char *internal_strdup(const char *s);
5959uptr internal_strlen(const char *s);
6060uptr internal_strlcat(char *dst, const char *src, uptr maxlen);
6161char *internal_strncat(char *dst, const char *src, uptr n);
62char* internal_strcat(char* dst, const char* src);
6263int internal_strncmp(const char *s1, const char *s2, uptr n);
6364uptr internal_strlcpy(char *dst, const char *src, uptr maxlen);
6465char *internal_strncpy(char *dst, const char *src, uptr n);
lib/libtsan/sanitizer_common/sanitizer_linux.cpp+15-7
......@@ -635,7 +635,7 @@ bool DirExists(const char *path) {
635635}
636636
637637# if !SANITIZER_NETBSD
638tid_t GetTid() {
638ThreadID GetTid() {
639639# if SANITIZER_FREEBSD
640640 long Tid;
641641 thr_self(&Tid);
......@@ -649,7 +649,7 @@ tid_t GetTid() {
649649# endif
650650}
651651
652int TgKill(pid_t pid, tid_t tid, int sig) {
652int TgKill(pid_t pid, ThreadID tid, int sig) {
653653# if SANITIZER_LINUX
654654 return internal_syscall(SYSCALL(tgkill), pid, tid, sig);
655655# elif SANITIZER_FREEBSD
......@@ -1091,7 +1091,7 @@ ThreadLister::ThreadLister(pid_t pid) : buffer_(4096) {
10911091}
10921092
10931093ThreadLister::Result ThreadLister::ListThreads(
1094 InternalMmapVector<tid_t> *threads) {
1094 InternalMmapVector<ThreadID> *threads) {
10951095 int descriptor = internal_open(task_path_.data(), O_RDONLY | O_DIRECTORY);
10961096 if (internal_iserror(descriptor)) {
10971097 Report("Can't open %s for reading.\n", task_path_.data());
......@@ -1146,7 +1146,7 @@ ThreadLister::Result ThreadLister::ListThreads(
11461146 }
11471147}
11481148
1149const char *ThreadLister::LoadStatus(tid_t tid) {
1149const char *ThreadLister::LoadStatus(ThreadID tid) {
11501150 status_path_.clear();
11511151 status_path_.AppendF("%s/%llu/status", task_path_.data(), tid);
11521152 auto cleanup = at_scope_exit([&] {
......@@ -1159,7 +1159,7 @@ const char *ThreadLister::LoadStatus(tid_t tid) {
11591159 return buffer_.data();
11601160}
11611161
1162bool ThreadLister::IsAlive(tid_t tid) {
1162bool ThreadLister::IsAlive(ThreadID tid) {
11631163 // /proc/%d/task/%d/status uses same call to detect alive threads as
11641164 // proc_task_readdir. See task_state implementation in Linux.
11651165 static const char kPrefix[] = "\nPPid:";
......@@ -1289,7 +1289,7 @@ uptr GetPageSize() {
12891289
12901290uptr ReadBinaryName(/*out*/ char *buf, uptr buf_len) {
12911291# if SANITIZER_HAIKU
1292 int cookie = 0;
1292 int32 cookie = 0;
12931293 image_info info;
12941294 const char *argv0 = "<UNKNOWN>";
12951295 while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
......@@ -1989,7 +1989,10 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
19891989# elif SANITIZER_NETBSD
19901990 uptr err = ucontext->uc_mcontext.__gregs[_REG_ERR];
19911991# elif SANITIZER_HAIKU
1992 uptr err = ucontext->uc_mcontext.r13;
1992 uptr err = 0; // FIXME: ucontext->uc_mcontext.r13;
1993 // The err register was added on the main branch and not
1994 // available with the current release. To be reverted later.
1995 // https://github.com/haiku/haiku/commit/11adda21aa4e6b24f71a496868a44d7607bc3764
19931996# elif SANITIZER_SOLARIS && defined(__i386__)
19941997 const int Err = 13;
19951998 uptr err = ucontext->uc_mcontext.gregs[Err];
......@@ -2619,6 +2622,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
26192622 *pc = ucontext->uc_mcontext.mc_eip;
26202623 *bp = ucontext->uc_mcontext.mc_ebp;
26212624 *sp = ucontext->uc_mcontext.mc_esp;
2625# elif SANITIZER_HAIKU
2626 ucontext_t *ucontext = (ucontext_t *)context;
2627 *pc = ucontext->uc_mcontext.eip;
2628 *bp = ucontext->uc_mcontext.ebp;
2629 *sp = ucontext->uc_mcontext.esp;
26222630# else
26232631 ucontext_t *ucontext = (ucontext_t *)context;
26242632# if SANITIZER_SOLARIS
lib/libtsan/sanitizer_common/sanitizer_linux.h+3-3
......@@ -108,11 +108,11 @@ class ThreadLister {
108108 Incomplete,
109109 Ok,
110110 };
111 Result ListThreads(InternalMmapVector<tid_t> *threads);
112 const char *LoadStatus(tid_t tid);
111 Result ListThreads(InternalMmapVector<ThreadID> *threads);
112 const char *LoadStatus(ThreadID tid);
113113
114114 private:
115 bool IsAlive(tid_t tid);
115 bool IsAlive(ThreadID tid);
116116
117117 InternalScopedString task_path_;
118118 InternalScopedString status_path_;
lib/libtsan/sanitizer_common/sanitizer_linux_libcdep.cpp+1
......@@ -29,6 +29,7 @@
2929# include "sanitizer_solaris.h"
3030
3131# if SANITIZER_HAIKU
32# define _GNU_SOURCE
3233# define _DEFAULT_SOURCE
3334# endif
3435
lib/libtsan/sanitizer_common/sanitizer_mac.cpp+255-104
......@@ -22,6 +22,11 @@
2222# endif
2323# include <stdio.h>
2424
25// Start searching for available memory region past PAGEZERO, which is
26// 4KB on 32-bit and 4GB on 64-bit.
27# define GAP_SEARCH_START_ADDRESS \
28 ((SANITIZER_WORDSIZE == 32) ? 0x000000001000 : 0x000100000000)
29
2530# include "sanitizer_common.h"
2631# include "sanitizer_file.h"
2732# include "sanitizer_flags.h"
......@@ -58,9 +63,11 @@ extern char ***_NSGetArgv(void);
5863# include <dlfcn.h> // for dladdr()
5964# include <errno.h>
6065# include <fcntl.h>
66# include <inttypes.h>
6167# include <libkern/OSAtomic.h>
6268# include <mach-o/dyld.h>
6369# include <mach/mach.h>
70# include <mach/mach_error.h>
6471# include <mach/mach_time.h>
6572# include <mach/vm_statistics.h>
6673# include <malloc/malloc.h>
......@@ -96,8 +103,16 @@ extern "C" {
96103 natural_t *nesting_depth,
97104 vm_region_recurse_info_t info,
98105 mach_msg_type_number_t *infoCnt);
106
107 extern const void* _dyld_get_shared_cache_range(size_t* length);
99108}
100109
110# if !SANITIZER_GO
111// Weak symbol no-op when TSan is not linked
112SANITIZER_WEAK_ATTRIBUTE extern void __tsan_set_in_internal_write_call(
113 bool value) {}
114# endif
115
101116namespace __sanitizer {
102117
103118#include "sanitizer_syscall_generic.inc"
......@@ -168,7 +183,15 @@ uptr internal_read(fd_t fd, void *buf, uptr count) {
168183}
169184
170185uptr internal_write(fd_t fd, const void *buf, uptr count) {
186# if SANITIZER_GO
171187 return write(fd, buf, count);
188# else
189 // We need to disable interceptors when writing in TSan
190 __tsan_set_in_internal_write_call(true);
191 uptr res = write(fd, buf, count);
192 __tsan_set_in_internal_write_call(false);
193 return res;
194# endif
172195}
173196
174197uptr internal_stat(const char *path, void *buf) {
......@@ -258,53 +281,43 @@ int internal_sysctlbyname(const char *sname, void *oldp, uptr *oldlenp,
258281 (size_t)newlen);
259282}
260283
261static fd_t internal_spawn_impl(const char *argv[], const char *envp[],
262 pid_t *pid) {
263 fd_t primary_fd = kInvalidFd;
264 fd_t secondary_fd = kInvalidFd;
284bool internal_spawn(const char* argv[], const char* envp[], pid_t* pid,
285 fd_t fd_stdin, fd_t fd_stdout) {
286 // NOTE: Caller ensures that fd_stdin and fd_stdout are not 0, 1, or 2, since
287 // this can break communication.
288 //
289 // NOTE: Caller is responsible for closing fd_stdin after the process has
290 // died.
265291
292 int res;
266293 auto fd_closer = at_scope_exit([&] {
267 internal_close(primary_fd);
268 internal_close(secondary_fd);
294 // NOTE: We intentionally do not close fd_stdin since this can
295 // cause us to receive a fatal SIGPIPE if the process dies.
296 internal_close(fd_stdout);
269297 });
270298
271 // We need a new pseudoterminal to avoid buffering problems. The 'atos' tool
272 // in particular detects when it's talking to a pipe and forgets to flush the
273 // output stream after sending a response.
274 primary_fd = posix_openpt(O_RDWR);
275 if (primary_fd == kInvalidFd)
276 return kInvalidFd;
277
278 int res = grantpt(primary_fd) || unlockpt(primary_fd);
279 if (res != 0) return kInvalidFd;
280
281 // Use TIOCPTYGNAME instead of ptsname() to avoid threading problems.
282 char secondary_pty_name[128];
283 res = ioctl(primary_fd, TIOCPTYGNAME, secondary_pty_name);
284 if (res == -1) return kInvalidFd;
285
286 secondary_fd = internal_open(secondary_pty_name, O_RDWR);
287 if (secondary_fd == kInvalidFd)
288 return kInvalidFd;
289
290299 // File descriptor actions
291300 posix_spawn_file_actions_t acts;
292301 res = posix_spawn_file_actions_init(&acts);
293 if (res != 0) return kInvalidFd;
302 if (res != 0)
303 return false;
294304
295305 auto acts_cleanup = at_scope_exit([&] {
296306 posix_spawn_file_actions_destroy(&acts);
297307 });
298308
299 res = posix_spawn_file_actions_adddup2(&acts, secondary_fd, STDIN_FILENO) ||
300 posix_spawn_file_actions_adddup2(&acts, secondary_fd, STDOUT_FILENO) ||
301 posix_spawn_file_actions_addclose(&acts, secondary_fd);
302 if (res != 0) return kInvalidFd;
309 res = posix_spawn_file_actions_adddup2(&acts, fd_stdin, STDIN_FILENO) ||
310 posix_spawn_file_actions_adddup2(&acts, fd_stdout, STDOUT_FILENO) ||
311 posix_spawn_file_actions_addclose(&acts, fd_stdin) ||
312 posix_spawn_file_actions_addclose(&acts, fd_stdout);
313 if (res != 0)
314 return false;
303315
304316 // Spawn attributes
305317 posix_spawnattr_t attrs;
306318 res = posix_spawnattr_init(&attrs);
307 if (res != 0) return kInvalidFd;
319 if (res != 0)
320 return false;
308321
309322 auto attrs_cleanup = at_scope_exit([&] {
310323 posix_spawnattr_destroy(&attrs);
......@@ -313,50 +326,17 @@ static fd_t internal_spawn_impl(const char *argv[], const char *envp[],
313326 // In the spawned process, close all file descriptors that are not explicitly
314327 // described by the file actions object. This is Darwin-specific extension.
315328 res = posix_spawnattr_setflags(&attrs, POSIX_SPAWN_CLOEXEC_DEFAULT);
316 if (res != 0) return kInvalidFd;
329 if (res != 0)
330 return false;
317331
318332 // posix_spawn
319333 char **argv_casted = const_cast<char **>(argv);
320334 char **envp_casted = const_cast<char **>(envp);
321335 res = posix_spawn(pid, argv[0], &acts, &attrs, argv_casted, envp_casted);
322 if (res != 0) return kInvalidFd;
323
324 // Disable echo in the new terminal, disable CR.
325 struct termios termflags;
326 tcgetattr(primary_fd, &termflags);
327 termflags.c_oflag &= ~ONLCR;
328 termflags.c_lflag &= ~ECHO;
329 tcsetattr(primary_fd, TCSANOW, &termflags);
330
331 // On success, do not close primary_fd on scope exit.
332 fd_t fd = primary_fd;
333 primary_fd = kInvalidFd;
334
335 return fd;
336}
337
338fd_t internal_spawn(const char *argv[], const char *envp[], pid_t *pid) {
339 // The client program may close its stdin and/or stdout and/or stderr thus
340 // allowing open/posix_openpt to reuse file descriptors 0, 1 or 2. In this
341 // case the communication is broken if either the parent or the child tries to
342 // close or duplicate these descriptors. We temporarily reserve these
343 // descriptors here to prevent this.
344 fd_t low_fds[3];
345 size_t count = 0;
346
347 for (; count < 3; count++) {
348 low_fds[count] = posix_openpt(O_RDWR);
349 if (low_fds[count] >= STDERR_FILENO)
350 break;
351 }
352
353 fd_t fd = internal_spawn_impl(argv, envp, pid);
354
355 for (; count > 0; count--) {
356 internal_close(low_fds[count]);
357 }
336 if (res != 0)
337 return false;
358338
359 return fd;
339 return true;
360340}
361341
362342uptr internal_rename(const char *oldpath, const char *newpath) {
......@@ -394,8 +374,8 @@ bool DirExists(const char *path) {
394374 return S_ISDIR(st.st_mode);
395375}
396376
397tid_t GetTid() {
398 tid_t tid;
377ThreadID GetTid() {
378 ThreadID tid;
399379 pthread_threadid_np(nullptr, &tid);
400380 return tid;
401381}
......@@ -769,11 +749,17 @@ void internal_join_thread(void *th) { pthread_join((pthread_t)th, 0); }
769749static Mutex syslog_lock;
770750# endif
771751
752# if SANITIZER_DRIVERKIT
753# define SANITIZER_OS_LOG os_log
754# else
755# define SANITIZER_OS_LOG os_log_error
756# endif
757
772758void WriteOneLineToSyslog(const char *s) {
773759#if !SANITIZER_GO
774760 syslog_lock.CheckLocked();
775761 if (GetMacosAlignedVersion() >= MacosVersion(10, 12)) {
776 os_log_error(OS_LOG_DEFAULT, "%{public}s", s);
762 SANITIZER_OS_LOG(OS_LOG_DEFAULT, "%{public}s", s);
777763 } else {
778764#pragma clang diagnostic push
779765// as_log is deprecated.
......@@ -837,22 +823,22 @@ void LogMessageOnPrintf(const char *str) {
837823
838824void LogFullErrorReport(const char *buffer) {
839825# if !SANITIZER_GO
840 // Log with os_log_error. This will make it into the crash log.
826 // When logging with os_log_error this will make it into the crash log.
841827 if (internal_strncmp(SanitizerToolName, "AddressSanitizer",
842828 sizeof("AddressSanitizer") - 1) == 0)
843 os_log_error(OS_LOG_DEFAULT, "Address Sanitizer reported a failure.");
829 SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Address Sanitizer reported a failure.");
844830 else if (internal_strncmp(SanitizerToolName, "UndefinedBehaviorSanitizer",
845831 sizeof("UndefinedBehaviorSanitizer") - 1) == 0)
846 os_log_error(OS_LOG_DEFAULT,
847 "Undefined Behavior Sanitizer reported a failure.");
832 SANITIZER_OS_LOG(OS_LOG_DEFAULT,
833 "Undefined Behavior Sanitizer reported a failure.");
848834 else if (internal_strncmp(SanitizerToolName, "ThreadSanitizer",
849835 sizeof("ThreadSanitizer") - 1) == 0)
850 os_log_error(OS_LOG_DEFAULT, "Thread Sanitizer reported a failure.");
836 SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Thread Sanitizer reported a failure.");
851837 else
852 os_log_error(OS_LOG_DEFAULT, "Sanitizer tool reported a failure.");
838 SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Sanitizer tool reported a failure.");
853839
854840 if (common_flags()->log_to_syslog)
855 os_log_error(OS_LOG_DEFAULT, "Consult syslog for more information.");
841 SANITIZER_OS_LOG(OS_LOG_DEFAULT, "Consult syslog for more information.");
856842
857843 // Log to syslog.
858844 // The logging on OS X may call pthread_create so we need the threading
......@@ -933,7 +919,17 @@ static void DisableMmapExcGuardExceptions() {
933919 RTLD_DEFAULT, "task_set_exc_guard_behavior");
934920 if (set_behavior == nullptr) return;
935921 const task_exc_guard_behavior_t task_exc_guard_none = 0;
936 set_behavior(mach_task_self(), task_exc_guard_none);
922 kern_return_t res = set_behavior(mach_task_self(), task_exc_guard_none);
923 if (res != KERN_SUCCESS) {
924 Report(
925 "WARN: task_set_exc_guard_behavior returned %d (%s), "
926 "mmap may fail unexpectedly.\n",
927 res, mach_error_string(res));
928 if (res == KERN_DENIED)
929 Report(
930 "HINT: Check that task_set_exc_guard_behavior is allowed by "
931 "sandbox.\n");
932 }
937933}
938934
939935static void VerifyInterceptorsWorking();
......@@ -1100,6 +1096,67 @@ static void StripEnv() {
11001096}
11011097#endif // SANITIZER_GO
11021098
1099// Prints out a consolidated memory map: contiguous regions
1100// are merged together.
1101static void PrintVmmap() {
1102 const mach_vm_address_t max_vm_address = GetMaxVirtualAddress() + 1;
1103 mach_vm_address_t address = GAP_SEARCH_START_ADDRESS;
1104 kern_return_t kr = KERN_SUCCESS;
1105
1106 Report("Memory map:\n");
1107 mach_vm_address_t last = 0;
1108 mach_vm_address_t lastsz = 0;
1109
1110 while (1) {
1111 mach_vm_size_t vmsize = 0;
1112 natural_t depth = 0;
1113 vm_region_submap_short_info_data_64_t vminfo;
1114 mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64;
1115 kr = mach_vm_region_recurse(mach_task_self(), &address, &vmsize, &depth,
1116 (vm_region_info_t)&vminfo, &count);
1117
1118 if (kr == KERN_DENIED) {
1119 Report(
1120 "ERROR: mach_vm_region_recurse got KERN_DENIED when printing memory "
1121 "map.\n");
1122 Report(
1123 "HINT: Check whether mach_vm_region_recurse is allowed by "
1124 "sandbox.\n");
1125 }
1126
1127 if (kr == KERN_SUCCESS && address < max_vm_address) {
1128 if (last + lastsz == address) {
1129 // This region is contiguous with the last; merge together.
1130 lastsz += vmsize;
1131 } else {
1132 if (lastsz)
1133 Printf("|| `[%p, %p]` || size=0x%016" PRIx64 " ||\n", (void*)last,
1134 (void*)(last + lastsz), lastsz);
1135
1136 last = address;
1137 lastsz = vmsize;
1138 }
1139 address += vmsize;
1140 } else {
1141 // We've reached the end of the memory map. Print the last remaining
1142 // region, if there is one.
1143 if (lastsz)
1144 Printf("|| `[%p, %p]` || size=0x%016" PRIx64 " ||\n", (void*)last,
1145 (void*)(last + lastsz), lastsz);
1146
1147 break;
1148 }
1149 }
1150}
1151
1152static void ReportShadowAllocFail(uptr shadow_size_bytes, uptr alignment) {
1153 Report(
1154 "FATAL: Failed to allocate shadow memory. Tried to allocate %p bytes "
1155 "(alignment=%p).\n",
1156 (void*)shadow_size_bytes, (void*)alignment);
1157 PrintVmmap();
1158}
1159
11031160char **GetArgv() {
11041161 return *_NSGetArgv();
11051162}
......@@ -1207,10 +1264,11 @@ uptr MapDynamicShadow(uptr shadow_size_bytes, uptr shadow_scale,
12071264 if (new_max_vm < max_occupied_addr) {
12081265 Report("Unable to find a memory range for dynamic shadow.\n");
12091266 Report(
1210 "space_size = %p, largest_gap_found = %p, max_occupied_addr = %p, "
1211 "new_max_vm = %p\n",
1212 (void *)space_size, (void *)largest_gap_found,
1213 (void *)max_occupied_addr, (void *)new_max_vm);
1267 "\tspace_size = %p\n\tlargest_gap_found = %p\n\tmax_occupied_addr "
1268 "= %p\n\tnew_max_vm = %p\n",
1269 (void*)space_size, (void*)largest_gap_found, (void*)max_occupied_addr,
1270 (void*)new_max_vm);
1271 ReportShadowAllocFail(shadow_size_bytes, alignment);
12141272 CHECK(0 && "cannot place shadow");
12151273 }
12161274 RestrictMemoryToMaxAddress(new_max_vm);
......@@ -1221,6 +1279,7 @@ uptr MapDynamicShadow(uptr shadow_size_bytes, uptr shadow_scale,
12211279 nullptr, nullptr);
12221280 if (shadow_start == 0) {
12231281 Report("Unable to find a memory range after restricting VM.\n");
1282 ReportShadowAllocFail(shadow_size_bytes, alignment);
12241283 CHECK(0 && "cannot place shadow after restricting vm");
12251284 }
12261285 }
......@@ -1229,6 +1288,25 @@ uptr MapDynamicShadow(uptr shadow_size_bytes, uptr shadow_scale,
12291288 return shadow_start;
12301289}
12311290
1291// Returns a list of ranges which must be covered by shadow memory,
1292// and cannot overlap with any fixed mappings made by a sanitizer.
1293// This can ensure that the sanitizer runtime does not map over
1294// platform-reserved regions.
1295void GetAppReservedRanges(InternalMmapVector<ReservedRange>& ranges) {
1296 ranges.clear();
1297
1298# if SANITIZER_OSX
1299 // On macOS, the first 512GB are platform-reserved (some of which
1300 // may also be available to applications).
1301 ranges.push_back({0x1000UL, 0x8000000000UL});
1302# endif
1303
1304 VReport(2, "App ranges:\n");
1305 for (auto& [range_start, range_end] : ranges) {
1306 VReport(2, " [%p, %p]\n", range_start, range_end);
1307 }
1308}
1309
12321310uptr MapDynamicShadowAndAliases(uptr shadow_size, uptr alias_size,
12331311 uptr num_aliases, uptr ring_buffer_size) {
12341312 CHECK(false && "HWASan aliasing is unimplemented on Mac");
......@@ -1236,40 +1314,61 @@ uptr MapDynamicShadowAndAliases(uptr shadow_size, uptr alias_size,
12361314}
12371315
12381316uptr FindAvailableMemoryRange(uptr size, uptr alignment, uptr left_padding,
1239 uptr *largest_gap_found,
1240 uptr *max_occupied_addr) {
1241 typedef vm_region_submap_short_info_data_64_t RegionInfo;
1242 enum { kRegionInfoSize = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64 };
1243 // Start searching for available memory region past PAGEZERO, which is
1244 // 4KB on 32-bit and 4GB on 64-bit.
1245 mach_vm_address_t start_address =
1246 (SANITIZER_WORDSIZE == 32) ? 0x000000001000 : 0x000100000000;
1247
1317 uptr* largest_gap_found,
1318 uptr* max_occupied_addr) {
12481319 const mach_vm_address_t max_vm_address = GetMaxVirtualAddress() + 1;
1249 mach_vm_address_t address = start_address;
1250 mach_vm_address_t free_begin = start_address;
1320 mach_vm_address_t address = GAP_SEARCH_START_ADDRESS;
1321 mach_vm_address_t free_begin = GAP_SEARCH_START_ADDRESS;
1322
1323 // Restrict the search to be after any reserved ranges
1324 InternalMmapVector<ReservedRange> app_ranges;
1325 GetAppReservedRanges(app_ranges);
1326
1327 for (auto& [range_start, range_end] : app_ranges) {
1328 address = Max(address, (mach_vm_address_t)range_end);
1329 free_begin = Max(free_begin, (mach_vm_address_t)range_end);
1330 }
1331
12511332 kern_return_t kr = KERN_SUCCESS;
12521333 if (largest_gap_found) *largest_gap_found = 0;
12531334 if (max_occupied_addr) *max_occupied_addr = 0;
12541335 while (kr == KERN_SUCCESS) {
12551336 mach_vm_size_t vmsize = 0;
12561337 natural_t depth = 0;
1257 RegionInfo vminfo;
1258 mach_msg_type_number_t count = kRegionInfoSize;
1338 vm_region_submap_short_info_data_64_t vminfo;
1339 mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64;
12591340 kr = mach_vm_region_recurse(mach_task_self(), &address, &vmsize, &depth,
12601341 (vm_region_info_t)&vminfo, &count);
12611342
1262 // There are cases where going beyond the processes' max vm does
1263 // not return KERN_INVALID_ADDRESS so we check for going beyond that
1264 // max address as well.
1265 if (kr == KERN_INVALID_ADDRESS || address > max_vm_address) {
1343 if (kr == KERN_SUCCESS) {
1344 // There are cases where going beyond the processes' max vm does
1345 // not return KERN_INVALID_ADDRESS so we check for going beyond that
1346 // max address as well.
1347 if (address > max_vm_address) {
1348 address = max_vm_address;
1349 kr = -1; // break after this iteration.
1350 }
1351
1352 if (max_occupied_addr)
1353 *max_occupied_addr = address + vmsize;
1354 } else if (kr == KERN_INVALID_ADDRESS) {
12661355 // No more regions beyond "address", consider the gap at the end of VM.
12671356 address = max_vm_address;
1268 vmsize = 0;
1269 kr = -1; // break after this iteration.
1357
1358 // We will break after this iteration anyway since kr != KERN_SUCCESS
1359 } else if (kr == KERN_DENIED) {
1360 Report("ERROR: Unable to find a memory range for dynamic shadow.\n");
1361 Report("HINT: Ensure mach_vm_region_recurse is allowed under sandbox.\n");
1362 Die();
12701363 } else {
1271 if (max_occupied_addr) *max_occupied_addr = address + vmsize;
1364 Report(
1365 "WARNING: mach_vm_region_recurse returned unexpected code %d (%s)\n",
1366 kr, mach_error_string(kr));
1367 DCHECK(false && "mach_vm_region_recurse returned unexpected code");
1368 break; // address is not valid unless KERN_SUCCESS, therefore we must not
1369 // use it.
12721370 }
1371
12731372 if (free_begin != address) {
12741373 // We found a free region [free_begin..address-1].
12751374 uptr gap_start = RoundUpTo((uptr)free_begin + left_padding, alignment);
......@@ -1292,6 +1391,58 @@ uptr FindAvailableMemoryRange(uptr size, uptr alignment, uptr left_padding,
12921391 return 0;
12931392}
12941393
1394// This function (when used during initialization when there is
1395// only a single thread), can be used to verify that a range
1396// of memory hasn't already been mapped, and won't be mapped
1397// later in the shared cache.
1398//
1399// If the syscall mach_vm_region_recurse fails (due to sandbox),
1400// we assume that the memory is not mapped so that execution can continue.
1401//
1402// NOTE: range_end is inclusive
1403//
1404// WARNING: This function must NOT allocate memory, since it is
1405// used in InitializeShadowMemory between where we search for
1406// space for shadow and where we actually allocate it.
1407bool MemoryRangeIsAvailable(uptr range_start, uptr range_end) {
1408 mach_vm_size_t vmsize = 0;
1409 natural_t depth = 0;
1410 vm_region_submap_short_info_data_64_t vminfo;
1411 mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64;
1412 mach_vm_address_t address = range_start;
1413
1414 // First, check if the range is already mapped.
1415 kern_return_t kr =
1416 mach_vm_region_recurse(mach_task_self(), &address, &vmsize, &depth,
1417 (vm_region_info_t)&vminfo, &count);
1418
1419 if (kr == KERN_DENIED) {
1420 Report(
1421 "WARN: mach_vm_region_recurse returned KERN_DENIED when checking "
1422 "whether an address is mapped.\n");
1423 Report("HINT: Is mach_vm_region_recurse allowed by sandbox?\n");
1424 }
1425
1426 if (kr == KERN_SUCCESS && !IntervalsAreSeparate(address, address + vmsize - 1,
1427 range_start, range_end)) {
1428 // Overlaps with already-mapped memory
1429 return false;
1430 }
1431
1432 size_t cacheLength;
1433 uptr cacheStart = (uptr)_dyld_get_shared_cache_range(&cacheLength);
1434
1435 if (cacheStart &&
1436 !IntervalsAreSeparate(cacheStart, cacheStart + cacheLength - 1,
1437 range_start, range_end)) {
1438 // Overlaps with shared cache region
1439 return false;
1440 }
1441
1442 // We believe this address is available.
1443 return true;
1444}
1445
12951446// FIXME implement on this platform.
12961447void GetMemoryProfile(fill_profile_f cb, uptr *stats) {}
12971448
lib/libtsan/sanitizer_common/sanitizer_mac.h+5
......@@ -58,8 +58,13 @@ struct DarwinKernelVersion : VersionBase<DarwinKernelVersion> {
5858 DarwinKernelVersion(u16 major, u16 minor) : VersionBase(major, minor) {}
5959};
6060
61struct ReservedRange {
62 uptr beg, end;
63};
64
6165MacosVersion GetMacosAlignedVersion();
6266DarwinKernelVersion GetDarwinKernelVersion();
67void GetAppReservedRanges(InternalMmapVector<ReservedRange>& ranges);
6368
6469char **GetEnviron();
6570
lib/libtsan/sanitizer_common/sanitizer_netbsd.cpp+2-2
......@@ -229,12 +229,12 @@ uptr internal_execve(const char *filename, char *const argv[],
229229 return _sys_execve(filename, argv, envp);
230230}
231231
232tid_t GetTid() {
232ThreadID GetTid() {
233233 DEFINE__REAL(int, _lwp_self);
234234 return _REAL(_lwp_self);
235235}
236236
237int TgKill(pid_t pid, tid_t tid, int sig) {
237int TgKill(pid_t pid, ThreadID tid, int sig) {
238238 DEFINE__REAL(int, _lwp_kill, int a, int b);
239239 (void)pid;
240240 return _REAL(_lwp_kill, tid, sig);
lib/libtsan/sanitizer_common/sanitizer_platform.h+27-1
......@@ -319,7 +319,11 @@
319319#endif
320320
321321// The first address that can be returned by mmap.
322#define SANITIZER_MMAP_BEGIN 0
322#if SANITIZER_AIX && SANITIZER_WORDSIZE == 64
323# define SANITIZER_MMAP_BEGIN 0x0a00'0000'0000'0000ULL
324#else
325# define SANITIZER_MMAP_BEGIN 0
326#endif
323327
324328// The range of addresses which can be returned my mmap.
325329// FIXME: this value should be different on different platforms. Larger values
......@@ -482,4 +486,26 @@
482486# define SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL 0
483487#endif
484488
489#if SANITIZER_LINUX
490# if SANITIZER_GLIBC
491// Workaround for
492// glibc/commit/3d3572f59059e2b19b8541ea648a6172136ec42e
493// Linux: Keep termios ioctl constants strictly internal
494# if __GLIBC_PREREQ(2, 41)
495# define SANITIZER_TERMIOS_IOCTL_CONSTANTS 0
496# else
497# define SANITIZER_TERMIOS_IOCTL_CONSTANTS 1
498# endif
499# else
500# define SANITIZER_TERMIOS_IOCTL_CONSTANTS 1
501# endif
502#endif
503
504#if SANITIZER_APPLE && SANITIZER_WORDSIZE == 64
505// MTE uses the lower half of the top byte.
506# define STRIP_MTE_TAG(addr) ((addr) & ~((uptr)0x0f << 56))
507#else
508# define STRIP_MTE_TAG(addr) (addr)
509#endif
510
485511#endif // SANITIZER_PLATFORM_H
lib/libtsan/sanitizer_common/sanitizer_platform_interceptors.h+5-4
......@@ -167,7 +167,7 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
167167
168168#define SANITIZER_INTERCEPT_STRLEN SI_NOT_FUCHSIA
169169#define SANITIZER_INTERCEPT_STRNLEN (SI_NOT_MAC && SI_NOT_FUCHSIA)
170#define SANITIZER_INTERCEPT_STRCMP (SI_NOT_FUCHSIA && SI_NOT_AIX)
170#define SANITIZER_INTERCEPT_STRCMP SI_NOT_FUCHSIA
171171#define SANITIZER_INTERCEPT_STRSTR SI_NOT_FUCHSIA
172172#define SANITIZER_INTERCEPT_STRCASESTR (SI_POSIX && SI_NOT_AIX)
173173#define SANITIZER_INTERCEPT_STRTOK SI_NOT_FUCHSIA
......@@ -179,8 +179,8 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
179179#define SANITIZER_INTERCEPT_TEXTDOMAIN SI_LINUX_NOT_ANDROID || SI_SOLARIS
180180#define SANITIZER_INTERCEPT_STRCASECMP SI_POSIX
181181#define SANITIZER_INTERCEPT_MEMSET 1
182#define SANITIZER_INTERCEPT_MEMMOVE SI_NOT_AIX
183#define SANITIZER_INTERCEPT_MEMCPY SI_NOT_AIX
182#define SANITIZER_INTERCEPT_MEMMOVE 1
183#define SANITIZER_INTERCEPT_MEMCPY 1
184184#define SANITIZER_INTERCEPT_MEMCMP SI_NOT_FUCHSIA
185185#define SANITIZER_INTERCEPT_BCMP \
186186 SANITIZER_INTERCEPT_MEMCMP && \
......@@ -551,7 +551,8 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
551551#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_NETBSD)
552552#define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
553553#define SANITIZER_INTERCEPT_WCSLEN 1
554#define SANITIZER_INTERCEPT_WCSCAT SI_POSIX
554#define SANITIZER_INTERCEPT_WCSNLEN 1
555#define SANITIZER_INTERCEPT_WCSCAT (SI_POSIX || SI_WINDOWS)
555556#define SANITIZER_INTERCEPT_WCSDUP SI_POSIX
556557#define SANITIZER_INTERCEPT_SIGNAL_AND_SIGACTION (!SI_WINDOWS && SI_NOT_FUCHSIA)
557558#define SANITIZER_INTERCEPT_BSD_SIGNAL SI_ANDROID
lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp+15-17
......@@ -76,6 +76,7 @@
7676#include <sys/vt.h>
7777#include <linux/cdrom.h>
7878#include <linux/fd.h>
79#include <linux/filter.h>
7980#if SANITIZER_ANDROID
8081#include <linux/fs.h>
8182#endif
......@@ -151,16 +152,15 @@ typedef struct user_fpregs elf_fpregset_t;
151152#if defined(__mips64)
152153# include <sys/procfs.h>
153154#endif
154#include <sys/user.h>
155#include <linux/if_eql.h>
156#include <linux/if_plip.h>
157#include <linux/lp.h>
158#include <linux/mroute.h>
159#include <linux/mroute6.h>
160#include <linux/scc.h>
161#include <linux/serial.h>
162#include <sys/msg.h>
163#include <sys/ipc.h>
155# include <linux/if_eql.h>
156# include <linux/if_plip.h>
157# include <linux/lp.h>
158# include <linux/mroute.h>
159# include <linux/mroute6.h>
160# include <linux/serial.h>
161# include <sys/ipc.h>
162# include <sys/msg.h>
163# include <sys/user.h>
164164#endif // SANITIZER_ANDROID
165165
166166#include <link.h>
......@@ -516,6 +516,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
516516 unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec);
517517 unsigned struct_synth_info_sz = sizeof(struct synth_info);
518518 unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
519 unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog);
519520#endif // SANITIZER_LINUX
520521
521522#if SANITIZER_GLIBC
......@@ -532,8 +533,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
532533 unsigned struct_kbsentry_sz = sizeof(struct kbsentry);
533534 unsigned struct_mtconfiginfo_sz = sizeof(struct mtconfiginfo);
534535 unsigned struct_nr_parms_struct_sz = sizeof(struct nr_parms_struct);
535 unsigned struct_scc_modem_sz = sizeof(struct scc_modem);
536 unsigned struct_scc_stat_sz = sizeof(struct scc_stat);
537536 unsigned struct_serial_multiport_struct_sz
538537 = sizeof(struct serial_multiport_struct);
539538 unsigned struct_serial_struct_sz = sizeof(struct serial_struct);
......@@ -543,7 +542,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
543542
544543 unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info);
545544 unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats);
546 unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog);
547545# endif // SANITIZER_GLIBC
548546
549547# if !SANITIZER_ANDROID && !SANITIZER_APPLE && !SANITIZER_HAIKU
......@@ -779,16 +777,16 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
779777 unsigned IOCTL_SOUND_PCM_WRITE_FILTER = SOUND_PCM_WRITE_FILTER;
780778#endif // SOUND_VERSION
781779 unsigned IOCTL_TCFLSH = TCFLSH;
782 unsigned IOCTL_TCGETA = TCGETA;
780# if SANITIZER_TERMIOS_IOCTL_CONSTANTS
783781 unsigned IOCTL_TCGETS = TCGETS;
782# endif
784783 unsigned IOCTL_TCSBRK = TCSBRK;
785784 unsigned IOCTL_TCSBRKP = TCSBRKP;
786 unsigned IOCTL_TCSETA = TCSETA;
787 unsigned IOCTL_TCSETAF = TCSETAF;
788 unsigned IOCTL_TCSETAW = TCSETAW;
785# if SANITIZER_TERMIOS_IOCTL_CONSTANTS
789786 unsigned IOCTL_TCSETS = TCSETS;
790787 unsigned IOCTL_TCSETSF = TCSETSF;
791788 unsigned IOCTL_TCSETSW = TCSETSW;
789# endif
792790 unsigned IOCTL_TCXONC = TCXONC;
793791 unsigned IOCTL_TIOCGLCKTRMIOS = TIOCGLCKTRMIOS;
794792 unsigned IOCTL_TIOCGSOFTCAR = TIOCGSOFTCAR;
lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h+32-6
......@@ -32,6 +32,8 @@
3232# elif SANITIZER_GLIBC || SANITIZER_ANDROID
3333# define SANITIZER_HAS_STAT64 1
3434# define SANITIZER_HAS_STATFS64 1
35# elif SANITIZER_HAIKU
36# include <stdint.h>
3537# endif
3638
3739# if defined(__sparc__)
......@@ -102,6 +104,8 @@ const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
102104 ? FIRST_32_SECOND_64(104, 128)
103105# if defined(_ABIN32) && _MIPS_SIM == _ABIN32
104106 : FIRST_32_SECOND_64(176, 216);
107# elif SANITIZER_MUSL
108 : FIRST_32_SECOND_64(160, 208);
105109# else
106110 : FIRST_32_SECOND_64(160, 216);
107111# endif
......@@ -476,6 +480,30 @@ struct __sanitizer_cmsghdr {
476480 int cmsg_level;
477481 int cmsg_type;
478482};
483# elif SANITIZER_MUSL
484struct __sanitizer_msghdr {
485 void *msg_name;
486 unsigned msg_namelen;
487 struct __sanitizer_iovec *msg_iov;
488 int msg_iovlen;
489# if SANITIZER_WORDSIZE == 64
490 int __pad1;
491# endif
492 void *msg_control;
493 unsigned msg_controllen;
494# if SANITIZER_WORDSIZE == 64
495 int __pad2;
496# endif
497 int msg_flags;
498};
499struct __sanitizer_cmsghdr {
500 unsigned cmsg_len;
501# if SANITIZER_WORDSIZE == 64
502 int __pad1;
503# endif
504 int cmsg_level;
505 int cmsg_type;
506};
479507# else
480508// In POSIX, int msg_iovlen; socklen_t msg_controllen; socklen_t cmsg_len; but
481509// many implementations don't conform to the standard.
......@@ -603,7 +631,7 @@ typedef unsigned long __sanitizer_sigset_t;
603631# elif SANITIZER_APPLE
604632typedef unsigned __sanitizer_sigset_t;
605633# elif SANITIZER_HAIKU
606typedef unsigned long __sanitizer_sigset_t;
634typedef uint64_t __sanitizer_sigset_t;
607635# elif SANITIZER_LINUX
608636struct __sanitizer_sigset_t {
609637 // The size is determined by looking at sizeof of real sigset_t on linux.
......@@ -1312,16 +1340,14 @@ extern unsigned IOCTL_SNDCTL_COPR_SENDMSG;
13121340extern unsigned IOCTL_SNDCTL_COPR_WCODE;
13131341extern unsigned IOCTL_SNDCTL_COPR_WDATA;
13141342extern unsigned IOCTL_TCFLSH;
1315extern unsigned IOCTL_TCGETA;
1316extern unsigned IOCTL_TCGETS;
13171343extern unsigned IOCTL_TCSBRK;
13181344extern unsigned IOCTL_TCSBRKP;
1319extern unsigned IOCTL_TCSETA;
1320extern unsigned IOCTL_TCSETAF;
1321extern unsigned IOCTL_TCSETAW;
1345# if SANITIZER_TERMIOS_IOCTL_CONSTANTS
1346extern unsigned IOCTL_TCGETS;
13221347extern unsigned IOCTL_TCSETS;
13231348extern unsigned IOCTL_TCSETSF;
13241349extern unsigned IOCTL_TCSETSW;
1350# endif
13251351extern unsigned IOCTL_TCXONC;
13261352extern unsigned IOCTL_TIOCGLCKTRMIOS;
13271353extern unsigned IOCTL_TIOCGSOFTCAR;
lib/libtsan/sanitizer_common/sanitizer_posix.cpp+3-12
......@@ -225,17 +225,9 @@ void *MapWritableFileToMemory(void *addr, uptr size, fd_t fd, OFF_T offset) {
225225 return (void *)p;
226226}
227227
228static inline bool IntervalsAreSeparate(uptr start1, uptr end1,
229 uptr start2, uptr end2) {
230 CHECK(start1 <= end1);
231 CHECK(start2 <= end2);
232 return (end1 < start2) || (end2 < start1);
233}
234
228# if !SANITIZER_APPLE
235229// FIXME: this is thread-unsafe, but should not cause problems most of the time.
236// When the shadow is mapped only a single thread usually exists (plus maybe
237// several worker threads on Mac, which aren't expected to map big chunks of
238// memory).
230// When the shadow is mapped only a single thread usually exists
239231bool MemoryRangeIsAvailable(uptr range_start, uptr range_end) {
240232 MemoryMappingLayout proc_maps(/*cache_enabled*/true);
241233 if (proc_maps.Error())
......@@ -251,7 +243,6 @@ bool MemoryRangeIsAvailable(uptr range_start, uptr range_end) {
251243 return true;
252244}
253245
254#if !SANITIZER_APPLE
255246void DumpProcessMap() {
256247 MemoryMappingLayout proc_maps(/*cache_enabled*/true);
257248 const sptr kBufSize = 4095;
......@@ -265,7 +256,7 @@ void DumpProcessMap() {
265256 Report("End of process memory map.\n");
266257 UnmapOrDie(filename, kBufSize);
267258}
268#endif
259# endif
269260
270261const char *GetPwd() {
271262 return GetEnv("PWD");
lib/libtsan/sanitizer_common/sanitizer_posix.h+2-1
......@@ -67,7 +67,8 @@ uptr internal_ptrace(int request, int pid, void *addr, void *data);
6767uptr internal_waitpid(int pid, int *status, int options);
6868
6969int internal_fork();
70fd_t internal_spawn(const char *argv[], const char *envp[], pid_t *pid);
70bool internal_spawn(const char* argv[], const char* envp[], pid_t* pid,
71 fd_t fd_stdin, fd_t fd_stdout);
7172
7273int internal_sysctl(const int *name, unsigned int namelen, void *oldp,
7374 uptr *oldlenp, const void *newp, uptr newlen);
lib/libtsan/sanitizer_common/sanitizer_posix_libcdep.cpp+19
......@@ -47,6 +47,8 @@ typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
4747
4848namespace __sanitizer {
4949
50[[maybe_unused]] static atomic_uint8_t signal_handler_is_from_sanitizer[64];
51
5052u32 GetUid() {
5153 return getuid();
5254}
......@@ -210,6 +212,20 @@ void UnsetAlternateSignalStack() {
210212 UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
211213}
212214
215bool IsSignalHandlerFromSanitizer(int signum) {
216 return atomic_load(&signal_handler_is_from_sanitizer[signum],
217 memory_order_relaxed);
218}
219
220bool SetSignalHandlerFromSanitizer(int signum, bool new_state) {
221 if (signum < 0 || static_cast<unsigned>(signum) >=
222 ARRAY_SIZE(signal_handler_is_from_sanitizer))
223 return false;
224
225 return atomic_exchange(&signal_handler_is_from_sanitizer[signum], new_state,
226 memory_order_relaxed);
227}
228
213229static void MaybeInstallSigaction(int signum,
214230 SignalHandlerType handler) {
215231 if (GetHandleSignalMode(signum) == kHandleSignalNo) return;
......@@ -223,6 +239,9 @@ static void MaybeInstallSigaction(int signum,
223239 if (common_flags()->use_sigaltstack) sigact.sa_flags |= SA_ONSTACK;
224240 CHECK_EQ(0, internal_sigaction(signum, &sigact, nullptr));
225241 VReport(1, "Installed the sigaction for signal %d\n", signum);
242
243 if (common_flags()->cloak_sanitizer_signal_handlers)
244 SetSignalHandlerFromSanitizer(signum, true);
226245}
227246
228247void InstallDeadlySignalHandlers(SignalHandlerType handler) {
lib/libtsan/sanitizer_common/sanitizer_procmaps_mac.cpp+102-37
......@@ -20,18 +20,21 @@
2020#include <mach/mach.h>
2121
2222// These are not available in older macOS SDKs.
23#ifndef CPU_SUBTYPE_X86_64_H
24#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell */
25#endif
26#ifndef CPU_SUBTYPE_ARM_V7S
27#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t)11) /* Swift */
28#endif
29#ifndef CPU_SUBTYPE_ARM_V7K
30#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t)12)
31#endif
32#ifndef CPU_TYPE_ARM64
33#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
34#endif
23# ifndef CPU_SUBTYPE_X86_64_H
24# define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell */
25# endif
26# ifndef CPU_SUBTYPE_ARM_V7S
27# define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t)11) /* Swift */
28# endif
29# ifndef CPU_SUBTYPE_ARM_V7K
30# define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t)12)
31# endif
32# ifndef CPU_TYPE_ARM64
33# define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
34# endif
35# ifndef CPU_SUBTYPE_ARM64E
36# define CPU_SUBTYPE_ARM64E ((cpu_subtype_t)2)
37# endif
3538
3639namespace __sanitizer {
3740
......@@ -42,7 +45,6 @@ struct MemoryMappedSegmentData {
4245 const char *current_load_cmd_addr;
4346 u32 lc_type;
4447 uptr base_virt_addr;
45 uptr addr_mask;
4648};
4749
4850template <typename Section>
......@@ -51,12 +53,62 @@ static void NextSectionLoad(LoadedModule *module, MemoryMappedSegmentData *data,
5153 const Section *sc = (const Section *)data->current_load_cmd_addr;
5254 data->current_load_cmd_addr += sizeof(Section);
5355
54 uptr sec_start = (sc->addr & data->addr_mask) + data->base_virt_addr;
56 uptr sec_start = sc->addr + data->base_virt_addr;
5557 uptr sec_end = sec_start + sc->size;
5658 module->addAddressRange(sec_start, sec_end, /*executable=*/false, isWritable,
5759 sc->sectname);
5860}
5961
62static bool VerifyMemoryMapping(MemoryMappingLayout* mapping) {
63 InternalMmapVector<LoadedModule> modules;
64 modules.reserve(128); // matches DumpProcessMap
65 mapping->DumpListOfModules(&modules);
66
67 InternalMmapVector<LoadedModule::AddressRange> segments;
68 for (uptr i = 0; i < modules.size(); ++i) {
69 for (auto& range : modules[i].ranges()) {
70 if (range.beg == range.end)
71 continue;
72 segments.push_back(range);
73 }
74 }
75
76 // Verify that none of the segments overlap:
77 // 1. Sort the segments by the start address
78 // 2. Check that every segment starts after the previous one ends.
79 Sort(segments.data(), segments.size(),
80 [](LoadedModule::AddressRange& a, LoadedModule::AddressRange& b) {
81 return a.beg < b.beg;
82 });
83
84 // To avoid spam, we only print the report message once-per-process.
85 static bool invalid_module_map_reported = false;
86 bool well_formed = true;
87
88 for (size_t i = 1; i < segments.size(); i++) {
89 uptr cur_start = segments[i].beg;
90 uptr prev_end = segments[i - 1].end;
91 if (cur_start < prev_end) {
92 well_formed = false;
93 VReport(2, "Overlapping mappings: %s start = %p, %s end = %p\n",
94 segments[i].name, (void*)cur_start, segments[i - 1].name,
95 (void*)prev_end);
96 if (!invalid_module_map_reported) {
97 Report(
98 "WARN: Invalid dyld module map detected. This is most likely a bug "
99 "in the sanitizer.\n");
100 Report("WARN: Backtraces may be unreliable.\n");
101 invalid_module_map_reported = true;
102 }
103 }
104 }
105
106 for (auto& m : modules) m.clear();
107
108 mapping->Reset();
109 return well_formed;
110}
111
60112void MemoryMappedSegment::AddAddressRanges(LoadedModule *module) {
61113 // Don't iterate over sections when the caller hasn't set up the
62114 // data pointer, when there are no sections, or when the segment
......@@ -82,6 +134,7 @@ void MemoryMappedSegment::AddAddressRanges(LoadedModule *module) {
82134
83135MemoryMappingLayout::MemoryMappingLayout(bool cache_enabled) {
84136 Reset();
137 VerifyMemoryMapping(this);
85138}
86139
87140MemoryMappingLayout::~MemoryMappingLayout() {
......@@ -123,7 +176,7 @@ void MemoryMappingLayout::Reset() {
123176// The dyld load address should be unchanged throughout process execution,
124177// and it is expensive to compute once many libraries have been loaded,
125178// so cache it here and do not reset.
126static mach_header *dyld_hdr = 0;
179static const mach_header* dyld_hdr = 0;
127180static const char kDyldPath[] = "/usr/lib/dyld";
128181static const int kDyldImageIdx = -1;
129182
......@@ -187,17 +240,22 @@ typedef struct dyld_shared_cache_dylib_text_info
187240
188241extern bool _dyld_get_shared_cache_uuid(uuid_t uuid);
189242extern const void *_dyld_get_shared_cache_range(size_t *length);
243extern intptr_t _dyld_get_image_slide(const struct mach_header* mh);
190244extern int dyld_shared_cache_iterate_text(
191245 const uuid_t cacheUuid,
192246 void (^callback)(const dyld_shared_cache_dylib_text_info *info));
247SANITIZER_WEAK_IMPORT const struct mach_header* _dyld_get_dyld_header(void);
193248} // extern "C"
194249
195static mach_header *GetDyldImageHeaderViaSharedCache() {
250static const mach_header* GetDyldImageHeaderViaSharedCache() {
196251 uuid_t uuid;
197252 bool hasCache = _dyld_get_shared_cache_uuid(uuid);
198253 if (!hasCache)
199254 return nullptr;
200255
256 if (&_dyld_get_dyld_header != nullptr)
257 return _dyld_get_dyld_header();
258
201259 size_t cacheLength;
202260 __block uptr cacheStart = (uptr)_dyld_get_shared_cache_range(&cacheLength);
203261 CHECK(cacheStart && cacheLength);
......@@ -255,23 +313,21 @@ static bool NextSegmentLoad(MemoryMappedSegment *segment,
255313 layout_data->current_load_cmd_count--;
256314 if (((const load_command *)lc)->cmd == kLCSegment) {
257315 const SegmentCommand* sc = (const SegmentCommand *)lc;
258 uptr base_virt_addr, addr_mask;
259 if (layout_data->current_image == kDyldImageIdx) {
260 base_virt_addr = (uptr)get_dyld_hdr();
261 // vmaddr is masked with 0xfffff because on macOS versions < 10.12,
262 // it contains an absolute address rather than an offset for dyld.
263 // To make matters even more complicated, this absolute address
264 // isn't actually the absolute segment address, but the offset portion
265 // of the address is accurate when combined with the dyld base address,
266 // and the mask will give just this offset.
267 addr_mask = 0xfffff;
268 } else {
316 if (internal_strcmp(sc->segname, "__LINKEDIT") == 0) {
317 // The LINKEDIT sections are for internal linker use, and may alias
318 // with the LINKEDIT section for other modules. (If we included them,
319 // our memory map would contain overlappping sections.)
320 return false;
321 }
322
323 uptr base_virt_addr;
324 if (layout_data->current_image == kDyldImageIdx)
325 base_virt_addr = (uptr)_dyld_get_image_slide(get_dyld_hdr());
326 else
269327 base_virt_addr =
270328 (uptr)_dyld_get_image_vmaddr_slide(layout_data->current_image);
271 addr_mask = ~0;
272 }
273329
274 segment->start = (sc->vmaddr & addr_mask) + base_virt_addr;
330 segment->start = sc->vmaddr + base_virt_addr;
275331 segment->end = segment->start + sc->vmsize;
276332 // Most callers don't need section information, so only fill this struct
277333 // when required.
......@@ -281,9 +337,9 @@ static bool NextSegmentLoad(MemoryMappedSegment *segment,
281337 (const char *)lc + sizeof(SegmentCommand);
282338 seg_data->lc_type = kLCSegment;
283339 seg_data->base_virt_addr = base_virt_addr;
284 seg_data->addr_mask = addr_mask;
285340 internal_strncpy(seg_data->name, sc->segname,
286341 ARRAY_SIZE(seg_data->name));
342 seg_data->name[ARRAY_SIZE(seg_data->name) - 1] = 0;
287343 }
288344
289345 // Return the initial protection.
......@@ -297,6 +353,7 @@ static bool NextSegmentLoad(MemoryMappedSegment *segment,
297353 ? kDyldPath
298354 : _dyld_get_image_name(layout_data->current_image);
299355 internal_strncpy(segment->filename, src, segment->filename_size);
356 segment->filename[segment->filename_size - 1] = 0;
300357 }
301358 segment->arch = layout_data->current_arch;
302359 internal_memcpy(segment->uuid, layout_data->current_uuid, kModuleUUIDSize);
......@@ -311,18 +368,26 @@ ModuleArch ModuleArchFromCpuType(cpu_type_t cputype, cpu_subtype_t cpusubtype) {
311368 case CPU_TYPE_I386:
312369 return kModuleArchI386;
313370 case CPU_TYPE_X86_64:
314 if (cpusubtype == CPU_SUBTYPE_X86_64_ALL) return kModuleArchX86_64;
315 if (cpusubtype == CPU_SUBTYPE_X86_64_H) return kModuleArchX86_64H;
371 if (cpusubtype == CPU_SUBTYPE_X86_64_ALL)
372 return kModuleArchX86_64;
373 if (cpusubtype == CPU_SUBTYPE_X86_64_H)
374 return kModuleArchX86_64H;
316375 CHECK(0 && "Invalid subtype of x86_64");
317376 return kModuleArchUnknown;
318377 case CPU_TYPE_ARM:
319 if (cpusubtype == CPU_SUBTYPE_ARM_V6) return kModuleArchARMV6;
320 if (cpusubtype == CPU_SUBTYPE_ARM_V7) return kModuleArchARMV7;
321 if (cpusubtype == CPU_SUBTYPE_ARM_V7S) return kModuleArchARMV7S;
322 if (cpusubtype == CPU_SUBTYPE_ARM_V7K) return kModuleArchARMV7K;
378 if (cpusubtype == CPU_SUBTYPE_ARM_V6)
379 return kModuleArchARMV6;
380 if (cpusubtype == CPU_SUBTYPE_ARM_V7)
381 return kModuleArchARMV7;
382 if (cpusubtype == CPU_SUBTYPE_ARM_V7S)
383 return kModuleArchARMV7S;
384 if (cpusubtype == CPU_SUBTYPE_ARM_V7K)
385 return kModuleArchARMV7K;
323386 CHECK(0 && "Invalid subtype of ARM");
324387 return kModuleArchUnknown;
325388 case CPU_TYPE_ARM64:
389 if (cpusubtype == CPU_SUBTYPE_ARM64E)
390 return kModuleArchARM64E;
326391 return kModuleArchARM64;
327392 default:
328393 CHECK(0 && "Invalid CPU type");
lib/libtsan/sanitizer_common/sanitizer_redefine_builtins.h+1-1
......@@ -15,7 +15,7 @@
1515# define SANITIZER_REDEFINE_BUILTINS_H
1616
1717// The asm hack only works with GCC and Clang.
18# if !defined(_WIN32) && !defined(_AIX)
18# if !defined(_WIN32) && !defined(_AIX) && !defined(__APPLE__)
1919
2020asm(R"(
2121 .set memcpy, __sanitizer_internal_memcpy
lib/libtsan/sanitizer_common/sanitizer_signal_interceptors.inc+40-2
......@@ -45,6 +45,8 @@ using namespace __sanitizer;
4545INTERCEPTOR(uptr, bsd_signal, int signum, uptr handler) {
4646 SIGNAL_INTERCEPTOR_ENTER();
4747 if (GetHandleSignalMode(signum) == kHandleSignalExclusive) return 0;
48
49 // TODO: support cloak_sanitizer_signal_handlers
4850 SIGNAL_INTERCEPTOR_SIGNAL_IMPL(bsd_signal, signum, handler);
4951}
5052#define INIT_BSD_SIGNAL COMMON_INTERCEPT_FUNCTION(bsd_signal)
......@@ -56,19 +58,55 @@ INTERCEPTOR(uptr, bsd_signal, int signum, uptr handler) {
5658INTERCEPTOR(uptr, signal, int signum, uptr handler) {
5759 SIGNAL_INTERCEPTOR_ENTER();
5860 if (GetHandleSignalMode(signum) == kHandleSignalExclusive)
61 // The user can neither view nor change the signal handler, regardless of
62 // the cloak_sanitizer_signal_handlers setting. This differs from
63 // sigaction().
5964 return (uptr) nullptr;
60 SIGNAL_INTERCEPTOR_SIGNAL_IMPL(signal, signum, handler);
65
66 uptr ret = +[](auto signal, int signum, uptr handler) {
67 SIGNAL_INTERCEPTOR_SIGNAL_IMPL(signal, signum, handler);
68 }(signal, signum, handler);
69
70 if (ret != sig_err && SetSignalHandlerFromSanitizer(signum, false))
71 // If the user sets a signal handler, it becomes uncloaked, even if they
72 // reuse a sanitizer's signal handler.
73 ret = sig_dfl;
74
75 return ret;
6176}
6277#define INIT_SIGNAL COMMON_INTERCEPT_FUNCTION(signal)
6378
6479INTERCEPTOR(int, sigaction_symname, int signum,
6580 const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
6681 SIGNAL_INTERCEPTOR_ENTER();
82
6783 if (GetHandleSignalMode(signum) == kHandleSignalExclusive) {
6884 if (!oldact) return 0;
6985 act = nullptr;
86 // If cloak_sanitizer_signal_handlers=true, the user can neither view nor
87 // change the signal handle.
88 // If false, the user can view but not change the signal handler. This
89 // differs from signal().
7090 }
71 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
91
92 int ret = +[](int signum, const __sanitizer_sigaction* act,
93 __sanitizer_sigaction* oldact) {
94 SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact);
95 }(signum, act, oldact);
96
97 if (act) {
98 if (ret == 0 && SetSignalHandlerFromSanitizer(signum, false)) {
99 // If the user sets a signal handler, it becomes uncloaked, even if they
100 // reuse a sanitizer's signal handler.
101
102 if (oldact)
103 oldact->handler = reinterpret_cast<__sanitizer_sighandler_ptr>(sig_dfl);
104 }
105 } else if (ret == 0 && oldact && IsSignalHandlerFromSanitizer(signum)) {
106 oldact->handler = reinterpret_cast<__sanitizer_sighandler_ptr>(sig_dfl);
107 }
108
109 return ret;
72110}
73111#define INIT_SIGACTION COMMON_INTERCEPT_FUNCTION(sigaction_symname)
74112
lib/libtsan/sanitizer_common/sanitizer_stoptheworld.h+1-1
......@@ -38,7 +38,7 @@ class SuspendedThreadsList {
3838 }
3939
4040 virtual uptr ThreadCount() const { UNIMPLEMENTED(); }
41 virtual tid_t GetThreadID(uptr index) const { UNIMPLEMENTED(); }
41 virtual ThreadID GetThreadID(uptr index) const { UNIMPLEMENTED(); }
4242
4343 protected:
4444 ~SuspendedThreadsList() {}
lib/libtsan/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp+83-12
......@@ -94,17 +94,17 @@ class SuspendedThreadsListLinux final : public SuspendedThreadsList {
9494 public:
9595 SuspendedThreadsListLinux() { thread_ids_.reserve(1024); }
9696
97 tid_t GetThreadID(uptr index) const override;
97 ThreadID GetThreadID(uptr index) const override;
9898 uptr ThreadCount() const override;
99 bool ContainsTid(tid_t thread_id) const;
100 void Append(tid_t tid);
99 bool ContainsTid(ThreadID thread_id) const;
100 void Append(ThreadID tid);
101101
102102 PtraceRegistersStatus GetRegistersAndSP(uptr index,
103103 InternalMmapVector<uptr> *buffer,
104104 uptr *sp) const override;
105105
106106 private:
107 InternalMmapVector<tid_t> thread_ids_;
107 InternalMmapVector<ThreadID> thread_ids_;
108108};
109109
110110// Structure for passing arguments into the tracer thread.
......@@ -137,10 +137,10 @@ class ThreadSuspender {
137137 private:
138138 SuspendedThreadsListLinux suspended_threads_list_;
139139 pid_t pid_;
140 bool SuspendThread(tid_t thread_id);
140 bool SuspendThread(ThreadID thread_id);
141141};
142142
143bool ThreadSuspender::SuspendThread(tid_t tid) {
143bool ThreadSuspender::SuspendThread(ThreadID tid) {
144144 int pterrno;
145145 if (internal_iserror(internal_ptrace(PTRACE_ATTACH, tid, nullptr, nullptr),
146146 &pterrno)) {
......@@ -210,7 +210,7 @@ void ThreadSuspender::KillAllThreads() {
210210bool ThreadSuspender::SuspendAllThreads() {
211211 ThreadLister thread_lister(pid_);
212212 bool retry = true;
213 InternalMmapVector<tid_t> threads;
213 InternalMmapVector<ThreadID> threads;
214214 threads.reserve(128);
215215 for (int i = 0; i < 30 && retry; ++i) {
216216 retry = false;
......@@ -226,7 +226,7 @@ bool ThreadSuspender::SuspendAllThreads() {
226226 case ThreadLister::Ok:
227227 break;
228228 }
229 for (tid_t tid : threads) {
229 for (ThreadID tid : threads) {
230230 // Are we already attached to this thread?
231231 // Currently this check takes linear time, however the number of threads
232232 // is usually small.
......@@ -403,7 +403,77 @@ struct ScopedSetTracerPID {
403403 }
404404};
405405
406// This detects whether ptrace is blocked (e.g., by seccomp), by forking and
407// then attempting ptrace.
408// This separate check is necessary because StopTheWorld() creates a thread
409// with a shared virtual address space and shared TLS, and therefore
410// cannot use waitpid() due to the shared errno.
411static void TestPTrace() {
412# if SANITIZER_SPARC
413 // internal_fork() on SPARC actually calls __fork(). We can't safely fork,
414 // because it's possible seccomp has been configured to disallow fork() but
415 // allow clone().
416 VReport(1, "WARNING: skipping TestPTrace() because this is SPARC\n");
417 VReport(1,
418 "If seccomp blocks ptrace, LeakSanitizer may hang without further "
419 "notice\n");
420 VReport(
421 1,
422 "If seccomp does not block ptrace, you can safely ignore this warning\n");
423# else
424 // Heuristic: only check the first time this is called. This is not always
425 // correct (e.g., user manually triggers leak detection, then updates
426 // seccomp, then leak detection is triggered again).
427 static bool checked = false;
428 if (checked)
429 return;
430 checked = true;
431
432 // Hopefully internal_fork() is not too expensive, thanks to copy-on-write.
433 // Besides, this is only called the first time.
434 // Note that internal_fork() on non-SPARC Linux actually calls
435 // SYSCALL(clone); thus, it is reasonable to use it because if seccomp kills
436 // TestPTrace(), it would have killed StopTheWorld() anyway.
437 int pid = internal_fork();
438
439 if (pid < 0) {
440 int rverrno;
441 if (internal_iserror(pid, &rverrno))
442 VReport(0, "WARNING: TestPTrace() failed to fork (errno %d)\n", rverrno);
443
444 // We don't abort the sanitizer - it's still worth letting the sanitizer
445 // try.
446 return;
447 }
448
449 if (pid == 0) {
450 // Child subprocess
451
452 // TODO: consider checking return value of internal_ptrace, to handle
453 // SCMP_ACT_ERRNO. However, be careful not to consume too many
454 // resources performing a proper ptrace.
455 internal_ptrace(PTRACE_ATTACH, 0, nullptr, nullptr);
456 internal__exit(0);
457 } else {
458 int wstatus;
459 internal_waitpid(pid, &wstatus, 0);
460
461 // Handle SCMP_ACT_KILL
462 if (WIFSIGNALED(wstatus)) {
463 VReport(0,
464 "WARNING: ptrace appears to be blocked (is seccomp enabled?). "
465 "LeakSanitizer may hang.\n");
466 VReport(0, "Child exited with signal %d.\n", WTERMSIG(wstatus));
467 // We don't abort the sanitizer - it's still worth letting the sanitizer
468 // try.
469 }
470 }
471# endif
472}
473
406474void StopTheWorld(StopTheWorldCallback callback, void *argument) {
475 TestPTrace();
476
407477 StopTheWorldScope in_stoptheworld;
408478 // Prepare the arguments for TracerThread.
409479 struct TracerThreadArgument tracer_thread_argument;
......@@ -457,7 +527,8 @@ void StopTheWorld(StopTheWorldCallback callback, void *argument) {
457527 internal_prctl(PR_SET_PTRACER, tracer_pid, 0, 0, 0);
458528 // Allow the tracer thread to start.
459529 tracer_thread_argument.mutex.Unlock();
460 // NOTE: errno is shared between this thread and the tracer thread.
530 // NOTE: errno is shared between this thread and the tracer thread
531 // (clone was called without CLONE_SETTLS / newtls).
461532 // internal_waitpid() may call syscall() which can access/spoil errno,
462533 // so we can't call it now. Instead we for the tracer thread to finish using
463534 // the spin loop below. Man page for sched_yield() says "In the Linux
......@@ -546,7 +617,7 @@ static constexpr uptr kExtraRegs[] = {0};
546617#error "Unsupported architecture"
547618#endif // SANITIZER_ANDROID && defined(__arm__)
548619
549tid_t SuspendedThreadsListLinux::GetThreadID(uptr index) const {
620ThreadID SuspendedThreadsListLinux::GetThreadID(uptr index) const {
550621 CHECK_LT(index, thread_ids_.size());
551622 return thread_ids_[index];
552623}
......@@ -555,14 +626,14 @@ uptr SuspendedThreadsListLinux::ThreadCount() const {
555626 return thread_ids_.size();
556627}
557628
558bool SuspendedThreadsListLinux::ContainsTid(tid_t thread_id) const {
629bool SuspendedThreadsListLinux::ContainsTid(ThreadID thread_id) const {
559630 for (uptr i = 0; i < thread_ids_.size(); i++) {
560631 if (thread_ids_[i] == thread_id) return true;
561632 }
562633 return false;
563634}
564635
565void SuspendedThreadsListLinux::Append(tid_t tid) {
636void SuspendedThreadsListLinux::Append(ThreadID tid) {
566637 thread_ids_.push_back(tid);
567638}
568639
lib/libtsan/sanitizer_common/sanitizer_stoptheworld_mac.cpp+3-3
......@@ -23,7 +23,7 @@
2323
2424namespace __sanitizer {
2525typedef struct {
26 tid_t tid;
26 ThreadID tid;
2727 thread_t thread;
2828} SuspendedThreadInfo;
2929
......@@ -31,7 +31,7 @@ class SuspendedThreadsListMac final : public SuspendedThreadsList {
3131 public:
3232 SuspendedThreadsListMac() = default;
3333
34 tid_t GetThreadID(uptr index) const override;
34 ThreadID GetThreadID(uptr index) const override;
3535 thread_t GetThread(uptr index) const;
3636 uptr ThreadCount() const override;
3737 bool ContainsThread(thread_t thread) const;
......@@ -111,7 +111,7 @@ typedef x86_thread_state32_t regs_struct;
111111#error "Unsupported architecture"
112112#endif
113113
114tid_t SuspendedThreadsListMac::GetThreadID(uptr index) const {
114ThreadID SuspendedThreadsListMac::GetThreadID(uptr index) const {
115115 CHECK_LT(index, threads_.size());
116116 return threads_[index].tid;
117117}
lib/libtsan/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp+7-7
......@@ -52,17 +52,17 @@ class SuspendedThreadsListNetBSD final : public SuspendedThreadsList {
5252 public:
5353 SuspendedThreadsListNetBSD() { thread_ids_.reserve(1024); }
5454
55 tid_t GetThreadID(uptr index) const;
55 ThreadID GetThreadID(uptr index) const;
5656 uptr ThreadCount() const;
57 bool ContainsTid(tid_t thread_id) const;
58 void Append(tid_t tid);
57 bool ContainsTid(ThreadID thread_id) const;
58 void Append(ThreadID tid);
5959
6060 PtraceRegistersStatus GetRegistersAndSP(uptr index,
6161 InternalMmapVector<uptr> *buffer,
6262 uptr *sp) const;
6363
6464 private:
65 InternalMmapVector<tid_t> thread_ids_;
65 InternalMmapVector<ThreadID> thread_ids_;
6666};
6767
6868struct TracerThreadArgument {
......@@ -313,7 +313,7 @@ void StopTheWorld(StopTheWorldCallback callback, void *argument) {
313313 }
314314}
315315
316tid_t SuspendedThreadsListNetBSD::GetThreadID(uptr index) const {
316ThreadID SuspendedThreadsListNetBSD::GetThreadID(uptr index) const {
317317 CHECK_LT(index, thread_ids_.size());
318318 return thread_ids_[index];
319319}
......@@ -322,7 +322,7 @@ uptr SuspendedThreadsListNetBSD::ThreadCount() const {
322322 return thread_ids_.size();
323323}
324324
325bool SuspendedThreadsListNetBSD::ContainsTid(tid_t thread_id) const {
325bool SuspendedThreadsListNetBSD::ContainsTid(ThreadID thread_id) const {
326326 for (uptr i = 0; i < thread_ids_.size(); i++) {
327327 if (thread_ids_[i] == thread_id)
328328 return true;
......@@ -330,7 +330,7 @@ bool SuspendedThreadsListNetBSD::ContainsTid(tid_t thread_id) const {
330330 return false;
331331}
332332
333void SuspendedThreadsListNetBSD::Append(tid_t tid) {
333void SuspendedThreadsListNetBSD::Append(ThreadID tid) {
334334 thread_ids_.push_back(tid);
335335}
336336
lib/libtsan/sanitizer_common/sanitizer_stoptheworld_win.cpp+2-2
......@@ -38,7 +38,7 @@ struct SuspendedThreadsListWindows final : public SuspendedThreadsList {
3838 InternalMmapVector<uptr> *buffer,
3939 uptr *sp) const override;
4040
41 tid_t GetThreadID(uptr index) const override;
41 ThreadID GetThreadID(uptr index) const override;
4242 uptr ThreadCount() const override;
4343};
4444
......@@ -68,7 +68,7 @@ PtraceRegistersStatus SuspendedThreadsListWindows::GetRegistersAndSP(
6868 return REGISTERS_AVAILABLE;
6969}
7070
71tid_t SuspendedThreadsListWindows::GetThreadID(uptr index) const {
71ThreadID SuspendedThreadsListWindows::GetThreadID(uptr index) const {
7272 CHECK_LT(index, threadIds.size());
7373 return threadIds[index];
7474}
lib/libtsan/sanitizer_common/sanitizer_symbolizer_internal.h+5-1
......@@ -83,7 +83,7 @@ class SymbolizerProcess {
8383 const char *SendCommand(const char *command);
8484
8585 protected:
86 ~SymbolizerProcess() {}
86 ~SymbolizerProcess();
8787
8888 /// The maximum number of arguments required to invoke a tool process.
8989 static const unsigned kArgVMax = 16;
......@@ -114,6 +114,10 @@ class SymbolizerProcess {
114114 fd_t input_fd_;
115115 fd_t output_fd_;
116116
117 // We hold on to the child's stdin fd (the read end of the pipe)
118 // so that when we write to it, we don't get a SIGPIPE
119 fd_t child_stdin_fd_;
120
117121 InternalMmapVector<char> buffer_;
118122
119123 static const uptr kMaxTimesRestarted = 5;
lib/libtsan/sanitizer_common/sanitizer_symbolizer_libcdep.cpp+11-1
......@@ -476,10 +476,11 @@ const char *LLVMSymbolizer::FormatAndSendCommand(const char *command_prefix,
476476 return symbolizer_process_->SendCommand(buffer_);
477477}
478478
479SymbolizerProcess::SymbolizerProcess(const char *path, bool use_posix_spawn)
479SymbolizerProcess::SymbolizerProcess(const char* path, bool use_posix_spawn)
480480 : path_(path),
481481 input_fd_(kInvalidFd),
482482 output_fd_(kInvalidFd),
483 child_stdin_fd_(kInvalidFd),
483484 times_restarted_(0),
484485 failed_to_start_(false),
485486 reported_invalid_path_(false),
......@@ -488,6 +489,11 @@ SymbolizerProcess::SymbolizerProcess(const char *path, bool use_posix_spawn)
488489 CHECK_NE(path_[0], '\0');
489490}
490491
492SymbolizerProcess::~SymbolizerProcess() {
493 if (child_stdin_fd_ != kInvalidFd)
494 CloseFile(child_stdin_fd_);
495}
496
491497static bool IsSameModule(const char *path) {
492498 if (const char *ProcessName = GetProcessName()) {
493499 if (const char *SymbolizerName = StripModuleName(path)) {
......@@ -533,6 +539,10 @@ bool SymbolizerProcess::Restart() {
533539 CloseFile(input_fd_);
534540 if (output_fd_ != kInvalidFd)
535541 CloseFile(output_fd_);
542 if (child_stdin_fd_ != kInvalidFd) {
543 CloseFile(child_stdin_fd_);
544 child_stdin_fd_ = kInvalidFd; // Don't free in destructor
545 }
536546 return StartSymbolizerSubprocess();
537547}
538548
lib/libtsan/sanitizer_common/sanitizer_symbolizer_mac.cpp+86-29
......@@ -78,13 +78,25 @@ class AtosSymbolizerProcess final : public SymbolizerProcess {
7878 }
7979
8080 bool ReachedEndOfOutput(const char *buffer, uptr length) const override {
81 return (length >= 1 && buffer[length - 1] == '\n');
81 if (common_flags()->symbolize_inline_frames) {
82 // When running with -i, atos sends two newlines at the end of each
83 // address it symbolizes. This indicates the end of the set of frames
84 // for a particular address.
85 return length >= 2 && buffer[length - 1] == '\n' &&
86 buffer[length - 2] == '\n';
87 } else {
88 // When running without -i, atos only sends a single newline at
89 // the end of each address it symbolizes.
90 return length >= 1 && buffer[length - 1] == '\n';
91 }
8292 }
8393
8494 void GetArgV(const char *path_to_binary,
8595 const char *(&argv)[kArgVMax]) const override {
8696 int i = 0;
8797 argv[i++] = path_to_binary;
98 if (common_flags()->symbolize_inline_frames)
99 argv[i++] = "-i";
88100 argv[i++] = "-p";
89101 argv[i++] = &pid_str_[0];
90102 if (GetMacosAlignedVersion() == MacosVersion(10, 9)) {
......@@ -102,12 +114,16 @@ class AtosSymbolizerProcess final : public SymbolizerProcess {
102114
103115#undef K_ATOS_ENV_VAR
104116
105static bool ParseCommandOutput(const char *str, uptr addr, char **out_name,
106 char **out_module, char **out_file, uptr *line,
107 uptr *start_address) {
117// Parses a single frame (one line) from str, and returns the pointer to the
118// next character to parse (i.e. after the newline) if successful. If
119// it fails, returns NULL.
120static const char* ParseCommandOutput(const char* str, uptr addr,
121 char** out_name, char** out_module,
122 char** out_file, uptr* line,
123 uptr* start_address) {
108124 // Trim ending newlines.
109125 char *trim;
110 ExtractTokenUpToDelimiter(str, "\n", &trim);
126 str = ExtractTokenUpToDelimiter(str, "\n", &trim);
111127
112128 // The line from `atos` is in one of these formats:
113129 // myfunction (in library.dylib) (sourcefile.c:17)
......@@ -124,7 +140,7 @@ static bool ParseCommandOutput(const char *str, uptr addr, char **out_name,
124140 if (rest[0] == '\0') {
125141 InternalFree(symbol_name);
126142 InternalFree(trim);
127 return false;
143 return NULL;
128144 }
129145
130146 if (internal_strncmp(symbol_name, "0x", 2) != 0)
......@@ -149,7 +165,7 @@ static bool ParseCommandOutput(const char *str, uptr addr, char **out_name,
149165 }
150166
151167 InternalFree(trim);
152 return true;
168 return str;
153169}
154170
155171AtosSymbolizer::AtosSymbolizer(const char *path, LowLevelAllocator *allocator)
......@@ -161,31 +177,72 @@ bool AtosSymbolizer::SymbolizePC(uptr addr, SymbolizedStack *stack) {
161177 char command[32];
162178 internal_snprintf(command, sizeof(command), "0x%zx\n", addr);
163179 const char *buf = process_->SendCommand(command);
164 if (!buf) return false;
165 uptr line;
166 uptr start_address = AddressInfo::kUnknown;
167 if (!ParseCommandOutput(buf, addr, &stack->info.function, &stack->info.module,
168 &stack->info.file, &line, &start_address)) {
169 Report("WARNING: atos failed to symbolize address \"0x%zx\"\n", addr);
180 if (!buf)
170181 return false;
171 }
172 stack->info.line = (int)line;
173
174 if (start_address == AddressInfo::kUnknown) {
175 // Fallback to dladdr() to get function start address if atos doesn't report
176 // it.
177 Dl_info info;
178 int result = dladdr((const void *)addr, &info);
179 if (result)
180 start_address = reinterpret_cast<uptr>(info.dli_saddr);
181 }
182182
183 // Only assign to `function_offset` if we were able to get the function's
184 // start address and we got a sensible `start_address` (dladdr doesn't always
185 // ensure that `addr >= sym_addr`).
186 if (start_address != AddressInfo::kUnknown && addr >= start_address) {
187 stack->info.function_offset = addr - start_address;
183 SymbolizedStack* last = stack;
184 bool top_frame = true;
185
186 // Parse one line of input (i.e. one frame).
187 //
188 // When symbolize_inline_frames=true, an empty line
189 // (i.e. \n at the beginning of a line) indicates that the last
190 // frame has been sent.
191 //
192 // When symbolize_inline_frames=false, the symbolizer will send only
193 // one frame (without a empty line), so loop runs exactly once
194 // and hits an early `break`.
195 while (*buf != '\n') {
196 uptr line;
197 uptr start_address = AddressInfo::kUnknown;
198
199 SymbolizedStack* cur;
200 if (top_frame) {
201 cur = stack;
202 } else {
203 cur = SymbolizedStack::New(stack->info.address);
204 cur->info.FillModuleInfo(stack->info.module, stack->info.module_offset,
205 stack->info.module_arch);
206 last->next = cur;
207 last = cur;
208 }
209
210 // Parse one line of input (i.e. one frame)
211 // If this succeeds, buf will be updated to point to the first character
212 // after the newline.
213 buf = ParseCommandOutput(buf, addr, &cur->info.function, &cur->info.module,
214 &cur->info.file, &line, &start_address);
215
216 // Upon failure, ParseCommandOutput returns NULL.
217 if (!buf) {
218 Report("WARNING: atos failed to symbolize address \"0x%zx\"\n", addr);
219 return false;
220 }
221 cur->info.line = (int)line;
222
223 if (top_frame && start_address == AddressInfo::kUnknown) {
224 // Fallback to dladdr() to get function start address if atos doesn't
225 // report it.
226 Dl_info info;
227 int result = dladdr((const void*)addr, &info);
228 if (result)
229 start_address = reinterpret_cast<uptr>(info.dli_saddr);
230 }
231
232 // Only assign to `function_offset` if we were able to get the function's
233 // start address and we got a sensible `start_address` (dladdr doesn't
234 // always ensure that `addr >= sym_addr`).
235 if (start_address != AddressInfo::kUnknown && addr >= start_address) {
236 cur->info.function_offset = addr - start_address;
237 }
238
239 // atos only sends one line when inline frames are off
240 if (!common_flags()->symbolize_inline_frames)
241 break;
242
243 top_frame = false;
188244 }
245
189246 return true;
190247}
191248
lib/libtsan/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp+27-16
......@@ -156,30 +156,34 @@ bool SymbolizerProcess::StartSymbolizerSubprocess() {
156156 Printf("\n");
157157 }
158158
159 fd_t infd[2] = {}, outfd[2] = {};
160 if (!CreateTwoHighNumberedPipes(infd, outfd)) {
161 Report(
162 "WARNING: Can't create a socket pair to start "
163 "external symbolizer (errno: %d)\n",
164 errno);
165 return false;
166 }
167
159168 if (use_posix_spawn_) {
160169# if SANITIZER_APPLE
161 fd_t fd = internal_spawn(argv, const_cast<const char **>(GetEnvP()), &pid);
162 if (fd == kInvalidFd) {
170 bool success = internal_spawn(argv, const_cast<const char**>(GetEnvP()),
171 &pid, outfd[0], infd[1]);
172 if (!success) {
163173 Report("WARNING: failed to spawn external symbolizer (errno: %d)\n",
164174 errno);
175 internal_close(infd[0]);
176 internal_close(outfd[1]);
165177 return false;
166178 }
167179
168 input_fd_ = fd;
169 output_fd_ = fd;
180 // We intentionally hold on to the read-end so that we don't get a SIGPIPE
181 child_stdin_fd_ = outfd[0];
182
170183# else // SANITIZER_APPLE
171184 UNIMPLEMENTED();
172185# endif // SANITIZER_APPLE
173186 } else {
174 fd_t infd[2] = {}, outfd[2] = {};
175 if (!CreateTwoHighNumberedPipes(infd, outfd)) {
176 Report(
177 "WARNING: Can't create a socket pair to start "
178 "external symbolizer (errno: %d)\n",
179 errno);
180 return false;
181 }
182
183187 pid = StartSubprocess(path_, argv, GetEnvP(), /* stdin */ outfd[0],
184188 /* stdout */ infd[1]);
185189 if (pid < 0) {
......@@ -187,11 +191,11 @@ bool SymbolizerProcess::StartSymbolizerSubprocess() {
187191 internal_close(outfd[1]);
188192 return false;
189193 }
190
191 input_fd_ = infd[0];
192 output_fd_ = outfd[1];
193194 }
194195
196 input_fd_ = infd[0];
197 output_fd_ = outfd[1];
198
195199 CHECK_GT(pid, 0);
196200
197201 // Check that symbolizer subprocess started successfully.
......@@ -505,6 +509,13 @@ static void ChooseSymbolizerTools(IntrusiveList<SymbolizerTool> *list,
505509 }
506510
507511# 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 }
508519 VReport(2, "Using dladdr symbolizer.\n");
509520 list->push_back(new (*allocator) DlAddrSymbolizer());
510521# endif // SANITIZER_APPLE
lib/libtsan/sanitizer_common/sanitizer_thread_registry.cpp+5-4
......@@ -80,7 +80,7 @@ void ThreadContextBase::SetFinished() {
8080 OnFinished();
8181}
8282
83void ThreadContextBase::SetStarted(tid_t _os_id, ThreadType _thread_type,
83void ThreadContextBase::SetStarted(ThreadID _os_id, ThreadType _thread_type,
8484 void *arg) {
8585 status = ThreadStatusRunning;
8686 os_id = _os_id;
......@@ -228,7 +228,8 @@ static bool FindThreadContextByOsIdCallback(ThreadContextBase *tctx,
228228 tctx->status != ThreadStatusDead);
229229}
230230
231ThreadContextBase *ThreadRegistry::FindThreadContextByOsIDLocked(tid_t os_id) {
231ThreadContextBase *ThreadRegistry::FindThreadContextByOsIDLocked(
232 ThreadID os_id) {
232233 return FindThreadContextLocked(FindThreadContextByOsIdCallback,
233234 (void *)os_id);
234235}
......@@ -322,8 +323,8 @@ ThreadStatus ThreadRegistry::FinishThread(u32 tid) {
322323 return prev_status;
323324}
324325
325void ThreadRegistry::StartThread(u32 tid, tid_t os_id, ThreadType thread_type,
326 void *arg) {
326void ThreadRegistry::StartThread(u32 tid, ThreadID os_id,
327 ThreadType thread_type, void *arg) {
327328 ThreadRegistryLock l(this);
328329 running_threads_++;
329330 ThreadContextBase *tctx = threads_[tid];
lib/libtsan/sanitizer_common/sanitizer_thread_registry.h+4-4
......@@ -43,7 +43,7 @@ class ThreadContextBase {
4343 const u32 tid; // Thread ID. Main thread should have tid = 0.
4444 u64 unique_id; // Unique thread ID.
4545 u32 reuse_count; // Number of times this tid was reused.
46 tid_t os_id; // PID (used for reporting).
46 ThreadID os_id; // PID (used for reporting).
4747 uptr user_id; // Some opaque user thread id (e.g. pthread_t).
4848 char name[64]; // As annotated by user.
4949
......@@ -62,7 +62,7 @@ class ThreadContextBase {
6262 void SetDead();
6363 void SetJoined(void *arg);
6464 void SetFinished();
65 void SetStarted(tid_t _os_id, ThreadType _thread_type, void *arg);
65 void SetStarted(ThreadID _os_id, ThreadType _thread_type, void *arg);
6666 void SetCreated(uptr _user_id, u64 _unique_id, bool _detached,
6767 u32 _parent_tid, u32 _stack_tid, void *arg);
6868 void Reset();
......@@ -126,7 +126,7 @@ class SANITIZER_MUTEX ThreadRegistry {
126126 // is found.
127127 ThreadContextBase *FindThreadContextLocked(FindThreadCallback cb,
128128 void *arg);
129 ThreadContextBase *FindThreadContextByOsIDLocked(tid_t os_id);
129 ThreadContextBase *FindThreadContextByOsIDLocked(ThreadID os_id);
130130
131131 void SetThreadName(u32 tid, const char *name);
132132 void SetThreadNameByUserId(uptr user_id, const char *name);
......@@ -134,7 +134,7 @@ class SANITIZER_MUTEX ThreadRegistry {
134134 void JoinThread(u32 tid, void *arg);
135135 // Finishes thread and returns previous status.
136136 ThreadStatus FinishThread(u32 tid);
137 void StartThread(u32 tid, tid_t os_id, ThreadType thread_type, void *arg);
137 void StartThread(u32 tid, ThreadID os_id, ThreadType thread_type, void *arg);
138138 u32 ConsumeThreadUserId(uptr user_id);
139139 void SetThreadUserId(u32 tid, uptr user_id);
140140
lib/libtsan/sanitizer_common/sanitizer_win.cpp+1-3
......@@ -108,9 +108,7 @@ int internal_dlinfo(void *handle, int request, void *p) {
108108
109109// In contrast to POSIX, on Windows GetCurrentThreadId()
110110// returns a system-unique identifier.
111tid_t GetTid() {
112 return GetCurrentThreadId();
113}
111ThreadID GetTid() { return GetCurrentThreadId(); }
114112
115113uptr GetThreadSelf() {
116114 return GetTid();
lib/libtsan/tsan_debugging.cpp+2-2
......@@ -165,7 +165,7 @@ int __tsan_get_report_mutex(void *report, uptr idx, uptr *mutex_id, void **addr,
165165}
166166
167167SANITIZER_INTERFACE_ATTRIBUTE
168int __tsan_get_report_thread(void *report, uptr idx, int *tid, tid_t *os_id,
168int __tsan_get_report_thread(void *report, uptr idx, int *tid, ThreadID *os_id,
169169 int *running, const char **name, int *parent_tid,
170170 void **trace, uptr trace_size) {
171171 const ReportDesc *rep = (ReportDesc *)report;
......@@ -242,7 +242,7 @@ const char *__tsan_locate_address(uptr addr, char *name, uptr name_size,
242242
243243SANITIZER_INTERFACE_ATTRIBUTE
244244int __tsan_get_alloc_stack(uptr addr, uptr *trace, uptr size, int *thread_id,
245 tid_t *os_id) {
245 ThreadID *os_id) {
246246 MBlock *b = 0;
247247 Allocator *a = allocator();
248248 if (a->PointerIsMine((void *)addr)) {
lib/libtsan/tsan_flags.cpp+37
......@@ -20,6 +20,43 @@
2020#include "tsan_rtl.h"
2121#include "ubsan/ubsan_flags.h"
2222
23#if SANITIZER_APPLE && !SANITIZER_GO
24namespace __sanitizer {
25
26template <>
27inline bool FlagHandler<LockDuringWriteSetting>::Parse(const char *value) {
28 if (internal_strcmp(value, "on") == 0) {
29 *t_ = kLockDuringAllWrites;
30 return true;
31 }
32 if (internal_strcmp(value, "disable_for_current_process") == 0) {
33 *t_ = kNoLockDuringWritesCurrentProcess;
34 return true;
35 }
36 if (internal_strcmp(value, "disable_for_all_processes") == 0) {
37 *t_ = kNoLockDuringWritesAllProcesses;
38 return true;
39 }
40 Printf("ERROR: Invalid value for signal handler option: '%s'\n", value);
41 return false;
42}
43
44template <>
45inline bool FlagHandler<LockDuringWriteSetting>::Format(char *buffer,
46 uptr size) {
47 switch (*t_) {
48 case kLockDuringAllWrites:
49 return FormatString(buffer, size, "on");
50 case kNoLockDuringWritesCurrentProcess:
51 return FormatString(buffer, size, "disable_for_current_process");
52 case kNoLockDuringWritesAllProcesses:
53 return FormatString(buffer, size, "disable_for_all_processes");
54 }
55}
56
57} // namespace __sanitizer
58#endif // SANITIZER_APPLE && !SANITIZER_GO
59
2360namespace __tsan {
2461
2562// Can be overriden in frontend.
lib/libtsan/tsan_flags.h+8
......@@ -16,6 +16,14 @@
1616#include "sanitizer_common/sanitizer_flags.h"
1717#include "sanitizer_common/sanitizer_deadlock_detector_interface.h"
1818
19#if SANITIZER_APPLE && !SANITIZER_GO
20enum LockDuringWriteSetting {
21 kLockDuringAllWrites,
22 kNoLockDuringWritesCurrentProcess,
23 kNoLockDuringWritesAllProcesses,
24};
25#endif
26
1927namespace __tsan {
2028
2129struct Flags : DDFlags {
lib/libtsan/tsan_flags.inc+12
......@@ -80,3 +80,15 @@ TSAN_FLAG(bool, shared_ptr_interceptor, true,
8080TSAN_FLAG(bool, print_full_thread_history, false,
8181 "If set, prints thread creation stacks for the threads involved in "
8282 "the report and their ancestors up to the main thread.")
83
84#if SANITIZER_APPLE && !SANITIZER_GO
85TSAN_FLAG(LockDuringWriteSetting, lock_during_write, kLockDuringAllWrites,
86 "Determines whether to obtain a lock while writing logs or error "
87 "reports. "
88 "\"on\" - [default] lock during all writes. "
89 "\"disable_for_current_process\" - don't lock during all writes in "
90 "the current process, but do lock for all writes in child "
91 "processes."
92 "\"disable_for_all_processes\" - don't lock during all writes in "
93 "the current process and it's children processes.")
94#endif
lib/libtsan/tsan_interceptors.h+9-1
......@@ -1,6 +1,9 @@
11#ifndef TSAN_INTERCEPTORS_H
22#define TSAN_INTERCEPTORS_H
33
4#if SANITIZER_APPLE && !SANITIZER_GO
5# include "sanitizer_common/sanitizer_mac.h"
6#endif
47#include "sanitizer_common/sanitizer_stacktrace.h"
58#include "tsan_rtl.h"
69
......@@ -43,7 +46,12 @@ inline bool in_symbolizer() {
4346#endif
4447
4548inline bool MustIgnoreInterceptor(ThreadState *thr) {
46 return !thr->is_inited || thr->ignore_interceptors || thr->in_ignored_lib;
49 return !thr->is_inited || thr->ignore_interceptors || thr->in_ignored_lib
50#if SANITIZER_APPLE && !SANITIZER_GO
51 || (flags()->lock_during_write != kLockDuringAllWrites &&
52 thr->in_internal_write_call)
53#endif
54 ;
4755}
4856
4957} // namespace __tsan
lib/libtsan/tsan_interceptors_mac.cpp+19
......@@ -281,6 +281,25 @@ TSAN_INTERCEPTOR(void, os_unfair_lock_lock, os_unfair_lock_t lock) {
281281 Acquire(thr, pc, (uptr)lock);
282282}
283283
284// os_unfair_lock_lock_with_flags was introduced in macOS 15
285# if defined(__MAC_15_0) || defined(__IPHONE_18_0) || defined(__TVOS_18_0) || \
286 defined(__VISIONOS_2_0) || defined(__WATCHOS_11_0)
287# pragma clang diagnostic push
288# pragma clang diagnostic ignored "-Wunguarded-availability-new"
289// We're just intercepting this - if it doesn't exist on the platform, then the
290// process shouldn't have called it in the first place.
291TSAN_INTERCEPTOR(void, os_unfair_lock_lock_with_flags, os_unfair_lock_t lock,
292 os_unfair_lock_flags_t flags) {
293 if (!cur_thread()->is_inited || cur_thread()->is_dead) {
294 return REAL(os_unfair_lock_lock_with_flags)(lock, flags);
295 }
296 SCOPED_TSAN_INTERCEPTOR(os_unfair_lock_lock_with_flags, lock, flags);
297 REAL(os_unfair_lock_lock_with_flags)(lock, flags);
298 Acquire(thr, pc, (uptr)lock);
299}
300# pragma clang diagnostic pop
301# endif
302
284303TSAN_INTERCEPTOR(void, os_unfair_lock_lock_with_options, os_unfair_lock_t lock,
285304 u32 options) {
286305 if (!cur_thread()->is_inited || cur_thread()->is_dead) {
lib/libtsan/tsan_interceptors_posix.cpp+78-32
......@@ -22,6 +22,7 @@
2222#include "sanitizer_common/sanitizer_internal_defs.h"
2323#include "sanitizer_common/sanitizer_libc.h"
2424#include "sanitizer_common/sanitizer_linux.h"
25#include "sanitizer_common/sanitizer_placement_new.h"
2526#include "sanitizer_common/sanitizer_platform_interceptors.h"
2627#include "sanitizer_common/sanitizer_platform_limits_netbsd.h"
2728#include "sanitizer_common/sanitizer_platform_limits_posix.h"
......@@ -30,6 +31,9 @@
3031#include "sanitizer_common/sanitizer_tls_get_addr.h"
3132#include "sanitizer_common/sanitizer_vector.h"
3233#include "tsan_fd.h"
34#if SANITIZER_APPLE && !SANITIZER_GO
35# include "tsan_flags.h"
36#endif
3337#include "tsan_interceptors.h"
3438#include "tsan_interface.h"
3539#include "tsan_mman.h"
......@@ -78,17 +82,6 @@ struct ucontext_t {
7882};
7983#endif
8084
81#if defined(__x86_64__) || defined(__mips__) || SANITIZER_PPC64V1 || \
82 defined(__s390x__)
83#define PTHREAD_ABI_BASE "GLIBC_2.3.2"
84#elif defined(__aarch64__) || SANITIZER_PPC64V2
85#define PTHREAD_ABI_BASE "GLIBC_2.17"
86#elif SANITIZER_LOONGARCH64
87#define PTHREAD_ABI_BASE "GLIBC_2.36"
88#elif SANITIZER_RISCV64
89# define PTHREAD_ABI_BASE "GLIBC_2.27"
90#endif
91
9285extern "C" int pthread_attr_init(void *attr);
9386extern "C" int pthread_attr_destroy(void *attr);
9487DECLARE_REAL(int, pthread_attr_getdetachstate, void *, void *)
......@@ -340,11 +333,6 @@ void ScopedInterceptor::DisableIgnoresImpl() {
340333}
341334
342335#define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func)
343#if SANITIZER_FREEBSD || SANITIZER_NETBSD
344# define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION(func)
345#else
346# define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION_VER(func, ver)
347#endif
348336#if SANITIZER_FREEBSD
349337# define TSAN_MAYBE_INTERCEPT_FREEBSD_ALIAS(func) \
350338 INTERCEPT_FUNCTION(_pthread_##func)
......@@ -1145,6 +1133,22 @@ TSAN_INTERCEPTOR(int, pthread_create,
11451133
11461134TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) {
11471135 SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret);
1136#if SANITIZER_ANDROID
1137 {
1138 // In Bionic, if the target thread has already exited when pthread_detach is
1139 // called, pthread_detach will call pthread_join internally to clean it up.
1140 // In that case, the thread has already been consumed by the pthread_detach
1141 // interceptor.
1142 Tid tid = ctx->thread_registry.FindThread(
1143 [](ThreadContextBase* tctx, void* arg) {
1144 return tctx->user_id == (uptr)arg;
1145 },
1146 th);
1147 if (tid == kInvalidTid) {
1148 return REAL(pthread_join)(th, ret);
1149 }
1150 }
1151#endif
11481152 Tid tid = ThreadConsumeTid(thr, pc, (uptr)th);
11491153 ThreadIgnoreBegin(thr, pc);
11501154 int res = BLOCK_REAL(pthread_join)(th, ret);
......@@ -1664,6 +1668,14 @@ TSAN_INTERCEPTOR(int, pthread_barrier_wait, void *b) {
16641668
16651669TSAN_INTERCEPTOR(int, pthread_once, void *o, void (*f)()) {
16661670 SCOPED_INTERCEPTOR_RAW(pthread_once, o, f);
1671#if SANITIZER_APPLE && !SANITIZER_GO
1672 if (flags()->lock_during_write != kLockDuringAllWrites &&
1673 cur_thread_init()->in_internal_write_call) {
1674 // This is needed to make it through process launch without hanging
1675 f();
1676 return 0;
1677 }
1678#endif
16671679 if (o == 0 || f == 0)
16681680 return errno_EINVAL;
16691681 atomic_uint32_t *a;
......@@ -2141,13 +2153,29 @@ static void ReportErrnoSpoiling(ThreadState *thr, uptr pc, int sig) {
21412153 // StackTrace::GetNestInstructionPc(pc) is used because return address is
21422154 // expected, OutputReport() will undo this.
21432155 ObtainCurrentStack(thr, StackTrace::GetNextInstructionPc(pc), &stack);
2144 ThreadRegistryLock l(&ctx->thread_registry);
2145 ScopedReport rep(ReportTypeErrnoInSignal);
2146 rep.SetSigNum(sig);
2147 if (!IsFiredSuppression(ctx, ReportTypeErrnoInSignal, stack)) {
2148 rep.AddStack(stack, true);
2149 OutputReport(thr, rep);
2156 // Use alloca, because malloc during signal handling deadlocks
2157 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
2158 bool suppressed;
2159 // Take a new scope as Apple platforms require the below locks released
2160 // before symbolizing in order to avoid a deadlock
2161 {
2162 ThreadRegistryLock l(&ctx->thread_registry);
2163 new (rep) ScopedReport(ReportTypeErrnoInSignal);
2164 rep->SetSigNum(sig);
2165 suppressed = IsFiredSuppression(ctx, ReportTypeErrnoInSignal, stack);
2166 if (!suppressed)
2167 rep->AddStack(stack, true);
2168#if SANITIZER_APPLE
2169 } // Close this scope to release the locks before writing report
2170#endif
2171 if (!suppressed)
2172 OutputReport(thr, *rep);
2173
2174 // Need to manually destroy this because we used placement new to allocate
2175 rep->~ScopedReport();
2176#if !SANITIZER_APPLE
21502177 }
2178#endif
21512179}
21522180
21532181static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire,
......@@ -2411,7 +2439,11 @@ TSAN_INTERCEPTOR(int, vfork, int fake) {
24112439}
24122440#endif
24132441
2414#if SANITIZER_LINUX
2442#if SANITIZER_LINUX && !SANITIZER_ANDROID
2443// Bionic's pthread_create internally calls clone. When the CLONE_THREAD flag is
2444// set, clone does not create a new process but a new thread. This is a
2445// workaround for Android. Disabling the interception of clone solves the
2446// problem in most scenarios.
24152447TSAN_INTERCEPTOR(int, clone, int (*fn)(void *), void *stack, int flags,
24162448 void *arg, int *parent_tid, void *tls, pid_t *child_tid) {
24172449 SCOPED_INTERCEPTOR_RAW(clone, fn, stack, flags, arg, parent_tid, tls,
......@@ -2888,12 +2920,12 @@ TSAN_INTERCEPTOR(void, _lwp_exit) {
28882920#endif
28892921
28902922#if SANITIZER_FREEBSD
2891TSAN_INTERCEPTOR(void, thr_exit, tid_t *state) {
2923TSAN_INTERCEPTOR(void, thr_exit, ThreadID *state) {
28922924 SCOPED_TSAN_INTERCEPTOR(thr_exit, state);
28932925 DestroyThreadState();
28942926 REAL(thr_exit(state));
28952927}
2896#define TSAN_MAYBE_INTERCEPT_THR_EXIT TSAN_INTERCEPT(thr_exit)
2928# define TSAN_MAYBE_INTERCEPT_THR_EXIT TSAN_INTERCEPT(thr_exit)
28972929#else
28982930#define TSAN_MAYBE_INTERCEPT_THR_EXIT
28992931#endif
......@@ -3024,12 +3056,26 @@ void InitializeInterceptors() {
30243056 TSAN_INTERCEPT(pthread_timedjoin_np);
30253057 #endif
30263058
3027 TSAN_INTERCEPT_VER(pthread_cond_init, PTHREAD_ABI_BASE);
3028 TSAN_INTERCEPT_VER(pthread_cond_signal, PTHREAD_ABI_BASE);
3029 TSAN_INTERCEPT_VER(pthread_cond_broadcast, PTHREAD_ABI_BASE);
3030 TSAN_INTERCEPT_VER(pthread_cond_wait, PTHREAD_ABI_BASE);
3031 TSAN_INTERCEPT_VER(pthread_cond_timedwait, PTHREAD_ABI_BASE);
3032 TSAN_INTERCEPT_VER(pthread_cond_destroy, PTHREAD_ABI_BASE);
3059 // In glibc versions older than 2.36, dlsym(RTLD_NEXT, "pthread_cond_init")
3060 // may return an outdated symbol (max(2.2,base_version)) if the port was
3061 // introduced before 2.3.2 (when the new pthread_cond_t was introduced).
3062#if SANITIZER_GLIBC && !__GLIBC_PREREQ(2, 36) && \
3063 (defined(__x86_64__) || defined(__mips__) || SANITIZER_PPC64V1 || \
3064 defined(__s390x__))
3065 INTERCEPT_FUNCTION_VER(pthread_cond_init, "GLIBC_2.3.2");
3066 INTERCEPT_FUNCTION_VER(pthread_cond_signal, "GLIBC_2.3.2");
3067 INTERCEPT_FUNCTION_VER(pthread_cond_broadcast, "GLIBC_2.3.2");
3068 INTERCEPT_FUNCTION_VER(pthread_cond_wait, "GLIBC_2.3.2");
3069 INTERCEPT_FUNCTION_VER(pthread_cond_timedwait, "GLIBC_2.3.2");
3070 INTERCEPT_FUNCTION_VER(pthread_cond_destroy, "GLIBC_2.3.2");
3071#else
3072 INTERCEPT_FUNCTION(pthread_cond_init);
3073 INTERCEPT_FUNCTION(pthread_cond_signal);
3074 INTERCEPT_FUNCTION(pthread_cond_broadcast);
3075 INTERCEPT_FUNCTION(pthread_cond_wait);
3076 INTERCEPT_FUNCTION(pthread_cond_timedwait);
3077 INTERCEPT_FUNCTION(pthread_cond_destroy);
3078#endif
30333079
30343080 TSAN_MAYBE_PTHREAD_COND_CLOCKWAIT;
30353081
......@@ -3120,7 +3166,7 @@ void InitializeInterceptors() {
31203166
31213167 TSAN_INTERCEPT(fork);
31223168 TSAN_INTERCEPT(vfork);
3123#if SANITIZER_LINUX
3169#if SANITIZER_LINUX && !SANITIZER_ANDROID
31243170 TSAN_INTERCEPT(clone);
31253171#endif
31263172#if !SANITIZER_ANDROID
lib/libtsan/tsan_interface.h+3-3
......@@ -16,7 +16,7 @@
1616#define TSAN_INTERFACE_H
1717
1818#include <sanitizer_common/sanitizer_internal_defs.h>
19using __sanitizer::tid_t;
19using __sanitizer::ThreadID;
2020using __sanitizer::uptr;
2121
2222// This header should NOT include any other headers.
......@@ -175,7 +175,7 @@ int __tsan_get_report_mutex(void *report, uptr idx, uptr *mutex_id, void **addr,
175175
176176// Returns information about threads included in the report.
177177SANITIZER_INTERFACE_ATTRIBUTE
178int __tsan_get_report_thread(void *report, uptr idx, int *tid, tid_t *os_id,
178int __tsan_get_report_thread(void *report, uptr idx, int *tid, ThreadID *os_id,
179179 int *running, const char **name, int *parent_tid,
180180 void **trace, uptr trace_size);
181181
......@@ -192,7 +192,7 @@ const char *__tsan_locate_address(uptr addr, char *name, uptr name_size,
192192// Returns the allocation stack for a heap pointer.
193193SANITIZER_INTERFACE_ATTRIBUTE
194194int __tsan_get_alloc_stack(uptr addr, uptr *trace, uptr size, int *thread_id,
195 tid_t *os_id);
195 ThreadID *os_id);
196196
197197#endif // SANITIZER_GO
198198
lib/libtsan/tsan_interface_ann.cpp+23-9
......@@ -437,16 +437,30 @@ void __tsan_mutex_post_divert(void *addr, unsigned flagz) {
437437}
438438
439439static void ReportMutexHeldWrongContext(ThreadState *thr, uptr pc) {
440 ThreadRegistryLock l(&ctx->thread_registry);
441 ScopedReport rep(ReportTypeMutexHeldWrongContext);
442 for (uptr i = 0; i < thr->mset.Size(); ++i) {
443 MutexSet::Desc desc = thr->mset.Get(i);
444 rep.AddMutex(desc.addr, desc.stack_id);
440 // Use alloca, because malloc during signal handling deadlocks
441 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
442 // Take a new scope as Apple platforms require the below locks released
443 // before symbolizing in order to avoid a deadlock
444 {
445 ThreadRegistryLock l(&ctx->thread_registry);
446 new (rep) ScopedReport(ReportTypeMutexHeldWrongContext);
447 for (uptr i = 0; i < thr->mset.Size(); ++i) {
448 MutexSet::Desc desc = thr->mset.Get(i);
449 rep->AddMutex(desc.addr, desc.stack_id);
450 }
451 VarSizeStackTrace trace;
452 ObtainCurrentStack(thr, pc, &trace);
453 rep->AddStack(trace, true);
454#if SANITIZER_APPLE
455 } // Close this scope to release the locks
456#endif
457 OutputReport(thr, *rep);
458
459 // Need to manually destroy this because we used placement new to allocate
460 rep->~ScopedReport();
461#if !SANITIZER_APPLE
445462 }
446 VarSizeStackTrace trace;
447 ObtainCurrentStack(thr, pc, &trace);
448 rep.AddStack(trace, true);
449 OutputReport(thr, rep);
463#endif
450464}
451465
452466INTERFACE_ATTRIBUTE
lib/libtsan/tsan_mman.cpp+18-4
......@@ -182,10 +182,24 @@ static void SignalUnsafeCall(ThreadState *thr, uptr pc) {
182182 ObtainCurrentStack(thr, pc, &stack);
183183 if (IsFiredSuppression(ctx, ReportTypeSignalUnsafe, stack))
184184 return;
185 ThreadRegistryLock l(&ctx->thread_registry);
186 ScopedReport rep(ReportTypeSignalUnsafe);
187 rep.AddStack(stack, true);
188 OutputReport(thr, rep);
185 // Use alloca, because malloc during signal handling deadlocks
186 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
187 // Take a new scope as Apple platforms require the below locks released
188 // before symbolizing in order to avoid a deadlock
189 {
190 ThreadRegistryLock l(&ctx->thread_registry);
191 new (rep) ScopedReport(ReportTypeSignalUnsafe);
192 rep->AddStack(stack, true);
193#if SANITIZER_APPLE
194 } // Close this scope to release the locks
195#endif
196 OutputReport(thr, *rep);
197
198 // Need to manually destroy this because we used placement new to allocate
199 rep->~ScopedReport();
200#if !SANITIZER_APPLE
201 }
202#endif
189203}
190204
191205
lib/libtsan/tsan_platform.h+44-7
......@@ -681,6 +681,32 @@ struct MappingGoMips64_47 {
681681 static const uptr kShadowAdd = 0x200000000000ull;
682682};
683683
684/* Go on linux/riscv64 (39-bit VMA)
6850000 0001 0000 - 000f 0000 0000: executable and heap (60 GiB)
686000f 0000 0000 - 0010 0000 0000: -
6870010 0000 0000 - 0030 0000 0000: shadow - 128 GiB ( ~ 2 * app)
6880030 0000 0000 - 0038 0000 0000: metainfo - 32 GiB ( ~ 0.5 * app)
6890038 0000 0000 - 0040 0000 0000: -
690*/
691struct MappingGoRiscv64_39 {
692 static const uptr kMetaShadowBeg = 0x003000000000ull;
693 static const uptr kMetaShadowEnd = 0x003800000000ull;
694 static const uptr kShadowBeg = 0x001000000000ull;
695 static const uptr kShadowEnd = 0x003000000000ull;
696 static const uptr kLoAppMemBeg = 0x000000010000ull;
697 static const uptr kLoAppMemEnd = 0x000f00000000ull;
698 static const uptr kMidAppMemBeg = 0;
699 static const uptr kMidAppMemEnd = 0;
700 static const uptr kHiAppMemBeg = 0;
701 static const uptr kHiAppMemEnd = 0;
702 static const uptr kHeapMemBeg = 0;
703 static const uptr kHeapMemEnd = 0;
704 static const uptr kVdsoBeg = 0;
705 static const uptr kShadowMsk = 0;
706 static const uptr kShadowXor = 0;
707 static const uptr kShadowAdd = 0x001000000000ull;
708};
709
684710/* Go on linux/riscv64 (48-bit VMA)
6857110000 0001 0000 - 00e0 0000 0000: executable and heap (896 GiB)
68671200e0 0000 0000 - 2000 0000 0000: -
......@@ -689,13 +715,13 @@ struct MappingGoMips64_47 {
6897153000 0000 0000 - 3100 0000 0000: metainfo - 1 TiB ( ~ 1 * app)
6907163100 0000 0000 - 8000 0000 0000: -
691717*/
692struct MappingGoRiscv64 {
718struct MappingGoRiscv64_48 {
693719 static const uptr kMetaShadowBeg = 0x300000000000ull;
694720 static const uptr kMetaShadowEnd = 0x310000000000ull;
695721 static const uptr kShadowBeg = 0x200000000000ull;
696722 static const uptr kShadowEnd = 0x240000000000ull;
697723 static const uptr kLoAppMemBeg = 0x000000010000ull;
698 static const uptr kLoAppMemEnd = 0x000e00000000ull;
724 static const uptr kLoAppMemEnd = 0x00e000000000ull;
699725 static const uptr kMidAppMemBeg = 0;
700726 static const uptr kMidAppMemEnd = 0;
701727 static const uptr kHiAppMemBeg = 0;
......@@ -756,7 +782,12 @@ ALWAYS_INLINE auto SelectMapping(Arg arg) {
756782# elif defined(__loongarch_lp64)
757783 return Func::template Apply<MappingGoLoongArch64_47>(arg);
758784# elif SANITIZER_RISCV64
759 return Func::template Apply<MappingGoRiscv64>(arg);
785 switch (vmaSize) {
786 case 39:
787 return Func::template Apply<MappingGoRiscv64_39>(arg);
788 case 48:
789 return Func::template Apply<MappingGoRiscv64_48>(arg);
790 }
760791# elif SANITIZER_WINDOWS
761792 return Func::template Apply<MappingGoWindows>(arg);
762793# else
......@@ -827,7 +858,8 @@ void ForEachMapping() {
827858 Func::template Apply<MappingGoAarch64>();
828859 Func::template Apply<MappingGoLoongArch64_47>();
829860 Func::template Apply<MappingGoMips64_47>();
830 Func::template Apply<MappingGoRiscv64>();
861 Func::template Apply<MappingGoRiscv64_39>();
862 Func::template Apply<MappingGoRiscv64_48>();
831863 Func::template Apply<MappingGoS390x>();
832864}
833865
......@@ -926,7 +958,9 @@ struct IsAppMemImpl {
926958};
927959
928960ALWAYS_INLINE
929bool IsAppMem(uptr mem) { return SelectMapping<IsAppMemImpl>(mem); }
961bool IsAppMem(uptr mem) {
962 return SelectMapping<IsAppMemImpl>(STRIP_MTE_TAG(mem));
963}
930964
931965struct IsShadowMemImpl {
932966 template <typename Mapping>
......@@ -965,7 +999,8 @@ struct MemToShadowImpl {
965999
9661000ALWAYS_INLINE
9671001RawShadow *MemToShadow(uptr x) {
968 return reinterpret_cast<RawShadow *>(SelectMapping<MemToShadowImpl>(x));
1002 return reinterpret_cast<RawShadow*>(
1003 SelectMapping<MemToShadowImpl>(STRIP_MTE_TAG(x)));
9691004}
9701005
9711006struct MemToMetaImpl {
......@@ -979,7 +1014,9 @@ struct MemToMetaImpl {
9791014};
9801015
9811016ALWAYS_INLINE
982u32 *MemToMeta(uptr x) { return SelectMapping<MemToMetaImpl>(x); }
1017u32* MemToMeta(uptr x) {
1018 return SelectMapping<MemToMetaImpl>(STRIP_MTE_TAG(x));
1019}
9831020
9841021struct ShadowToMemImpl {
9851022 template <typename Mapping>
lib/libtsan/tsan_platform_linux.cpp+42-14
......@@ -393,9 +393,9 @@ void InitializePlatformEarly() {
393393 Die();
394394 }
395395# else
396 if (vmaSize != 48) {
396 if (vmaSize != 39 && vmaSize != 48) {
397397 Printf("FATAL: ThreadSanitizer: unsupported VMA range\n");
398 Printf("FATAL: Found %zd - Supported 48\n", vmaSize);
398 Printf("FATAL: Found %zd - Supported 39 and 48\n", vmaSize);
399399 Die();
400400 }
401401# endif
......@@ -415,7 +415,7 @@ void InitializePlatform() {
415415 // is not compiled with -pie.
416416#if !SANITIZER_GO
417417 {
418# if SANITIZER_LINUX && (defined(__aarch64__) || defined(__loongarch_lp64))
418# if INIT_LONGJMP_XOR_KEY
419419 // Initialize the xor key used in {sig}{set,long}jump.
420420 InitializeLongjmpXorKey();
421421# endif
......@@ -486,8 +486,20 @@ int ExtractRecvmsgFDs(void *msgp, int *fds, int nfd) {
486486
487487// Reverse operation of libc stack pointer mangling
488488static uptr UnmangleLongJmpSp(uptr mangled_sp) {
489#if defined(__x86_64__)
490# if SANITIZER_LINUX
489# if SANITIZER_ANDROID && INIT_LONGJMP_XOR_KEY
490 if (longjmp_xor_key == 0) {
491 // bionic libc initialization process: __libc_init_globals ->
492 // __libc_init_vdso (calls strcmp) -> __libc_init_setjmp_cookie. strcmp is
493 // intercepted by TSan, so during TSan initialization the setjmp_cookie
494 // remains uninitialized. On Android, longjmp_xor_key must be set on first
495 // use.
496 InitializeLongjmpXorKey();
497 CHECK_NE(longjmp_xor_key, 0);
498 }
499# endif
500
501# if defined(__x86_64__)
502# if SANITIZER_LINUX
491503 // Reverse of:
492504 // xor %fs:0x30, %rsi
493505 // rol $0x11, %rsi
......@@ -542,13 +554,23 @@ static uptr UnmangleLongJmpSp(uptr mangled_sp) {
542554# else
543555# define LONG_JMP_SP_ENV_SLOT 2
544556# endif
545#elif SANITIZER_LINUX
546# ifdef __aarch64__
547# define LONG_JMP_SP_ENV_SLOT 13
548# elif defined(__loongarch__)
549# define LONG_JMP_SP_ENV_SLOT 1
550# elif defined(__mips64)
551# define LONG_JMP_SP_ENV_SLOT 1
557# elif SANITIZER_ANDROID
558# ifdef __aarch64__
559# define LONG_JMP_SP_ENV_SLOT 3
560# elif SANITIZER_RISCV64
561# define LONG_JMP_SP_ENV_SLOT 3
562# elif defined(__x86_64__)
563# define LONG_JMP_SP_ENV_SLOT 6
564# else
565# error unsupported
566# endif
567# elif SANITIZER_LINUX
568# ifdef __aarch64__
569# define LONG_JMP_SP_ENV_SLOT 13
570# elif defined(__loongarch__)
571# define LONG_JMP_SP_ENV_SLOT 1
572# elif defined(__mips64)
573# define LONG_JMP_SP_ENV_SLOT 1
552574# elif SANITIZER_RISCV64
553575# define LONG_JMP_SP_ENV_SLOT 13
554576# elif defined(__s390x__)
......@@ -556,7 +578,7 @@ static uptr UnmangleLongJmpSp(uptr mangled_sp) {
556578# else
557579# define LONG_JMP_SP_ENV_SLOT 6
558580# endif
559#endif
581# endif
560582
561583uptr ExtractLongJmpSp(uptr *env) {
562584 uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT];
......@@ -653,7 +675,13 @@ ThreadState *cur_thread() {
653675 }
654676 CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, &oldset, nullptr));
655677 }
656 return thr;
678
679 // Skia calls mallopt(M_THREAD_DISABLE_MEM_INIT, 1), which sets the least
680 // significant bit of TLS_SLOT_SANITIZER to 1. Scudo allocator uses this bit
681 // as a flag to disable memory initialization. This is a workaround to get the
682 // correct ThreadState pointer.
683 uptr addr = reinterpret_cast<uptr>(thr);
684 return reinterpret_cast<ThreadState*>(addr & ~1ULL);
657685}
658686
659687void set_cur_thread(ThreadState *thr) {
lib/libtsan/tsan_platform_mac.cpp+16-3
......@@ -226,9 +226,20 @@ static void ThreadTerminateCallback(uptr thread) {
226226void InitializePlatformEarly() {
227227# if !SANITIZER_GO && SANITIZER_IOS
228228 uptr max_vm = GetMaxUserVirtualAddress() + 1;
229 if (max_vm != HiAppMemEnd()) {
230 Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n",
231 (void *)max_vm, (void *)HiAppMemEnd());
229 if (max_vm < HiAppMemEnd()) {
230 Report(
231 "ThreadSanitizer: Unsupported virtual memory layout:\n\tVM address "
232 "limit = %p\n\tExpected %p.\n",
233 (void*)max_vm, (void*)HiAppMemEnd());
234 Die();
235 }
236 // In some configurations, the max_vm is expanded, but much of this space is
237 // already mapped. TSAN will not work in this configuration.
238 if (!MemoryRangeIsAvailable(HiAppMemEnd() - 1, HiAppMemEnd() - 1)) {
239 Report(
240 "ThreadSanitizer: Unsupported virtual memory layout: Address %p is "
241 "already mapped.\n",
242 (void*)(HiAppMemEnd() - 1));
232243 Die();
233244 }
234245#endif
......@@ -248,7 +259,9 @@ void InitializePlatform() {
248259
249260 ThreadEventCallbacks callbacks = {
250261 .create = ThreadCreateCallback,
262 .start = nullptr,
251263 .terminate = ThreadTerminateCallback,
264 .destroy = nullptr,
252265 };
253266 InstallPthreadIntrospectionHook(callbacks);
254267#endif
lib/libtsan/tsan_report.h+14-1
......@@ -12,6 +12,8 @@
1212#ifndef TSAN_REPORT_H
1313#define TSAN_REPORT_H
1414
15#include "sanitizer_common/sanitizer_internal_defs.h"
16#include "sanitizer_common/sanitizer_stacktrace.h"
1517#include "sanitizer_common/sanitizer_symbolizer.h"
1618#include "sanitizer_common/sanitizer_thread_registry.h"
1719#include "sanitizer_common/sanitizer_vector.h"
......@@ -56,6 +58,7 @@ struct ReportMop {
5658 bool atomic;
5759 uptr external_tag;
5860 Vector<ReportMopMutex> mset;
61 StackTrace stack_trace;
5962 ReportStack *stack;
6063
6164 ReportMop();
......@@ -79,25 +82,34 @@ struct ReportLocation {
7982 int fd = 0;
8083 bool fd_closed = false;
8184 bool suppressable = false;
85 StackID stack_id = 0;
8286 ReportStack *stack = nullptr;
8387};
8488
8589struct ReportThread {
8690 Tid id;
87 tid_t os_id;
91 ThreadID os_id;
8892 bool running;
8993 ThreadType thread_type;
9094 char *name;
9195 Tid parent_tid;
96 StackID stack_id;
9297 ReportStack *stack;
98 bool suppressable;
9399};
94100
95101struct ReportMutex {
96102 int id;
97103 uptr addr;
104 StackID stack_id;
98105 ReportStack *stack;
99106};
100107
108struct AddedLocationAddr {
109 uptr addr;
110 usize locs_idx;
111};
112
101113class ReportDesc {
102114 public:
103115 ReportType typ;
......@@ -105,6 +117,7 @@ class ReportDesc {
105117 Vector<ReportStack*> stacks;
106118 Vector<ReportMop*> mops;
107119 Vector<ReportLocation*> locs;
120 Vector<AddedLocationAddr> added_location_addrs;
108121 Vector<ReportMutex*> mutexes;
109122 Vector<ReportThread*> threads;
110123 Vector<Tid> unique_tids;
lib/libtsan/tsan_rtl.cpp+14
......@@ -40,6 +40,13 @@ SANITIZER_WEAK_DEFAULT_IMPL
4040void __tsan_test_only_on_fork() {}
4141#endif
4242
43#if SANITIZER_APPLE && !SANITIZER_GO
44// Override weak symbol from sanitizer_common
45extern void __tsan_set_in_internal_write_call(bool value) {
46 __tsan::cur_thread_init()->in_internal_write_call = value;
47}
48#endif
49
4350namespace __tsan {
4451
4552#if !SANITIZER_GO
......@@ -893,6 +900,13 @@ void ForkChildAfter(ThreadState* thr, uptr pc, bool start_thread) {
893900 ThreadIgnoreBegin(thr, pc);
894901 ThreadIgnoreSyncBegin(thr, pc);
895902 }
903
904# if SANITIZER_APPLE && !SANITIZER_GO
905 // This flag can have inheritance disabled - we are the child so act
906 // accordingly
907 if (flags()->lock_during_write == kNoLockDuringWritesCurrentProcess)
908 flags()->lock_during_write = kLockDuringAllWrites;
909# endif
896910}
897911#endif
898912
lib/libtsan/tsan_rtl.h+7-2
......@@ -236,6 +236,10 @@ struct alignas(SANITIZER_CACHE_LINE_SIZE) ThreadState {
236236
237237 const ReportDesc *current_report;
238238
239#if SANITIZER_APPLE && !SANITIZER_GO
240 bool in_internal_write_call;
241#endif
242
239243 explicit ThreadState(Tid tid);
240244};
241245
......@@ -420,6 +424,7 @@ class ScopedReportBase {
420424 void AddSleep(StackID stack_id);
421425 void SetCount(int count);
422426 void SetSigNum(int sig);
427 void SymbolizeStackElems(void);
423428
424429 const ReportDesc *GetReport() const;
425430
......@@ -498,7 +503,7 @@ void ForkChildAfter(ThreadState *thr, uptr pc, bool start_thread);
498503
499504void ReportRace(ThreadState *thr, RawShadow *shadow_mem, Shadow cur, Shadow old,
500505 AccessType typ);
501bool OutputReport(ThreadState *thr, const ScopedReport &srep);
506bool OutputReport(ThreadState *thr, ScopedReport &srep);
502507bool IsFiredSuppression(Context *ctx, ReportType type, StackTrace trace);
503508bool IsExpectedReport(uptr addr, uptr size);
504509
......@@ -559,7 +564,7 @@ void ThreadIgnoreSyncBegin(ThreadState *thr, uptr pc);
559564void ThreadIgnoreSyncEnd(ThreadState *thr);
560565
561566Tid ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached);
562void ThreadStart(ThreadState *thr, Tid tid, tid_t os_id,
567void ThreadStart(ThreadState *thr, Tid tid, ThreadID os_id,
563568 ThreadType thread_type);
564569void ThreadFinish(ThreadState *thr);
565570Tid ThreadConsumeTid(ThreadState *thr, uptr pc, uptr uid);
lib/libtsan/tsan_rtl_aarch64.S+3-5
......@@ -4,10 +4,8 @@
44#include "sanitizer_common/sanitizer_asm.h"
55#include "builtins/assembly.h"
66
7#if !defined(__APPLE__)
8.section .text
9#else
10.section __TEXT,__text
7TEXT_SECTION
8#if defined(__APPLE__)
119.align 3
1210#endif
1311
......@@ -222,6 +220,6 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
222220
223221NO_EXEC_STACK_DIRECTIVE
224222
225GNU_PROPERTY_BTI_PAC
223GNU_PROPERTY_BTI_PAC_GCS
226224
227225#endif
lib/libtsan/tsan_rtl_access.cpp+8-3
......@@ -419,6 +419,11 @@ NOINLINE void TraceRestartMemoryAccess(ThreadState* thr, uptr pc, uptr addr,
419419
420420ALWAYS_INLINE USED void MemoryAccess(ThreadState* thr, uptr pc, uptr addr,
421421 uptr size, AccessType typ) {
422#if SANITIZER_APPLE && !SANITIZER_GO
423 // Swift symbolizer can be intercepted and deadlock without this
424 if (thr->in_symbolizer)
425 return;
426#endif
422427 RawShadow* shadow_mem = MemToShadow(addr);
423428 UNUSED char memBuf[4][64];
424429 DPrintf2("#%d: Access: %d@%d %p/%zd typ=0x%x {%s, %s, %s, %s}\n", thr->tid,
......@@ -684,7 +689,7 @@ void MemoryAccessRangeT(ThreadState* thr, uptr pc, uptr addr, uptr size) {
684689 DCHECK(IsAppMem(addr + size - 1));
685690 }
686691 if (!IsShadowMem(shadow_mem)) {
687 Printf("Bad shadow start addr: %p (%p)\n", shadow_mem, (void*)addr);
692 Printf("Bad shadow start addr: %p (%p)\n", (void*)shadow_mem, (void*)addr);
688693 DCHECK(IsShadowMem(shadow_mem));
689694 }
690695
......@@ -693,12 +698,12 @@ void MemoryAccessRangeT(ThreadState* thr, uptr pc, uptr addr, uptr size) {
693698 RawShadow* shadow_mem_end =
694699 shadow_mem + rounded_size / kShadowCell * kShadowCnt;
695700 if (!IsShadowMem(shadow_mem_end - 1)) {
696 Printf("Bad shadow end addr: %p (%p)\n", shadow_mem_end - 1,
701 Printf("Bad shadow end addr: %p (%p)\n", (void*)(shadow_mem_end - 1),
697702 (void*)(addr + size - 1));
698703 Printf(
699704 "Shadow start addr (ok): %p (%p); size: 0x%zx; rounded_size: 0x%zx; "
700705 "kShadowMultiplier: %zx\n",
701 shadow_mem, (void*)addr, size, rounded_size, kShadowMultiplier);
706 (void*)shadow_mem, (void*)addr, size, rounded_size, kShadowMultiplier);
702707 DCHECK(IsShadowMem(shadow_mem_end - 1));
703708 }
704709#endif
lib/libtsan/tsan_rtl_amd64.S+2
......@@ -3,6 +3,8 @@
33
44#include "sanitizer_common/sanitizer_asm.h"
55
6.att_syntax
7
68#if !defined(__APPLE__)
79.section .text
810#else
lib/libtsan/tsan_rtl_mutex.cpp+94-49
......@@ -11,14 +11,15 @@
1111//===----------------------------------------------------------------------===//
1212
1313#include <sanitizer_common/sanitizer_deadlock_detector_interface.h>
14#include <sanitizer_common/sanitizer_placement_new.h>
1415#include <sanitizer_common/sanitizer_stackdepot.h>
1516
16#include "tsan_rtl.h"
1717#include "tsan_flags.h"
18#include "tsan_sync.h"
18#include "tsan_platform.h"
1919#include "tsan_report.h"
20#include "tsan_rtl.h"
2021#include "tsan_symbolize.h"
21#include "tsan_platform.h"
22#include "tsan_sync.h"
2223
2324namespace __tsan {
2425
......@@ -55,14 +56,28 @@ static void ReportMutexMisuse(ThreadState *thr, uptr pc, ReportType typ,
5556 return;
5657 if (!ShouldReport(thr, typ))
5758 return;
58 ThreadRegistryLock l(&ctx->thread_registry);
59 ScopedReport rep(typ);
60 rep.AddMutex(addr, creation_stack_id);
61 VarSizeStackTrace trace;
62 ObtainCurrentStack(thr, pc, &trace);
63 rep.AddStack(trace, true);
64 rep.AddLocation(addr, 1);
65 OutputReport(thr, rep);
59 // Use alloca, because malloc during signal handling deadlocks
60 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
61 // Take a new scope as Apple platforms require the below locks released
62 // before symbolizing in order to avoid a deadlock
63 {
64 ThreadRegistryLock l(&ctx->thread_registry);
65 new (rep) ScopedReport(typ);
66 rep->AddMutex(addr, creation_stack_id);
67 VarSizeStackTrace trace;
68 ObtainCurrentStack(thr, pc, &trace);
69 rep->AddStack(trace, true);
70 rep->AddLocation(addr, 1);
71#if SANITIZER_APPLE
72 } // Close this scope to release the locks
73#endif
74 OutputReport(thr, *rep);
75
76 // Need to manually destroy this because we used placement new to allocate
77 rep->~ScopedReport();
78#if !SANITIZER_APPLE
79 }
80#endif
6681}
6782
6883static void RecordMutexLock(ThreadState *thr, uptr pc, uptr addr,
......@@ -528,51 +543,81 @@ void AfterSleep(ThreadState *thr, uptr pc) {
528543void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r) {
529544 if (r == 0 || !ShouldReport(thr, ReportTypeDeadlock))
530545 return;
531 ThreadRegistryLock l(&ctx->thread_registry);
532 ScopedReport rep(ReportTypeDeadlock);
533 for (int i = 0; i < r->n; i++) {
534 rep.AddMutex(r->loop[i].mtx_ctx0, r->loop[i].stk[0]);
535 rep.AddUniqueTid((int)r->loop[i].thr_ctx);
536 rep.AddThread((int)r->loop[i].thr_ctx);
537 }
538 uptr dummy_pc = 0x42;
539 for (int i = 0; i < r->n; i++) {
540 for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) {
541 u32 stk = r->loop[i].stk[j];
542 if (stk && stk != kInvalidStackID) {
543 rep.AddStack(StackDepotGet(stk), true);
544 } else {
545 // Sometimes we fail to extract the stack trace (FIXME: investigate),
546 // but we should still produce some stack trace in the report.
547 rep.AddStack(StackTrace(&dummy_pc, 1), true);
546 // Use alloca, because malloc during signal handling deadlocks
547 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
548 // Take a new scope as Apple platforms require the below locks released
549 // before symbolizing in order to avoid a deadlock
550 {
551 ThreadRegistryLock l(&ctx->thread_registry);
552 new (rep) ScopedReport(ReportTypeDeadlock);
553 for (int i = 0; i < r->n; i++) {
554 rep->AddMutex(r->loop[i].mtx_ctx0, r->loop[i].stk[0]);
555 rep->AddUniqueTid((int)r->loop[i].thr_ctx);
556 rep->AddThread((int)r->loop[i].thr_ctx);
557 }
558 uptr dummy_pc = 0x42;
559 for (int i = 0; i < r->n; i++) {
560 for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) {
561 u32 stk = r->loop[i].stk[j];
562 StackTrace stack;
563 if (stk && stk != kInvalidStackID) {
564 stack = StackDepotGet(stk);
565 } else {
566 // Sometimes we fail to extract the stack trace (FIXME: investigate),
567 // but we should still produce some stack trace in the report.
568 stack = StackTrace(&dummy_pc, 1);
569 }
570 rep->AddStack(stack, true);
548571 }
549572 }
573#if SANITIZER_APPLE
574 } // Close this scope to release the locks
575#endif
576 OutputReport(thr, *rep);
577
578 // Need to manually destroy this because we used placement new to allocate
579 rep->~ScopedReport();
580#if !SANITIZER_APPLE
550581 }
551 OutputReport(thr, rep);
582#endif
552583}
553584
554585void ReportDestroyLocked(ThreadState *thr, uptr pc, uptr addr,
555586 FastState last_lock, StackID creation_stack_id) {
556 // We need to lock the slot during RestoreStack because it protects
557 // the slot journal.
558 Lock slot_lock(&ctx->slots[static_cast<uptr>(last_lock.sid())].mtx);
559 ThreadRegistryLock l0(&ctx->thread_registry);
560 Lock slots_lock(&ctx->slot_mtx);
561 ScopedReport rep(ReportTypeMutexDestroyLocked);
562 rep.AddMutex(addr, creation_stack_id);
563 VarSizeStackTrace trace;
564 ObtainCurrentStack(thr, pc, &trace);
565 rep.AddStack(trace, true);
566
567 Tid tid;
568 DynamicMutexSet mset;
569 uptr tag;
570 if (!RestoreStack(EventType::kLock, last_lock.sid(), last_lock.epoch(), addr,
571 0, kAccessWrite, &tid, &trace, mset, &tag))
572 return;
573 rep.AddStack(trace, true);
574 rep.AddLocation(addr, 1);
575 OutputReport(thr, rep);
587 // Use alloca, because malloc during signal handling deadlocks
588 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
589 // Take a new scope as Apple platforms require the below locks released
590 // before symbolizing in order to avoid a deadlock
591 {
592 // We need to lock the slot during RestoreStack because it protects
593 // the slot journal.
594 Lock slot_lock(&ctx->slots[static_cast<uptr>(last_lock.sid())].mtx);
595 ThreadRegistryLock l0(&ctx->thread_registry);
596 Lock slots_lock(&ctx->slot_mtx);
597 new (rep) ScopedReport(ReportTypeMutexDestroyLocked);
598 rep->AddMutex(addr, creation_stack_id);
599 VarSizeStackTrace trace;
600 ObtainCurrentStack(thr, pc, &trace);
601 rep->AddStack(trace, true);
602
603 Tid tid;
604 DynamicMutexSet mset;
605 uptr tag;
606 if (!RestoreStack(EventType::kLock, last_lock.sid(), last_lock.epoch(),
607 addr, 0, kAccessWrite, &tid, &trace, mset, &tag))
608 return;
609 rep->AddStack(trace, true);
610 rep->AddLocation(addr, 1);
611#if SANITIZER_APPLE
612 } // Close this scope to release the locks
613#endif
614 OutputReport(thr, *rep);
615
616 // Need to manually destroy this because we used placement new to allocate
617 rep->~ScopedReport();
618#if !SANITIZER_APPLE
619 }
620#endif
576621}
577622
578623} // namespace __tsan
lib/libtsan/tsan_rtl_report.cpp+132-65
......@@ -11,10 +11,12 @@
1111//===----------------------------------------------------------------------===//
1212
1313#include "sanitizer_common/sanitizer_common.h"
14#include "sanitizer_common/sanitizer_internal_defs.h"
1415#include "sanitizer_common/sanitizer_libc.h"
1516#include "sanitizer_common/sanitizer_placement_new.h"
1617#include "sanitizer_common/sanitizer_stackdepot.h"
1718#include "sanitizer_common/sanitizer_stacktrace.h"
19#include "tsan_defs.h"
1820#include "tsan_fd.h"
1921#include "tsan_flags.h"
2022#include "tsan_mman.h"
......@@ -109,7 +111,13 @@ static ReportStack *SymbolizeStack(StackTrace trace) {
109111 // instruction.
110112 if ((pc & kExternalPCBit) == 0)
111113 pc1 = StackTrace::GetPreviousInstructionPc(pc);
112 SymbolizedStack *ent = SymbolizeCode(pc1);
114 SymbolizedStack* ent = SymbolizeCode(pc1, si == trace.size - 1);
115#if SANITIZER_GO
116 if (ent == nullptr) {
117 // Go might have 0 frames for this PC (wrapper frames aren't reported).
118 continue;
119 }
120#endif
113121 CHECK_NE(ent, 0);
114122 SymbolizedStack *last = ent;
115123 while (last->next) {
......@@ -187,10 +195,8 @@ void ScopedReportBase::AddMemoryAccess(uptr addr, uptr external_tag, Shadow s,
187195 mop->size = size;
188196 mop->write = !(typ & kAccessRead);
189197 mop->atomic = typ & kAccessAtomic;
190 mop->stack = SymbolizeStack(stack);
191198 mop->external_tag = external_tag;
192 if (mop->stack)
193 mop->stack->suppressable = true;
199 mop->stack_trace = stack;
194200 for (uptr i = 0; i < mset->Size(); i++) {
195201 MutexSet::Desc d = mset->Get(i);
196202 int id = this->AddMutex(d.addr, d.stack_id);
......@@ -199,6 +205,56 @@ void ScopedReportBase::AddMemoryAccess(uptr addr, uptr external_tag, Shadow s,
199205 }
200206}
201207
208void ScopedReportBase::SymbolizeStackElems() {
209 // symbolize memory ops
210 for (usize i = 0, size = rep_->mops.Size(); i < size; i++) {
211 ReportMop *mop = rep_->mops[i];
212 mop->stack = SymbolizeStack(mop->stack_trace);
213 if (mop->stack)
214 mop->stack->suppressable = true;
215 }
216
217 // symbolize locations
218 for (usize i = 0, size = rep_->locs.Size(); i < size; i++) {
219 // added locations have a NULL placeholder - don't dereference them
220 if (ReportLocation *loc = rep_->locs[i])
221 loc->stack = SymbolizeStackId(loc->stack_id);
222 }
223
224 // symbolize any added locations
225 for (usize i = 0, size = rep_->added_location_addrs.Size(); i < size; i++) {
226 AddedLocationAddr *added_loc = &rep_->added_location_addrs[i];
227 if (ReportLocation *loc = SymbolizeData(added_loc->addr)) {
228 loc->suppressable = true;
229 rep_->locs[added_loc->locs_idx] = loc;
230 }
231 }
232
233 // Filter out any added location placeholders that could not be symbolized
234 usize j = 0;
235 for (usize i = 0, size = rep_->locs.Size(); i < size; i++) {
236 if (rep_->locs[i] != nullptr) {
237 rep_->locs[j] = rep_->locs[i];
238 j++;
239 }
240 }
241 rep_->locs.Resize(j);
242
243 // symbolize threads
244 for (usize i = 0, size = rep_->threads.Size(); i < size; i++) {
245 ReportThread *rt = rep_->threads[i];
246 rt->stack = SymbolizeStackId(rt->stack_id);
247 if (rt->stack)
248 rt->stack->suppressable = rt->suppressable;
249 }
250
251 // symbolize mutexes
252 for (usize i = 0, size = rep_->mutexes.Size(); i < size; i++) {
253 ReportMutex *rm = rep_->mutexes[i];
254 rm->stack = SymbolizeStackId(rm->stack_id);
255 }
256}
257
202258void ScopedReportBase::AddUniqueTid(Tid unique_tid) {
203259 rep_->unique_tids.PushBack(unique_tid);
204260}
......@@ -216,10 +272,8 @@ void ScopedReportBase::AddThread(const ThreadContext *tctx, bool suppressable) {
216272 rt->name = internal_strdup(tctx->name);
217273 rt->parent_tid = tctx->parent_tid;
218274 rt->thread_type = tctx->thread_type;
219 rt->stack = 0;
220 rt->stack = SymbolizeStackId(tctx->creation_stack_id);
221 if (rt->stack)
222 rt->stack->suppressable = suppressable;
275 rt->stack_id = tctx->creation_stack_id;
276 rt->suppressable = suppressable;
223277}
224278
225279#if !SANITIZER_GO
......@@ -270,7 +324,7 @@ int ScopedReportBase::AddMutex(uptr addr, StackID creation_stack_id) {
270324 rep_->mutexes.PushBack(rm);
271325 rm->id = rep_->mutexes.Size() - 1;
272326 rm->addr = addr;
273 rm->stack = SymbolizeStackId(creation_stack_id);
327 rm->stack_id = creation_stack_id;
274328 return rm->id;
275329}
276330
......@@ -288,7 +342,7 @@ void ScopedReportBase::AddLocation(uptr addr, uptr size) {
288342 loc->fd_closed = closed;
289343 loc->fd = fd;
290344 loc->tid = creat_tid;
291 loc->stack = SymbolizeStackId(creat_stack);
345 loc->stack_id = creat_stack;
292346 rep_->locs.PushBack(loc);
293347 AddThread(creat_tid);
294348 return;
......@@ -310,7 +364,7 @@ void ScopedReportBase::AddLocation(uptr addr, uptr size) {
310364 loc->heap_chunk_size = b->siz;
311365 loc->external_tag = b->tag;
312366 loc->tid = b->tid;
313 loc->stack = SymbolizeStackId(b->stk);
367 loc->stack_id = b->stk;
314368 rep_->locs.PushBack(loc);
315369 AddThread(b->tid);
316370 return;
......@@ -324,11 +378,8 @@ void ScopedReportBase::AddLocation(uptr addr, uptr size) {
324378 AddThread(tctx);
325379 }
326380#endif
327 if (ReportLocation *loc = SymbolizeData(addr)) {
328 loc->suppressable = true;
329 rep_->locs.PushBack(loc);
330 return;
331 }
381 rep_->added_location_addrs.PushBack({addr, rep_->locs.Size()});
382 rep_->locs.PushBack(nullptr);
332383}
333384
334385#if !SANITIZER_GO
......@@ -628,11 +679,12 @@ static bool HandleRacyStacks(ThreadState *thr, VarSizeStackTrace traces[2]) {
628679 return false;
629680}
630681
631bool OutputReport(ThreadState *thr, const ScopedReport &srep) {
682bool OutputReport(ThreadState *thr, ScopedReport &srep) {
632683 // These should have been checked in ShouldReport.
633684 // It's too late to check them here, we have already taken locks.
634685 CHECK(flags()->report_bugs);
635686 CHECK(!thr->suppress_reports);
687 srep.SymbolizeStackElems();
636688 atomic_store_relaxed(&ctx->last_symbolize_time_ns, NanoTime());
637689 const ReportDesc *rep = srep.GetReport();
638690 CHECK_EQ(thr->current_report, nullptr);
......@@ -761,65 +813,80 @@ void ReportRace(ThreadState *thr, RawShadow *shadow_mem, Shadow cur, Shadow old,
761813 DynamicMutexSet mset1;
762814 MutexSet *mset[kMop] = {&thr->mset, mset1};
763815
764 // We need to lock the slot during RestoreStack because it protects
765 // the slot journal.
766 Lock slot_lock(&ctx->slots[static_cast<uptr>(s[1].sid())].mtx);
767 ThreadRegistryLock l0(&ctx->thread_registry);
768 Lock slots_lock(&ctx->slot_mtx);
769 if (SpuriousRace(old))
770 return;
771 if (!RestoreStack(EventType::kAccessExt, s[1].sid(), s[1].epoch(), addr1,
772 size1, typ1, &tids[1], &traces[1], mset[1], &tags[1])) {
773 StoreShadow(&ctx->last_spurious_race, old.raw());
774 return;
775 }
816 // Use alloca, because malloc during signal handling deadlocks
817 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
818 // Take a new scope as Apple platforms require the below locks released
819 // before symbolizing in order to avoid a deadlock
820 {
821 // We need to lock the slot during RestoreStack because it protects
822 // the slot journal.
823 Lock slot_lock(&ctx->slots[static_cast<uptr>(s[1].sid())].mtx);
824 ThreadRegistryLock l0(&ctx->thread_registry);
825 Lock slots_lock(&ctx->slot_mtx);
826 if (SpuriousRace(old))
827 return;
828 if (!RestoreStack(EventType::kAccessExt, s[1].sid(), s[1].epoch(), addr1,
829 size1, typ1, &tids[1], &traces[1], mset[1], &tags[1])) {
830 StoreShadow(&ctx->last_spurious_race, old.raw());
831 return;
832 }
776833
777 if (IsFiredSuppression(ctx, rep_typ, traces[1]))
778 return;
834 if (IsFiredSuppression(ctx, rep_typ, traces[1]))
835 return;
779836
780 if (HandleRacyStacks(thr, traces))
781 return;
837 if (HandleRacyStacks(thr, traces))
838 return;
782839
783 // If any of the accesses has a tag, treat this as an "external" race.
784 uptr tag = kExternalTagNone;
785 for (uptr i = 0; i < kMop; i++) {
786 if (tags[i] != kExternalTagNone) {
787 rep_typ = ReportTypeExternalRace;
788 tag = tags[i];
789 break;
840 // If any of the accesses has a tag, treat this as an "external" race.
841 uptr tag = kExternalTagNone;
842 for (uptr i = 0; i < kMop; i++) {
843 if (tags[i] != kExternalTagNone) {
844 rep_typ = ReportTypeExternalRace;
845 tag = tags[i];
846 break;
847 }
790848 }
791 }
792849
793 ScopedReport rep(rep_typ, tag);
794 for (uptr i = 0; i < kMop; i++)
795 rep.AddMemoryAccess(addr, tags[i], s[i], tids[i], traces[i], mset[i]);
850 new (rep) ScopedReport(rep_typ, tag);
851 for (uptr i = 0; i < kMop; i++)
852 rep->AddMemoryAccess(addr, tags[i], s[i], tids[i], traces[i], mset[i]);
796853
797 for (uptr i = 0; i < kMop; i++) {
798 ThreadContext *tctx = static_cast<ThreadContext *>(
799 ctx->thread_registry.GetThreadLocked(tids[i]));
800 rep.AddThread(tctx);
801 }
854 for (uptr i = 0; i < kMop; i++) {
855 ThreadContext *tctx = static_cast<ThreadContext *>(
856 ctx->thread_registry.GetThreadLocked(tids[i]));
857 rep->AddThread(tctx);
858 }
802859
803 rep.AddLocation(addr_min, addr_max - addr_min);
804
805 if (flags()->print_full_thread_history) {
806 const ReportDesc *rep_desc = rep.GetReport();
807 for (uptr i = 0; i < rep_desc->threads.Size(); i++) {
808 Tid parent_tid = rep_desc->threads[i]->parent_tid;
809 if (parent_tid == kMainTid || parent_tid == kInvalidTid)
810 continue;
811 ThreadContext *parent_tctx = static_cast<ThreadContext *>(
812 ctx->thread_registry.GetThreadLocked(parent_tid));
813 rep.AddThread(parent_tctx);
860 rep->AddLocation(addr_min, addr_max - addr_min);
861
862 if (flags()->print_full_thread_history) {
863 const ReportDesc *rep_desc = rep->GetReport();
864 for (uptr i = 0; i < rep_desc->threads.Size(); i++) {
865 Tid parent_tid = rep_desc->threads[i]->parent_tid;
866 if (parent_tid == kMainTid || parent_tid == kInvalidTid)
867 continue;
868 ThreadContext *parent_tctx = static_cast<ThreadContext *>(
869 ctx->thread_registry.GetThreadLocked(parent_tid));
870 rep->AddThread(parent_tctx);
871 }
814872 }
815 }
816873
817874#if !SANITIZER_GO
818 if (!((typ0 | typ1) & kAccessFree) &&
819 s[1].epoch() <= thr->last_sleep_clock.Get(s[1].sid()))
820 rep.AddSleep(thr->last_sleep_stack_id);
875 if (!((typ0 | typ1) & kAccessFree) &&
876 s[1].epoch() <= thr->last_sleep_clock.Get(s[1].sid()))
877 rep->AddSleep(thr->last_sleep_stack_id);
878#endif
879
880#if SANITIZER_APPLE
881 } // Close this scope to release the locks
882#endif
883 OutputReport(thr, *rep);
884
885 // Need to manually destroy this because we used placement new to allocate
886 rep->~ScopedReport();
887#if !SANITIZER_APPLE
888 }
821889#endif
822 OutputReport(thr, rep);
823890}
824891
825892void PrintCurrentStack(ThreadState *thr, uptr pc) {
lib/libtsan/tsan_rtl_thread.cpp+31-9
......@@ -88,15 +88,33 @@ void ThreadFinalize(ThreadState *thr) {
8888#if !SANITIZER_GO
8989 if (!ShouldReport(thr, ReportTypeThreadLeak))
9090 return;
91 ThreadRegistryLock l(&ctx->thread_registry);
9291 Vector<ThreadLeak> leaks;
93 ctx->thread_registry.RunCallbackForEachThreadLocked(CollectThreadLeaks,
94 &leaks);
92 {
93 ThreadRegistryLock l(&ctx->thread_registry);
94 ctx->thread_registry.RunCallbackForEachThreadLocked(CollectThreadLeaks,
95 &leaks);
96 }
97
9598 for (uptr i = 0; i < leaks.Size(); i++) {
96 ScopedReport rep(ReportTypeThreadLeak);
97 rep.AddThread(leaks[i].tctx, true);
98 rep.SetCount(leaks[i].count);
99 OutputReport(thr, rep);
99 // Use alloca, because malloc during signal handling deadlocks
100 ScopedReport *rep = (ScopedReport *)__builtin_alloca(sizeof(ScopedReport));
101 // Take a new scope as Apple platforms require the below locks released
102 // before symbolizing in order to avoid a deadlock
103 {
104 ThreadRegistryLock l(&ctx->thread_registry);
105 new (rep) ScopedReport(ReportTypeThreadLeak);
106 rep->AddThread(leaks[i].tctx, true);
107 rep->SetCount(leaks[i].count);
108# if SANITIZER_APPLE
109 } // Close this scope to release the locks
110# endif
111 OutputReport(thr, *rep);
112
113 // Need to manually destroy this because we used placement new to allocate
114 rep->~ScopedReport();
115# if !SANITIZER_APPLE
116 }
117# endif
100118 }
101119#endif
102120}
......@@ -149,7 +167,7 @@ struct OnStartedArgs {
149167 uptr tls_size;
150168};
151169
152void ThreadStart(ThreadState *thr, Tid tid, tid_t os_id,
170void ThreadStart(ThreadState *thr, Tid tid, ThreadID os_id,
153171 ThreadType thread_type) {
154172 ctx->thread_registry.StartThread(tid, os_id, thread_type, thr);
155173 if (!thr->ignore_sync) {
......@@ -188,10 +206,14 @@ void ThreadStart(ThreadState *thr, Tid tid, tid_t os_id,
188206 }
189207#endif
190208
191#if !SANITIZER_GO
209#if !SANITIZER_GO && !SANITIZER_ANDROID
192210 // Don't imitate stack/TLS writes for the main thread,
193211 // because its initialization is synchronized with all
194212 // subsequent threads anyway.
213 // Because thr is created by MmapOrDie, the thr object
214 // is not in tls, the pointer to the thr object is in
215 // TLS_SLOT_SANITIZER slot. So skip this check on
216 // Android platform.
195217 if (tid != kMainTid) {
196218 if (stk_addr && stk_size) {
197219 const uptr pc = StackTrace::GetNextInstructionPc(
lib/libtsan/tsan_symbolize.cpp+1-1
......@@ -79,7 +79,7 @@ static void AddFrame(void *ctx, const char *function_name, const char *file,
7979 info->column = column;
8080}
8181
82SymbolizedStack *SymbolizeCode(uptr addr) {
82SymbolizedStack* SymbolizeCode(uptr addr, bool leaf) {
8383 // Check if PC comes from non-native land.
8484 if (addr & kExternalPCBit) {
8585 SymbolizedStackBuilder ssb = {nullptr, nullptr, addr};
lib/libtsan/tsan_symbolize.h+1-1
......@@ -19,7 +19,7 @@ namespace __tsan {
1919
2020void EnterSymbolizer();
2121void ExitSymbolizer();
22SymbolizedStack *SymbolizeCode(uptr addr);
22SymbolizedStack* SymbolizeCode(uptr addr, bool leaf);
2323ReportLocation *SymbolizeData(uptr addr);
2424void SymbolizeFlush();
2525
lib/libtsan/tsan_trace.h+1-1
......@@ -190,7 +190,7 @@ struct Trace {
190190 Mutex mtx;
191191 IList<TraceHeader, &TraceHeader::trace_parts, TracePart> parts;
192192 // First node non-queued into ctx->trace_part_recycle.
193 TracePart* local_head;
193 TracePart* local_head = nullptr;
194194 // Final position in the last part for finished threads.
195195 Event* final_pos = nullptr;
196196 // Number of trace parts allocated on behalf of this trace specifically.
lib/libunwind/include/__libunwind_config.h+11-2
......@@ -73,11 +73,11 @@
7373# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC
7474# elif defined(__aarch64__)
7575# define _LIBUNWIND_TARGET_AARCH64 1
76# define _LIBUNWIND_CONTEXT_SIZE 66
76#define _LIBUNWIND_CONTEXT_SIZE 67
7777# if defined(__SEH__)
7878# define _LIBUNWIND_CURSOR_SIZE 164
7979# else
80# define _LIBUNWIND_CURSOR_SIZE 78
80#define _LIBUNWIND_CURSOR_SIZE 79
8181# endif
8282# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64
8383# elif defined(__arm__)
......@@ -212,4 +212,13 @@
212212# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
213213#endif // _LIBUNWIND_IS_NATIVE_ONLY
214214
215#if defined(__has_feature)
216# if __has_feature(ptrauth_calls) && __has_feature(ptrauth_returns)
217# define _LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING 1
218# elif __has_feature(ptrauth_calls) != __has_feature(ptrauth_returns)
219# error "Either both or none of ptrauth_calls and ptrauth_returns "\
220 "is allowed to be enabled"
221# endif
222#endif
223
215224#endif // ____LIBUNWIND_CONFIG_H__
lib/libunwind/include/libunwind.h+117-11
......@@ -43,6 +43,109 @@
4343 #define LIBUNWIND_AVAIL
4444#endif
4545
46#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
47
48 #include <ptrauth.h>
49
50 // `__ptrauth_restricted_intptr` is a feature of apple clang that predates
51 // support for direct application of `__ptrauth` to integer types. This
52 // guard is necessary to support compilation with those compiler.
53 #if __has_extension(ptrauth_restricted_intptr_qualifier)
54 #define __unwind_ptrauth_restricted_intptr(...) \
55 __ptrauth_restricted_intptr(__VA_ARGS__)
56 #else
57 #define __unwind_ptrauth_restricted_intptr(...) \
58 __ptrauth(__VA_ARGS__)
59 #endif
60
61 // ptrauth_string_discriminator("unw_proc_info_t::handler") == 0x7405
62 #define __ptrauth_unwind_upi_handler_disc 0x7405
63
64 #define __ptrauth_unwind_upi_handler \
65 __ptrauth(ptrauth_key_function_pointer, 1, __ptrauth_unwind_upi_handler_disc)
66
67 #define __ptrauth_unwind_upi_handler_intptr \
68 __unwind_ptrauth_restricted_intptr(ptrauth_key_function_pointer, 1,\
69 __ptrauth_unwind_upi_handler_disc)
70
71 // ptrauth_string_discriminator("unw_proc_info_t::start_ip") == 0xCA2C
72 #define __ptrauth_unwind_upi_startip \
73 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_independent_code, 1, 0xCA2C)
74
75 // ptrauth_string_discriminator("unw_proc_info_t::end_ip") == 0xE183
76 #define __ptrauth_unwind_upi_endip \
77 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_independent_code, 1, 0xE183)
78
79 // ptrauth_string_discriminator("unw_proc_info_t::lsda") == 0x83DE
80 #define __ptrauth_unwind_upi_lsda \
81 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x83DE)
82
83 // ptrauth_string_discriminator("unw_proc_info_t::flags") == 0x79A1
84 #define __ptrauth_unwind_upi_flags \
85 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x79A1)
86
87 // ptrauth_string_discriminator("unw_proc_info_t::unwind_info") == 0xC20C
88 #define __ptrauth_unwind_upi_info \
89 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0xC20C)
90
91 // ptrauth_string_discriminator("unw_proc_info_t::extra") == 0x03DF
92 #define __ptrauth_unwind_upi_extra \
93 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x03DF)
94
95 // ptrauth_string_discriminator("Registers_arm64::link_reg_t") == 0x8301
96 #define __ptrauth_unwind_registers_arm64_link_reg \
97 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_code, 1, 0x8301)
98
99 // ptrauth_string_discriminator("UnwindInfoSections::dso_base") == 0x4FF5
100 #define __ptrauth_unwind_uis_dso_base \
101 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x4FF5)
102
103 // ptrauth_string_discriminator("UnwindInfoSections::dwarf_section") == 0x4974
104 #define __ptrauth_unwind_uis_dwarf_section \
105 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x4974)
106
107 // ptrauth_string_discriminator("UnwindInfoSections::dwarf_section_length") == 0x2A9A
108 #define __ptrauth_unwind_uis_dwarf_section_length \
109 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x2A9A)
110
111 // ptrauth_string_discriminator("UnwindInfoSections::compact_unwind_section") == 0xA27B
112 #define __ptrauth_unwind_uis_compact_unwind_section \
113 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0xA27B)
114
115 // ptrauth_string_discriminator("UnwindInfoSections::compact_unwind_section_length") == 0x5D0A
116 #define __ptrauth_unwind_uis_compact_unwind_section_length \
117 __unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x5D0A)
118
119 // ptrauth_string_discriminator("CIE_Info::personality") == 0x6A40
120 #define __ptrauth_unwind_cie_info_personality_disc 0x6A40
121 #define __ptrauth_unwind_cie_info_personality \
122 __unwind_ptrauth_restricted_intptr(ptrauth_key_function_pointer, 1, \
123 __ptrauth_unwind_cie_info_personality_disc)
124
125 // ptrauth_string_discriminator("personality") == 0x7EAD)
126 #define __ptrauth_unwind_pauthtest_personality_disc 0x7EAD
127
128#else
129
130 #define __unwind_ptrauth_restricted_intptr(...)
131 #define __ptrauth_unwind_upi_handler
132 #define __ptrauth_unwind_upi_handler_intptr
133 #define __ptrauth_unwind_upi_startip
134 #define __ptrauth_unwind_upi_endip
135 #define __ptrauth_unwind_upi_lsda
136 #define __ptrauth_unwind_upi_flags
137 #define __ptrauth_unwind_upi_info
138 #define __ptrauth_unwind_upi_extra
139 #define __ptrauth_unwind_registers_arm64_link_reg
140 #define __ptrauth_unwind_uis_dso_base
141 #define __ptrauth_unwind_uis_dwarf_section
142 #define __ptrauth_unwind_uis_dwarf_section_length
143 #define __ptrauth_unwind_uis_compact_unwind_section
144 #define __ptrauth_unwind_uis_compact_unwind_section_length
145 #define __ptrauth_unwind_cie_info_personality
146
147#endif
148
46149#if defined(_WIN32) && defined(__SEH__)
47150 #define LIBUNWIND_CURSOR_ALIGNMENT_ATTR __attribute__((__aligned__(16)))
48151#else
......@@ -88,17 +191,18 @@ typedef double unw_fpreg_t;
88191#endif
89192
90193struct unw_proc_info_t {
91 unw_word_t start_ip; /* start address of function */
92 unw_word_t end_ip; /* address after end of function */
93 unw_word_t lsda; /* address of language specific data area, */
94 /* or zero if not used */
95 unw_word_t handler; /* personality routine, or zero if not used */
96 unw_word_t gp; /* not used */
97 unw_word_t flags; /* not used */
98 uint32_t format; /* compact unwind encoding, or zero if none */
99 uint32_t unwind_info_size; /* size of DWARF unwind info, or zero if none */
100 unw_word_t unwind_info; /* address of DWARF unwind info, or zero */
101 unw_word_t extra; /* mach_header of mach-o image containing func */
194 unw_word_t __ptrauth_unwind_upi_startip start_ip; /* start address of function */
195 unw_word_t __ptrauth_unwind_upi_endip end_ip; /* address after end of function */
196 unw_word_t __ptrauth_unwind_upi_lsda lsda; /* address of language specific data area, */
197 /* or zero if not used */
198
199 unw_word_t __ptrauth_unwind_upi_handler_intptr handler;
200 unw_word_t gp; /* not used */
201 unw_word_t __ptrauth_unwind_upi_flags flags; /* not used */
202 uint32_t format; /* compact unwind encoding, or zero if none */
203 uint32_t unwind_info_size; /* size of DWARF unwind info, or zero if none */
204 unw_word_t __ptrauth_unwind_upi_info unwind_info; /* address of DWARF unwind info, or zero */
205 unw_word_t __ptrauth_unwind_upi_extra extra; /* mach_header of mach-o image containing func */
102206};
103207typedef struct unw_proc_info_t unw_proc_info_t;
104208
......@@ -130,6 +234,7 @@ extern int unw_is_fpreg(unw_cursor_t *, unw_regnum_t) LIBUNWIND_AVAIL;
130234extern int unw_is_signal_frame(unw_cursor_t *) LIBUNWIND_AVAIL;
131235extern int unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *) LIBUNWIND_AVAIL;
132236//extern int unw_get_save_loc(unw_cursor_t*, int, unw_save_loc_t*);
237extern const char *unw_strerror(int) LIBUNWIND_AVAIL;
133238
134239extern unw_addr_space_t unw_local_addr_space;
135240
......@@ -532,6 +637,7 @@ enum {
532637 UNW_AARCH64_X31 = 31,
533638 UNW_AARCH64_SP = 31,
534639 UNW_AARCH64_PC = 32,
640 UNW_AARCH64_VG = 46,
535641
536642 // reserved block
537643 UNW_AARCH64_RA_SIGN_STATE = 34,
lib/libunwind/include/unwind_arm_ehabi.h+4-1
......@@ -125,8 +125,11 @@ _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
125125 uint32_t discriminator,
126126 _Unwind_VRS_DataRepresentation representation);
127127
128extern _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception *,
129 _Unwind_Context *);
130
128131#if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE)
129#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern
132#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern __inline__
130133#else
131134#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 static __inline__
132135#endif
lib/libunwind/src/AddressSpace.hpp+40-19
......@@ -129,22 +129,27 @@ struct UnwindInfoSections {
129129 defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) || \
130130 defined(_LIBUNWIND_USE_DL_ITERATE_PHDR)
131131 // No dso_base for SEH.
132 uintptr_t dso_base;
132 uintptr_t __ptrauth_unwind_uis_dso_base
133 dso_base = 0;
133134#endif
134135#if defined(_LIBUNWIND_USE_DL_ITERATE_PHDR)
135136 size_t text_segment_length;
136137#endif
137138#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
138 uintptr_t dwarf_section;
139 size_t dwarf_section_length;
139 uintptr_t __ptrauth_unwind_uis_dwarf_section
140 dwarf_section = 0;
141 size_t __ptrauth_unwind_uis_dwarf_section_length
142 dwarf_section_length = 0;
140143#endif
141144#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX)
142145 uintptr_t dwarf_index_section;
143146 size_t dwarf_index_section_length;
144147#endif
145148#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
146 uintptr_t compact_unwind_section;
147 size_t compact_unwind_section_length;
149 uintptr_t __ptrauth_unwind_uis_compact_unwind_section
150 compact_unwind_section = 0;
151 size_t __ptrauth_unwind_uis_compact_unwind_section_length
152 compact_unwind_section_length = 0;
148153#endif
149154#if defined(_LIBUNWIND_ARM_EHABI)
150155 uintptr_t arm_section;
......@@ -196,11 +201,16 @@ public:
196201 static int64_t getSLEB128(pint_t &addr, pint_t end);
197202
198203 pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
199 pint_t datarelBase = 0);
200 bool findFunctionName(pint_t addr, char *buf, size_t bufLen,
201 unw_word_t *offset);
202 bool findUnwindSections(pint_t targetAddr, UnwindInfoSections &info);
203 bool findOtherFDE(pint_t targetAddr, pint_t &fde);
204 pint_t datarelBase = 0, pint_t *resultAddr = nullptr);
205 template <typename R>
206 bool findFunctionName(typename R::link_hardened_reg_arg_t addr, char *buf,
207 size_t bufLen, unw_word_t *offset);
208 template <typename R>
209 bool findUnwindSections(typename R::link_hardened_reg_arg_t targetAddr,
210 UnwindInfoSections &info);
211 template <typename R>
212 bool findOtherFDE(typename R::link_hardened_reg_arg_t targetAddr,
213 pint_t &fde);
204214
205215 static LocalAddressSpace sThisAddressSpace;
206216};
......@@ -269,7 +279,7 @@ inline int64_t LocalAddressSpace::getSLEB128(pint_t &addr, pint_t end) {
269279
270280inline LocalAddressSpace::pint_t
271281LocalAddressSpace::getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
272 pint_t datarelBase) {
282 pint_t datarelBase, pint_t *resultAddr) {
273283 pint_t startAddr = addr;
274284 const uint8_t *p = (uint8_t *)addr;
275285 pint_t result;
......@@ -353,8 +363,14 @@ LocalAddressSpace::getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
353363 break;
354364 }
355365
356 if (encoding & DW_EH_PE_indirect)
366 if (encoding & DW_EH_PE_indirect) {
367 if (resultAddr)
368 *resultAddr = result;
357369 result = getP(result);
370 } else {
371 if (resultAddr)
372 *resultAddr = startAddr;
373 }
358374
359375 return result;
360376}
......@@ -486,9 +502,9 @@ static int findUnwindSectionsByPhdr(struct dl_phdr_info *pinfo,
486502
487503#endif // defined(_LIBUNWIND_USE_DL_ITERATE_PHDR)
488504
489
490inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
491 UnwindInfoSections &info) {
505template <typename R>
506inline bool LocalAddressSpace::findUnwindSections(
507 typename R::link_hardened_reg_arg_t targetAddr, UnwindInfoSections &info) {
492508#ifdef __APPLE__
493509 dyld_unwind_sections dyldInfo;
494510 if (_dyld_find_unwind_sections((void *)targetAddr, &dyldInfo)) {
......@@ -658,16 +674,21 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
658674 return false;
659675}
660676
661inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
677template <typename R>
678inline bool
679LocalAddressSpace::findOtherFDE(typename R::link_hardened_reg_arg_t targetAddr,
680 pint_t &fde) {
662681 // TO DO: if OS has way to dynamically register FDEs, check that.
663682 (void)targetAddr;
664683 (void)fde;
665684 return false;
666685}
667686
668inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
669 size_t bufLen,
670 unw_word_t *offset) {
687template <typename R>
688inline bool
689LocalAddressSpace::findFunctionName(typename R::link_hardened_reg_arg_t addr,
690 char *buf, size_t bufLen,
691 unw_word_t *offset) {
671692#if _LIBUNWIND_USE_DLADDR
672693 Dl_info dyldInfo;
673694 if (dladdr((void *)addr, &dyldInfo)) {
lib/libunwind/src/CompactUnwinder.hpp+16-5
......@@ -601,11 +601,17 @@ int CompactUnwinder_arm64<A>::stepWithCompactEncodingFrameless(
601601 savedRegisterLoc -= 8;
602602 }
603603
604 // We load the link register prior to setting the new SP as the authentication
605 // schema for LR entangles the SP of the old frame into the diversifier.
606 Registers_arm64::reg_t linkRegister = registers.getRegister(UNW_AARCH64_LR);
607
604608 // subtract stack size off of sp
605609 registers.setSP(savedRegisterLoc);
606610
607 // set pc to be value in lr
608 registers.setIP(registers.getRegister(UNW_AARCH64_LR));
611 // Set pc to be value in lr. This needs to be performed after the new SP has
612 // been set, as the PC authentication schema entangles the SP of the new
613 // frame.
614 registers.setIP(linkRegister);
609615
610616 return UNW_STEP_SUCCESS;
611617}
......@@ -614,7 +620,7 @@ template <typename A>
614620int CompactUnwinder_arm64<A>::stepWithCompactEncodingFrame(
615621 compact_unwind_encoding_t encoding, uint64_t, A &addressSpace,
616622 Registers_arm64 &registers) {
617 uint64_t savedRegisterLoc = registers.getFP() - 8;
623 Registers_arm64::reg_t savedRegisterLoc = registers.getFP() - 8;
618624
619625 if (encoding & UNWIND_ARM64_FRAME_X19_X20_PAIR) {
620626 registers.setRegister(UNW_AARCH64_X19, addressSpace.get64(savedRegisterLoc));
......@@ -680,11 +686,16 @@ int CompactUnwinder_arm64<A>::stepWithCompactEncodingFrame(
680686 savedRegisterLoc -= 8;
681687 }
682688
683 uint64_t fp = registers.getFP();
689 Registers_arm64::reg_t fp = registers.getFP();
690
684691 // fp points to old fp
685692 registers.setFP(addressSpace.get64(fp));
686 // old sp is fp less saved fp and lr
693
694 // Old sp is fp less saved fp and lr. We need to set this prior to setting
695 // the lr as the pointer authentication schema for the lr incorporates the
696 // sp as part of the diversifier.
687697 registers.setSP(fp + 16);
698
688699 // pop return address into pc
689700 registers.setIP(addressSpace.get64(fp + 8));
690701
lib/libunwind/src/DwarfInstructions.hpp+24-13
......@@ -22,7 +22,6 @@
2222#include "dwarf2.h"
2323#include "libunwind_ext.h"
2424
25
2625namespace libunwind {
2726
2827
......@@ -34,8 +33,10 @@ public:
3433 typedef typename A::pint_t pint_t;
3534 typedef typename A::sint_t sint_t;
3635
37 static int stepWithDwarf(A &addressSpace, pint_t pc, pint_t fdeStart,
38 R &registers, bool &isSignalFrame, bool stage2);
36 static int stepWithDwarf(A &addressSpace,
37 typename R::link_hardened_reg_arg_t pc,
38 pint_t fdeStart, R &registers, bool &isSignalFrame,
39 bool stage2);
3940
4041private:
4142
......@@ -64,9 +65,10 @@ private:
6465
6566 static pint_t getCFA(A &addressSpace, const PrologInfo &prolog,
6667 const R &registers) {
67 if (prolog.cfaRegister != 0)
68 return (pint_t)((sint_t)registers.getRegister((int)prolog.cfaRegister) +
69 prolog.cfaRegisterOffset);
68 if (prolog.cfaRegister != 0) {
69 uintptr_t cfaRegister = registers.getRegister((int)prolog.cfaRegister);
70 return (pint_t)(cfaRegister + prolog.cfaRegisterOffset);
71 }
7072 if (prolog.cfaExpression != 0)
7173 return evaluateExpression((pint_t)prolog.cfaExpression, addressSpace,
7274 registers, 0);
......@@ -207,16 +209,16 @@ bool DwarfInstructions<A, R>::isReturnAddressSignedWithPC(A &addressSpace,
207209#endif
208210
209211template <typename A, typename R>
210int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc,
211 pint_t fdeStart, R &registers,
212 bool &isSignalFrame, bool stage2) {
212int DwarfInstructions<A, R>::stepWithDwarf(
213 A &addressSpace, typename R::link_hardened_reg_arg_t pc, pint_t fdeStart,
214 R &registers, bool &isSignalFrame, bool stage2) {
213215 FDE_Info fdeInfo;
214216 CIE_Info cieInfo;
215217 if (CFI_Parser<A>::decodeFDE(addressSpace, fdeStart, &fdeInfo,
216218 &cieInfo) == NULL) {
217219 PrologInfo prolog;
218 if (CFI_Parser<A>::parseFDEInstructions(addressSpace, fdeInfo, cieInfo, pc,
219 R::getArch(), &prolog)) {
220 if (CFI_Parser<A>::template parseFDEInstructions<R>(
221 addressSpace, fdeInfo, cieInfo, pc, R::getArch(), &prolog)) {
220222 // get pointer to cfa (architecture specific)
221223 pint_t cfa = getCFA(addressSpace, prolog, registers);
222224
......@@ -264,7 +266,7 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc,
264266 // by a CFI directive later on.
265267 newRegisters.setSP(cfa);
266268
267 pint_t returnAddress = 0;
269 typename R::reg_t returnAddress = 0;
268270 constexpr int lastReg = R::lastDwarfRegNum();
269271 static_assert(static_cast<int>(CFI_Parser<A>::kMaxRegisterNumber) >=
270272 lastReg,
......@@ -300,7 +302,16 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc,
300302
301303 isSignalFrame = cieInfo.isSignalFrame;
302304
303#if defined(_LIBUNWIND_TARGET_AARCH64)
305#if defined(_LIBUNWIND_TARGET_AARCH64) && \
306 !defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
307 // There are two ways of return address signing: pac-ret (enabled via
308 // -mbranch-protection=pac-ret) and ptrauth-returns (enabled as part of
309 // Apple's arm64e or experimental pauthtest ABI on Linux). The code
310 // below handles signed RA for pac-ret, while ptrauth-returns uses
311 // different logic.
312 // TODO: unify logic for both cases, see
313 // https://github.com/llvm/llvm-project/issues/160110
314 //
304315 // If the target is aarch64 then the return address may have been signed
305316 // using the v8.3 pointer authentication extensions. The original
306317 // return address needs to be authenticated before the return address is
lib/libunwind/src/DwarfParser.hpp+60-22
......@@ -23,6 +23,10 @@
2323
2424#include "config.h"
2525
26#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
27#include <ptrauth.h>
28#endif
29
2630namespace libunwind {
2731
2832/// CFI_Parser does basic parsing of a CFI (Call Frame Information) records.
......@@ -33,6 +37,7 @@ template <typename A>
3337class CFI_Parser {
3438public:
3539 typedef typename A::pint_t pint_t;
40 typedef pint_t __ptrauth_unwind_cie_info_personality personality_t;
3641
3742 /// Information encoded in a CIE (Common Information Entry)
3843 struct CIE_Info {
......@@ -43,7 +48,7 @@ public:
4348 uint8_t lsdaEncoding;
4449 uint8_t personalityEncoding;
4550 uint8_t personalityOffsetInCIE;
46 pint_t personality;
51 personality_t personality;
4752 uint32_t codeAlignFactor;
4853 int dataAlignFactor;
4954 bool isSignalFrame;
......@@ -155,14 +160,17 @@ public:
155160 }
156161 };
157162
158 static bool findFDE(A &addressSpace, pint_t pc, pint_t ehSectionStart,
159 size_t sectionLength, pint_t fdeHint, FDE_Info *fdeInfo,
160 CIE_Info *cieInfo);
163 template <typename R>
164 static bool findFDE(A &addressSpace, typename R::link_hardened_reg_arg_t pc,
165 pint_t ehSectionStart, size_t sectionLength,
166 pint_t fdeHint, FDE_Info *fdeInfo, CIE_Info *cieInfo);
161167 static const char *decodeFDE(A &addressSpace, pint_t fdeStart,
162168 FDE_Info *fdeInfo, CIE_Info *cieInfo,
163169 bool useCIEInfo = false);
170 template <typename R>
164171 static bool parseFDEInstructions(A &addressSpace, const FDE_Info &fdeInfo,
165 const CIE_Info &cieInfo, pint_t upToPC,
172 const CIE_Info &cieInfo,
173 typename R::link_hardened_reg_arg_t upToPC,
166174 int arch, PrologInfo *results);
167175
168176 static const char *parseCIE(A &addressSpace, pint_t cie, CIE_Info *cieInfo);
......@@ -234,9 +242,12 @@ const char *CFI_Parser<A>::decodeFDE(A &addressSpace, pint_t fdeStart,
234242
235243/// Scan an eh_frame section to find an FDE for a pc
236244template <typename A>
237bool CFI_Parser<A>::findFDE(A &addressSpace, pint_t pc, pint_t ehSectionStart,
238 size_t sectionLength, pint_t fdeHint,
239 FDE_Info *fdeInfo, CIE_Info *cieInfo) {
245template <typename R>
246bool CFI_Parser<A>::findFDE(A &addressSpace,
247 typename R::link_hardened_reg_arg_t pc,
248 pint_t ehSectionStart, size_t sectionLength,
249 pint_t fdeHint, FDE_Info *fdeInfo,
250 CIE_Info *cieInfo) {
240251 //fprintf(stderr, "findFDE(0x%llX)\n", (long long)pc);
241252 pint_t p = (fdeHint != 0) ? fdeHint : ehSectionStart;
242253 const pint_t ehSectionEnd = (sectionLength == SIZE_MAX)
......@@ -273,7 +284,7 @@ bool CFI_Parser<A>::findFDE(A &addressSpace, pint_t pc, pint_t ehSectionStart,
273284 pint_t pcRange = addressSpace.getEncodedP(
274285 p, nextCFI, cieInfo->pointerEncoding & 0x0F);
275286 // Test if pc is within the function this FDE covers.
276 if ((pcStart < pc) && (pc <= pcStart + pcRange)) {
287 if ((pcStart <= pc) && (pc < pcStart + pcRange)) {
277288 // parse rest of info
278289 fdeInfo->lsda = 0;
279290 // check for augmentation length
......@@ -369,6 +380,7 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie,
369380 cieInfo->returnAddressRegister = (uint8_t)raReg;
370381 // parse augmentation data based on augmentation string
371382 const char *result = NULL;
383 pint_t resultAddr = 0;
372384 if (addressSpace.get8(strStart) == 'z') {
373385 // parse augmentation data length
374386 addressSpace.getULEB128(p, cieContentEnd);
......@@ -377,13 +389,41 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie,
377389 case 'z':
378390 cieInfo->fdesHaveAugmentationData = true;
379391 break;
380 case 'P':
392 case 'P': {
381393 cieInfo->personalityEncoding = addressSpace.get8(p);
382394 ++p;
383395 cieInfo->personalityOffsetInCIE = (uint8_t)(p - cie);
384 cieInfo->personality = addressSpace
385 .getEncodedP(p, cieContentEnd, cieInfo->personalityEncoding);
396 pint_t personality = addressSpace.getEncodedP(
397 p, cieContentEnd, cieInfo->personalityEncoding,
398 /*datarelBase=*/0, &resultAddr);
399#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
400 if (personality) {
401 // The GOT for the personality function was signed address
402 // authenticated. Manually re-sign with the CIE_Info::personality
403 // schema. If we could guarantee the encoding of the personality we
404 // could avoid this by simply giving resultAddr the correct ptrauth
405 // schema and performing an assignment.
406#if defined(__arm64e__)
407 const auto oldDiscriminator = resultAddr;
408#else
409 const auto oldDiscriminator = ptrauth_blend_discriminator(
410 (void *)resultAddr, __ptrauth_unwind_pauthtest_personality_disc);
411#endif
412 const auto discriminator = ptrauth_blend_discriminator(
413 &cieInfo->personality,
414 __ptrauth_unwind_cie_info_personality_disc);
415 void *signedPtr = ptrauth_auth_and_resign(
416 (void *)personality, ptrauth_key_function_pointer,
417 oldDiscriminator, ptrauth_key_function_pointer, discriminator);
418 personality = (pint_t)signedPtr;
419 }
420#endif
421 // We use memmove to set the CIE personality as we have already
422 // re-signed the pointer to the correct schema.
423 memmove((void *)&cieInfo->personality, (void *)&personality,
424 sizeof(personality));
386425 break;
426 }
387427 case 'L':
388428 cieInfo->lsdaEncoding = addressSpace.get8(p);
389429 ++p;
......@@ -417,10 +457,10 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie,
417457
418458/// "run" the DWARF instructions and create the abstract PrologInfo for an FDE
419459template <typename A>
420bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace,
421 const FDE_Info &fdeInfo,
422 const CIE_Info &cieInfo, pint_t upToPC,
423 int arch, PrologInfo *results) {
460template <typename R>
461bool CFI_Parser<A>::parseFDEInstructions(
462 A &addressSpace, const FDE_Info &fdeInfo, const CIE_Info &cieInfo,
463 typename R::link_hardened_reg_arg_t upToPC, int arch, PrologInfo *results) {
424464 // Alloca is used for the allocation of the rememberStack entries. It removes
425465 // the dependency on new/malloc but the below for loop can not be refactored
426466 // into functions. Entry could be saved during the processing of a CIE and
......@@ -808,12 +848,10 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace,
808848 results->savedRegisters[UNW_AARCH64_RA_SIGN_STATE].value ^ 0x3;
809849 results->setRegisterValue(UNW_AARCH64_RA_SIGN_STATE, value,
810850 initialState);
811 // When calculating the value of the PC, it is assumed that the CFI
812 // instruction is placed before the signing instruction, however it is
813 // placed after. Because of this, we need to take into account the CFI
814 // instruction is one instruction call later than expected, and reduce
815 // the PC value by 4 bytes to compensate.
816 results->ptrAuthDiversifier = fdeInfo.pcStart + codeOffset - 0x4;
851 // When using Feat_PAuthLR, the PC value needs to be captured so that
852 // during unwinding, the correct PC value is used for re-authentication.
853 // It is assumed that the CFI is placed before the signing instruction.
854 results->ptrAuthDiversifier = fdeInfo.pcStart + codeOffset;
817855 _LIBUNWIND_TRACE_DWARF(
818856 "DW_CFA_AARCH64_negate_ra_state_with_pc(pc=0x%" PRIx64 ")\n",
819857 static_cast<uint64_t>(results->ptrAuthDiversifier));
lib/libunwind/src/EHHeaderParser.hpp+7-4
......@@ -37,8 +37,9 @@ public:
3737
3838 static bool decodeEHHdr(A &addressSpace, pint_t ehHdrStart, pint_t ehHdrEnd,
3939 EHHeaderInfo &ehHdrInfo);
40 static bool findFDE(A &addressSpace, pint_t pc, pint_t ehHdrStart,
41 uint32_t sectionLength,
40 template <typename R>
41 static bool findFDE(A &addressSpace, typename R::link_hardened_reg_arg_t pc,
42 pint_t ehHdrStart, uint32_t sectionLength,
4243 typename CFI_Parser<A>::FDE_Info *fdeInfo,
4344 typename CFI_Parser<A>::CIE_Info *cieInfo);
4445
......@@ -112,8 +113,10 @@ bool EHHeaderParser<A>::decodeTableEntry(
112113}
113114
114115template <typename A>
115bool EHHeaderParser<A>::findFDE(A &addressSpace, pint_t pc, pint_t ehHdrStart,
116 uint32_t sectionLength,
116template <typename R>
117bool EHHeaderParser<A>::findFDE(A &addressSpace,
118 typename R::link_hardened_reg_arg_t pc,
119 pint_t ehHdrStart, uint32_t sectionLength,
117120 typename CFI_Parser<A>::FDE_Info *fdeInfo,
118121 typename CFI_Parser<A>::CIE_Info *cieInfo) {
119122 pint_t ehHdrEnd = ehHdrStart + sectionLength;
lib/libunwind/src/Registers.hpp+226-22
......@@ -17,8 +17,13 @@
1717
1818#include "config.h"
1919#include "libunwind.h"
20#include "libunwind_ext.h"
2021#include "shadow_stack_unwind.h"
2122
23#if defined(_LIBUNWIND_HAVE_GETAUXVAL) || defined(_LIBUNWIND_HAVE_ELF_AUX_INFO)
24#include <sys/auxv.h>
25#endif
26
2227namespace libunwind {
2328
2429// For emulating 128-bit registers
......@@ -60,6 +65,10 @@ public:
6065 Registers_x86();
6166 Registers_x86(const void *registers);
6267
68 typedef uint32_t reg_t;
69 typedef uint32_t link_reg_t;
70 typedef const link_reg_t &link_hardened_reg_arg_t;
71
6372 bool validRegister(int num) const;
6473 uint32_t getRegister(int num) const;
6574 void setRegister(int num, uint32_t value);
......@@ -278,6 +287,10 @@ public:
278287 Registers_x86_64();
279288 Registers_x86_64(const void *registers);
280289
290 typedef uint64_t reg_t;
291 typedef uint64_t link_reg_t;
292 typedef const link_reg_t &link_hardened_reg_arg_t;
293
281294 bool validRegister(int num) const;
282295 uint64_t getRegister(int num) const;
283296 void setRegister(int num, uint64_t value);
......@@ -597,6 +610,10 @@ public:
597610 Registers_ppc();
598611 Registers_ppc(const void *registers);
599612
613 typedef uint32_t reg_t;
614 typedef uint32_t link_reg_t;
615 typedef const link_reg_t &link_hardened_reg_arg_t;
616
600617 bool validRegister(int num) const;
601618 uint32_t getRegister(int num) const;
602619 void setRegister(int num, uint32_t value);
......@@ -1169,6 +1186,10 @@ public:
11691186 Registers_ppc64();
11701187 Registers_ppc64(const void *registers);
11711188
1189 typedef uint64_t reg_t;
1190 typedef uint64_t link_reg_t;
1191 typedef const link_reg_t &link_hardened_reg_arg_t;
1192
11721193 bool validRegister(int num) const;
11731194 uint64_t getRegister(int num) const;
11741195 void setRegister(int num, uint64_t value);
......@@ -1814,7 +1835,9 @@ inline const char *Registers_ppc64::getRegisterName(int regNum) {
18141835/// Registers_arm64 holds the register state of a thread in a 64-bit arm
18151836/// process.
18161837class _LIBUNWIND_HIDDEN Registers_arm64;
1817extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *);
1838extern "C" int64_t __libunwind_Registers_arm64_za_disable();
1839extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *,
1840 unsigned walkedFrames);
18181841
18191842#if defined(_LIBUNWIND_USE_GCS)
18201843extern "C" void *__libunwind_shstk_get_jump_target() {
......@@ -1824,8 +1847,21 @@ extern "C" void *__libunwind_shstk_get_jump_target() {
18241847
18251848class _LIBUNWIND_HIDDEN Registers_arm64 {
18261849public:
1827 Registers_arm64();
1850 Registers_arm64() = default;
18281851 Registers_arm64(const void *registers);
1852 Registers_arm64(const Registers_arm64 &);
1853 Registers_arm64 &operator=(const Registers_arm64 &);
1854
1855 typedef uint64_t reg_t;
1856 typedef uint64_t __ptrauth_unwind_registers_arm64_link_reg link_reg_t;
1857
1858 // Use `link_hardened_reg_arg_t` to pass values of `link_reg_t` type as
1859 // function arguments. We need to use a const l-value reference to keep
1860 // signature of `__ptrauth`-qualified values of `link_reg_t` type on AArch64
1861 // PAuth-enabled ABI intact. Passing the raw pointer by value would cause
1862 // authentication on the caller side and make the pointer prone to
1863 // substitution if spilled to the stack in the callee.
1864 typedef const link_reg_t &link_hardened_reg_arg_t;
18291865
18301866 bool validRegister(int num) const;
18311867 uint64_t getRegister(int num) const;
......@@ -1837,7 +1873,14 @@ public:
18371873 v128 getVectorRegister(int num) const;
18381874 void setVectorRegister(int num, v128 value);
18391875 static const char *getRegisterName(int num);
1840 void jumpto() { __libunwind_Registers_arm64_jumpto(this); }
1876 void jumpto(unsigned walkedFrames = 0) {
1877 zaDisable();
1878 __libunwind_Registers_arm64_jumpto(this, walkedFrames);
1879 }
1880#ifdef _LIBUNWIND_TRACE_RET_INJECT
1881 _LIBUNWIND_TRACE_NO_INLINE
1882 void returnto(unsigned walkedFrames) { jumpto(walkedFrames); }
1883#endif
18411884 static constexpr int lastDwarfRegNum() {
18421885 return _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64;
18431886 }
......@@ -1845,27 +1888,104 @@ public:
18451888
18461889 uint64_t getSP() const { return _registers.__sp; }
18471890 void setSP(uint64_t value) { _registers.__sp = value; }
1848 uint64_t getIP() const { return _registers.__pc; }
1849 void setIP(uint64_t value) { _registers.__pc = value; }
1850 uint64_t getFP() const { return _registers.__fp; }
1851 void setFP(uint64_t value) { _registers.__fp = value; }
1891 uint64_t getIP() const {
1892 uint64_t value = _registers.__pc;
1893#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
1894 // 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.
1896 value = (uint64_t)ptrauth_auth_and_resign((void *)_registers.__pc,
1897 ptrauth_key_return_address,
1898 &_registers.__pc,
1899 ptrauth_key_return_address,
1900 getSP());
1901#endif
1902 return value;
1903 }
1904 void setIP(uint64_t value) {
1905#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
1906 // Note the value which was set should have been signed with the SP.
1907 // We then resign with the slot we are being stored in to so that both SP
1908 // and LR can't be spoofed at the same time.
1909 value = (uint64_t)ptrauth_auth_and_resign((void *)value,
1910 ptrauth_key_return_address,
1911 getSP(),
1912 ptrauth_key_return_address,
1913 &_registers.__pc);
1914#endif
1915 _registers.__pc = value;
1916 }
1917 uint64_t getFP() const { return _registers.__fp; }
1918 void setFP(uint64_t value) { _registers.__fp = value; }
1919
1920#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
1921 void
1922 loadAndAuthenticateLinkRegister(reg_t inplaceAuthedLinkRegister,
1923 link_reg_t *referenceAuthedLinkRegister) {
1924 // If we are in an arm64/arm64e frame, then the PC should have been signed
1925 // with the SP
1926 *referenceAuthedLinkRegister =
1927 (uint64_t)ptrauth_auth_data((void *)inplaceAuthedLinkRegister,
1928 ptrauth_key_return_address,
1929 _registers.__sp);
1930 }
1931#endif
18521932
18531933private:
1934 uint64_t lazyGetVG() const;
1935
1936 void zaDisable() const {
1937 if (!_misc_registers.__has_sme)
1938 return;
1939 if (__libunwind_Registers_arm64_za_disable() != 0)
1940 _LIBUNWIND_ABORT("SME ZA disable failed");
1941 }
1942
1943#if defined(_LIBUNWIND_HAVE_GETAUXVAL)
1944 static bool checkHasSME() {
1945 constexpr int hwcap2_sme = (1 << 23);
1946 unsigned long hwcap2 = getauxval(AT_HWCAP2);
1947 return (hwcap2 & hwcap2_sme) != 0;
1948 }
1949#elif defined(_LIBUNWIND_HAVE_ELF_AUX_INFO)
1950 static bool checkHasSME() {
1951 constexpr int hwcap2_sme = (1 << 23);
1952 unsigned long hwcap2 = 0;
1953 elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
1954 return (hwcap2 & hwcap2_sme) != 0;
1955 }
1956#else
1957 static bool checkHasSME() {
1958 // TODO: Support other platforms.
1959 return false;
1960 }
1961#endif
1962
18541963 struct GPRs {
1855 uint64_t __x[29]; // x0-x28
1856 uint64_t __fp; // Frame pointer x29
1857 uint64_t __lr; // Link register x30
1858 uint64_t __sp; // Stack pointer x31
1859 uint64_t __pc; // Program counter
1860 uint64_t __ra_sign_state; // RA sign state register
1964 uint64_t __x[29] = {}; // x0-x28
1965 uint64_t __fp = 0; // Frame pointer x29
1966 uint64_t __lr = 0; // Link register x30
1967 uint64_t __sp = 0; // Stack pointer x31
1968 uint64_t __pc = 0; // Program counter
1969 uint64_t __ra_sign_state = 0; // RA sign state register
1970 };
1971
1972 struct Misc {
1973 mutable uint32_t __vg = 0; // Vector Granule
1974 bool __has_sme = checkHasSME();
18611975 };
18621976
1863 GPRs _registers;
1864 double _vectorHalfRegisters[32];
1977 GPRs _registers = {};
18651978 // Currently only the lower double in 128-bit vectore registers
18661979 // is perserved during unwinding. We could define new register
18671980 // numbers (> 96) which mean whole vector registers, then this
18681981 // struct would need to change to contain whole vector registers.
1982 double _vectorHalfRegisters[32] = {};
1983
1984 // Miscellaneous/virtual registers. These are stored below the GPRs and FPRs
1985 // as they do not correspond to physical registers, so do not need to be
1986 // saved/restored in UnwindRegistersRestore.S and UnwindRegistersSave.S, and
1987 // we don't want to modify the existing offsets for GPRs and FPRs.
1988 Misc _misc_registers;
18691989};
18701990
18711991inline Registers_arm64::Registers_arm64(const void *registers) {
......@@ -1877,11 +1997,31 @@ inline Registers_arm64::Registers_arm64(const void *registers) {
18771997 memcpy(_vectorHalfRegisters,
18781998 static_cast<const uint8_t *>(registers) + sizeof(GPRs),
18791999 sizeof(_vectorHalfRegisters));
2000 _misc_registers.__vg = 0;
2001
2002#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
2003 // We have to do some pointer authentication fixups after this copy,
2004 // and as part of that we need to load the source pc without
2005 // authenticating so that we maintain the signature for the resigning
2006 // performed by setIP.
2007 uint64_t pcRegister = 0;
2008 memmove(&pcRegister, ((uint8_t *)&_registers) + offsetof(GPRs, __pc),
2009 sizeof(pcRegister));
2010 setIP(pcRegister);
2011#endif
18802012}
18812013
1882inline Registers_arm64::Registers_arm64() {
1883 memset(&_registers, 0, sizeof(_registers));
1884 memset(&_vectorHalfRegisters, 0, sizeof(_vectorHalfRegisters));
2014inline Registers_arm64::Registers_arm64(const Registers_arm64 &other) {
2015 *this = other;
2016}
2017
2018inline Registers_arm64 &
2019Registers_arm64::operator=(const Registers_arm64 &other) {
2020 memmove(static_cast<void *>(this), &other, sizeof(*this));
2021 // We perform this step to ensure that we correctly authenticate and re-sign
2022 // the pc after the bitwise copy.
2023 setIP(other.getIP());
2024 return *this;
18852025}
18862026
18872027inline bool Registers_arm64::validRegister(int regNum) const {
......@@ -1895,22 +2035,40 @@ inline bool Registers_arm64::validRegister(int regNum) const {
18952035 return false;
18962036 if (regNum == UNW_AARCH64_RA_SIGN_STATE)
18972037 return true;
2038 if (regNum == UNW_AARCH64_VG)
2039 return true;
18982040 if ((regNum > 32) && (regNum < 64))
18992041 return false;
19002042 return true;
19012043}
19022044
2045inline uint64_t Registers_arm64::lazyGetVG() const {
2046 if (!_misc_registers.__vg) {
2047#if defined(__aarch64__)
2048 register uint64_t vg asm("x0");
2049 asm(".inst 0x04e0e3e0" // CNTD x0
2050 : "=r"(vg));
2051 _misc_registers.__vg = vg;
2052#else
2053 _LIBUNWIND_ABORT("arm64 VG undefined");
2054#endif
2055 }
2056 return _misc_registers.__vg;
2057}
2058
19032059inline uint64_t Registers_arm64::getRegister(int regNum) const {
19042060 if (regNum == UNW_REG_IP || regNum == UNW_AARCH64_PC)
1905 return _registers.__pc;
2061 return getIP();
19062062 if (regNum == UNW_REG_SP || regNum == UNW_AARCH64_SP)
19072063 return _registers.__sp;
19082064 if (regNum == UNW_AARCH64_RA_SIGN_STATE)
19092065 return _registers.__ra_sign_state;
19102066 if (regNum == UNW_AARCH64_FP)
1911 return _registers.__fp;
2067 return getFP();
19122068 if (regNum == UNW_AARCH64_LR)
19132069 return _registers.__lr;
2070 if (regNum == UNW_AARCH64_VG)
2071 return lazyGetVG();
19142072 if ((regNum >= 0) && (regNum < 29))
19152073 return _registers.__x[regNum];
19162074 _LIBUNWIND_ABORT("unsupported arm64 register");
......@@ -1918,15 +2076,17 @@ inline uint64_t Registers_arm64::getRegister(int regNum) const {
19182076
19192077inline void Registers_arm64::setRegister(int regNum, uint64_t value) {
19202078 if (regNum == UNW_REG_IP || regNum == UNW_AARCH64_PC)
1921 _registers.__pc = value;
2079 setIP(value);
19222080 else if (regNum == UNW_REG_SP || regNum == UNW_AARCH64_SP)
19232081 _registers.__sp = value;
19242082 else if (regNum == UNW_AARCH64_RA_SIGN_STATE)
19252083 _registers.__ra_sign_state = value;
19262084 else if (regNum == UNW_AARCH64_FP)
1927 _registers.__fp = value;
2085 setFP(value);
19282086 else if (regNum == UNW_AARCH64_LR)
19292087 _registers.__lr = value;
2088 else if (regNum == UNW_AARCH64_VG)
2089 _misc_registers.__vg = value;
19302090 else if ((regNum >= 0) && (regNum < 29))
19312091 _registers.__x[regNum] = value;
19322092 else
......@@ -2116,6 +2276,10 @@ public:
21162276 Registers_arm();
21172277 Registers_arm(const void *registers);
21182278
2279 typedef uint32_t reg_t;
2280 typedef uint32_t link_reg_t;
2281 typedef const link_reg_t &link_hardened_reg_arg_t;
2282
21192283 bool validRegister(int num) const;
21202284 uint32_t getRegister(int num) const;
21212285 void setRegister(int num, uint32_t value);
......@@ -2621,6 +2785,10 @@ public:
26212785 Registers_or1k();
26222786 Registers_or1k(const void *registers);
26232787
2788 typedef uint32_t reg_t;
2789 typedef uint32_t link_reg_t;
2790 typedef const link_reg_t &link_hardened_reg_arg_t;
2791
26242792 bool validRegister(int num) const;
26252793 uint32_t getRegister(int num) const;
26262794 void setRegister(int num, uint32_t value);
......@@ -2820,6 +2988,10 @@ public:
28202988 Registers_mips_o32();
28212989 Registers_mips_o32(const void *registers);
28222990
2991 typedef uint32_t reg_t;
2992 typedef uint32_t link_reg_t;
2993 typedef const link_reg_t &link_hardened_reg_arg_t;
2994
28232995 bool validRegister(int num) const;
28242996 uint32_t getRegister(int num) const;
28252997 void setRegister(int num, uint32_t value);
......@@ -3155,6 +3327,10 @@ public:
31553327 Registers_mips_newabi();
31563328 Registers_mips_newabi(const void *registers);
31573329
3330 typedef uint64_t reg_t;
3331 typedef uint64_t link_reg_t;
3332 typedef const link_reg_t &link_hardened_reg_arg_t;
3333
31583334 bool validRegister(int num) const;
31593335 uint64_t getRegister(int num) const;
31603336 void setRegister(int num, uint64_t value);
......@@ -3458,6 +3634,10 @@ public:
34583634 Registers_sparc();
34593635 Registers_sparc(const void *registers);
34603636
3637 typedef uint32_t reg_t;
3638 typedef uint32_t link_reg_t;
3639 typedef const link_reg_t &link_hardened_reg_arg_t;
3640
34613641 bool validRegister(int num) const;
34623642 uint32_t getRegister(int num) const;
34633643 void setRegister(int num, uint32_t value);
......@@ -3644,6 +3824,10 @@ public:
36443824 Registers_sparc64() = default;
36453825 Registers_sparc64(const void *registers);
36463826
3827 typedef uint64_t reg_t;
3828 typedef uint64_t link_reg_t;
3829 typedef const link_reg_t &link_hardened_reg_arg_t;
3830
36473831 bool validRegister(int num) const;
36483832 uint64_t getRegister(int num) const;
36493833 void setRegister(int num, uint64_t value);
......@@ -3829,6 +4013,10 @@ public:
38294013 Registers_hexagon();
38304014 Registers_hexagon(const void *registers);
38314015
4016 typedef uint32_t reg_t;
4017 typedef uint32_t link_reg_t;
4018 typedef const link_reg_t &link_hardened_reg_arg_t;
4019
38324020 bool validRegister(int num) const;
38334021 uint32_t getRegister(int num) const;
38344022 void setRegister(int num, uint32_t value);
......@@ -4044,6 +4232,10 @@ public:
40444232 Registers_riscv();
40454233 Registers_riscv(const void *registers);
40464234
4235 typedef ::libunwind::reg_t reg_t;
4236 typedef ::libunwind::reg_t link_reg_t;
4237 typedef const link_reg_t &link_hardened_reg_arg_t;
4238
40474239 bool validRegister(int num) const;
40484240 reg_t getRegister(int num) const;
40494241 void setRegister(int num, reg_t value);
......@@ -4341,6 +4533,10 @@ public:
43414533 Registers_ve();
43424534 Registers_ve(const void *registers);
43434535
4536 typedef uint64_t reg_t;
4537 typedef uint64_t link_reg_t;
4538 typedef const link_reg_t &link_hardened_reg_arg_t;
4539
43444540 bool validRegister(int num) const;
43454541 uint64_t getRegister(int num) const;
43464542 void setRegister(int num, uint64_t value);
......@@ -4784,6 +4980,10 @@ public:
47844980 Registers_s390x();
47854981 Registers_s390x(const void *registers);
47864982
4983 typedef uint64_t reg_t;
4984 typedef uint64_t link_reg_t;
4985 typedef const link_reg_t &link_hardened_reg_arg_t;
4986
47874987 bool validRegister(int num) const;
47884988 uint64_t getRegister(int num) const;
47894989 void setRegister(int num, uint64_t value);
......@@ -5072,6 +5272,10 @@ public:
50725272 Registers_loongarch();
50735273 Registers_loongarch(const void *registers);
50745274
5275 typedef uint64_t reg_t;
5276 typedef uint64_t link_reg_t;
5277 typedef const link_reg_t &link_hardened_reg_arg_t;
5278
50755279 bool validRegister(int num) const;
50765280 uint64_t getRegister(int num) const;
50775281 void setRegister(int num, uint64_t value);
lib/libunwind/src/Unwind-seh.cpp+6-7
......@@ -163,7 +163,7 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
163163 // If we were called by __libunwind_seh_personality(), indicate that
164164 // a handler was found; otherwise, initiate phase 2 by unwinding.
165165 if (ours && ms_exc->NumberParameters > 1)
166 return 4 /* ExceptionExecuteHandler in mingw */;
166 return static_cast<EXCEPTION_DISPOSITION>(4);
167167 // This should never happen in phase 2.
168168 if (IS_UNWINDING(ms_exc->ExceptionFlags))
169169 _LIBUNWIND_ABORT("Personality indicated exception handler in phase 2!");
......@@ -182,7 +182,7 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
182182 // a handler was found; otherwise, it's time to initiate a collided
183183 // unwind to the target.
184184 if (ours && !IS_UNWINDING(ms_exc->ExceptionFlags) && ms_exc->NumberParameters > 1)
185 return 4 /* ExceptionExecuteHandler in mingw */;
185 return static_cast<EXCEPTION_DISPOSITION>(4);
186186 // This should never happen in phase 1.
187187 if (!IS_UNWINDING(ms_exc->ExceptionFlags))
188188 _LIBUNWIND_ABORT("Personality installed context during phase 1!");
......@@ -259,13 +259,12 @@ __libunwind_seh_personality(int version, _Unwind_Action state,
259259 (void *)disp_ctx->LanguageHandler, (void *)&ms_exc,
260260 (void *)disp_ctx->EstablisherFrame,
261261 (void *)disp_ctx->ContextRecord, (void *)disp_ctx);
262 EXCEPTION_DISPOSITION ms_act = disp_ctx->LanguageHandler(&ms_exc,
263 (PVOID)disp_ctx->EstablisherFrame,
264 disp_ctx->ContextRecord,
265 disp_ctx);
262 int ms_act = static_cast<int>(
263 disp_ctx->LanguageHandler(&ms_exc, (PVOID)disp_ctx->EstablisherFrame,
264 disp_ctx->ContextRecord, disp_ctx));
266265 _LIBUNWIND_TRACE_UNWINDING("__libunwind_seh_personality() LanguageHandler "
267266 "returned %d",
268 (int)ms_act);
267 ms_act);
269268 switch (ms_act) {
270269 case ExceptionContinueExecution: return _URC_END_OF_STACK;
271270 case ExceptionContinueSearch: return _URC_CONTINUE_UNWIND;
lib/libunwind/src/Unwind-wasm.c+7-7
......@@ -37,13 +37,13 @@ struct _Unwind_LandingPadContext {
3737// function
3838thread_local struct _Unwind_LandingPadContext __wasm_lpad_context;
3939
40/// Calls to this function is in landing pads in compiler-generated user code.
40/// Calls to this function are in landing pads in compiler-generated user code.
4141/// In other EH schemes, stack unwinding is done by libunwind library, which
42/// calls the personality function for each each frame it lands. On the other
43/// hand, WebAssembly stack unwinding process is performed by a VM, and the
44/// personality function cannot be called from there. So the compiler inserts
45/// a call to this function in landing pads in the user code, which in turn
46/// calls the personality function.
42/// calls the personality function for each frame it lands. On the other hand,
43/// WebAssembly stack unwinding process is performed by a VM, and the
44/// personality function cannot be called from there. So the compiler inserts a
45/// call to this function in landing pads in the user code, which in turn calls
46/// the personality function.
4747_Unwind_Reason_Code _Unwind_CallPersonality(void *exception_ptr) {
4848 struct _Unwind_Exception *exception_object =
4949 (struct _Unwind_Exception *)exception_ptr;
......@@ -92,7 +92,7 @@ _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,
9292
9393/// Called by personality handler to get instruction pointer.
9494_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
95 // The result will be used as an 1-based index after decrementing 1, so we
95 // The result will be used as a 1-based index after decrementing 1, so we
9696 // increment 2 here
9797 uintptr_t result =
9898 ((struct _Unwind_LandingPadContext *)context)->lpad_index + 2;
lib/libunwind/src/UnwindCursor.hpp+167-49
......@@ -41,7 +41,8 @@
4141#define _LIBUNWIND_CHECK_LINUX_SIGRETURN 1
4242#endif
4343
44#if defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
44#if defined(_LIBUNWIND_TARGET_HAIKU) && \
45 (defined(_LIBUNWIND_TARGET_I386) || defined(_LIBUNWIND_TARGET_X86_64))
4546#include <OS.h>
4647#include <signal.h>
4748#define _LIBUNWIND_CHECK_HAIKU_SIGRETURN 1
......@@ -120,7 +121,9 @@ class _LIBUNWIND_HIDDEN DwarfFDECache {
120121 typedef typename A::pint_t pint_t;
121122public:
122123 static constexpr pint_t kSearchAll = static_cast<pint_t>(-1);
123 static pint_t findFDE(pint_t mh, pint_t pc);
124 template <typename R>
125 static pint_t findFDE(pint_t mh, typename R::link_hardened_reg_arg_t pc);
126
124127 static void add(pint_t mh, pint_t ip_start, pint_t ip_end, pint_t fde);
125128 static void removeAllIn(pint_t mh);
126129 static void iterateCacheEntries(void (*func)(unw_word_t ip_start,
......@@ -173,7 +176,9 @@ bool DwarfFDECache<A>::_registeredForDyldUnloads = false;
173176#endif
174177
175178template <typename A>
176typename A::pint_t DwarfFDECache<A>::findFDE(pint_t mh, pint_t pc) {
179template <typename R>
180typename DwarfFDECache<A>::pint_t
181DwarfFDECache<A>::findFDE(pint_t mh, typename R::link_hardened_reg_arg_t pc) {
177182 pint_t result = 0;
178183 _LIBUNWIND_LOG_IF_FALSE(_lock.lock_shared());
179184 for (entry *p = _buffer; p < _bufferUsed; ++p) {
......@@ -471,7 +476,9 @@ public:
471476 virtual void getInfo(unw_proc_info_t *) {
472477 _LIBUNWIND_ABORT("getInfo not implemented");
473478 }
474 virtual void jumpto() { _LIBUNWIND_ABORT("jumpto not implemented"); }
479 _LIBUNWIND_TRACE_NO_INLINE virtual void jumpto() {
480 _LIBUNWIND_ABORT("jumpto not implemented");
481 }
475482 virtual bool isSignalFrame() {
476483 _LIBUNWIND_ABORT("isSignalFrame not implemented");
477484 }
......@@ -488,6 +495,12 @@ public:
488495 virtual void saveVFPAsX() { _LIBUNWIND_ABORT("saveVFPAsX not implemented"); }
489496#endif
490497
498#ifdef _LIBUNWIND_TRACE_RET_INJECT
499 virtual void setWalkedFrames(unsigned) {
500 _LIBUNWIND_ABORT("setWalkedFrames not implemented");
501 }
502#endif
503
491504#ifdef _AIX
492505 virtual uintptr_t getDataRelBase() {
493506 _LIBUNWIND_ABORT("getDataRelBase not implemented");
......@@ -964,7 +977,8 @@ public:
964977 virtual void setFloatReg(int, unw_fpreg_t);
965978 virtual int step(bool stage2 = false);
966979 virtual void getInfo(unw_proc_info_t *);
967 virtual void jumpto();
980 _LIBUNWIND_TRACE_NO_INLINE
981 virtual void jumpto();
968982 virtual bool isSignalFrame();
969983 virtual bool getFunctionName(char *buf, size_t len, unw_word_t *off);
970984 virtual void setInfoBasedOnIPRegister(bool isReturnAddress = false);
......@@ -973,6 +987,10 @@ public:
973987 virtual void saveVFPAsX();
974988#endif
975989
990#ifdef _LIBUNWIND_TRACE_RET_INJECT
991 virtual void setWalkedFrames(unsigned);
992#endif
993
976994#ifdef _AIX
977995 virtual uintptr_t getDataRelBase();
978996#endif
......@@ -1045,19 +1063,28 @@ private:
10451063#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
10461064 bool getInfoFromFdeCie(const typename CFI_Parser<A>::FDE_Info &fdeInfo,
10471065 const typename CFI_Parser<A>::CIE_Info &cieInfo,
1048 pint_t pc, uintptr_t dso_base);
1049 bool getInfoFromDwarfSection(pint_t pc, const UnwindInfoSections &sects,
1050 uint32_t fdeSectionOffsetHint=0);
1066 typename R::link_hardened_reg_arg_t pc,
1067 uintptr_t dso_base);
1068 bool getInfoFromDwarfSection(typename R::link_hardened_reg_arg_t pc,
1069 const UnwindInfoSections &sects,
1070 uint32_t fdeSectionOffsetHint = 0);
10511071 int stepWithDwarfFDE(bool stage2) {
1072#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
1073 typename R::reg_t rawPC = this->getReg(UNW_REG_IP);
1074 typename R::link_reg_t pc;
1075 _registers.loadAndAuthenticateLinkRegister(rawPC, &pc);
1076#else
1077 typename R::link_reg_t pc = this->getReg(UNW_REG_IP);
1078#endif
10521079 return DwarfInstructions<A, R>::stepWithDwarf(
1053 _addressSpace, (pint_t)this->getReg(UNW_REG_IP),
1054 (pint_t)_info.unwind_info, _registers, _isSignalFrame, stage2);
1080 _addressSpace, pc, (pint_t)_info.unwind_info, _registers,
1081 _isSignalFrame, stage2);
10551082 }
10561083#endif
10571084
10581085#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
1059 bool getInfoFromCompactEncodingSection(pint_t pc,
1060 const UnwindInfoSections &sects);
1086 bool getInfoFromCompactEncodingSection(typename R::link_hardened_reg_arg_t pc,
1087 const UnwindInfoSections &sects);
10611088 int stepWithCompactEncoding(bool stage2 = false) {
10621089#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
10631090 if ( compactSaysUseDwarf() )
......@@ -1344,9 +1371,12 @@ private:
13441371 bool _unwindInfoMissing;
13451372 bool _isSignalFrame;
13461373#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) || \
1347 defined(_LIBUNWIND_TARGET_HAIKU)
1374 defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
13481375 bool _isSigReturn = false;
13491376#endif
1377#ifdef _LIBUNWIND_TRACE_RET_INJECT
1378 uint32_t _walkedFrames;
1379#endif
13501380};
13511381
13521382
......@@ -1358,13 +1388,13 @@ UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
13581388 "UnwindCursor<> does not fit in unw_cursor_t");
13591389 static_assert((alignof(UnwindCursor<A, R>) <= alignof(unw_cursor_t)),
13601390 "UnwindCursor<> requires more alignment than unw_cursor_t");
1361 memset(&_info, 0, sizeof(_info));
1391 memset(static_cast<void *>(&_info), 0, sizeof(_info));
13621392}
13631393
13641394template <typename A, typename R>
13651395UnwindCursor<A, R>::UnwindCursor(A &as, void *)
13661396 : _addressSpace(as), _unwindInfoMissing(false), _isSignalFrame(false) {
1367 memset(&_info, 0, sizeof(_info));
1397 memset(static_cast<void *>(&_info), 0, sizeof(_info));
13681398 // FIXME
13691399 // fill in _registers from thread arg
13701400}
......@@ -1401,7 +1431,46 @@ void UnwindCursor<A, R>::setFloatReg(int regNum, unw_fpreg_t value) {
14011431}
14021432
14031433template <typename A, typename R> void UnwindCursor<A, R>::jumpto() {
1434#ifdef _LIBUNWIND_TRACE_RET_INJECT
1435 /*
1436
1437 The value of `_walkedFrames` is computed in `unwind_phase2` and represents the
1438 number of frames walked starting `unwind_phase2` to get to the landing pad.
1439
1440 ```
1441 // uc is initialized by __unw_getcontext in the parent frame.
1442 // The first stack frame walked is unwind_phase2.
1443 unsigned framesWalked = 1;
1444 ```
1445
1446 To that, we need to add the number of function calls in libunwind between
1447 `unwind_phase2` & `__libunwind_Registers_arm64_jumpto` which performs the long
1448 jump, to rebalance the execution flow.
1449
1450 ```
1451 frame #0: libunwind.1.dylib`__libunwind_Registers_arm64_jumpto at UnwindRegistersRestore.S:646
1452 frame #1: libunwind.1.dylib`libunwind::Registers_arm64::returnto at Registers.hpp:2291:3
1453 frame #2: libunwind.1.dylib`libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_arm64>::jumpto at UnwindCursor.hpp:1474:14
1454 frame #3: libunwind.1.dylib`__unw_resume at libunwind.cpp:375:7
1455 frame #4: libunwind.1.dylib`__unw_resume_with_frames_walked at libunwind.cpp:363:10
1456 frame #5: libunwind.1.dylib`unwind_phase2 at UnwindLevel1.c:328:9
1457 frame #6: libunwind.1.dylib`_Unwind_RaiseException at UnwindLevel1.c:480:10
1458 frame #7: libc++abi.dylib`__cxa_throw at cxa_exception.cpp:295:5
1459 ...
1460 ```
1461
1462 If we look at the backtrace from `__libunwind_Registers_arm64_jumpto`, we see
1463 there are 5 frames on the stack to reach `unwind_phase2`. However, only 4 of
1464 them will never return, since `__libunwind_Registers_arm64_jumpto` returns
1465 back to the landing pad, so we need to subtract 1 to the number of
1466 `_EXTRA_LIBUNWIND_FRAMES_WALKED`.
1467 */
1468
1469 static constexpr size_t _EXTRA_LIBUNWIND_FRAMES_WALKED = 5 - 1;
1470 _registers.returnto(_walkedFrames + _EXTRA_LIBUNWIND_FRAMES_WALKED);
1471#else
14041472 _registers.jumpto();
1473#endif
14051474}
14061475
14071476#ifdef __arm__
......@@ -1410,6 +1479,13 @@ template <typename A, typename R> void UnwindCursor<A, R>::saveVFPAsX() {
14101479}
14111480#endif
14121481
1482#ifdef _LIBUNWIND_TRACE_RET_INJECT
1483template <typename A, typename R>
1484void UnwindCursor<A, R>::setWalkedFrames(unsigned walkedFrames) {
1485 _walkedFrames = walkedFrames;
1486}
1487#endif
1488
14131489#ifdef _AIX
14141490template <typename A, typename R>
14151491uintptr_t UnwindCursor<A, R>::getDataRelBase() {
......@@ -1658,11 +1734,11 @@ bool UnwindCursor<A, R>::getInfoFromEHABISection(
16581734template <typename A, typename R>
16591735bool UnwindCursor<A, R>::getInfoFromFdeCie(
16601736 const typename CFI_Parser<A>::FDE_Info &fdeInfo,
1661 const typename CFI_Parser<A>::CIE_Info &cieInfo, pint_t pc,
1662 uintptr_t dso_base) {
1737 const typename CFI_Parser<A>::CIE_Info &cieInfo,
1738 typename R::link_hardened_reg_arg_t pc, uintptr_t dso_base) {
16631739 typename CFI_Parser<A>::PrologInfo prolog;
1664 if (CFI_Parser<A>::parseFDEInstructions(_addressSpace, fdeInfo, cieInfo, pc,
1665 R::getArch(), &prolog)) {
1740 if (CFI_Parser<A>::template parseFDEInstructions<R>(
1741 _addressSpace, fdeInfo, cieInfo, pc, R::getArch(), &prolog)) {
16661742 // Save off parsed FDE info
16671743 _info.start_ip = fdeInfo.pcStart;
16681744 _info.end_ip = fdeInfo.pcEnd;
......@@ -1682,43 +1758,42 @@ bool UnwindCursor<A, R>::getInfoFromFdeCie(
16821758}
16831759
16841760template <typename A, typename R>
1685bool UnwindCursor<A, R>::getInfoFromDwarfSection(pint_t pc,
1686 const UnwindInfoSections &sects,
1687 uint32_t fdeSectionOffsetHint) {
1761bool UnwindCursor<A, R>::getInfoFromDwarfSection(
1762 typename R::link_hardened_reg_arg_t pc, const UnwindInfoSections &sects,
1763 uint32_t fdeSectionOffsetHint) {
16881764 typename CFI_Parser<A>::FDE_Info fdeInfo;
16891765 typename CFI_Parser<A>::CIE_Info cieInfo;
16901766 bool foundFDE = false;
16911767 bool foundInCache = false;
16921768 // If compact encoding table gave offset into dwarf section, go directly there
16931769 if (fdeSectionOffsetHint != 0) {
1694 foundFDE = CFI_Parser<A>::findFDE(_addressSpace, pc, sects.dwarf_section,
1695 sects.dwarf_section_length,
1696 sects.dwarf_section + fdeSectionOffsetHint,
1697 &fdeInfo, &cieInfo);
1770 foundFDE = CFI_Parser<A>::template findFDE<R>(
1771 _addressSpace, pc, sects.dwarf_section, sects.dwarf_section_length,
1772 sects.dwarf_section + fdeSectionOffsetHint, &fdeInfo, &cieInfo);
16981773 }
16991774#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX)
17001775 if (!foundFDE && (sects.dwarf_index_section != 0)) {
1701 foundFDE = EHHeaderParser<A>::findFDE(
1776 foundFDE = EHHeaderParser<A>::template findFDE<R>(
17021777 _addressSpace, pc, sects.dwarf_index_section,
17031778 (uint32_t)sects.dwarf_index_section_length, &fdeInfo, &cieInfo);
17041779 }
17051780#endif
17061781 if (!foundFDE) {
17071782 // otherwise, search cache of previously found FDEs.
1708 pint_t cachedFDE = DwarfFDECache<A>::findFDE(sects.dso_base, pc);
1783 pint_t cachedFDE =
1784 DwarfFDECache<A>::template findFDE<R>(sects.dso_base, pc);
17091785 if (cachedFDE != 0) {
1710 foundFDE =
1711 CFI_Parser<A>::findFDE(_addressSpace, pc, sects.dwarf_section,
1712 sects.dwarf_section_length,
1713 cachedFDE, &fdeInfo, &cieInfo);
1786 foundFDE = CFI_Parser<A>::template findFDE<R>(
1787 _addressSpace, pc, sects.dwarf_section, sects.dwarf_section_length,
1788 cachedFDE, &fdeInfo, &cieInfo);
17141789 foundInCache = foundFDE;
17151790 }
17161791 }
17171792 if (!foundFDE) {
17181793 // Still not found, do full scan of __eh_frame section.
1719 foundFDE = CFI_Parser<A>::findFDE(_addressSpace, pc, sects.dwarf_section,
1720 sects.dwarf_section_length, 0,
1721 &fdeInfo, &cieInfo);
1794 foundFDE = CFI_Parser<A>::template findFDE<R>(
1795 _addressSpace, pc, sects.dwarf_section, sects.dwarf_section_length, 0,
1796 &fdeInfo, &cieInfo);
17221797 }
17231798 if (foundFDE) {
17241799 if (getInfoFromFdeCie(fdeInfo, cieInfo, pc, sects.dso_base)) {
......@@ -1742,8 +1817,8 @@ bool UnwindCursor<A, R>::getInfoFromDwarfSection(pint_t pc,
17421817
17431818#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
17441819template <typename A, typename R>
1745bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
1746 const UnwindInfoSections &sects) {
1820bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(
1821 typename R::link_hardened_reg_arg_t pc, const UnwindInfoSections &sects) {
17471822 const bool log = false;
17481823 if (log)
17491824 fprintf(stderr, "getInfoFromCompactEncodingSection(pc=0x%llX, mh=0x%llX)\n",
......@@ -1974,6 +2049,16 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
19742049 personalityIndex * sizeof(uint32_t));
19752050 pint_t personalityPointer = sects.dso_base + (pint_t)personalityDelta;
19762051 personality = _addressSpace.getP(personalityPointer);
2052#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
2053 // The GOT for the personality function was signed address authenticated.
2054 // Resign it as a regular function pointer.
2055 const auto discriminator = ptrauth_blend_discriminator(
2056 &_info.handler, __ptrauth_unwind_upi_handler_disc);
2057 void *signedPtr = ptrauth_auth_and_resign(
2058 (void *)personality, ptrauth_key_function_pointer, personalityPointer,
2059 ptrauth_key_function_pointer, discriminator);
2060 personality = (__typeof(personality))signedPtr;
2061#endif
19772062 if (log)
19782063 fprintf(stderr, "getInfoFromCompactEncodingSection(pc=0x%llX), "
19792064 "personalityDelta=0x%08X, personality=0x%08llX\n",
......@@ -1987,7 +2072,11 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
19872072 _info.start_ip = funcStart;
19882073 _info.end_ip = funcEnd;
19892074 _info.lsda = lsda;
1990 _info.handler = personality;
2075 // We use memmove to copy the personality function as we have already manually
2076 // re-signed the pointer, and assigning directly will attempt to incorrectly
2077 // sign the already signed value.
2078 memmove(reinterpret_cast<void *>(&_info.handler),
2079 reinterpret_cast<void *>(&personality), sizeof(personality));
19912080 _info.gp = 0;
19922081 _info.flags = 0;
19932082 _info.format = encoding;
......@@ -2640,11 +2729,19 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
26402729 _isSigReturn = false;
26412730#endif
26422731
2643 pint_t pc = static_cast<pint_t>(this->getReg(UNW_REG_IP));
2732 typename R::reg_t rawPC = this->getReg(UNW_REG_IP);
2733
26442734#if defined(_LIBUNWIND_ARM_EHABI)
26452735 // Remove the thumb bit so the IP represents the actual instruction address.
26462736 // This matches the behaviour of _Unwind_GetIP on arm.
2647 pc &= (pint_t)~0x1;
2737 rawPC &= (pint_t)~0x1;
2738#endif
2739
2740 typename R::link_reg_t pc;
2741#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
2742 _registers.loadAndAuthenticateLinkRegister(rawPC, &pc);
2743#else
2744 pc = rawPC;
26482745#endif
26492746
26502747 // Exit early if at the top of the stack.
......@@ -2679,7 +2776,7 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
26792776
26802777 // Ask address space object to find unwind sections for this pc.
26812778 UnwindInfoSections sects;
2682 if (_addressSpace.findUnwindSections(pc, sects)) {
2779 if (_addressSpace.template findUnwindSections<R>(pc, sects)) {
26832780#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
26842781 // If there is a compact unwind encoding table, look there first.
26852782 if (sects.compact_unwind_section != 0) {
......@@ -2735,8 +2832,8 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
27352832#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
27362833 // There is no static unwind info for this pc. Look to see if an FDE was
27372834 // dynamically registered for it.
2738 pint_t cachedFDE = DwarfFDECache<A>::findFDE(DwarfFDECache<A>::kSearchAll,
2739 pc);
2835 pint_t cachedFDE =
2836 DwarfFDECache<A>::template findFDE<R>(DwarfFDECache<A>::kSearchAll, pc);
27402837 if (cachedFDE != 0) {
27412838 typename CFI_Parser<A>::FDE_Info fdeInfo;
27422839 typename CFI_Parser<A>::CIE_Info cieInfo;
......@@ -2748,7 +2845,7 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
27482845 // Lastly, ask AddressSpace object about platform specific ways to locate
27492846 // other FDEs.
27502847 pint_t fde;
2751 if (_addressSpace.findOtherFDE(pc, fde)) {
2848 if (_addressSpace.template findOtherFDE<R>(pc, fde)) {
27522849 typename CFI_Parser<A>::FDE_Info fdeInfo;
27532850 typename CFI_Parser<A>::CIE_Info cieInfo;
27542851 if (!CFI_Parser<A>::decodeFDE(_addressSpace, fde, &fdeInfo, &cieInfo)) {
......@@ -2772,6 +2869,21 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
27722869
27732870#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) && \
27742871 defined(_LIBUNWIND_TARGET_AARCH64)
2872
2873/*
2874 * The linux sigreturn restorer stub will always have the form:
2875 *
2876 * d2801168 movz x8, #0x8b
2877 * d4000001 svc #0x0
2878 */
2879#if defined(__AARCH64EB__)
2880#define MOVZ_X8_8B 0x681180d2
2881#define SVC_0 0x010000d4
2882#else
2883#define MOVZ_X8_8B 0xd2801168
2884#define SVC_0 0xd4000001
2885#endif
2886
27752887template <typename A, typename R>
27762888bool UnwindCursor<A, R>::setInfoForSigReturn(Registers_arm64 &) {
27772889 // Look for the sigreturn trampoline. The trampoline's body is two
......@@ -2796,7 +2908,7 @@ bool UnwindCursor<A, R>::setInfoForSigReturn(Registers_arm64 &) {
27962908 return false;
27972909 auto *instructions = reinterpret_cast<const uint32_t *>(pc);
27982910 // Look for instructions: mov x8, #0x8b; svc #0x0
2799 if (instructions[0] != 0xd2801168 || instructions[1] != 0xd4000001)
2911 if (instructions[0] != MOVZ_X8_8B || instructions[1] != SVC_0)
28002912 return false;
28012913
28022914 _info = {};
......@@ -3188,16 +3300,22 @@ template <typename A, typename R> int UnwindCursor<A, R>::step(bool stage2) {
31883300template <typename A, typename R>
31893301void UnwindCursor<A, R>::getInfo(unw_proc_info_t *info) {
31903302 if (_unwindInfoMissing)
3191 memset(info, 0, sizeof(*info));
3303 memset(static_cast<void *>(info), 0, sizeof(*info));
31923304 else
31933305 *info = _info;
31943306}
31953307
31963308template <typename A, typename R>
31973309bool UnwindCursor<A, R>::getFunctionName(char *buf, size_t bufLen,
3198 unw_word_t *offset) {
3199 return _addressSpace.findFunctionName((pint_t)this->getReg(UNW_REG_IP),
3200 buf, bufLen, offset);
3310 unw_word_t *offset) {
3311#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
3312 typename R::reg_t rawPC = this->getReg(UNW_REG_IP);
3313 typename R::link_reg_t pc;
3314 _registers.loadAndAuthenticateLinkRegister(rawPC, &pc);
3315#else
3316 typename R::link_reg_t pc = this->getReg(UNW_REG_IP);
3317#endif
3318 return _addressSpace.template findFunctionName<R>(pc, buf, bufLen, offset);
32013319}
32023320
32033321#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN)
lib/libunwind/src/UnwindLevel1.c+46-17
......@@ -48,16 +48,15 @@
4848// avoided when invoking the `jumpto()` function. To do this, we use inline
4949// assemblies to "goto" the `jumpto()` for these architectures.
5050#if !defined(_LIBUNWIND_USE_CET) && !defined(_LIBUNWIND_USE_GCS)
51#define __unw_phase2_resume(cursor, fn) \
51#define __unw_phase2_resume(cursor, payload) \
5252 do { \
53 (void)fn; \
54 __unw_resume((cursor)); \
53 __unw_resume_with_frames_walked((cursor), (payload)); \
5554 } while (0)
5655#elif defined(_LIBUNWIND_TARGET_I386)
5756#define __shstk_step_size (4)
58#define __unw_phase2_resume(cursor, fn) \
57#define __unw_phase2_resume(cursor, payload) \
5958 do { \
60 _LIBUNWIND_POP_SHSTK_SSP((fn)); \
59 _LIBUNWIND_POP_SHSTK_SSP((payload)); \
6160 void *shstkRegContext = __libunwind_shstk_get_registers((cursor)); \
6261 void *shstkJumpAddress = __libunwind_shstk_get_jump_target(); \
6362 __asm__ volatile("push %%edi\n\t" \
......@@ -67,9 +66,9 @@
6766 } while (0)
6867#elif defined(_LIBUNWIND_TARGET_X86_64)
6968#define __shstk_step_size (8)
70#define __unw_phase2_resume(cursor, fn) \
69#define __unw_phase2_resume(cursor, payload) \
7170 do { \
72 _LIBUNWIND_POP_SHSTK_SSP((fn)); \
71 _LIBUNWIND_POP_SHSTK_SSP((payload)); \
7372 void *shstkRegContext = __libunwind_shstk_get_registers((cursor)); \
7473 void *shstkJumpAddress = __libunwind_shstk_get_jump_target(); \
7574 __asm__ volatile("jmpq *%%rdx\n\t" ::"D"(shstkRegContext), \
......@@ -77,19 +76,37 @@
7776 } while (0)
7877#elif defined(_LIBUNWIND_TARGET_AARCH64)
7978#define __shstk_step_size (8)
80#define __unw_phase2_resume(cursor, fn) \
79#define __unw_phase2_resume(cursor, payload) \
8180 do { \
82 _LIBUNWIND_POP_SHSTK_SSP((fn)); \
81 _LIBUNWIND_POP_SHSTK_SSP((payload)); \
8382 void *shstkRegContext = __libunwind_shstk_get_registers((cursor)); \
8483 void *shstkJumpAddress = __libunwind_shstk_get_jump_target(); \
8584 __asm__ volatile("mov x0, %0\n\t" \
85 "mov x1, #0\n\t" \
8686 "br %1\n\t" \
8787 : \
8888 : "r"(shstkRegContext), "r"(shstkJumpAddress) \
89 : "x0"); \
89 : "x0", "x1"); \
9090 } while (0)
9191#endif
9292
93// We need this helper function as the semantics of casting between integers and
94// function pointers mean that we end up with a function pointer without the
95// correct signature. Instead we assign to an integer with a matching schema,
96// and then memmove the result into a variable of the correct type. This memmove
97// is possible as `_Unwind_Personality_Fn` is a standard function pointer, and
98// as such is not address diversified.
99static _Unwind_Personality_Fn get_handler_function(unw_proc_info_t *frameInfo) {
100 uintptr_t __unwind_ptrauth_restricted_intptr(ptrauth_key_function_pointer,
101 0,
102 ptrauth_function_pointer_type_discriminator(_Unwind_Personality_Fn))
103 reauthenticatedIntegerHandler = frameInfo->handler;
104 _Unwind_Personality_Fn handler;
105 memmove(&handler, (void *)&reauthenticatedIntegerHandler,
106 sizeof(_Unwind_Personality_Fn));
107 return handler;
108}
109
93110static _Unwind_Reason_Code
94111unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
95112 __unw_init_local(cursor, uc);
......@@ -147,8 +164,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
147164 // If there is a personality routine, ask it if it will want to stop at
148165 // this frame.
149166 if (frameInfo.handler != 0) {
150 _Unwind_Personality_Fn p =
151 (_Unwind_Personality_Fn)(uintptr_t)(frameInfo.handler);
167 _Unwind_Personality_Fn p = get_handler_function(&frameInfo);
152168 _LIBUNWIND_TRACE_UNWINDING(
153169 "unwind_phase1(ex_obj=%p): calling personality function %p",
154170 (void *)exception_object, (void *)(uintptr_t)p);
......@@ -184,11 +200,12 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
184200 }
185201 return _URC_NO_REASON;
186202}
187extern int __unw_step_stage2(unw_cursor_t *);
188203
189204#if defined(_LIBUNWIND_USE_GCS)
190205// Enable the GCS target feature to permit gcspop instructions to be used.
191206__attribute__((target("+gcs")))
207#else
208_LIBUNWIND_TRACE_NO_INLINE
192209#endif
193210static _Unwind_Reason_Code
194211unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
......@@ -276,8 +293,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
276293 ++framesWalked;
277294 // If there is a personality routine, tell it we are unwinding.
278295 if (frameInfo.handler != 0) {
279 _Unwind_Personality_Fn p =
280 (_Unwind_Personality_Fn)(uintptr_t)(frameInfo.handler);
296 _Unwind_Personality_Fn p = get_handler_function(&frameInfo);
281297 _Unwind_Action action = _UA_CLEANUP_PHASE;
282298 if (sp == exception_object->private_2) {
283299 // Tell personality this was the frame it marked in phase 1.
......@@ -334,6 +350,8 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
334350#if defined(_LIBUNWIND_USE_GCS)
335351// Enable the GCS target feature to permit gcspop instructions to be used.
336352__attribute__((target("+gcs")))
353#else
354_LIBUNWIND_TRACE_NO_INLINE
337355#endif
338356static _Unwind_Reason_Code
339357unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
......@@ -394,8 +412,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
394412 ++framesWalked;
395413 // If there is a personality routine, tell it we are unwinding.
396414 if (frameInfo.handler != 0) {
397 _Unwind_Personality_Fn p =
398 (_Unwind_Personality_Fn)(intptr_t)(frameInfo.handler);
415 _Unwind_Personality_Fn p = get_handler_function(&frameInfo);
399416 _LIBUNWIND_TRACE_UNWINDING(
400417 "unwind_phase2_forced(ex_obj=%p): calling personality function %p",
401418 (void *)exception_object, (void *)(uintptr_t)p);
......@@ -597,6 +614,18 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
597614 unw_cursor_t *cursor = (unw_cursor_t *)context;
598615 unw_word_t result;
599616 __unw_get_reg(cursor, UNW_REG_IP, &result);
617
618#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
619 // If we are in an arm64e frame, then the PC should have been signed with the
620 // sp
621 {
622 unw_word_t sp;
623 __unw_get_reg(cursor, UNW_REG_SP, &sp);
624 result = (unw_word_t)ptrauth_auth_data((void *)result,
625 ptrauth_key_return_address, sp);
626 }
627#endif
628
600629 _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIxPTR,
601630 (void *)context, result);
602631 return (uintptr_t)result;
lib/libunwind/src/UnwindRegistersRestore.S+46-5
......@@ -6,6 +6,8 @@
66//
77//===----------------------------------------------------------------------===//
88
9#if !defined(__wasm__)
10
911#include "assembly.h"
1012
1113#define FROM_0_TO_15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
......@@ -16,13 +18,17 @@
1618
1719#if defined(_AIX)
1820 .toc
21#elif defined(__aarch64__) && defined(__ELF__) && defined(_LIBUNWIND_EXECUTE_ONLY_CODE)
22 .section .text,"axy",@progbits,unique,0
1923#else
2024 .text
2125#endif
2226
23#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__)
27#if !defined(__USING_SJLJ_EXCEPTIONS__)
2428
2529#if defined(__i386__)
30.att_syntax
31
2632DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_x86_jumpto)
2733#
2834# extern "C" void __libunwind_Registers_x86_jumpto(Registers_x86 *);
......@@ -67,6 +73,7 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_x86_jumpto)
6773 # skip gs
6874
6975#elif defined(__x86_64__) && !defined(__arm64ec__)
76.att_syntax
7077
7178DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_x86_64_jumpto)
7279#
......@@ -629,18 +636,35 @@ Lnovec:
629636
630637#elif defined(__aarch64__)
631638
639#ifndef __has_feature
640#define __has_feature(__feature) 0
641#endif
642
632643#if defined(__ARM_FEATURE_GCS_DEFAULT)
633644.arch_extension gcs
634645#endif
635646
636647//
637// extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *);
648// extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *, unsigned);
638649//
639650// On entry:
640651// thread_state pointer is in x0
652// walked_frames counter is in x1
641653//
642654 .p2align 2
643655DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
656
657 #if defined(_LIBUNWIND_TRACE_RET_INJECT)
658 cbz w1, 1f
659 0:
660 subs w1, w1, #1
661 adr x16, #8
662 ret x16
663
664 b.ne 0b
665 1:
666 #endif
667
644668 // skip restore of x0,x1 for now
645669 ldp x2, x3, [x0, #0x010]
646670 ldp x4, x5, [x0, #0x020]
......@@ -657,7 +681,7 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
657681 ldp x24,x25, [x0, #0x0C0]
658682 ldp x26,x27, [x0, #0x0D0]
659683 ldp x28,x29, [x0, #0x0E0]
660 ldr x30, [x0, #0x100] // restore pc into lr
684
661685#if defined(__ARM_FP) && __ARM_FP != 0
662686 ldp d0, d1, [x0, #0x110]
663687 ldp d2, d3, [x0, #0x120]
......@@ -681,7 +705,18 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
681705 // context struct, because it is allocated on the stack, and an exception
682706 // could clobber the de-allocated portion of the stack after sp has been
683707 // restored.
684 ldr x16, [x0, #0x0F8]
708
709 ldr x16, [x0, #0x0F8] // load sp into scratch
710 ldr lr, [x0, #0x100] // restore pc into lr
711
712#if __has_feature(ptrauth_calls)
713 // The LR is signed with its address inside the register state. Time
714 // to resign to be a regular ROP protected signed pointer
715 add x1, x0, #0x100
716 autib lr, x1
717 pacib lr, x16 // signed the scratch register for sp
718#endif
719
685720 ldp x0, x1, [x0, #0x000] // restore x0,x1
686721 mov sp,x16 // restore sp
687722#if defined(__ARM_FEATURE_GCS_DEFAULT)
......@@ -694,7 +729,12 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
694729 gcspushm x30
695730Lnogcs:
696731#endif
732
733#if __has_feature(ptrauth_calls)
734 retab
735#else
697736 ret x30 // jump to pc
737#endif
698738
699739#elif defined(__arm__) && !defined(__APPLE__)
700740
......@@ -1253,7 +1293,8 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind19Registers_loongarch6jumptoEv)
12531293
12541294#endif
12551295
1256#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) */
1296#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */
12571297
12581298NO_EXEC_STACK_DIRECTIVE
12591299
1300#endif /* !defined(__wasm__) */
lib/libunwind/src/UnwindRegistersSave.S+86-2
......@@ -6,6 +6,8 @@
66//
77//===----------------------------------------------------------------------===//
88
9#if !defined(__wasm__)
10
911#include "assembly.h"
1012
1113#define FROM_0_TO_15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
......@@ -16,13 +18,16 @@
1618
1719#if defined(_AIX)
1820 .toc
21#elif defined(__aarch64__) && defined(__ELF__) && defined(_LIBUNWIND_EXECUTE_ONLY_CODE)
22 .section .text,"axy",@progbits,unique,0
1923#else
2024 .text
2125#endif
2226
23#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__)
27#if !defined(__USING_SJLJ_EXCEPTIONS__)
2428
2529#if defined(__i386__)
30.att_syntax
2631
2732#
2833# extern int __unw_getcontext(unw_context_t* thread_state)
......@@ -107,6 +112,7 @@ DEFINE_LIBUNWIND_FUNCTION("#__unw_getcontext")
107112 .text
108113
109114#elif defined(__x86_64__)
115.att_syntax
110116
111117#
112118# extern int __unw_getcontext(unw_context_t* thread_state)
......@@ -759,6 +765,10 @@ LnoR2Fix:
759765
760766#elif defined(__aarch64__)
761767
768#ifndef __has_feature
769#define __has_feature(__feature) 0
770#endif
771
762772//
763773// extern int __unw_getcontext(unw_context_t* thread_state)
764774//
......@@ -767,6 +777,11 @@ LnoR2Fix:
767777//
768778 .p2align 2
769779DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
780
781#if __has_feature(ptrauth_calls)
782 pacibsp
783#endif
784
770785 stp x0, x1, [x0, #0x000]
771786 stp x2, x3, [x0, #0x010]
772787 stp x4, x5, [x0, #0x020]
......@@ -807,7 +822,74 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
807822 str d31, [x0, #0x208]
808823#endif
809824 mov x0, #0 // return UNW_ESUCCESS
825
826#if __has_feature(ptrauth_calls)
827 retab
828#else
829 ret
830#endif
831
832//
833// extern "C" int64_t __libunwind_Registers_arm64_za_disable()
834//
835// This function implements the requirements of the __arm_za_disable ABI
836// routine, except that it will not abort; it will return a non-zero value
837// to signify the routine failed.
838//
839// Note: This function uses SME instructions. It must only be called if SME
840// has been confirmed to be available.
841//
842// On return:
843//
844// A status is placed in x0. A zero value indicates success; any non-zero
845// value indicates failure.
846//
847 .p2align 2
848DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_za_disable)
849 .variant_pcs __libunwind_Registers_arm64_za_disable
850#if __has_feature(ptrauth_calls)
851 pacibsp
852#endif
853 // If TPIDR2_EL0 is null, the subroutine just disables ZA.
854 .inst 0xd53bd0b0 // mrs x16, TPIDR2_EL0
855 cbz x16, 1f
856
857 // If any of the reserved bytes in the first 16 bytes of the TPIDR2 block are
858 // nonzero, return a non-zero value (libunwind will then abort).
859 ldrh w0, [x16, #10]
860 cbnz w0, 2f
861 ldr w0, [x16, #12]
862 cbnz w0, 2f
863
864 // If num_za_save_slices is zero, the subroutine just disables ZA.
865 ldrh w0, [x16, #8]
866 cbz x0, 1f
867
868 // If za_save_buffer is NULL, the subroutine just disables ZA.
869 ldr x16, [x16]
870 cbz x16, 1f
871
872 // Store ZA to za_save_buffer.
873 mov x15, xzr
8740:
875 .inst 0xe1206200 // str za[w15,0], [x16]
876 .inst 0x04305830 // addsvl x16, x16, #1
877 add x15, x15, #1
878 cmp x0, x15
879 b.ne 0b
8801:
881 // * Set TPIDR2_EL0 to null.
882 .inst 0xd51bd0bf // msr TPIDR2_EL0, xzr
883 // * Set PSTATE.ZA to 0.
884 .inst 0xd503447f // smstop za
885 // * Return zero (success)
886 mov x0, xzr
8872:
888#if __has_feature(ptrauth_calls)
889 retab
890#else
810891 ret
892#endif
811893
812894#elif defined(__arm__) && !defined(__APPLE__)
813895
......@@ -1232,6 +1314,8 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
12321314 WEAK_ALIAS(__unw_getcontext, unw_getcontext)
12331315#endif
12341316
1235#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__) */
1317#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */
12361318
12371319NO_EXEC_STACK_DIRECTIVE
1320
1321#endif /* !defined(__wasm__) */
lib/libunwind/src/assembly.h+5-1
......@@ -15,7 +15,7 @@
1515#ifndef UNWIND_ASSEMBLY_H
1616#define UNWIND_ASSEMBLY_H
1717
18#if defined(__linux__) && defined(__CET__)
18#if defined(__CET__)
1919#include <cet.h>
2020#define _LIBUNWIND_CET_ENDBR _CET_ENDBR
2121#else
......@@ -132,6 +132,10 @@
132132
133133#if defined(__APPLE__)
134134
135#if defined(__aarch64__) || defined(__arm64__) || defined(__arm64e__)
136#define _LIBUNWIND_TRACE_RET_INJECT 1
137#endif
138
135139#define SYMBOL_IS_FUNC(name)
136140#define HIDDEN_SYMBOL(name) .private_extern name
137141#if defined(_LIBUNWIND_HIDE_SYMBOLS)
lib/libunwind/src/config.h+9
......@@ -28,6 +28,9 @@
2828 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
2929 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
3030 #endif
31 #if defined(__aarch64__) || defined(__arm64__) || defined(__arm64e__)
32 #define _LIBUNWIND_TRACE_RET_INJECT 1
33 #endif
3134#elif defined(_WIN32)
3235 #ifdef __SEH__
3336 #define _LIBUNWIND_SUPPORT_SEH_UNWIND 1
......@@ -61,6 +64,12 @@
6164 #endif
6265#endif
6366
67#ifdef _LIBUNWIND_TRACE_RET_INJECT
68#define _LIBUNWIND_TRACE_NO_INLINE __attribute__((noinline, disable_tail_calls))
69#else
70#define _LIBUNWIND_TRACE_NO_INLINE
71#endif
72
6473#if defined(_LIBUNWIND_HIDE_SYMBOLS)
6574 // The CMake file passes -fvisibility=hidden to control ELF/Mach-O visibility.
6675 #define _LIBUNWIND_EXPORT
lib/libunwind/src/gcc_personality_v0.c+79-6
......@@ -31,6 +31,58 @@ EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *, PCONTEXT,
3131 _Unwind_Personality_Fn);
3232#endif
3333
34#ifndef __has_feature
35#define __has_feature(__feature) 0
36#endif
37
38#if __has_feature(ptrauth_calls)
39#include <ptrauth.h>
40
41// `__ptrauth_restricted_intptr` is a feature of apple clang that predates
42// support for direct application of `__ptrauth` to integer types. This
43// guard is necessary to support compilation with those compiler.
44#if __has_feature(ptrauth_restricted_intptr_qualifier)
45#define __ptrauth_gcc_personality_intptr(key, addressDiscriminated, \
46 discriminator) \
47 __ptrauth_restricted_intptr(key, addressDiscriminated, discriminator)
48#else
49#define __ptrauth_gcc_personality_intptr(key, addressDiscriminated, \
50 discriminator) \
51 __ptrauth(key, addressDiscriminated, discriminator)
52#endif
53#else
54#define __ptrauth_gcc_personality_intptr(...)
55#endif
56
57#define __ptrauth_gcc_personality_func_key ptrauth_key_function_pointer
58
59// ptrauth_string_discriminator("__gcc_personality_v0'funcStart") == 0xDFEB
60#define __ptrauth_gcc_personality_func_start \
61 __ptrauth_gcc_personality_intptr(__ptrauth_gcc_personality_func_key, 1, \
62 0xDFEB)
63
64// ptrauth_string_discriminator("__gcc_personality_v0'start") == 0x52DC
65#define __ptrauth_gcc_personality_start \
66 __ptrauth_gcc_personality_intptr(__ptrauth_gcc_personality_func_key, 1, \
67 0x52DC)
68
69// ptrauth_string_discriminator("__gcc_personality_v0'length") == 0xFFF7
70#define __ptrauth_gcc_personality_length \
71 __ptrauth_gcc_personality_intptr(__ptrauth_gcc_personality_func_key, 1, \
72 0xFFF7)
73
74// ptrauth_string_discriminator("__gcc_personality_v0'landingPadOffset") ==
75// 0x6498
76#define __ptrauth_gcc_personality_lpoffset \
77 __ptrauth_gcc_personality_intptr(__ptrauth_gcc_personality_func_key, 1, \
78 0x6498)
79
80// ptrauth_string_discriminator("__gcc_personality_v0'landingPad") == 0xA134
81#define __ptrauth_gcc_personality_lpad_disc 0xA134
82#define __ptrauth_gcc_personality_lpad \
83 __ptrauth_gcc_personality_intptr(__ptrauth_gcc_personality_func_key, 1, \
84 __ptrauth_gcc_personality_lpad_disc)
85
3486// Pointer encodings documented at:
3587// http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html
3688
......@@ -206,7 +258,8 @@ COMPILER_RT_ABI _Unwind_Reason_Code __gcc_personality_v0(
206258 return continueUnwind(exceptionObject, context);
207259
208260 uintptr_t pc = (uintptr_t)_Unwind_GetIP(context) - 1;
209 uintptr_t funcStart = (uintptr_t)_Unwind_GetRegionStart(context);
261 uintptr_t __ptrauth_gcc_personality_func_start funcStart =
262 (uintptr_t)_Unwind_GetRegionStart(context);
210263 uintptr_t pcOffset = pc - funcStart;
211264
212265 // Parse LSDA header.
......@@ -225,11 +278,14 @@ COMPILER_RT_ABI _Unwind_Reason_Code __gcc_personality_v0(
225278 const uint8_t *callSiteTableEnd = callSiteTableStart + callSiteTableLength;
226279 const uint8_t *p = callSiteTableStart;
227280 while (p < callSiteTableEnd) {
228 uintptr_t start = readEncodedPointer(&p, callSiteEncoding);
229 size_t length = readEncodedPointer(&p, callSiteEncoding);
230 size_t landingPad = readEncodedPointer(&p, callSiteEncoding);
281 uintptr_t __ptrauth_gcc_personality_start start =
282 readEncodedPointer(&p, callSiteEncoding);
283 size_t __ptrauth_gcc_personality_length length =
284 readEncodedPointer(&p, callSiteEncoding);
285 size_t __ptrauth_gcc_personality_lpoffset landingPadOffset =
286 readEncodedPointer(&p, callSiteEncoding);
231287 readULEB128(&p); // action value not used for C code
232 if (landingPad == 0)
288 if (landingPadOffset == 0)
233289 continue; // no landing pad for this entry
234290 if ((start <= pcOffset) && (pcOffset < (start + length))) {
235291 // Found landing pad for the PC.
......@@ -239,7 +295,24 @@ COMPILER_RT_ABI _Unwind_Reason_Code __gcc_personality_v0(
239295 _Unwind_SetGR(context, __builtin_eh_return_data_regno(0),
240296 (uintptr_t)exceptionObject);
241297 _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), 0);
242 _Unwind_SetIP(context, (funcStart + landingPad));
298 size_t __ptrauth_gcc_personality_lpad landingPad =
299 funcStart + landingPadOffset;
300#if __has_feature(ptrauth_calls)
301 uintptr_t stackPointer = _Unwind_GetGR(context, -2);
302 const uintptr_t existingDiscriminator = ptrauth_blend_discriminator(
303 &landingPad, __ptrauth_gcc_personality_lpad_disc);
304 // newIP is authenticated as if it were qualified with a pseudo qualifier
305 // along the lines of:
306 // __ptrauth(ptrauth_key_return_address, <stackPointer>, 0)
307 // where the stack pointer is used in place of the strict storage
308 // address.
309 uintptr_t newIP = (uintptr_t)ptrauth_auth_and_resign(
310 *(void **)&landingPad, __ptrauth_gcc_personality_func_key,
311 existingDiscriminator, ptrauth_key_return_address, stackPointer);
312 _Unwind_SetIP(context, newIP);
313#else
314 _Unwind_SetIP(context, landingPad);
315#endif
243316 return _URC_INSTALL_CONTEXT;
244317 }
245318 }
lib/libunwind/src/libunwind.cpp+104-4
......@@ -118,14 +118,55 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
118118 typedef LocalAddressSpace::pint_t pint_t;
119119 AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
120120 if (co->validReg(regNum)) {
121 co->setReg(regNum, (pint_t)value);
122121 // special case altering IP to re-find info (being called by personality
123122 // function)
124123 if (regNum == UNW_REG_IP) {
125124 unw_proc_info_t info;
126125 // First, get the FDE for the old location and then update it.
127126 co->getInfo(&info);
128 co->setInfoBasedOnIPRegister(false);
127
128 pint_t sp = (pint_t)co->getReg(UNW_REG_SP);
129
130#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
131 {
132 // It is only valid to set the IP within the current function. This is
133 // 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");
151
152 // PC should have been signed with the sp, so we verify that
153 // roundtripping does not fail. The `ptrauth_auth_and_resign` is
154 // guaranteed to trap on authentication failure even without FPAC
155 // feature.
156 pint_t pc = (pint_t)co->getReg(UNW_REG_IP);
157 if (ptrauth_auth_and_resign((void *)pc, ptrauth_key_return_address, sp,
158 ptrauth_key_return_address,
159 sp) != (void *)pc) {
160 _LIBUNWIND_LOG(
161 "Bad unwind with PAuth-enabled ABI (0x%zX, 0x%zX)->0x%zX\n", pc,
162 sp,
163 (pint_t)ptrauth_auth_data((void *)pc, ptrauth_key_return_address,
164 sp));
165 _LIBUNWIND_ABORT("Bad unwind with PAuth-enabled ABI");
166 }
167 }
168#endif
169
129170 // If the original call expects stack adjustment, perform this now.
130171 // Normal frame unwinding would have included the offset already in the
131172 // CFA computation.
......@@ -133,7 +174,11 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
133174 // this should actually be - info.gp. LLVM doesn't currently support
134175 // any such platforms and Clang doesn't export a macro for them.
135176 if (info.gp)
136 co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + info.gp);
177 co->setReg(UNW_REG_SP, sp + info.gp);
178 co->setReg(UNW_REG_IP, value);
179 co->setInfoBasedOnIPRegister(false);
180 } else {
181 co->setReg(regNum, (pint_t)value);
137182 }
138183 return UNW_ESUCCESS;
139184 }
......@@ -205,7 +250,27 @@ _LIBUNWIND_HIDDEN int __unw_get_proc_info(unw_cursor_t *cursor,
205250}
206251_LIBUNWIND_WEAK_ALIAS(__unw_get_proc_info, unw_get_proc_info)
207252
208/// Resume execution at cursor position (aka longjump).
253/// Rebalance the execution flow by injecting the right amount of `ret`
254/// instruction relatively to the amount of `walkedFrames` then resume execution
255/// at cursor position (aka longjump).
256_LIBUNWIND_HIDDEN int __unw_resume_with_frames_walked(unw_cursor_t *cursor,
257 unsigned walkedFrames) {
258 _LIBUNWIND_TRACE_API("__unw_resume(cursor=%p, walkedFrames=%u)",
259 static_cast<void *>(cursor), walkedFrames);
260#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
261 // Inform the ASan runtime that now might be a good time to clean stuff up.
262 __asan_handle_no_return();
263#endif
264#ifdef _LIBUNWIND_TRACE_RET_INJECT
265 AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
266 co->setWalkedFrames(walkedFrames);
267#endif
268 return __unw_resume(cursor);
269}
270_LIBUNWIND_WEAK_ALIAS(__unw_resume_with_frames_walked,
271 unw_resume_with_frames_walked)
272
273/// Legacy function. Resume execution at cursor position (aka longjump).
209274_LIBUNWIND_HIDDEN int __unw_resume(unw_cursor_t *cursor) {
210275 _LIBUNWIND_TRACE_API("__unw_resume(cursor=%p)", static_cast<void *>(cursor));
211276#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
......@@ -347,6 +412,41 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) {
347412}
348413
349414#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
415
416/// Maps the UNW_* error code to a textual representation
417_LIBUNWIND_HIDDEN const char *__unw_strerror(int error_code) {
418 switch (error_code) {
419 case UNW_ESUCCESS:
420 return "no error";
421 case UNW_EUNSPEC:
422 return "unspecified (general) error";
423 case UNW_ENOMEM:
424 return "out of memory";
425 case UNW_EBADREG:
426 return "bad register number";
427 case UNW_EREADONLYREG:
428 return "attempt to write read-only register";
429 case UNW_ESTOPUNWIND:
430 return "stop unwinding";
431 case UNW_EINVALIDIP:
432 return "invalid IP";
433 case UNW_EBADFRAME:
434 return "bad frame";
435 case UNW_EINVAL:
436 return "unsupported operation or bad value";
437 case UNW_EBADVERSION:
438 return "unwind info has unsupported version";
439 case UNW_ENOINFO:
440 return "no unwind info found";
441#if defined(_LIBUNWIND_TARGET_AARCH64) && !defined(_LIBUNWIND_IS_NATIVE_ONLY)
442 case UNW_ECROSSRASIGNING:
443 return "cross unwind with return address signing";
444#endif
445 }
446 return "invalid error code";
447}
448_LIBUNWIND_WEAK_ALIAS(__unw_strerror, unw_strerror)
449
350450#endif // !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__)
351451
352452#ifdef __APPLE__
lib/libunwind/src/libunwind_ext.h+7-1
......@@ -26,11 +26,16 @@ extern "C" {
2626extern int __unw_getcontext(unw_context_t *);
2727extern int __unw_init_local(unw_cursor_t *, unw_context_t *);
2828extern int __unw_step(unw_cursor_t *);
29extern int __unw_step_stage2(unw_cursor_t *);
2930extern int __unw_get_reg(unw_cursor_t *, unw_regnum_t, unw_word_t *);
3031extern int __unw_get_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t *);
3132extern int __unw_set_reg(unw_cursor_t *, unw_regnum_t, unw_word_t);
3233extern int __unw_set_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t);
33extern int __unw_resume(unw_cursor_t *);
34_LIBUNWIND_TRACE_NO_INLINE
35 extern int __unw_resume_with_frames_walked(unw_cursor_t *, unsigned);
36// `__unw_resume` is a legacy function. Use `__unw_resume_with_frames_walked` instead.
37_LIBUNWIND_TRACE_NO_INLINE
38 extern int __unw_resume(unw_cursor_t *);
3439
3540#ifdef __arm__
3641/* Save VFP registers in FSTMX format (instead of FSTMD). */
......@@ -42,6 +47,7 @@ extern int __unw_get_proc_info(unw_cursor_t *, unw_proc_info_t *);
4247extern int __unw_is_fpreg(unw_cursor_t *, unw_regnum_t);
4348extern int __unw_is_signal_frame(unw_cursor_t *);
4449extern int __unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *);
50extern const char *__unw_strerror(int);
4551
4652#if defined(_AIX)
4753extern uintptr_t __unw_get_data_rel_base(unw_cursor_t *);
lib/libunwind/src/shadow_stack_unwind.h+2-2
......@@ -12,8 +12,8 @@
1212
1313#include "libunwind.h"
1414
15// Currently, CET is implemented on Linux x86 platforms.
16#if defined(_LIBUNWIND_TARGET_LINUX) && defined(__CET__) && defined(__SHSTK__)
15// Currently, CET is implemented on some ELF x86 platforms.
16#if defined(__CET__) && defined(__SHSTK__)
1717#define _LIBUNWIND_USE_CET 1
1818#endif
1919
lib/std/Io/test.zig-1
......@@ -137,7 +137,6 @@ test "File.setLength" {
137137test "legacy setLength" {
138138 // https://github.com/ziglang/zig/issues/20747 (open fd does not have write permission)
139139 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
140 if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23806
141140
142141 const io = testing.io;
143142
lib/std/Target.zig+11-2
......@@ -845,6 +845,12 @@ pub const Abi = enum {
845845 => .eabi,
846846 else => .none,
847847 },
848 .fuchsia => switch (arch) {
849 .arm,
850 .thumb,
851 => .eabihf,
852 else => .none,
853 },
848854 .haiku => switch (arch) {
849855 .arm,
850856 .powerpc,
......@@ -928,7 +934,6 @@ pub const Abi = enum {
928934 .wasi, .emscripten => .musl,
929935
930936 .contiki,
931 .fuchsia,
932937 .hermit,
933938 .illumos,
934939 .managarm,
......@@ -1014,6 +1019,7 @@ pub const Abi = enum {
10141019 .gnueabi,
10151020 .musleabi,
10161021 .gnusf,
1022 .muslsf,
10171023 .ohoseabi,
10181024 => .soft,
10191025 else => .hard,
......@@ -1219,7 +1225,7 @@ pub const Cpu = struct {
12191225 pub const Set = struct {
12201226 ints: [usize_count]usize,
12211227
1222 pub const needed_bit_count = 317;
1228 pub const needed_bit_count = 347;
12231229 pub const byte_count = (needed_bit_count + 7) / 8;
12241230 pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);
12251231 pub const Index = std.math.Log2Int(std.meta.Int(.unsigned, usize_count * @bitSizeOf(usize)));
......@@ -2055,6 +2061,7 @@ pub const Cpu = struct {
20552061 .hppa => &hppa.cpu.pa_7300lc,
20562062 .kvx => &kvx.cpu.coolidge_v2,
20572063 .lanai => &lanai.cpu.v11, // clang does not have a generic lanai model.
2064 .loongarch32 => &loongarch.cpu.la32v1_0,
20582065 .loongarch64 => &loongarch.cpu.la64v1_0,
20592066 .m68k => &m68k.cpu.M68000,
20602067 .mips => &mips.cpu.mips32r2,
......@@ -2442,8 +2449,10 @@ pub const DynamicLinker = struct {
24422449 pub fn standard(cpu: Cpu, os: Os, abi: Abi) DynamicLinker {
24432450 return switch (os.tag) {
24442451 .fuchsia => switch (cpu.arch) {
2452 .arm,
24452453 .aarch64,
24462454 .riscv64,
2455 .thumb,
24472456 .x86_64,
24482457 => init("ld.so.1"), // Fuchsia is unusual in that `DT_INTERP` is just a basename.
24492458 else => none,
lib/std/Target/aarch64.zig+620-77
......@@ -9,6 +9,7 @@ pub const Feature = enum {
99 addr_lsl_slow_14,
1010 aes,
1111 aggressive_fma,
12 aggressive_interleaving,
1213 alternate_sextload_cvt_f32_pattern,
1314 altnzcv,
1415 alu_lsl_fast,
......@@ -22,6 +23,7 @@ pub const Feature = enum {
2223 bf16,
2324 brbe,
2425 bti,
26 btie,
2527 call_saved_x10,
2628 call_saved_x11,
2729 call_saved_x12,
......@@ -36,6 +38,7 @@ pub const Feature = enum {
3638 ccpp,
3739 chk,
3840 clrbhb,
41 cmh,
3942 cmp_bcc_fusion,
4043 cmpbr,
4144 complxnum,
......@@ -48,7 +51,9 @@ pub const Feature = enum {
4851 disable_fast_inc_vl,
4952 disable_latency_sched_heuristic,
5053 disable_ldp,
54 disable_maximize_scalable_bandwidth,
5155 disable_stp,
56 disable_unpredicated_ld_st_lower,
5257 dit,
5358 dotprod,
5459 ecv,
......@@ -58,6 +63,9 @@ pub const Feature = enum {
5863 ete,
5964 execute_only,
6065 exynos_cheap_as_move,
66 f16f32dot,
67 f16f32mm,
68 f16mm,
6169 f32mm,
6270 f64mm,
6371 f8f16mm,
......@@ -86,7 +94,9 @@ pub const Feature = enum {
8694 fuse_arith_logic,
8795 fuse_crypto_eor,
8896 fuse_csel,
97 fuse_cset,
8998 fuse_literals,
99 gcie,
90100 gcs,
91101 harden_sls_blr,
92102 harden_sls_nocomdat,
......@@ -99,22 +109,27 @@ pub const Feature = enum {
99109 ldp_aligned_only,
100110 lor,
101111 ls64,
112 lscp,
102113 lse,
103114 lse128,
104115 lse2,
105116 lsfe,
106117 lsui,
107118 lut,
119 max_interleave_factor_4,
108120 mec,
109121 mops,
122 mops_go,
110123 mpam,
124 mpamv2,
111125 mte,
126 mtetc,
112127 neon,
113128 nmi,
114129 no_bti_at_return_twice,
115130 no_neg_immediates,
116131 no_sve_fp_ld1r,
117 no_zcz_fp,
132 no_zcz_fpr64,
118133 nv,
119134 occmo,
120135 olympus,
......@@ -125,6 +140,7 @@ pub const Feature = enum {
125140 pauth_lr,
126141 pcdphint,
127142 perfmon,
143 poe2,
128144 pops,
129145 predictable_select_expensive,
130146 predres,
......@@ -174,6 +190,7 @@ pub const Feature = enum {
174190 sme2,
175191 sme2p1,
176192 sme2p2,
193 sme2p3,
177194 sme_b16b16,
178195 sme_f16f16,
179196 sme_f64f64,
......@@ -206,19 +223,22 @@ pub const Feature = enum {
206223 sve2_sm4,
207224 sve2p1,
208225 sve2p2,
226 sve2p3,
209227 sve_aes,
210228 sve_aes2,
211229 sve_b16b16,
230 sve_b16mm,
212231 sve_bfscale,
213232 sve_bitperm,
214233 sve_f16f32mm,
215234 sve_sha3,
216235 sve_sm4,
217236 tagged_globals,
237 tev,
218238 the,
219239 tlb_rmi,
240 tlbid,
220241 tlbiw,
221 tme,
222242 tpidr_el1,
223243 tpidr_el2,
224244 tpidr_el3,
......@@ -230,6 +250,7 @@ pub const Feature = enum {
230250 use_fixed_over_scalable_if_equal_cost,
231251 use_postra_scheduler,
232252 use_reciprocal_square_root,
253 use_wzr_to_vec_move,
233254 v8_1a,
234255 v8_2a,
235256 v8_3a,
......@@ -247,17 +268,20 @@ pub const Feature = enum {
247268 v9_4a,
248269 v9_5a,
249270 v9_6a,
271 v9_7a,
250272 v9a,
251273 vh,
252274 wfxt,
253275 xs,
276 zcm_fpr128,
254277 zcm_fpr32,
255278 zcm_fpr64,
256279 zcm_gpr32,
257280 zcm_gpr64,
258 zcz,
259281 zcz_fp_workaround,
260 zcz_gp,
282 zcz_fpr128,
283 zcz_gpr32,
284 zcz_gpr64,
261285};
262286
263287pub const featureSet = CpuFeature.FeatureSetFns(Feature).featureSet;
......@@ -274,9 +298,12 @@ pub const all_features = blk: {
274298 .llvm_name = "a320",
275299 .description = "Cortex-A320 ARM processors",
276300 .dependencies = featureSet(&[_]Feature{
301 .aggressive_interleaving,
277302 .fuse_adrp_add,
278303 .fuse_aes,
304 .use_fixed_over_scalable_if_equal_cost,
279305 .use_postra_scheduler,
306 .use_wzr_to_vec_move,
280307 }),
281308 };
282309 result[@intFromEnum(Feature.addr_lsl_slow_14)] = .{
......@@ -296,6 +323,11 @@ pub const all_features = blk: {
296323 .description = "Enable Aggressive FMA for floating-point.",
297324 .dependencies = featureSet(&[_]Feature{}),
298325 };
326 result[@intFromEnum(Feature.aggressive_interleaving)] = .{
327 .llvm_name = "aggressive-interleaving",
328 .description = "Make use of aggressive interleaving during vectorization",
329 .dependencies = featureSet(&[_]Feature{}),
330 };
299331 result[@intFromEnum(Feature.alternate_sextload_cvt_f32_pattern)] = .{
300332 .llvm_name = "alternate-sextload-cvt-f32-pattern",
301333 .description = "Use alternative pattern for sextload convert to f32",
......@@ -367,6 +399,11 @@ pub const all_features = blk: {
367399 .description = "Enable Branch Target Identification",
368400 .dependencies = featureSet(&[_]Feature{}),
369401 };
402 result[@intFromEnum(Feature.btie)] = .{
403 .llvm_name = "btie",
404 .description = "Enable Enhanced Branch Target Identification extension",
405 .dependencies = featureSet(&[_]Feature{}),
406 };
370407 result[@intFromEnum(Feature.call_saved_x10)] = .{
371408 .llvm_name = "call-saved-x10",
372409 .description = "Make X10 callee saved.",
......@@ -439,6 +476,11 @@ pub const all_features = blk: {
439476 .description = "Enable Clear BHB instruction",
440477 .dependencies = featureSet(&[_]Feature{}),
441478 };
479 result[@intFromEnum(Feature.cmh)] = .{
480 .llvm_name = "cmh",
481 .description = "Enable Armv9.7-A Contention Management Hints",
482 .dependencies = featureSet(&[_]Feature{}),
483 };
442484 result[@intFromEnum(Feature.cmp_bcc_fusion)] = .{
443485 .llvm_name = "cmp-bcc-fusion",
444486 .description = "CPU fuses cmp+bcc operations",
......@@ -506,11 +548,21 @@ pub const all_features = blk: {
506548 .description = "Do not emit ldp",
507549 .dependencies = featureSet(&[_]Feature{}),
508550 };
551 result[@intFromEnum(Feature.disable_maximize_scalable_bandwidth)] = .{
552 .llvm_name = "disable-maximize-scalable-bandwidth",
553 .description = "Determine the maximum scalable vector length for a loop by the largest scalar type rather than the smallest",
554 .dependencies = featureSet(&[_]Feature{}),
555 };
509556 result[@intFromEnum(Feature.disable_stp)] = .{
510557 .llvm_name = "disable-stp",
511558 .description = "Do not emit stp",
512559 .dependencies = featureSet(&[_]Feature{}),
513560 };
561 result[@intFromEnum(Feature.disable_unpredicated_ld_st_lower)] = .{
562 .llvm_name = "disable-unpredicated-ld-st-lower",
563 .description = "Disable lowering unpredicated loads/stores as LDR/STR",
564 .dependencies = featureSet(&[_]Feature{}),
565 };
514566 result[@intFromEnum(Feature.dit)] = .{
515567 .llvm_name = "dit",
516568 .description = "Enable Armv8.4-A Data Independent Timing instructions",
......@@ -560,6 +612,30 @@ pub const all_features = blk: {
560612 .description = "Use Exynos specific handling of cheap instructions",
561613 .dependencies = featureSet(&[_]Feature{}),
562614 };
615 result[@intFromEnum(Feature.f16f32dot)] = .{
616 .llvm_name = "f16f32dot",
617 .description = "Enable Armv9.7-A Advanced SIMD half-precision dot product accumulate to single-precision",
618 .dependencies = featureSet(&[_]Feature{
619 .fullfp16,
620 .neon,
621 }),
622 };
623 result[@intFromEnum(Feature.f16f32mm)] = .{
624 .llvm_name = "f16f32mm",
625 .description = "Enable Armv9.7-A Advanced SIMD half-precision matrix multiply-accumulate to single-precision",
626 .dependencies = featureSet(&[_]Feature{
627 .fullfp16,
628 .neon,
629 }),
630 };
631 result[@intFromEnum(Feature.f16mm)] = .{
632 .llvm_name = "f16mm",
633 .description = "Enable Armv9.7-A non-widening half-precision matrix multiply-accumulate",
634 .dependencies = featureSet(&[_]Feature{
635 .fullfp16,
636 .neon,
637 }),
638 };
563639 result[@intFromEnum(Feature.f32mm)] = .{
564640 .llvm_name = "f32mm",
565641 .description = "Enable Matrix Multiply FP32 Extension",
......@@ -729,7 +805,12 @@ pub const all_features = blk: {
729805 };
730806 result[@intFromEnum(Feature.fuse_csel)] = .{
731807 .llvm_name = "fuse-csel",
732 .description = "CPU fuses conditional select operations",
808 .description = "CPU can fuse CMP and CSEL operations",
809 .dependencies = featureSet(&[_]Feature{}),
810 };
811 result[@intFromEnum(Feature.fuse_cset)] = .{
812 .llvm_name = "fuse-cset",
813 .description = "CPU can fuse CMP and CSET operations",
733814 .dependencies = featureSet(&[_]Feature{}),
734815 };
735816 result[@intFromEnum(Feature.fuse_literals)] = .{
......@@ -737,6 +818,11 @@ pub const all_features = blk: {
737818 .description = "CPU fuses literal generation operations",
738819 .dependencies = featureSet(&[_]Feature{}),
739820 };
821 result[@intFromEnum(Feature.gcie)] = .{
822 .llvm_name = "gcie",
823 .description = "Enable GICv5 (Generic Interrupt Controller) CPU Interface Extension",
824 .dependencies = featureSet(&[_]Feature{}),
825 };
740826 result[@intFromEnum(Feature.gcs)] = .{
741827 .llvm_name = "gcs",
742828 .description = "Enable Armv9.4-A Guarded Call Stack Extension",
......@@ -805,6 +891,11 @@ pub const all_features = blk: {
805891 .description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension",
806892 .dependencies = featureSet(&[_]Feature{}),
807893 };
894 result[@intFromEnum(Feature.lscp)] = .{
895 .llvm_name = "lscp",
896 .description = "Enable Armv9.7-A Load-acquire and store-release pair extension",
897 .dependencies = featureSet(&[_]Feature{}),
898 };
808899 result[@intFromEnum(Feature.lse)] = .{
809900 .llvm_name = "lse",
810901 .description = "Enable Armv8.1-A Large System Extension (LSE) atomic instructions",
......@@ -841,6 +932,11 @@ pub const all_features = blk: {
841932 .neon,
842933 }),
843934 };
935 result[@intFromEnum(Feature.max_interleave_factor_4)] = .{
936 .llvm_name = "max-interleave-factor-4",
937 .description = "Set the MaxInterleaveFactor to 4 (from the default 2)",
938 .dependencies = featureSet(&[_]Feature{}),
939 };
844940 result[@intFromEnum(Feature.mec)] = .{
845941 .llvm_name = "mec",
846942 .description = "Enable Memory Encryption Contexts Extension",
......@@ -853,16 +949,36 @@ pub const all_features = blk: {
853949 .description = "Enable Armv8.8-A memcpy and memset acceleration instructions",
854950 .dependencies = featureSet(&[_]Feature{}),
855951 };
952 result[@intFromEnum(Feature.mops_go)] = .{
953 .llvm_name = "mops-go",
954 .description = "Enable memset acceleration granule only",
955 .dependencies = featureSet(&[_]Feature{
956 .mops,
957 .mte,
958 }),
959 };
856960 result[@intFromEnum(Feature.mpam)] = .{
857961 .llvm_name = "mpam",
858962 .description = "Enable Armv8.4-A Memory system Partitioning and Monitoring extension",
859963 .dependencies = featureSet(&[_]Feature{}),
860964 };
965 result[@intFromEnum(Feature.mpamv2)] = .{
966 .llvm_name = "mpamv2",
967 .description = "Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions",
968 .dependencies = featureSet(&[_]Feature{}),
969 };
861970 result[@intFromEnum(Feature.mte)] = .{
862971 .llvm_name = "mte",
863972 .description = "Enable Memory Tagging Extension",
864973 .dependencies = featureSet(&[_]Feature{}),
865974 };
975 result[@intFromEnum(Feature.mtetc)] = .{
976 .llvm_name = "mtetc",
977 .description = "Enable Virtual Memory Tagging Extension",
978 .dependencies = featureSet(&[_]Feature{
979 .mte,
980 }),
981 };
866982 result[@intFromEnum(Feature.neon)] = .{
867983 .llvm_name = "neon",
868984 .description = "Enable Advanced SIMD instructions",
......@@ -890,9 +1006,9 @@ pub const all_features = blk: {
8901006 .description = "Avoid using LD1RX instructions for FP",
8911007 .dependencies = featureSet(&[_]Feature{}),
8921008 };
893 result[@intFromEnum(Feature.no_zcz_fp)] = .{
894 .llvm_name = "no-zcz-fp",
895 .description = "Has no zero-cycle zeroing instructions for FP registers",
1009 result[@intFromEnum(Feature.no_zcz_fpr64)] = .{
1010 .llvm_name = "no-zcz-fpr64",
1011 .description = "Has no zero-cycle zeroing instructions for FPR64 registers",
8961012 .dependencies = featureSet(&[_]Feature{}),
8971013 };
8981014 result[@intFromEnum(Feature.nv)] = .{
......@@ -914,6 +1030,7 @@ pub const all_features = blk: {
9141030 .enable_select_opt,
9151031 .fuse_adrp_add,
9161032 .fuse_aes,
1033 .max_interleave_factor_4,
9171034 .predictable_select_expensive,
9181035 .use_fixed_over_scalable_if_equal_cost,
9191036 .use_postra_scheduler,
......@@ -956,6 +1073,11 @@ pub const all_features = blk: {
9561073 .description = "Enable Armv8.0-A PMUv3 Performance Monitors extension",
9571074 .dependencies = featureSet(&[_]Feature{}),
9581075 };
1076 result[@intFromEnum(Feature.poe2)] = .{
1077 .llvm_name = "poe2",
1078 .description = "Enable Stage 1 Permission Overlays Extension 2 instructions",
1079 .dependencies = featureSet(&[_]Feature{}),
1080 };
9591081 result[@intFromEnum(Feature.pops)] = .{
9601082 .llvm_name = "pops",
9611083 .description = "Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions",
......@@ -1224,6 +1346,13 @@ pub const all_features = blk: {
12241346 .sme2p1,
12251347 }),
12261348 };
1349 result[@intFromEnum(Feature.sme2p3)] = .{
1350 .llvm_name = "sme2p3",
1351 .description = "Enable Armv9.7-A Scalable Matrix Extension 2.3 instructions",
1352 .dependencies = featureSet(&[_]Feature{
1353 .sme2p2,
1354 }),
1355 };
12271356 result[@intFromEnum(Feature.sme_b16b16)] = .{
12281357 .llvm_name = "sme-b16b16",
12291358 .description = "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions",
......@@ -1447,6 +1576,13 @@ pub const all_features = blk: {
14471576 .sve2p1,
14481577 }),
14491578 };
1579 result[@intFromEnum(Feature.sve2p3)] = .{
1580 .llvm_name = "sve2p3",
1581 .description = "Enable Armv9.7-A Scalable Vector Extension 2.3 instructions",
1582 .dependencies = featureSet(&[_]Feature{
1583 .sve2p2,
1584 }),
1585 };
14501586 result[@intFromEnum(Feature.sve_aes)] = .{
14511587 .llvm_name = "sve-aes",
14521588 .description = "Enable SVE AES and quadword SVE polynomial multiply instructions",
......@@ -1464,6 +1600,13 @@ pub const all_features = blk: {
14641600 .description = "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions",
14651601 .dependencies = featureSet(&[_]Feature{}),
14661602 };
1603 result[@intFromEnum(Feature.sve_b16mm)] = .{
1604 .llvm_name = "sve-b16mm",
1605 .description = "Enable Armv9.7-A SVE non-widening BFloat16 matrix multiply-accumulate",
1606 .dependencies = featureSet(&[_]Feature{
1607 .sve,
1608 }),
1609 };
14671610 result[@intFromEnum(Feature.sve_bfscale)] = .{
14681611 .llvm_name = "sve-bfscale",
14691612 .description = "Enable Armv9.6-A SVE BFloat16 scaling instructions",
......@@ -1500,6 +1643,11 @@ pub const all_features = blk: {
15001643 .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits",
15011644 .dependencies = featureSet(&[_]Feature{}),
15021645 };
1646 result[@intFromEnum(Feature.tev)] = .{
1647 .llvm_name = "tev",
1648 .description = "Enable TIndex Exception-like Vector instructions",
1649 .dependencies = featureSet(&[_]Feature{}),
1650 };
15031651 result[@intFromEnum(Feature.the)] = .{
15041652 .llvm_name = "the",
15051653 .description = "Enable Armv8.9-A Translation Hardening Extension",
......@@ -1510,16 +1658,16 @@ pub const all_features = blk: {
15101658 .description = "Enable Armv8.4-A TLB Range and Maintenance instructions",
15111659 .dependencies = featureSet(&[_]Feature{}),
15121660 };
1661 result[@intFromEnum(Feature.tlbid)] = .{
1662 .llvm_name = "tlbid",
1663 .description = "Enable Armv9.7-A TLBI Domains extension",
1664 .dependencies = featureSet(&[_]Feature{}),
1665 };
15131666 result[@intFromEnum(Feature.tlbiw)] = .{
15141667 .llvm_name = "tlbiw",
15151668 .description = "Enable Armv9.5-A TLBI VMALL for Dirty State",
15161669 .dependencies = featureSet(&[_]Feature{}),
15171670 };
1518 result[@intFromEnum(Feature.tme)] = .{
1519 .llvm_name = "tme",
1520 .description = "Enable Transactional Memory Extension",
1521 .dependencies = featureSet(&[_]Feature{}),
1522 };
15231671 result[@intFromEnum(Feature.tpidr_el1)] = .{
15241672 .llvm_name = "tpidr-el1",
15251673 .description = "Permit use of TPIDR_EL1 for the TLS base",
......@@ -1575,6 +1723,11 @@ pub const all_features = blk: {
15751723 .description = "Use the reciprocal square root approximation",
15761724 .dependencies = featureSet(&[_]Feature{}),
15771725 };
1726 result[@intFromEnum(Feature.use_wzr_to_vec_move)] = .{
1727 .llvm_name = "use-wzr-to-vec-move",
1728 .description = "Move from WZR to insert 0 into vector registers",
1729 .dependencies = featureSet(&[_]Feature{}),
1730 };
15781731 result[@intFromEnum(Feature.v8_1a)] = .{
15791732 .llvm_name = "v8.1a",
15801733 .description = "Support ARM v8.1a architecture",
......@@ -1783,6 +1936,16 @@ pub const all_features = blk: {
17831936 .v9_5a,
17841937 }),
17851938 };
1939 result[@intFromEnum(Feature.v9_7a)] = .{
1940 .llvm_name = "v9.7a",
1941 .description = "Support ARM v9.7a architecture",
1942 .dependencies = featureSet(&[_]Feature{
1943 .f16f32dot,
1944 .fprcvt,
1945 .sve2p3,
1946 .v9_6a,
1947 }),
1948 };
17861949 result[@intFromEnum(Feature.v9a)] = .{
17871950 .llvm_name = "v9a",
17881951 .description = "Support ARM v9a architecture",
......@@ -1808,6 +1971,11 @@ pub const all_features = blk: {
18081971 .description = "Enable Armv8.7-A limited-TLB-maintenance instruction",
18091972 .dependencies = featureSet(&[_]Feature{}),
18101973 };
1974 result[@intFromEnum(Feature.zcm_fpr128)] = .{
1975 .llvm_name = "zcm-fpr128",
1976 .description = "Has zero-cycle register moves for FPR128 registers",
1977 .dependencies = featureSet(&[_]Feature{}),
1978 };
18111979 result[@intFromEnum(Feature.zcm_fpr32)] = .{
18121980 .llvm_name = "zcm-fpr32",
18131981 .description = "Has zero-cycle register moves for FPR32 registers",
......@@ -1828,21 +1996,24 @@ pub const all_features = blk: {
18281996 .description = "Has zero-cycle register moves for GPR64 registers",
18291997 .dependencies = featureSet(&[_]Feature{}),
18301998 };
1831 result[@intFromEnum(Feature.zcz)] = .{
1832 .llvm_name = "zcz",
1833 .description = "Has zero-cycle zeroing instructions",
1834 .dependencies = featureSet(&[_]Feature{
1835 .zcz_gp,
1836 }),
1837 };
18381999 result[@intFromEnum(Feature.zcz_fp_workaround)] = .{
18392000 .llvm_name = "zcz-fp-workaround",
18402001 .description = "The zero-cycle floating-point zeroing instruction has a bug",
18412002 .dependencies = featureSet(&[_]Feature{}),
18422003 };
1843 result[@intFromEnum(Feature.zcz_gp)] = .{
1844 .llvm_name = "zcz-gp",
1845 .description = "Has zero-cycle zeroing instructions for generic registers",
2004 result[@intFromEnum(Feature.zcz_fpr128)] = .{
2005 .llvm_name = "zcz-fpr128",
2006 .description = "Has zero-cycle zeroing instructions for FPR128 registers",
2007 .dependencies = featureSet(&[_]Feature{}),
2008 };
2009 result[@intFromEnum(Feature.zcz_gpr32)] = .{
2010 .llvm_name = "zcz-gpr32",
2011 .description = "Has zero-cycle zeroing instructions for GPR32 registers",
2012 .dependencies = featureSet(&[_]Feature{}),
2013 };
2014 result[@intFromEnum(Feature.zcz_gpr64)] = .{
2015 .llvm_name = "zcz-gpr64",
2016 .description = "Has zero-cycle zeroing instructions for GPR64 registers",
18462017 .dependencies = featureSet(&[_]Feature{}),
18472018 };
18482019 const ti = @typeInfo(Feature);
......@@ -1862,6 +2033,8 @@ pub const cpu = struct {
18622033 .aggressive_fma,
18632034 .arith_bcc_fusion,
18642035 .complxnum,
2036 .disable_unpredicated_ld_st_lower,
2037 .max_interleave_factor_4,
18652038 .perfmon,
18662039 .predictable_select_expensive,
18672040 .sha2,
......@@ -1886,6 +2059,7 @@ pub const cpu = struct {
18862059 .fuse_aes,
18872060 .fuse_literals,
18882061 .ldp_aligned_only,
2062 .max_interleave_factor_4,
18892063 .perfmon,
18902064 .rand,
18912065 .sha3,
......@@ -1911,6 +2085,7 @@ pub const cpu = struct {
19112085 .fuse_aes,
19122086 .fuse_literals,
19132087 .ldp_aligned_only,
2088 .max_interleave_factor_4,
19142089 .mte,
19152090 .perfmon,
19162091 .rand,
......@@ -1939,6 +2114,7 @@ pub const cpu = struct {
19392114 .fuse_aes,
19402115 .fuse_literals,
19412116 .ldp_aligned_only,
2117 .max_interleave_factor_4,
19422118 .mte,
19432119 .perfmon,
19442120 .predictable_select_expensive,
......@@ -1951,6 +2127,38 @@ pub const cpu = struct {
19512127 .v8_7a,
19522128 }),
19532129 };
2130 pub const ampere1c: CpuModel = .{
2131 .name = "ampere1c",
2132 .llvm_name = "ampere1c",
2133 .features = featureSet(&[_]Feature{
2134 .aggressive_fma,
2135 .alu_lsl_fast,
2136 .arith_bcc_fusion,
2137 .cmp_bcc_fusion,
2138 .cssc,
2139 .enable_select_opt,
2140 .faminmax,
2141 .fp16fml,
2142 .fp8fma,
2143 .fuse_address,
2144 .fuse_adrp_add,
2145 .fuse_aes,
2146 .fuse_literals,
2147 .lut,
2148 .max_interleave_factor_4,
2149 .mte,
2150 .perfmon,
2151 .predictable_select_expensive,
2152 .rand,
2153 .store_pair_suppress,
2154 .sve_aes,
2155 .sve_b16b16,
2156 .sve_sha3,
2157 .sve_sm4,
2158 .use_postra_scheduler,
2159 .v9_2a,
2160 }),
2161 };
19542162 pub const apple_a10: CpuModel = .{
19552163 .name = "apple_a10",
19562164 .llvm_name = "apple-a10",
......@@ -1964,6 +2172,7 @@ pub const cpu = struct {
19642172 .fuse_aes,
19652173 .fuse_crypto_eor,
19662174 .lor,
2175 .no_zcz_fpr64,
19672176 .pan,
19682177 .perfmon,
19692178 .rdm,
......@@ -1971,9 +2180,11 @@ pub const cpu = struct {
19712180 .store_pair_suppress,
19722181 .v8a,
19732182 .vh,
1974 .zcm_fpr64,
2183 .zcm_fpr128,
19752184 .zcm_gpr64,
1976 .zcz,
2185 .zcz_fpr128,
2186 .zcz_gpr32,
2187 .zcz_gpr64,
19772188 }),
19782189 };
19792190 pub const apple_a11: CpuModel = .{
......@@ -1988,13 +2199,16 @@ pub const cpu = struct {
19882199 .fullfp16,
19892200 .fuse_aes,
19902201 .fuse_crypto_eor,
2202 .no_zcz_fpr64,
19912203 .perfmon,
19922204 .sha2,
19932205 .store_pair_suppress,
19942206 .v8_2a,
1995 .zcm_fpr64,
2207 .zcm_fpr128,
19962208 .zcm_gpr64,
1997 .zcz,
2209 .zcz_fpr128,
2210 .zcz_gpr32,
2211 .zcz_gpr64,
19982212 }),
19992213 };
20002214 pub const apple_a12: CpuModel = .{
......@@ -2009,13 +2223,16 @@ pub const cpu = struct {
20092223 .fullfp16,
20102224 .fuse_aes,
20112225 .fuse_crypto_eor,
2226 .no_zcz_fpr64,
20122227 .perfmon,
20132228 .sha2,
20142229 .store_pair_suppress,
20152230 .v8_3a,
2016 .zcm_fpr64,
2231 .zcm_fpr128,
20172232 .zcm_gpr64,
2018 .zcz,
2233 .zcz_fpr128,
2234 .zcz_gpr32,
2235 .zcz_gpr64,
20192236 }),
20202237 };
20212238 pub const apple_a13: CpuModel = .{
......@@ -2030,13 +2247,16 @@ pub const cpu = struct {
20302247 .fp16fml,
20312248 .fuse_aes,
20322249 .fuse_crypto_eor,
2250 .no_zcz_fpr64,
20332251 .perfmon,
20342252 .sha3,
20352253 .store_pair_suppress,
20362254 .v8_4a,
2037 .zcm_fpr64,
2255 .zcm_fpr128,
20382256 .zcm_gpr64,
2039 .zcz,
2257 .zcz_fpr128,
2258 .zcz_gpr32,
2259 .zcz_gpr64,
20402260 }),
20412261 };
20422262 pub const apple_a14: CpuModel = .{
......@@ -2059,6 +2279,8 @@ pub const cpu = struct {
20592279 .fuse_crypto_eor,
20602280 .fuse_csel,
20612281 .fuse_literals,
2282 .max_interleave_factor_4,
2283 .no_zcz_fpr64,
20622284 .perfmon,
20632285 .predres,
20642286 .sb,
......@@ -2067,9 +2289,11 @@ pub const cpu = struct {
20672289 .ssbs,
20682290 .store_pair_suppress,
20692291 .v8_4a,
2070 .zcm_fpr64,
2292 .zcm_fpr128,
20712293 .zcm_gpr64,
2072 .zcz,
2294 .zcz_fpr128,
2295 .zcz_gpr32,
2296 .zcz_gpr64,
20732297 }),
20742298 };
20752299 pub const apple_a15: CpuModel = .{
......@@ -2090,13 +2314,17 @@ pub const cpu = struct {
20902314 .fuse_crypto_eor,
20912315 .fuse_csel,
20922316 .fuse_literals,
2317 .max_interleave_factor_4,
2318 .no_zcz_fpr64,
20932319 .perfmon,
20942320 .sha3,
20952321 .store_pair_suppress,
20962322 .v8_6a,
2097 .zcm_fpr64,
2323 .zcm_fpr128,
20982324 .zcm_gpr64,
2099 .zcz,
2325 .zcz_fpr128,
2326 .zcz_gpr32,
2327 .zcz_gpr64,
21002328 }),
21012329 };
21022330 pub const apple_a16: CpuModel = .{
......@@ -2118,13 +2346,17 @@ pub const cpu = struct {
21182346 .fuse_csel,
21192347 .fuse_literals,
21202348 .hcx,
2349 .max_interleave_factor_4,
2350 .no_zcz_fpr64,
21212351 .perfmon,
21222352 .sha3,
21232353 .store_pair_suppress,
21242354 .v8_6a,
2125 .zcm_fpr64,
2355 .zcm_fpr128,
21262356 .zcm_gpr64,
2127 .zcz,
2357 .zcz_fpr128,
2358 .zcz_gpr32,
2359 .zcz_gpr64,
21282360 }),
21292361 };
21302362 pub const apple_a17: CpuModel = .{
......@@ -2146,13 +2378,17 @@ pub const cpu = struct {
21462378 .fuse_csel,
21472379 .fuse_literals,
21482380 .hcx,
2381 .max_interleave_factor_4,
2382 .no_zcz_fpr64,
21492383 .perfmon,
21502384 .sha3,
21512385 .store_pair_suppress,
21522386 .v8_6a,
2153 .zcm_fpr64,
2387 .zcm_fpr128,
21542388 .zcm_gpr64,
2155 .zcz,
2389 .zcz_fpr128,
2390 .zcz_gpr32,
2391 .zcz_gpr64,
21562392 }),
21572393 };
21582394 pub const apple_a18: CpuModel = .{
......@@ -2173,15 +2409,58 @@ pub const cpu = struct {
21732409 .fuse_crypto_eor,
21742410 .fuse_csel,
21752411 .fuse_literals,
2412 .max_interleave_factor_4,
2413 .no_zcz_fpr64,
21762414 .perfmon,
21772415 .sha3,
21782416 .sme2,
21792417 .sme_f64f64,
21802418 .sme_i16i64,
21812419 .v8_7a,
2182 .zcm_fpr64,
2420 .zcm_fpr128,
21832421 .zcm_gpr64,
2184 .zcz,
2422 .zcz_fpr128,
2423 .zcz_gpr32,
2424 .zcz_gpr64,
2425 }),
2426 };
2427 pub const apple_a19: CpuModel = .{
2428 .name = "apple_a19",
2429 .llvm_name = "apple-a19",
2430 .features = featureSet(&[_]Feature{
2431 .aes,
2432 .alternate_sextload_cvt_f32_pattern,
2433 .arith_bcc_fusion,
2434 .arith_cbz_fusion,
2435 .cssc,
2436 .disable_latency_sched_heuristic,
2437 .fp16fml,
2438 .fpac,
2439 .fuse_address,
2440 .fuse_adrp_add,
2441 .fuse_aes,
2442 .fuse_arith_logic,
2443 .fuse_crypto_eor,
2444 .fuse_csel,
2445 .fuse_literals,
2446 .hbc,
2447 .max_interleave_factor_4,
2448 .mte,
2449 .no_zcz_fpr64,
2450 .perfmon,
2451 .sha3,
2452 .sme2p1,
2453 .sme_b16b16,
2454 .sme_f16f16,
2455 .sme_f64f64,
2456 .sme_i16i64,
2457 .specres2,
2458 .v8_7a,
2459 .zcm_fpr128,
2460 .zcm_gpr64,
2461 .zcz_fpr128,
2462 .zcz_gpr32,
2463 .zcz_gpr64,
21852464 }),
21862465 };
21872466 pub const apple_a7: CpuModel = .{
......@@ -2195,14 +2474,17 @@ pub const cpu = struct {
21952474 .disable_latency_sched_heuristic,
21962475 .fuse_aes,
21972476 .fuse_crypto_eor,
2477 .no_zcz_fpr64,
21982478 .perfmon,
21992479 .sha2,
22002480 .store_pair_suppress,
22012481 .v8a,
2202 .zcm_fpr64,
2482 .zcm_fpr128,
22032483 .zcm_gpr64,
2204 .zcz,
22052484 .zcz_fp_workaround,
2485 .zcz_fpr128,
2486 .zcz_gpr32,
2487 .zcz_gpr64,
22062488 }),
22072489 };
22082490 pub const apple_a8: CpuModel = .{
......@@ -2216,14 +2498,17 @@ pub const cpu = struct {
22162498 .disable_latency_sched_heuristic,
22172499 .fuse_aes,
22182500 .fuse_crypto_eor,
2501 .no_zcz_fpr64,
22192502 .perfmon,
22202503 .sha2,
22212504 .store_pair_suppress,
22222505 .v8a,
2223 .zcm_fpr64,
2506 .zcm_fpr128,
22242507 .zcm_gpr64,
2225 .zcz,
22262508 .zcz_fp_workaround,
2509 .zcz_fpr128,
2510 .zcz_gpr32,
2511 .zcz_gpr64,
22272512 }),
22282513 };
22292514 pub const apple_a9: CpuModel = .{
......@@ -2237,14 +2522,17 @@ pub const cpu = struct {
22372522 .disable_latency_sched_heuristic,
22382523 .fuse_aes,
22392524 .fuse_crypto_eor,
2525 .no_zcz_fpr64,
22402526 .perfmon,
22412527 .sha2,
22422528 .store_pair_suppress,
22432529 .v8a,
2244 .zcm_fpr64,
2530 .zcm_fpr128,
22452531 .zcm_gpr64,
2246 .zcz,
22472532 .zcz_fp_workaround,
2533 .zcz_fpr128,
2534 .zcz_gpr32,
2535 .zcz_gpr64,
22482536 }),
22492537 };
22502538 pub const apple_m1: CpuModel = .{
......@@ -2267,6 +2555,8 @@ pub const cpu = struct {
22672555 .fuse_crypto_eor,
22682556 .fuse_csel,
22692557 .fuse_literals,
2558 .max_interleave_factor_4,
2559 .no_zcz_fpr64,
22702560 .perfmon,
22712561 .predres,
22722562 .sb,
......@@ -2275,9 +2565,11 @@ pub const cpu = struct {
22752565 .ssbs,
22762566 .store_pair_suppress,
22772567 .v8_4a,
2278 .zcm_fpr64,
2568 .zcm_fpr128,
22792569 .zcm_gpr64,
2280 .zcz,
2570 .zcz_fpr128,
2571 .zcz_gpr32,
2572 .zcz_gpr64,
22812573 }),
22822574 };
22832575 pub const apple_m2: CpuModel = .{
......@@ -2298,13 +2590,17 @@ pub const cpu = struct {
22982590 .fuse_crypto_eor,
22992591 .fuse_csel,
23002592 .fuse_literals,
2593 .max_interleave_factor_4,
2594 .no_zcz_fpr64,
23012595 .perfmon,
23022596 .sha3,
23032597 .store_pair_suppress,
23042598 .v8_6a,
2305 .zcm_fpr64,
2599 .zcm_fpr128,
23062600 .zcm_gpr64,
2307 .zcz,
2601 .zcz_fpr128,
2602 .zcz_gpr32,
2603 .zcz_gpr64,
23082604 }),
23092605 };
23102606 pub const apple_m3: CpuModel = .{
......@@ -2326,13 +2622,17 @@ pub const cpu = struct {
23262622 .fuse_csel,
23272623 .fuse_literals,
23282624 .hcx,
2625 .max_interleave_factor_4,
2626 .no_zcz_fpr64,
23292627 .perfmon,
23302628 .sha3,
23312629 .store_pair_suppress,
23322630 .v8_6a,
2333 .zcm_fpr64,
2631 .zcm_fpr128,
23342632 .zcm_gpr64,
2335 .zcz,
2633 .zcz_fpr128,
2634 .zcz_gpr32,
2635 .zcz_gpr64,
23362636 }),
23372637 };
23382638 pub const apple_m4: CpuModel = .{
......@@ -2353,15 +2653,58 @@ pub const cpu = struct {
23532653 .fuse_crypto_eor,
23542654 .fuse_csel,
23552655 .fuse_literals,
2656 .max_interleave_factor_4,
2657 .no_zcz_fpr64,
23562658 .perfmon,
23572659 .sha3,
23582660 .sme2,
23592661 .sme_f64f64,
23602662 .sme_i16i64,
23612663 .v8_7a,
2362 .zcm_fpr64,
2664 .zcm_fpr128,
2665 .zcm_gpr64,
2666 .zcz_fpr128,
2667 .zcz_gpr32,
2668 .zcz_gpr64,
2669 }),
2670 };
2671 pub const apple_m5: CpuModel = .{
2672 .name = "apple_m5",
2673 .llvm_name = "apple-m5",
2674 .features = featureSet(&[_]Feature{
2675 .aes,
2676 .alternate_sextload_cvt_f32_pattern,
2677 .arith_bcc_fusion,
2678 .arith_cbz_fusion,
2679 .cssc,
2680 .disable_latency_sched_heuristic,
2681 .fp16fml,
2682 .fpac,
2683 .fuse_address,
2684 .fuse_adrp_add,
2685 .fuse_aes,
2686 .fuse_arith_logic,
2687 .fuse_crypto_eor,
2688 .fuse_csel,
2689 .fuse_literals,
2690 .hbc,
2691 .max_interleave_factor_4,
2692 .mte,
2693 .no_zcz_fpr64,
2694 .perfmon,
2695 .sha3,
2696 .sme2p1,
2697 .sme_b16b16,
2698 .sme_f16f16,
2699 .sme_f64f64,
2700 .sme_i16i64,
2701 .specres2,
2702 .v8_7a,
2703 .zcm_fpr128,
23632704 .zcm_gpr64,
2364 .zcz,
2705 .zcz_fpr128,
2706 .zcz_gpr32,
2707 .zcz_gpr64,
23652708 }),
23662709 };
23672710 pub const apple_s10: CpuModel = .{
......@@ -2383,13 +2726,17 @@ pub const cpu = struct {
23832726 .fuse_csel,
23842727 .fuse_literals,
23852728 .hcx,
2729 .max_interleave_factor_4,
2730 .no_zcz_fpr64,
23862731 .perfmon,
23872732 .sha3,
23882733 .store_pair_suppress,
23892734 .v8_6a,
2390 .zcm_fpr64,
2735 .zcm_fpr128,
23912736 .zcm_gpr64,
2392 .zcz,
2737 .zcz_fpr128,
2738 .zcz_gpr32,
2739 .zcz_gpr64,
23932740 }),
23942741 };
23952742 pub const apple_s4: CpuModel = .{
......@@ -2404,13 +2751,16 @@ pub const cpu = struct {
24042751 .fullfp16,
24052752 .fuse_aes,
24062753 .fuse_crypto_eor,
2754 .no_zcz_fpr64,
24072755 .perfmon,
24082756 .sha2,
24092757 .store_pair_suppress,
24102758 .v8_3a,
2411 .zcm_fpr64,
2759 .zcm_fpr128,
24122760 .zcm_gpr64,
2413 .zcz,
2761 .zcz_fpr128,
2762 .zcz_gpr32,
2763 .zcz_gpr64,
24142764 }),
24152765 };
24162766 pub const apple_s5: CpuModel = .{
......@@ -2425,13 +2775,16 @@ pub const cpu = struct {
24252775 .fullfp16,
24262776 .fuse_aes,
24272777 .fuse_crypto_eor,
2778 .no_zcz_fpr64,
24282779 .perfmon,
24292780 .sha2,
24302781 .store_pair_suppress,
24312782 .v8_3a,
2432 .zcm_fpr64,
2783 .zcm_fpr128,
24332784 .zcm_gpr64,
2434 .zcz,
2785 .zcz_fpr128,
2786 .zcz_gpr32,
2787 .zcz_gpr64,
24352788 }),
24362789 };
24372790 pub const apple_s6: CpuModel = .{
......@@ -2446,13 +2799,16 @@ pub const cpu = struct {
24462799 .fp16fml,
24472800 .fuse_aes,
24482801 .fuse_crypto_eor,
2802 .no_zcz_fpr64,
24492803 .perfmon,
24502804 .sha3,
24512805 .store_pair_suppress,
24522806 .v8_4a,
2453 .zcm_fpr64,
2807 .zcm_fpr128,
24542808 .zcm_gpr64,
2455 .zcz,
2809 .zcz_fpr128,
2810 .zcz_gpr32,
2811 .zcz_gpr64,
24562812 }),
24572813 };
24582814 pub const apple_s7: CpuModel = .{
......@@ -2467,13 +2823,16 @@ pub const cpu = struct {
24672823 .fp16fml,
24682824 .fuse_aes,
24692825 .fuse_crypto_eor,
2826 .no_zcz_fpr64,
24702827 .perfmon,
24712828 .sha3,
24722829 .store_pair_suppress,
24732830 .v8_4a,
2474 .zcm_fpr64,
2831 .zcm_fpr128,
24752832 .zcm_gpr64,
2476 .zcz,
2833 .zcz_fpr128,
2834 .zcz_gpr32,
2835 .zcz_gpr64,
24772836 }),
24782837 };
24792838 pub const apple_s8: CpuModel = .{
......@@ -2488,13 +2847,16 @@ pub const cpu = struct {
24882847 .fp16fml,
24892848 .fuse_aes,
24902849 .fuse_crypto_eor,
2850 .no_zcz_fpr64,
24912851 .perfmon,
24922852 .sha3,
24932853 .store_pair_suppress,
24942854 .v8_4a,
2495 .zcm_fpr64,
2855 .zcm_fpr128,
24962856 .zcm_gpr64,
2497 .zcz,
2857 .zcz_fpr128,
2858 .zcz_gpr32,
2859 .zcz_gpr64,
24982860 }),
24992861 };
25002862 pub const apple_s9: CpuModel = .{
......@@ -2516,13 +2878,126 @@ pub const cpu = struct {
25162878 .fuse_csel,
25172879 .fuse_literals,
25182880 .hcx,
2881 .max_interleave_factor_4,
2882 .no_zcz_fpr64,
25192883 .perfmon,
25202884 .sha3,
25212885 .store_pair_suppress,
25222886 .v8_6a,
2523 .zcm_fpr64,
2887 .zcm_fpr128,
25242888 .zcm_gpr64,
2525 .zcz,
2889 .zcz_fpr128,
2890 .zcz_gpr32,
2891 .zcz_gpr64,
2892 }),
2893 };
2894 pub const c1_nano: CpuModel = .{
2895 .name = "c1_nano",
2896 .llvm_name = "c1-nano",
2897 .features = featureSet(&[_]Feature{
2898 .chk,
2899 .clrbhb,
2900 .ete,
2901 .fp16fml,
2902 .fpac,
2903 .fuse_adrp_add,
2904 .fuse_aes,
2905 .mte,
2906 .perfmon,
2907 .rcpc3,
2908 .sme2,
2909 .specres2,
2910 .sve_bitperm,
2911 .use_fixed_over_scalable_if_equal_cost,
2912 .use_postra_scheduler,
2913 .use_wzr_to_vec_move,
2914 .v9_3a,
2915 }),
2916 };
2917 pub const c1_premium: CpuModel = .{
2918 .name = "c1_premium",
2919 .llvm_name = "c1-premium",
2920 .features = featureSet(&[_]Feature{
2921 .alu_lsl_fast,
2922 .avoid_ldapur,
2923 .chk,
2924 .clrbhb,
2925 .enable_select_opt,
2926 .ete,
2927 .fp16fml,
2928 .fpac,
2929 .fuse_adrp_add,
2930 .fuse_aes,
2931 .fuse_csel,
2932 .fuse_cset,
2933 .mte,
2934 .perfmon,
2935 .predictable_select_expensive,
2936 .rcpc3,
2937 .sme2,
2938 .spe,
2939 .specres2,
2940 .sve_bitperm,
2941 .use_fixed_over_scalable_if_equal_cost,
2942 .use_postra_scheduler,
2943 .v9_3a,
2944 }),
2945 };
2946 pub const c1_pro: CpuModel = .{
2947 .name = "c1_pro",
2948 .llvm_name = "c1-pro",
2949 .features = featureSet(&[_]Feature{
2950 .alu_lsl_fast,
2951 .chk,
2952 .clrbhb,
2953 .cmp_bcc_fusion,
2954 .enable_select_opt,
2955 .ete,
2956 .fp16fml,
2957 .fpac,
2958 .fuse_adrp_add,
2959 .fuse_aes,
2960 .fuse_csel,
2961 .fuse_cset,
2962 .mte,
2963 .perfmon,
2964 .predictable_select_expensive,
2965 .rcpc3,
2966 .sme2,
2967 .spe,
2968 .specres2,
2969 .sve_bitperm,
2970 .use_postra_scheduler,
2971 .v9_3a,
2972 }),
2973 };
2974 pub const c1_ultra: CpuModel = .{
2975 .name = "c1_ultra",
2976 .llvm_name = "c1-ultra",
2977 .features = featureSet(&[_]Feature{
2978 .alu_lsl_fast,
2979 .avoid_ldapur,
2980 .chk,
2981 .clrbhb,
2982 .enable_select_opt,
2983 .ete,
2984 .fp16fml,
2985 .fpac,
2986 .fuse_adrp_add,
2987 .fuse_aes,
2988 .fuse_csel,
2989 .fuse_cset,
2990 .mte,
2991 .perfmon,
2992 .predictable_select_expensive,
2993 .rcpc3,
2994 .sme2,
2995 .spe,
2996 .specres2,
2997 .sve_bitperm,
2998 .use_fixed_over_scalable_if_equal_cost,
2999 .use_postra_scheduler,
3000 .v9_3a,
25263001 }),
25273002 };
25283003 pub const carmel: CpuModel = .{
......@@ -2541,12 +3016,15 @@ pub const cpu = struct {
25413016 .features = featureSet(&[_]Feature{
25423017 .alu_lsl_fast,
25433018 .bf16,
3019 .disable_maximize_scalable_bandwidth,
25443020 .enable_select_opt,
25453021 .ete,
25463022 .fp16fml,
25473023 .fpac,
25483024 .fuse_adrp_add,
25493025 .fuse_aes,
3026 .fuse_csel,
3027 .fuse_cset,
25503028 .i8mm,
25513029 .mte,
25523030 .perfmon,
......@@ -2607,6 +3085,7 @@ pub const cpu = struct {
26073085 .sve_bitperm,
26083086 .use_fixed_over_scalable_if_equal_cost,
26093087 .use_postra_scheduler,
3088 .use_wzr_to_vec_move,
26103089 .v9a,
26113090 }),
26123091 };
......@@ -2624,6 +3103,7 @@ pub const cpu = struct {
26243103 .sve_bitperm,
26253104 .use_fixed_over_scalable_if_equal_cost,
26263105 .use_postra_scheduler,
3106 .use_wzr_to_vec_move,
26273107 .v9_2a,
26283108 }),
26293109 };
......@@ -2640,6 +3120,7 @@ pub const cpu = struct {
26403120 .perfmon,
26413121 .sve_bitperm,
26423122 .use_postra_scheduler,
3123 .use_wzr_to_vec_move,
26433124 .v9_2a,
26443125 }),
26453126 };
......@@ -2655,6 +3136,7 @@ pub const cpu = struct {
26553136 .perfmon,
26563137 .sha2,
26573138 .use_postra_scheduler,
3139 .use_wzr_to_vec_move,
26583140 .v8a,
26593141 }),
26603142 };
......@@ -2672,6 +3154,7 @@ pub const cpu = struct {
26723154 .rcpc,
26733155 .sha2,
26743156 .use_postra_scheduler,
3157 .use_wzr_to_vec_move,
26753158 .v8_2a,
26763159 }),
26773160 };
......@@ -2687,6 +3170,7 @@ pub const cpu = struct {
26873170 .fuse_adrp_add,
26883171 .fuse_aes,
26893172 .fuse_literals,
3173 .max_interleave_factor_4,
26903174 .perfmon,
26913175 .predictable_select_expensive,
26923176 .sha2,
......@@ -2747,6 +3231,8 @@ pub const cpu = struct {
27473231 .fpac,
27483232 .fuse_adrp_add,
27493233 .fuse_aes,
3234 .fuse_csel,
3235 .fuse_cset,
27503236 .i8mm,
27513237 .mte,
27523238 .perfmon,
......@@ -2769,6 +3255,8 @@ pub const cpu = struct {
27693255 .fpac,
27703256 .fuse_adrp_add,
27713257 .fuse_aes,
3258 .fuse_csel,
3259 .fuse_cset,
27723260 .i8mm,
27733261 .mte,
27743262 .perfmon,
......@@ -2808,6 +3296,8 @@ pub const cpu = struct {
28083296 .fpac,
28093297 .fuse_adrp_add,
28103298 .fuse_aes,
3299 .fuse_csel,
3300 .fuse_cset,
28113301 .mte,
28123302 .perfmon,
28133303 .predictable_select_expensive,
......@@ -2829,6 +3319,8 @@ pub const cpu = struct {
28293319 .fpac,
28303320 .fuse_adrp_add,
28313321 .fuse_aes,
3322 .fuse_csel,
3323 .fuse_cset,
28323324 .mte,
28333325 .perfmon,
28343326 .predictable_select_expensive,
......@@ -2850,6 +3342,8 @@ pub const cpu = struct {
28503342 .fpac,
28513343 .fuse_adrp_add,
28523344 .fuse_aes,
3345 .fuse_csel,
3346 .fuse_cset,
28533347 .mte,
28543348 .perfmon,
28553349 .predictable_select_expensive,
......@@ -2967,6 +3461,8 @@ pub const cpu = struct {
29673461 .fullfp16,
29683462 .fuse_adrp_add,
29693463 .fuse_aes,
3464 .fuse_csel,
3465 .fuse_cset,
29703466 .perfmon,
29713467 .predictable_select_expensive,
29723468 .rcpc,
......@@ -2990,6 +3486,8 @@ pub const cpu = struct {
29903486 .fullfp16,
29913487 .fuse_adrp_add,
29923488 .fuse_aes,
3489 .fuse_csel,
3490 .fuse_cset,
29933491 .perfmon,
29943492 .predictable_select_expensive,
29953493 .rcpc,
......@@ -3014,6 +3512,8 @@ pub const cpu = struct {
30143512 .fullfp16,
30153513 .fuse_adrp_add,
30163514 .fuse_aes,
3515 .fuse_csel,
3516 .fuse_cset,
30173517 .pauth,
30183518 .perfmon,
30193519 .predictable_select_expensive,
......@@ -3157,6 +3657,8 @@ pub const cpu = struct {
31573657 .fpac,
31583658 .fuse_adrp_add,
31593659 .fuse_aes,
3660 .fuse_csel,
3661 .fuse_cset,
31603662 .mte,
31613663 .perfmon,
31623664 .predictable_select_expensive,
......@@ -3179,6 +3681,8 @@ pub const cpu = struct {
31793681 .fpac,
31803682 .fuse_adrp_add,
31813683 .fuse_aes,
3684 .fuse_csel,
3685 .fuse_cset,
31823686 .mte,
31833687 .perfmon,
31843688 .predictable_select_expensive,
......@@ -3200,14 +3704,17 @@ pub const cpu = struct {
32003704 .disable_latency_sched_heuristic,
32013705 .fuse_aes,
32023706 .fuse_crypto_eor,
3707 .no_zcz_fpr64,
32033708 .perfmon,
32043709 .sha2,
32053710 .store_pair_suppress,
32063711 .v8a,
3207 .zcm_fpr64,
3712 .zcm_fpr128,
32083713 .zcm_gpr64,
3209 .zcz,
32103714 .zcz_fp_workaround,
3715 .zcz_fpr128,
3716 .zcz_gpr32,
3717 .zcz_gpr64,
32113718 }),
32123719 };
32133720 pub const emag: CpuModel = .{
......@@ -3267,6 +3774,7 @@ pub const cpu = struct {
32673774 .fuse_aes,
32683775 .fuse_csel,
32693776 .fuse_literals,
3777 .max_interleave_factor_4,
32703778 .perfmon,
32713779 .predictable_select_expensive,
32723780 .sha2,
......@@ -3293,12 +3801,14 @@ pub const cpu = struct {
32933801 .fuse_arith_logic,
32943802 .fuse_csel,
32953803 .fuse_literals,
3804 .max_interleave_factor_4,
32963805 .perfmon,
32973806 .sha2,
32983807 .store_pair_suppress,
32993808 .use_postra_scheduler,
33003809 .v8_2a,
3301 .zcz,
3810 .zcz_gpr32,
3811 .zcz_gpr64,
33023812 }),
33033813 };
33043814 pub const exynos_m5: CpuModel = .{
......@@ -3319,12 +3829,14 @@ pub const cpu = struct {
33193829 .fuse_arith_logic,
33203830 .fuse_csel,
33213831 .fuse_literals,
3832 .max_interleave_factor_4,
33223833 .perfmon,
33233834 .sha2,
33243835 .store_pair_suppress,
33253836 .use_postra_scheduler,
33263837 .v8_2a,
3327 .zcz,
3838 .zcz_gpr32,
3839 .zcz_gpr64,
33283840 }),
33293841 };
33303842 pub const falkor: CpuModel = .{
......@@ -3334,6 +3846,7 @@ pub const cpu = struct {
33343846 .aes,
33353847 .alu_lsl_fast,
33363848 .crc,
3849 .max_interleave_factor_4,
33373850 .perfmon,
33383851 .predictable_select_expensive,
33393852 .rdm,
......@@ -3342,7 +3855,8 @@ pub const cpu = struct {
33423855 .store_pair_suppress,
33433856 .use_postra_scheduler,
33443857 .v8a,
3345 .zcz,
3858 .zcz_gpr32,
3859 .zcz_gpr64,
33463860 }),
33473861 };
33483862 pub const fujitsu_monaka: CpuModel = .{
......@@ -3382,6 +3896,8 @@ pub const cpu = struct {
33823896 .fpac,
33833897 .fuse_adrp_add,
33843898 .fuse_aes,
3899 .fuse_csel,
3900 .fuse_cset,
33853901 .mte,
33863902 .perfmon,
33873903 .predictable_select_expensive,
......@@ -3422,11 +3938,13 @@ pub const cpu = struct {
34223938 .fpac,
34233939 .fuse_adrp_add,
34243940 .fuse_aes,
3941 .fuse_csel,
3942 .fuse_cset,
34253943 .i8mm,
3944 .max_interleave_factor_4,
34263945 .mte,
34273946 .perfmon,
34283947 .predictable_select_expensive,
3429 .rand,
34303948 .spe,
34313949 .sve_aes,
34323950 .sve_bitperm,
......@@ -3444,13 +3962,15 @@ pub const cpu = struct {
34443962 .aes,
34453963 .alu_lsl_fast,
34463964 .crc,
3965 .max_interleave_factor_4,
34473966 .perfmon,
34483967 .predictable_select_expensive,
34493968 .sha2,
34503969 .store_pair_suppress,
34513970 .use_postra_scheduler,
34523971 .v8a,
3453 .zcz,
3972 .zcz_gpr32,
3973 .zcz_gpr64,
34543974 }),
34553975 };
34563976 pub const neoverse_512tvb: CpuModel = .{
......@@ -3467,6 +3987,7 @@ pub const cpu = struct {
34673987 .fuse_adrp_add,
34683988 .fuse_aes,
34693989 .i8mm,
3990 .max_interleave_factor_4,
34703991 .perfmon,
34713992 .predictable_select_expensive,
34723993 .rand,
......@@ -3524,12 +4045,15 @@ pub const cpu = struct {
35244045 .features = featureSet(&[_]Feature{
35254046 .alu_lsl_fast,
35264047 .bf16,
4048 .disable_maximize_scalable_bandwidth,
35274049 .enable_select_opt,
35284050 .ete,
35294051 .fp16fml,
35304052 .fpac,
35314053 .fuse_adrp_add,
35324054 .fuse_aes,
4055 .fuse_csel,
4056 .fuse_cset,
35334057 .i8mm,
35344058 .mte,
35354059 .perfmon,
......@@ -3550,6 +4074,8 @@ pub const cpu = struct {
35504074 .fpac,
35514075 .fuse_adrp_add,
35524076 .fuse_aes,
4077 .fuse_csel,
4078 .fuse_cset,
35534079 .mte,
35544080 .perfmon,
35554081 .predictable_select_expensive,
......@@ -3569,10 +4095,13 @@ pub const cpu = struct {
35694095 .alu_lsl_fast,
35704096 .bf16,
35714097 .ccdp,
4098 .disable_maximize_scalable_bandwidth,
35724099 .enable_select_opt,
35734100 .fp16fml,
35744101 .fuse_adrp_add,
35754102 .fuse_aes,
4103 .fuse_csel,
4104 .fuse_cset,
35764105 .i8mm,
35774106 .no_sve_fp_ld1r,
35784107 .perfmon,
......@@ -3602,7 +4131,10 @@ pub const cpu = struct {
36024131 .fpac,
36034132 .fuse_adrp_add,
36044133 .fuse_aes,
4134 .fuse_csel,
4135 .fuse_cset,
36054136 .i8mm,
4137 .max_interleave_factor_4,
36064138 .mte,
36074139 .perfmon,
36084140 .predictable_select_expensive,
......@@ -3627,7 +4159,10 @@ pub const cpu = struct {
36274159 .fpac,
36284160 .fuse_adrp_add,
36294161 .fuse_aes,
4162 .fuse_csel,
4163 .fuse_cset,
36304164 .ls64,
4165 .max_interleave_factor_4,
36314166 .mte,
36324167 .perfmon,
36334168 .predictable_select_expensive,
......@@ -3651,7 +4186,10 @@ pub const cpu = struct {
36514186 .fpac,
36524187 .fuse_adrp_add,
36534188 .fuse_aes,
4189 .fuse_csel,
4190 .fuse_cset,
36544191 .ls64,
4192 .max_interleave_factor_4,
36554193 .mte,
36564194 .perfmon,
36574195 .predictable_select_expensive,
......@@ -3700,6 +4238,7 @@ pub const cpu = struct {
37004238 .fuse_adrp_add,
37014239 .fuse_aes,
37024240 .fuse_crypto_eor,
4241 .max_interleave_factor_4,
37034242 .perfmon,
37044243 .rand,
37054244 .sha3,
......@@ -3715,6 +4254,7 @@ pub const cpu = struct {
37154254 .features = featureSet(&[_]Feature{
37164255 .aes,
37174256 .alu_lsl_fast,
4257 .max_interleave_factor_4,
37184258 .perfmon,
37194259 .predictable_select_expensive,
37204260 .sha2,
......@@ -3722,7 +4262,8 @@ pub const cpu = struct {
37224262 .store_pair_suppress,
37234263 .use_postra_scheduler,
37244264 .v8_4a,
3725 .zcz,
4265 .zcz_gpr32,
4266 .zcz_gpr64,
37264267 }),
37274268 };
37284269 pub const thunderx: CpuModel = .{
......@@ -3746,6 +4287,7 @@ pub const cpu = struct {
37464287 .aes,
37474288 .aggressive_fma,
37484289 .arith_bcc_fusion,
4290 .max_interleave_factor_4,
37494291 .predictable_select_expensive,
37504292 .sha2,
37514293 .store_pair_suppress,
......@@ -3761,6 +4303,7 @@ pub const cpu = struct {
37614303 .aggressive_fma,
37624304 .arith_bcc_fusion,
37634305 .balance_fp_ops,
4306 .max_interleave_factor_4,
37644307 .perfmon,
37654308 .predictable_select_expensive,
37664309 .sha2,
lib/std/Target/amdgcn.zig+421-21
......@@ -5,12 +5,17 @@ const CpuFeature = std.Target.Cpu.Feature;
55const CpuModel = std.Target.Cpu.Model;
66
77pub const Feature = enum {
8 @"1024_addressable_vgprs",
89 @"16_bit_insts",
10 @"45_bit_num_records_buffer_resource",
911 @"64_bit_literals",
1012 a16,
13 add_min_max_insts,
1114 add_no_carry_insts,
15 add_sub_u64_insts,
1216 addressablelocalmemorysize163840,
1317 addressablelocalmemorysize32768,
18 addressablelocalmemorysize327680,
1419 addressablelocalmemorysize65536,
1520 agent_scope_fine_grained_remote_memory_atomics,
1621 allocate1_5xvgprs,
......@@ -18,6 +23,7 @@ pub const Feature = enum {
1823 architected_flat_scratch,
1924 architected_sgprs,
2025 ashr_pk_insts,
26 assembler_permissive_wavesize,
2127 atomic_buffer_global_pk_add_f16_insts,
2228 atomic_buffer_global_pk_add_f16_no_rtn_insts,
2329 atomic_buffer_pk_add_bf16_inst,
......@@ -34,15 +40,22 @@ pub const Feature = enum {
3440 auto_waitcnt_before_barrier,
3541 back_off_barrier,
3642 bf16_cvt_insts,
43 bf16_pk_insts,
3744 bf16_trans_insts,
3845 bf8_cvt_scale_insts,
3946 bitop3_insts,
4047 block_vgpr_csr,
4148 bvh_dual_bvh_8_insts,
4249 ci_insts,
50 clusters,
51 cube_insts,
4352 cumode,
4453 cvt_fp8_vop1_bug,
54 cvt_norm_insts,
4555 cvt_pk_f16_f32_inst,
56 cvt_pknorm_vop2_insts,
57 cvt_pknorm_vop3_insts,
58 d16_write_vgpr32,
4659 default_component_broadcast,
4760 default_component_zero,
4861 dl_insts,
......@@ -65,8 +78,7 @@ pub const Feature = enum {
6578 dpp_src1_sgpr,
6679 ds128,
6780 ds_src2_insts,
68 dynamic_vgpr,
69 dynamic_vgpr_block_size_32,
81 emulated_system_scope_atomics,
7082 extended_image_insts,
7183 f16bf16_to_fp6bf6_cvt_scale_insts,
7284 f32_to_f16bf16_cvt_sr_insts,
......@@ -77,10 +89,12 @@ pub const Feature = enum {
7789 flat_buffer_global_fadd_f64_inst,
7890 flat_for_global,
7991 flat_global_insts,
92 flat_gvs_mode,
8093 flat_inst_offsets,
8194 flat_scratch,
8295 flat_scratch_insts,
8396 flat_segment_offset_bug,
97 fma_mix_bf16_insts,
8498 fma_mix_insts,
8599 fmacf64_inst,
86100 fmaf,
......@@ -113,6 +127,7 @@ pub const Feature = enum {
113127 gfx940_insts,
114128 gfx950_insts,
115129 gfx9_insts,
130 globally_addressable_scratch,
116131 gws,
117132 half_rate_64_ops,
118133 ieee_minimum_maximum_insts,
......@@ -128,20 +143,24 @@ pub const Feature = enum {
128143 lds_misaligned_bug,
129144 ldsbankcount16,
130145 ldsbankcount32,
146 lerp_inst,
131147 load_store_opt,
132148 lshl_add_u64_inst,
133149 mad_intra_fwd_bug,
134150 mad_mac_f32_insts,
135151 mad_mix_insts,
152 mad_u32_inst,
136153 mai_insts,
137154 max_hard_clause_length_32,
138155 max_hard_clause_length_63,
139156 max_private_element_size_16,
140157 max_private_element_size_4,
141158 max_private_element_size_8,
159 mcast_load_insts,
142160 memory_atomic_fadd_f32_denormal_support,
143161 mfma_inline_literal_bug,
144162 mimg_r128,
163 min3_max3_pkf16,
145164 minimum3_maximum3_f16,
146165 minimum3_maximum3_f32,
147166 minimum3_maximum3_pkf16,
......@@ -160,6 +179,7 @@ pub const Feature = enum {
160179 partial_nsa_encoding,
161180 permlane16_swap,
162181 permlane32_swap,
182 pk_add_min_max_insts,
163183 pk_fmac_f16_inst,
164184 point_sample_accel,
165185 precise_memory,
......@@ -168,6 +188,7 @@ pub const Feature = enum {
168188 promote_alloca,
169189 prt_strict_null,
170190 pseudo_scalar_trans,
191 qsad_insts,
171192 r128_a16,
172193 real_true16,
173194 relaxed_buffer_oob_mode,
......@@ -176,6 +197,9 @@ pub const Feature = enum {
176197 restricted_soffset,
177198 s_memrealtime,
178199 s_memtime_inst,
200 s_wakeup_barrier_inst,
201 sad_insts,
202 safe_cu_prefetch,
179203 safe_smem_prefetch,
180204 salu_float,
181205 scalar_atomics,
......@@ -190,6 +214,7 @@ pub const Feature = enum {
190214 sdwa_sdst,
191215 sea_islands,
192216 setprio_inc_wg_inst,
217 setreg_vgpr_msb_fixup,
193218 sgpr_init_bug,
194219 shader_cycles_hi_lo_registers,
195220 shader_cycles_register,
......@@ -198,6 +223,8 @@ pub const Feature = enum {
198223 southern_islands,
199224 sramecc,
200225 sramecc_support,
226 tanh_insts,
227 tensor_cvt_lut_insts,
201228 tgsplit,
202229 transpose_load_f4f6_insts,
203230 trap_handler,
......@@ -213,7 +240,9 @@ pub const Feature = enum {
213240 valu_trans_use_hazard,
214241 vcmpx_exec_war_hazard,
215242 vcmpx_permlane_hazard,
243 vgpr_align2,
216244 vgpr_index_mode,
245 vmem_pref_insts,
217246 vmem_to_lds_load_insts,
218247 vmem_to_scalar_write_hazard,
219248 vmem_write_vgpr_in_order,
......@@ -223,6 +252,7 @@ pub const Feature = enum {
223252 vopd,
224253 vscnt,
225254 wait_xcnt,
255 waits_before_system_scope_stores,
226256 wavefrontsize16,
227257 wavefrontsize32,
228258 wavefrontsize64,
......@@ -241,11 +271,21 @@ pub const all_features = blk: {
241271 const len = @typeInfo(Feature).@"enum".fields.len;
242272 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
243273 var result: [len]CpuFeature = undefined;
274 result[@intFromEnum(Feature.@"1024_addressable_vgprs")] = .{
275 .llvm_name = "1024-addressable-vgprs",
276 .description = "Has 1024 addressable VGPRs",
277 .dependencies = featureSet(&[_]Feature{}),
278 };
244279 result[@intFromEnum(Feature.@"16_bit_insts")] = .{
245280 .llvm_name = "16-bit-insts",
246281 .description = "Has i16/f16 instructions",
247282 .dependencies = featureSet(&[_]Feature{}),
248283 };
284 result[@intFromEnum(Feature.@"45_bit_num_records_buffer_resource")] = .{
285 .llvm_name = "45-bit-num-records-buffer-resource",
286 .description = "The buffer resource (V#) supports 45-bit num_records",
287 .dependencies = featureSet(&[_]Feature{}),
288 };
249289 result[@intFromEnum(Feature.@"64_bit_literals")] = .{
250290 .llvm_name = "64-bit-literals",
251291 .description = "Can use 64-bit literals with single DWORD instructions",
......@@ -256,11 +296,21 @@ pub const all_features = blk: {
256296 .description = "Support A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands",
257297 .dependencies = featureSet(&[_]Feature{}),
258298 };
299 result[@intFromEnum(Feature.add_min_max_insts)] = .{
300 .llvm_name = "add-min-max-insts",
301 .description = "Has v_add_{min|max}_{i|u}32 instructions",
302 .dependencies = featureSet(&[_]Feature{}),
303 };
259304 result[@intFromEnum(Feature.add_no_carry_insts)] = .{
260305 .llvm_name = "add-no-carry-insts",
261306 .description = "Have VALU add/sub instructions without carry out",
262307 .dependencies = featureSet(&[_]Feature{}),
263308 };
309 result[@intFromEnum(Feature.add_sub_u64_insts)] = .{
310 .llvm_name = "add-sub-u64-insts",
311 .description = "Has v_add_u64 and v_sub_u64 instructions",
312 .dependencies = featureSet(&[_]Feature{}),
313 };
264314 result[@intFromEnum(Feature.addressablelocalmemorysize163840)] = .{
265315 .llvm_name = "addressablelocalmemorysize163840",
266316 .description = "The size of local memory in bytes",
......@@ -271,6 +321,11 @@ pub const all_features = blk: {
271321 .description = "The size of local memory in bytes",
272322 .dependencies = featureSet(&[_]Feature{}),
273323 };
324 result[@intFromEnum(Feature.addressablelocalmemorysize327680)] = .{
325 .llvm_name = "addressablelocalmemorysize327680",
326 .description = "The size of local memory in bytes",
327 .dependencies = featureSet(&[_]Feature{}),
328 };
274329 result[@intFromEnum(Feature.addressablelocalmemorysize65536)] = .{
275330 .llvm_name = "addressablelocalmemorysize65536",
276331 .description = "The size of local memory in bytes",
......@@ -306,6 +361,11 @@ pub const all_features = blk: {
306361 .description = "Has Arithmetic Shift Pack instructions",
307362 .dependencies = featureSet(&[_]Feature{}),
308363 };
364 result[@intFromEnum(Feature.assembler_permissive_wavesize)] = .{
365 .llvm_name = "assembler-permissive-wavesize",
366 .description = "allow parsing wave32 and wave64 variants of instructions",
367 .dependencies = featureSet(&[_]Feature{}),
368 };
309369 result[@intFromEnum(Feature.atomic_buffer_global_pk_add_f16_insts)] = .{
310370 .llvm_name = "atomic-buffer-global-pk-add-f16-insts",
311371 .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that can return original value",
......@@ -357,12 +417,16 @@ pub const all_features = blk: {
357417 result[@intFromEnum(Feature.atomic_fmin_fmax_flat_f32)] = .{
358418 .llvm_name = "atomic-fmin-fmax-flat-f32",
359419 .description = "Has flat memory instructions for atomicrmw fmin/fmax for float",
360 .dependencies = featureSet(&[_]Feature{}),
420 .dependencies = featureSet(&[_]Feature{
421 .flat_address_space,
422 }),
361423 };
362424 result[@intFromEnum(Feature.atomic_fmin_fmax_flat_f64)] = .{
363425 .llvm_name = "atomic-fmin-fmax-flat-f64",
364426 .description = "Has flat memory instructions for atomicrmw fmin/fmax for double",
365 .dependencies = featureSet(&[_]Feature{}),
427 .dependencies = featureSet(&[_]Feature{
428 .flat_address_space,
429 }),
366430 };
367431 result[@intFromEnum(Feature.atomic_fmin_fmax_global_f32)] = .{
368432 .llvm_name = "atomic-fmin-fmax-global-f32",
......@@ -396,6 +460,11 @@ pub const all_features = blk: {
396460 .description = "Has bf16 conversion instructions",
397461 .dependencies = featureSet(&[_]Feature{}),
398462 };
463 result[@intFromEnum(Feature.bf16_pk_insts)] = .{
464 .llvm_name = "bf16-pk-insts",
465 .description = "Has bf16 packed instructions (fma, add, mul, max, min)",
466 .dependencies = featureSet(&[_]Feature{}),
467 };
399468 result[@intFromEnum(Feature.bf16_trans_insts)] = .{
400469 .llvm_name = "bf16-trans-insts",
401470 .description = "Has bf16 transcendental instructions",
......@@ -426,6 +495,16 @@ pub const all_features = blk: {
426495 .description = "Additional instructions for CI+",
427496 .dependencies = featureSet(&[_]Feature{}),
428497 };
498 result[@intFromEnum(Feature.clusters)] = .{
499 .llvm_name = "clusters",
500 .description = "Has clusters of workgroups support",
501 .dependencies = featureSet(&[_]Feature{}),
502 };
503 result[@intFromEnum(Feature.cube_insts)] = .{
504 .llvm_name = "cube-insts",
505 .description = "Has v_cube* instructions",
506 .dependencies = featureSet(&[_]Feature{}),
507 };
429508 result[@intFromEnum(Feature.cumode)] = .{
430509 .llvm_name = "cumode",
431510 .description = "Enable CU wavefront execution mode",
......@@ -438,11 +517,31 @@ pub const all_features = blk: {
438517 .fp8_conversion_insts,
439518 }),
440519 };
520 result[@intFromEnum(Feature.cvt_norm_insts)] = .{
521 .llvm_name = "cvt-norm-insts",
522 .description = "Has v_cvt_norm* instructions",
523 .dependencies = featureSet(&[_]Feature{}),
524 };
441525 result[@intFromEnum(Feature.cvt_pk_f16_f32_inst)] = .{
442526 .llvm_name = "cvt-pk-f16-f32-inst",
443527 .description = "Has cvt_pk_f16_f32 instruction",
444528 .dependencies = featureSet(&[_]Feature{}),
445529 };
530 result[@intFromEnum(Feature.cvt_pknorm_vop2_insts)] = .{
531 .llvm_name = "cvt-pknorm-vop2-insts",
532 .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions",
533 .dependencies = featureSet(&[_]Feature{}),
534 };
535 result[@intFromEnum(Feature.cvt_pknorm_vop3_insts)] = .{
536 .llvm_name = "cvt-pknorm-vop3-insts",
537 .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions",
538 .dependencies = featureSet(&[_]Feature{}),
539 };
540 result[@intFromEnum(Feature.d16_write_vgpr32)] = .{
541 .llvm_name = "d16-write-vgpr32",
542 .description = "D16 instructions potentially have 32-bit data dependencies",
543 .dependencies = featureSet(&[_]Feature{}),
544 };
446545 result[@intFromEnum(Feature.default_component_broadcast)] = .{
447546 .llvm_name = "default-component-broadcast",
448547 .description = "BUFFER/IMAGE store instructions set unspecified components to x component (GFX12)",
......@@ -553,14 +652,9 @@ pub const all_features = blk: {
553652 .description = "Has ds_*_src2 instructions",
554653 .dependencies = featureSet(&[_]Feature{}),
555654 };
556 result[@intFromEnum(Feature.dynamic_vgpr)] = .{
557 .llvm_name = "dynamic-vgpr",
558 .description = "Enable dynamic VGPR mode",
559 .dependencies = featureSet(&[_]Feature{}),
560 };
561 result[@intFromEnum(Feature.dynamic_vgpr_block_size_32)] = .{
562 .llvm_name = "dynamic-vgpr-block-size-32",
563 .description = "Use a block size of 32 for dynamic VGPR allocation (default is 16)",
655 result[@intFromEnum(Feature.emulated_system_scope_atomics)] = .{
656 .llvm_name = "emulated-system-scope-atomics",
657 .description = "System scope atomics unsupported by the PCI-e are emulated in HW via CAS loop and functional.",
564658 .dependencies = featureSet(&[_]Feature{}),
565659 };
566660 result[@intFromEnum(Feature.extended_image_insts)] = .{
......@@ -596,7 +690,9 @@ pub const all_features = blk: {
596690 result[@intFromEnum(Feature.flat_atomic_fadd_f32_inst)] = .{
597691 .llvm_name = "flat-atomic-fadd-f32-inst",
598692 .description = "Has flat_atomic_add_f32 instruction",
599 .dependencies = featureSet(&[_]Feature{}),
693 .dependencies = featureSet(&[_]Feature{
694 .flat_address_space,
695 }),
600696 };
601697 result[@intFromEnum(Feature.flat_buffer_global_fadd_f64_inst)] = .{
602698 .llvm_name = "flat-buffer-global-fadd-f64-inst",
......@@ -611,7 +707,16 @@ pub const all_features = blk: {
611707 result[@intFromEnum(Feature.flat_global_insts)] = .{
612708 .llvm_name = "flat-global-insts",
613709 .description = "Have global_* flat memory instructions",
614 .dependencies = featureSet(&[_]Feature{}),
710 .dependencies = featureSet(&[_]Feature{
711 .flat_address_space,
712 }),
713 };
714 result[@intFromEnum(Feature.flat_gvs_mode)] = .{
715 .llvm_name = "flat-gvs-mode",
716 .description = "Have GVS addressing mode with flat_* instructions",
717 .dependencies = featureSet(&[_]Feature{
718 .flat_address_space,
719 }),
615720 };
616721 result[@intFromEnum(Feature.flat_inst_offsets)] = .{
617722 .llvm_name = "flat-inst-offsets",
......@@ -626,13 +731,20 @@ pub const all_features = blk: {
626731 result[@intFromEnum(Feature.flat_scratch_insts)] = .{
627732 .llvm_name = "flat-scratch-insts",
628733 .description = "Have scratch_* flat memory instructions",
629 .dependencies = featureSet(&[_]Feature{}),
734 .dependencies = featureSet(&[_]Feature{
735 .flat_address_space,
736 }),
630737 };
631738 result[@intFromEnum(Feature.flat_segment_offset_bug)] = .{
632739 .llvm_name = "flat-segment-offset-bug",
633740 .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory",
634741 .dependencies = featureSet(&[_]Feature{}),
635742 };
743 result[@intFromEnum(Feature.fma_mix_bf16_insts)] = .{
744 .llvm_name = "fma-mix-bf16-insts",
745 .description = "Has v_fma_mix_f32_bf16, v_fma_mixlo_bf16, v_fma_mixhi_bf16 instructions",
746 .dependencies = featureSet(&[_]Feature{}),
747 };
636748 result[@intFromEnum(Feature.fma_mix_insts)] = .{
637749 .llvm_name = "fma-mix-insts",
638750 .description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions",
......@@ -722,13 +834,16 @@ pub const all_features = blk: {
722834 .atomic_fmin_fmax_global_f32,
723835 .atomic_fmin_fmax_global_f64,
724836 .ci_insts,
837 .cube_insts,
838 .cvt_norm_insts,
839 .cvt_pknorm_vop2_insts,
840 .cvt_pknorm_vop3_insts,
725841 .default_component_zero,
726842 .dpp,
727843 .dpp8,
728844 .extended_image_insts,
729845 .fast_denormal_f32,
730846 .fast_fmaf,
731 .flat_address_space,
732847 .flat_global_insts,
733848 .flat_inst_offsets,
734849 .flat_scratch_insts,
......@@ -743,14 +858,17 @@ pub const all_features = blk: {
743858 .image_insts,
744859 .int_clamp_insts,
745860 .inv_2pi_inline_imm,
861 .lerp_inst,
746862 .max_hard_clause_length_63,
747863 .mimg_r128,
748864 .movrel,
749865 .no_data_dep_hazard,
750866 .no_sdst_cmpx,
751867 .pk_fmac_f16_inst,
868 .qsad_insts,
752869 .s_memrealtime,
753870 .s_memtime_inst,
871 .sad_insts,
754872 .sdwa,
755873 .sdwa_omod,
756874 .sdwa_scalar,
......@@ -797,13 +915,16 @@ pub const all_features = blk: {
797915 .atomic_fmin_fmax_flat_f32,
798916 .atomic_fmin_fmax_global_f32,
799917 .ci_insts,
918 .cube_insts,
919 .cvt_norm_insts,
920 .cvt_pknorm_vop2_insts,
921 .cvt_pknorm_vop3_insts,
800922 .default_component_zero,
801923 .dpp,
802924 .dpp8,
803925 .extended_image_insts,
804926 .fast_denormal_f32,
805927 .fast_fmaf,
806 .flat_address_space,
807928 .flat_global_insts,
808929 .flat_inst_offsets,
809930 .flat_scratch_insts,
......@@ -821,12 +942,15 @@ pub const all_features = blk: {
821942 .gws,
822943 .int_clamp_insts,
823944 .inv_2pi_inline_imm,
945 .lerp_inst,
824946 .max_hard_clause_length_32,
825947 .mimg_r128,
826948 .movrel,
827949 .no_data_dep_hazard,
828950 .no_sdst_cmpx,
829951 .pk_fmac_f16_inst,
952 .qsad_insts,
953 .sad_insts,
830954 .true16,
831955 .unaligned_buffer_access,
832956 .unaligned_ds_access,
......@@ -850,7 +974,6 @@ pub const all_features = blk: {
850974 .@"16_bit_insts",
851975 .a16,
852976 .add_no_carry_insts,
853 .addressablelocalmemorysize65536,
854977 .agent_scope_fine_grained_remote_memory_atomics,
855978 .aperture_regs,
856979 .atomic_fmin_fmax_flat_f32,
......@@ -861,7 +984,6 @@ pub const all_features = blk: {
861984 .dpp8,
862985 .fast_denormal_f32,
863986 .fast_fmaf,
864 .flat_address_space,
865987 .flat_global_insts,
866988 .flat_inst_offsets,
867989 .flat_scratch_insts,
......@@ -926,11 +1048,14 @@ pub const all_features = blk: {
9261048 .add_no_carry_insts,
9271049 .aperture_regs,
9281050 .ci_insts,
1051 .cube_insts,
1052 .cvt_norm_insts,
1053 .cvt_pknorm_vop2_insts,
1054 .cvt_pknorm_vop3_insts,
9291055 .default_component_zero,
9301056 .dpp,
9311057 .fast_denormal_f32,
9321058 .fast_fmaf,
933 .flat_address_space,
9341059 .flat_global_insts,
9351060 .flat_inst_offsets,
9361061 .flat_scratch_insts,
......@@ -942,10 +1067,13 @@ pub const all_features = blk: {
9421067 .gws,
9431068 .int_clamp_insts,
9441069 .inv_2pi_inline_imm,
1070 .lerp_inst,
9451071 .negative_scratch_offset_bug,
1072 .qsad_insts,
9461073 .r128_a16,
9471074 .s_memrealtime,
9481075 .s_memtime_inst,
1076 .sad_insts,
9491077 .scalar_atomics,
9501078 .scalar_flat_scratch_insts,
9511079 .scalar_stores,
......@@ -997,6 +1125,11 @@ pub const all_features = blk: {
9971125 .description = "Additional instructions for GFX9+",
9981126 .dependencies = featureSet(&[_]Feature{}),
9991127 };
1128 result[@intFromEnum(Feature.globally_addressable_scratch)] = .{
1129 .llvm_name = "globally-addressable-scratch",
1130 .description = "FLAT instructions can access scratch memory for any thread in any wave",
1131 .dependencies = featureSet(&[_]Feature{}),
1132 };
10001133 result[@intFromEnum(Feature.gws)] = .{
10011134 .llvm_name = "gws",
10021135 .description = "Has Global Wave Sync",
......@@ -1072,6 +1205,11 @@ pub const all_features = blk: {
10721205 .description = "The number of LDS banks per compute unit.",
10731206 .dependencies = featureSet(&[_]Feature{}),
10741207 };
1208 result[@intFromEnum(Feature.lerp_inst)] = .{
1209 .llvm_name = "lerp-inst",
1210 .description = "Has v_lerp_u8 instruction",
1211 .dependencies = featureSet(&[_]Feature{}),
1212 };
10751213 result[@intFromEnum(Feature.load_store_opt)] = .{
10761214 .llvm_name = "load-store-opt",
10771215 .description = "Enable SI load/store optimizer pass",
......@@ -1097,6 +1235,11 @@ pub const all_features = blk: {
10971235 .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions",
10981236 .dependencies = featureSet(&[_]Feature{}),
10991237 };
1238 result[@intFromEnum(Feature.mad_u32_inst)] = .{
1239 .llvm_name = "mad-u32-inst",
1240 .description = "Has v_mad_u32 instruction",
1241 .dependencies = featureSet(&[_]Feature{}),
1242 };
11001243 result[@intFromEnum(Feature.mai_insts)] = .{
11011244 .llvm_name = "mai-insts",
11021245 .description = "Has mAI instructions",
......@@ -1127,6 +1270,11 @@ pub const all_features = blk: {
11271270 .description = "Maximum private access size may be 8",
11281271 .dependencies = featureSet(&[_]Feature{}),
11291272 };
1273 result[@intFromEnum(Feature.mcast_load_insts)] = .{
1274 .llvm_name = "mcast-load-insts",
1275 .description = "Has multicast load instructions",
1276 .dependencies = featureSet(&[_]Feature{}),
1277 };
11301278 result[@intFromEnum(Feature.memory_atomic_fadd_f32_denormal_support)] = .{
11311279 .llvm_name = "memory-atomic-fadd-f32-denormal-support",
11321280 .description = "global/flat/buffer atomic fadd for float supports denormal handling",
......@@ -1142,6 +1290,11 @@ pub const all_features = blk: {
11421290 .description = "Support 128-bit texture resources",
11431291 .dependencies = featureSet(&[_]Feature{}),
11441292 };
1293 result[@intFromEnum(Feature.min3_max3_pkf16)] = .{
1294 .llvm_name = "min3-max3-pkf16",
1295 .description = "Has v_pk_min3_num_f16 and v_pk_max3_num_f16 instructions",
1296 .dependencies = featureSet(&[_]Feature{}),
1297 };
11451298 result[@intFromEnum(Feature.minimum3_maximum3_f16)] = .{
11461299 .llvm_name = "minimum3-maximum3-f16",
11471300 .description = "Has v_minimum3_f16 and v_maximum3_f16 instructions",
......@@ -1232,6 +1385,11 @@ pub const all_features = blk: {
12321385 .description = "Has v_permlane32_swap_b32 instructions",
12331386 .dependencies = featureSet(&[_]Feature{}),
12341387 };
1388 result[@intFromEnum(Feature.pk_add_min_max_insts)] = .{
1389 .llvm_name = "pk-add-min-max-insts",
1390 .description = "Has v_pk_add_{min|max}_{i|u}16 instructions",
1391 .dependencies = featureSet(&[_]Feature{}),
1392 };
12351393 result[@intFromEnum(Feature.pk_fmac_f16_inst)] = .{
12361394 .llvm_name = "pk-fmac-f16-inst",
12371395 .description = "Has v_pk_fmac_f16 instruction",
......@@ -1272,6 +1430,11 @@ pub const all_features = blk: {
12721430 .description = "Has Pseudo Scalar Transcendental instructions",
12731431 .dependencies = featureSet(&[_]Feature{}),
12741432 };
1433 result[@intFromEnum(Feature.qsad_insts)] = .{
1434 .llvm_name = "qsad-insts",
1435 .description = "Has v_qsad* instructions",
1436 .dependencies = featureSet(&[_]Feature{}),
1437 };
12751438 result[@intFromEnum(Feature.r128_a16)] = .{
12761439 .llvm_name = "r128-a16",
12771440 .description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128",
......@@ -1312,6 +1475,21 @@ pub const all_features = blk: {
13121475 .description = "Has s_memtime instruction",
13131476 .dependencies = featureSet(&[_]Feature{}),
13141477 };
1478 result[@intFromEnum(Feature.s_wakeup_barrier_inst)] = .{
1479 .llvm_name = "s-wakeup-barrier-inst",
1480 .description = "Has s_wakeup_barrier instruction.",
1481 .dependencies = featureSet(&[_]Feature{}),
1482 };
1483 result[@intFromEnum(Feature.sad_insts)] = .{
1484 .llvm_name = "sad-insts",
1485 .description = "Has v_sad* instructions",
1486 .dependencies = featureSet(&[_]Feature{}),
1487 };
1488 result[@intFromEnum(Feature.safe_cu_prefetch)] = .{
1489 .llvm_name = "safe-cu-prefetch",
1490 .description = "VMEM CU scope prefetches do not fail on illegal address",
1491 .dependencies = featureSet(&[_]Feature{}),
1492 };
13151493 result[@intFromEnum(Feature.safe_smem_prefetch)] = .{
13161494 .llvm_name = "safe-smem-prefetch",
13171495 .description = "SMEM prefetches do not fail on illegal address",
......@@ -1382,19 +1560,23 @@ pub const all_features = blk: {
13821560 .atomic_fmin_fmax_global_f32,
13831561 .atomic_fmin_fmax_global_f64,
13841562 .ci_insts,
1563 .cube_insts,
1564 .cvt_pknorm_vop2_insts,
13851565 .default_component_zero,
13861566 .ds_src2_insts,
13871567 .extended_image_insts,
1388 .flat_address_space,
13891568 .fp64,
13901569 .gds,
13911570 .gfx7_gfx8_gfx9_insts,
13921571 .gws,
13931572 .image_insts,
1573 .lerp_inst,
13941574 .mad_mac_f32_insts,
13951575 .mimg_r128,
13961576 .movrel,
1577 .qsad_insts,
13971578 .s_memtime_inst,
1579 .sad_insts,
13981580 .trig_reduced_range,
13991581 .unaligned_buffer_access,
14001582 .vmem_write_vgpr_in_order,
......@@ -1406,6 +1588,11 @@ pub const all_features = blk: {
14061588 .description = "Has s_setprio_inc_wg instruction.",
14071589 .dependencies = featureSet(&[_]Feature{}),
14081590 };
1591 result[@intFromEnum(Feature.setreg_vgpr_msb_fixup)] = .{
1592 .llvm_name = "setreg-vgpr-msb-fixup",
1593 .description = "S_SETREG to MODE clobbers VGPR MSB bits, requires fixup",
1594 .dependencies = featureSet(&[_]Feature{}),
1595 };
14091596 result[@intFromEnum(Feature.sgpr_init_bug)] = .{
14101597 .llvm_name = "sgpr-init-bug",
14111598 .description = "VI SGPR initialization bug requiring a fixed SGPR allocation size",
......@@ -1438,6 +1625,8 @@ pub const all_features = blk: {
14381625 .addressablelocalmemorysize32768,
14391626 .atomic_fmin_fmax_global_f32,
14401627 .atomic_fmin_fmax_global_f64,
1628 .cube_insts,
1629 .cvt_pknorm_vop2_insts,
14411630 .default_component_zero,
14421631 .ds_src2_insts,
14431632 .extended_image_insts,
......@@ -1446,10 +1635,12 @@ pub const all_features = blk: {
14461635 .gws,
14471636 .image_insts,
14481637 .ldsbankcount32,
1638 .lerp_inst,
14491639 .mad_mac_f32_insts,
14501640 .mimg_r128,
14511641 .movrel,
14521642 .s_memtime_inst,
1643 .sad_insts,
14531644 .trig_reduced_range,
14541645 .vmem_write_vgpr_in_order,
14551646 .wavefrontsize64,
......@@ -1465,6 +1656,16 @@ pub const all_features = blk: {
14651656 .description = "Hardware supports SRAMECC",
14661657 .dependencies = featureSet(&[_]Feature{}),
14671658 };
1659 result[@intFromEnum(Feature.tanh_insts)] = .{
1660 .llvm_name = "tanh-insts",
1661 .description = "Has v_tanh_f32/f16 instructions",
1662 .dependencies = featureSet(&[_]Feature{}),
1663 };
1664 result[@intFromEnum(Feature.tensor_cvt_lut_insts)] = .{
1665 .llvm_name = "tensor-cvt-lut-insts",
1666 .description = "Has v_perm_pk16* instructions",
1667 .dependencies = featureSet(&[_]Feature{}),
1668 };
14681669 result[@intFromEnum(Feature.tgsplit)] = .{
14691670 .llvm_name = "tgsplit",
14701671 .description = "Enable threadgroup split execution",
......@@ -1540,11 +1741,21 @@ pub const all_features = blk: {
15401741 .description = "TODO: describe me",
15411742 .dependencies = featureSet(&[_]Feature{}),
15421743 };
1744 result[@intFromEnum(Feature.vgpr_align2)] = .{
1745 .llvm_name = "vgpr-align2",
1746 .description = "VGPR and AGPR tuple operands require even alignment",
1747 .dependencies = featureSet(&[_]Feature{}),
1748 };
15431749 result[@intFromEnum(Feature.vgpr_index_mode)] = .{
15441750 .llvm_name = "vgpr-index-mode",
15451751 .description = "Has VGPR mode register indexing",
15461752 .dependencies = featureSet(&[_]Feature{}),
15471753 };
1754 result[@intFromEnum(Feature.vmem_pref_insts)] = .{
1755 .llvm_name = "vmem-pref-insts",
1756 .description = "Has flat_prefect_b8 and global_prefetch_b8 instructions",
1757 .dependencies = featureSet(&[_]Feature{}),
1758 };
15481759 result[@intFromEnum(Feature.vmem_to_lds_load_insts)] = .{
15491760 .llvm_name = "vmem-to-lds-load-insts",
15501761 .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.",
......@@ -1567,6 +1778,8 @@ pub const all_features = blk: {
15671778 .@"16_bit_insts",
15681779 .addressablelocalmemorysize65536,
15691780 .ci_insts,
1781 .cube_insts,
1782 .cvt_pknorm_vop2_insts,
15701783 .default_component_zero,
15711784 .dpp,
15721785 .ds_src2_insts,
......@@ -1582,11 +1795,14 @@ pub const all_features = blk: {
15821795 .image_insts,
15831796 .int_clamp_insts,
15841797 .inv_2pi_inline_imm,
1798 .lerp_inst,
15851799 .mad_mac_f32_insts,
15861800 .mimg_r128,
15871801 .movrel,
1802 .qsad_insts,
15881803 .s_memrealtime,
15891804 .s_memtime_inst,
1805 .sad_insts,
15901806 .scalar_stores,
15911807 .sdwa,
15921808 .sdwa_mav,
......@@ -1623,6 +1839,11 @@ pub const all_features = blk: {
16231839 .description = "Has s_wait_xcnt instruction",
16241840 .dependencies = featureSet(&[_]Feature{}),
16251841 };
1842 result[@intFromEnum(Feature.waits_before_system_scope_stores)] = .{
1843 .llvm_name = "waits-before-system-scope-stores",
1844 .description = "Target requires waits for loads and atomics before system scope stores",
1845 .dependencies = featureSet(&[_]Feature{}),
1846 };
16261847 result[@intFromEnum(Feature.wavefrontsize16)] = .{
16271848 .llvm_name = "wavefrontsize16",
16281849 .description = "The number of threads per wavefront",
......@@ -2044,6 +2265,8 @@ pub const cpu = struct {
20442265 .architected_flat_scratch,
20452266 .atomic_fadd_no_rtn_insts,
20462267 .atomic_fadd_rtn_insts,
2268 .back_off_barrier,
2269 .d16_write_vgpr32,
20472270 .dl_insts,
20482271 .dot10_insts,
20492272 .dot12_insts,
......@@ -2077,6 +2300,8 @@ pub const cpu = struct {
20772300 .architected_flat_scratch,
20782301 .atomic_fadd_no_rtn_insts,
20792302 .atomic_fadd_rtn_insts,
2303 .back_off_barrier,
2304 .d16_write_vgpr32,
20802305 .dl_insts,
20812306 .dot10_insts,
20822307 .dot12_insts,
......@@ -2108,6 +2333,8 @@ pub const cpu = struct {
21082333 .architected_flat_scratch,
21092334 .atomic_fadd_no_rtn_insts,
21102335 .atomic_fadd_rtn_insts,
2336 .back_off_barrier,
2337 .d16_write_vgpr32,
21112338 .dl_insts,
21122339 .dot10_insts,
21132340 .dot12_insts,
......@@ -2140,6 +2367,8 @@ pub const cpu = struct {
21402367 .architected_flat_scratch,
21412368 .atomic_fadd_no_rtn_insts,
21422369 .atomic_fadd_rtn_insts,
2370 .back_off_barrier,
2371 .d16_write_vgpr32,
21432372 .dl_insts,
21442373 .dot10_insts,
21452374 .dot12_insts,
......@@ -2171,6 +2400,8 @@ pub const cpu = struct {
21712400 .architected_flat_scratch,
21722401 .atomic_fadd_no_rtn_insts,
21732402 .atomic_fadd_rtn_insts,
2403 .back_off_barrier,
2404 .d16_write_vgpr32,
21742405 .dl_insts,
21752406 .dot10_insts,
21762407 .dot12_insts,
......@@ -2188,6 +2419,7 @@ pub const cpu = struct {
21882419 .packed_tid,
21892420 .partial_nsa_encoding,
21902421 .point_sample_accel,
2422 .real_true16,
21912423 .required_export_priority,
21922424 .salu_float,
21932425 .shader_cycles_register,
......@@ -2202,6 +2434,8 @@ pub const cpu = struct {
22022434 .architected_flat_scratch,
22032435 .atomic_fadd_no_rtn_insts,
22042436 .atomic_fadd_rtn_insts,
2437 .back_off_barrier,
2438 .d16_write_vgpr32,
22052439 .dl_insts,
22062440 .dot10_insts,
22072441 .dot12_insts,
......@@ -2219,6 +2453,7 @@ pub const cpu = struct {
22192453 .packed_tid,
22202454 .partial_nsa_encoding,
22212455 .point_sample_accel,
2456 .real_true16,
22222457 .required_export_priority,
22232458 .salu_float,
22242459 .shader_cycles_register,
......@@ -2232,6 +2467,8 @@ pub const cpu = struct {
22322467 .architected_flat_scratch,
22332468 .atomic_fadd_no_rtn_insts,
22342469 .atomic_fadd_rtn_insts,
2470 .back_off_barrier,
2471 .d16_write_vgpr32,
22352472 .dl_insts,
22362473 .dot10_insts,
22372474 .dot12_insts,
......@@ -2249,6 +2486,7 @@ pub const cpu = struct {
22492486 .packed_tid,
22502487 .partial_nsa_encoding,
22512488 .point_sample_accel,
2489 .real_true16,
22522490 .required_export_priority,
22532491 .salu_float,
22542492 .shader_cycles_register,
......@@ -2262,6 +2500,8 @@ pub const cpu = struct {
22622500 .architected_flat_scratch,
22632501 .atomic_fadd_no_rtn_insts,
22642502 .atomic_fadd_rtn_insts,
2503 .back_off_barrier,
2504 .d16_write_vgpr32,
22652505 .dl_insts,
22662506 .dot10_insts,
22672507 .dot12_insts,
......@@ -2278,6 +2518,7 @@ pub const cpu = struct {
22782518 .nsa_encoding,
22792519 .packed_tid,
22802520 .partial_nsa_encoding,
2521 .real_true16,
22812522 .required_export_priority,
22822523 .salu_float,
22832524 .shader_cycles_register,
......@@ -2291,6 +2532,8 @@ pub const cpu = struct {
22912532 .architected_flat_scratch,
22922533 .atomic_fadd_no_rtn_insts,
22932534 .atomic_fadd_rtn_insts,
2535 .back_off_barrier,
2536 .d16_write_vgpr32,
22942537 .dl_insts,
22952538 .dot10_insts,
22962539 .dot12_insts,
......@@ -2309,6 +2552,7 @@ pub const cpu = struct {
23092552 .packed_tid,
23102553 .partial_nsa_encoding,
23112554 .priv_enabled_trap2_nop_bug,
2555 .real_true16,
23122556 .required_export_priority,
23132557 .requires_cov6,
23142558 .shader_cycles_register,
......@@ -2321,6 +2565,7 @@ pub const cpu = struct {
23212565 .name = "gfx1200",
23222566 .llvm_name = "gfx1200",
23232567 .features = featureSet(&[_]Feature{
2568 .addressablelocalmemorysize65536,
23242569 .allocate1_5xvgprs,
23252570 .architected_flat_scratch,
23262571 .architected_sgprs,
......@@ -2331,7 +2576,13 @@ pub const cpu = struct {
23312576 .atomic_fadd_rtn_insts,
23322577 .atomic_flat_pk_add_16_insts,
23332578 .atomic_global_pk_add_bf16_inst,
2579 .back_off_barrier,
23342580 .bvh_dual_bvh_8_insts,
2581 .cube_insts,
2582 .cvt_norm_insts,
2583 .cvt_pknorm_vop2_insts,
2584 .cvt_pknorm_vop3_insts,
2585 .d16_write_vgpr32,
23352586 .dl_insts,
23362587 .dot10_insts,
23372588 .dot11_insts,
......@@ -2346,22 +2597,27 @@ pub const cpu = struct {
23462597 .gfx12,
23472598 .image_insts,
23482599 .ldsbankcount32,
2600 .lerp_inst,
23492601 .memory_atomic_fadd_f32_denormal_support,
23502602 .nsa_encoding,
23512603 .packed_tid,
23522604 .partial_nsa_encoding,
23532605 .pseudo_scalar_trans,
2606 .qsad_insts,
23542607 .restricted_soffset,
2608 .sad_insts,
23552609 .salu_float,
23562610 .scalar_dwordx3_loads,
23572611 .shader_cycles_hi_lo_registers,
23582612 .vcmpx_permlane_hazard,
2613 .waits_before_system_scope_stores,
23592614 }),
23602615 };
23612616 pub const gfx1201: CpuModel = .{
23622617 .name = "gfx1201",
23632618 .llvm_name = "gfx1201",
23642619 .features = featureSet(&[_]Feature{
2620 .addressablelocalmemorysize65536,
23652621 .allocate1_5xvgprs,
23662622 .architected_flat_scratch,
23672623 .architected_sgprs,
......@@ -2372,7 +2628,13 @@ pub const cpu = struct {
23722628 .atomic_fadd_rtn_insts,
23732629 .atomic_flat_pk_add_16_insts,
23742630 .atomic_global_pk_add_bf16_inst,
2631 .back_off_barrier,
23752632 .bvh_dual_bvh_8_insts,
2633 .cube_insts,
2634 .cvt_norm_insts,
2635 .cvt_pknorm_vop2_insts,
2636 .cvt_pknorm_vop3_insts,
2637 .d16_write_vgpr32,
23762638 .dl_insts,
23772639 .dot10_insts,
23782640 .dot11_insts,
......@@ -2387,23 +2649,32 @@ pub const cpu = struct {
23872649 .gfx12,
23882650 .image_insts,
23892651 .ldsbankcount32,
2652 .lerp_inst,
23902653 .memory_atomic_fadd_f32_denormal_support,
23912654 .nsa_encoding,
23922655 .packed_tid,
23932656 .partial_nsa_encoding,
23942657 .pseudo_scalar_trans,
2658 .qsad_insts,
23952659 .restricted_soffset,
2660 .sad_insts,
23962661 .salu_float,
23972662 .scalar_dwordx3_loads,
23982663 .shader_cycles_hi_lo_registers,
23992664 .vcmpx_permlane_hazard,
2665 .waits_before_system_scope_stores,
24002666 }),
24012667 };
24022668 pub const gfx1250: CpuModel = .{
24032669 .name = "gfx1250",
24042670 .llvm_name = "gfx1250",
24052671 .features = featureSet(&[_]Feature{
2672 .@"1024_addressable_vgprs",
2673 .@"45_bit_num_records_buffer_resource",
24062674 .@"64_bit_literals",
2675 .add_min_max_insts,
2676 .add_sub_u64_insts,
2677 .addressablelocalmemorysize327680,
24072678 .architected_flat_scratch,
24082679 .architected_sgprs,
24092680 .ashr_pk_insts,
......@@ -2417,49 +2688,164 @@ pub const cpu = struct {
24172688 .atomic_fmin_fmax_global_f64,
24182689 .atomic_global_pk_add_bf16_inst,
24192690 .bf16_cvt_insts,
2691 .bf16_pk_insts,
24202692 .bf16_trans_insts,
24212693 .bitop3_insts,
2694 .clusters,
2695 .cube_insts,
24222696 .cumode,
2697 .cvt_norm_insts,
24232698 .cvt_pk_f16_f32_inst,
2699 .cvt_pknorm_vop2_insts,
2700 .cvt_pknorm_vop3_insts,
2701 .d16_write_vgpr32,
24242702 .dl_insts,
24252703 .dot7_insts,
24262704 .dot8_insts,
24272705 .dpp_src1_sgpr,
2706 .emulated_system_scope_atomics,
24282707 .flat_atomic_fadd_f32_inst,
24292708 .flat_buffer_global_fadd_f64_inst,
2709 .flat_gvs_mode,
2710 .fma_mix_bf16_insts,
24302711 .fmacf64_inst,
24312712 .fp8_conversion_insts,
24322713 .fp8e5m3_insts,
24332714 .gfx12,
24342715 .gfx1250_insts,
2716 .globally_addressable_scratch,
24352717 .kernarg_preload,
24362718 .lds_barrier_arrive_atomic,
24372719 .ldsbankcount32,
2720 .lerp_inst,
24382721 .lshl_add_u64_inst,
2722 .mad_u32_inst,
24392723 .max_hard_clause_length_63,
2724 .mcast_load_insts,
24402725 .memory_atomic_fadd_f32_denormal_support,
2726 .min3_max3_pkf16,
24412727 .minimum3_maximum3_pkf16,
24422728 .packed_fp32_ops,
24432729 .packed_tid,
24442730 .permlane16_swap,
2731 .pk_add_min_max_insts,
24452732 .prng_inst,
24462733 .pseudo_scalar_trans,
2734 .qsad_insts,
24472735 .restricted_soffset,
2736 .s_wakeup_barrier_inst,
2737 .sad_insts,
24482738 .salu_float,
24492739 .scalar_dwordx3_loads,
24502740 .setprio_inc_wg_inst,
2741 .setreg_vgpr_msb_fixup,
24512742 .shader_cycles_hi_lo_registers,
24522743 .sramecc_support,
2744 .tanh_insts,
2745 .tensor_cvt_lut_insts,
24532746 .transpose_load_f4f6_insts,
24542747 .vcmpx_permlane_hazard,
2748 .vgpr_align2,
2749 .vmem_pref_insts,
24552750 .wait_xcnt,
24562751 .wavefrontsize32,
2752 .xnack,
2753 .xnack_support,
2754 }),
2755 };
2756 pub const gfx1251: CpuModel = .{
2757 .name = "gfx1251",
2758 .llvm_name = "gfx1251",
2759 .features = featureSet(&[_]Feature{
2760 .@"1024_addressable_vgprs",
2761 .@"45_bit_num_records_buffer_resource",
2762 .@"64_bit_literals",
2763 .add_min_max_insts,
2764 .add_sub_u64_insts,
2765 .addressablelocalmemorysize327680,
2766 .architected_flat_scratch,
2767 .architected_sgprs,
2768 .ashr_pk_insts,
2769 .atomic_buffer_global_pk_add_f16_insts,
2770 .atomic_buffer_pk_add_bf16_inst,
2771 .atomic_ds_pk_add_16_insts,
2772 .atomic_fadd_no_rtn_insts,
2773 .atomic_fadd_rtn_insts,
2774 .atomic_flat_pk_add_16_insts,
2775 .atomic_fmin_fmax_flat_f64,
2776 .atomic_fmin_fmax_global_f64,
2777 .atomic_global_pk_add_bf16_inst,
2778 .bf16_cvt_insts,
2779 .bf16_pk_insts,
2780 .bf16_trans_insts,
2781 .bitop3_insts,
2782 .clusters,
2783 .cube_insts,
2784 .cumode,
2785 .cvt_norm_insts,
2786 .cvt_pk_f16_f32_inst,
2787 .cvt_pknorm_vop2_insts,
2788 .cvt_pknorm_vop3_insts,
2789 .d16_write_vgpr32,
2790 .dl_insts,
2791 .dot7_insts,
2792 .dot8_insts,
2793 .dpp_64bit,
2794 .dpp_src1_sgpr,
2795 .emulated_system_scope_atomics,
2796 .flat_atomic_fadd_f32_inst,
2797 .flat_buffer_global_fadd_f64_inst,
2798 .flat_gvs_mode,
2799 .fma_mix_bf16_insts,
2800 .fmacf64_inst,
2801 .fp8_conversion_insts,
2802 .fp8e5m3_insts,
2803 .gfx12,
2804 .gfx1250_insts,
2805 .globally_addressable_scratch,
2806 .kernarg_preload,
2807 .lds_barrier_arrive_atomic,
2808 .ldsbankcount32,
2809 .lerp_inst,
2810 .lshl_add_u64_inst,
2811 .mad_u32_inst,
2812 .max_hard_clause_length_63,
2813 .mcast_load_insts,
2814 .memory_atomic_fadd_f32_denormal_support,
2815 .min3_max3_pkf16,
2816 .minimum3_maximum3_pkf16,
2817 .packed_fp32_ops,
2818 .packed_tid,
2819 .permlane16_swap,
2820 .pk_add_min_max_insts,
2821 .prng_inst,
2822 .pseudo_scalar_trans,
2823 .qsad_insts,
2824 .restricted_soffset,
2825 .s_wakeup_barrier_inst,
2826 .sad_insts,
2827 .salu_float,
2828 .scalar_dwordx3_loads,
2829 .setprio_inc_wg_inst,
2830 .shader_cycles_hi_lo_registers,
2831 .sramecc_support,
2832 .tanh_insts,
2833 .tensor_cvt_lut_insts,
2834 .transpose_load_f4f6_insts,
2835 .vcmpx_permlane_hazard,
2836 .vgpr_align2,
2837 .vmem_pref_insts,
2838 .wait_xcnt,
2839 .wavefrontsize32,
2840 .xnack,
2841 .xnack_support,
24572842 }),
24582843 };
24592844 pub const gfx12_generic: CpuModel = .{
24602845 .name = "gfx12_generic",
24612846 .llvm_name = "gfx12-generic",
24622847 .features = featureSet(&[_]Feature{
2848 .addressablelocalmemorysize65536,
24632849 .allocate1_5xvgprs,
24642850 .architected_flat_scratch,
24652851 .architected_sgprs,
......@@ -2470,7 +2856,13 @@ pub const cpu = struct {
24702856 .atomic_fadd_rtn_insts,
24712857 .atomic_flat_pk_add_16_insts,
24722858 .atomic_global_pk_add_bf16_inst,
2859 .back_off_barrier,
24732860 .bvh_dual_bvh_8_insts,
2861 .cube_insts,
2862 .cvt_norm_insts,
2863 .cvt_pknorm_vop2_insts,
2864 .cvt_pknorm_vop3_insts,
2865 .d16_write_vgpr32,
24742866 .dl_insts,
24752867 .dot10_insts,
24762868 .dot11_insts,
......@@ -2485,17 +2877,21 @@ pub const cpu = struct {
24852877 .gfx12,
24862878 .image_insts,
24872879 .ldsbankcount32,
2880 .lerp_inst,
24882881 .memory_atomic_fadd_f32_denormal_support,
24892882 .nsa_encoding,
24902883 .packed_tid,
24912884 .partial_nsa_encoding,
24922885 .pseudo_scalar_trans,
2886 .qsad_insts,
24932887 .requires_cov6,
24942888 .restricted_soffset,
2889 .sad_insts,
24952890 .salu_float,
24962891 .scalar_dwordx3_loads,
24972892 .shader_cycles_hi_lo_registers,
24982893 .vcmpx_permlane_hazard,
2894 .waits_before_system_scope_stores,
24992895 }),
25002896 };
25012897 pub const gfx600: CpuModel = .{
......@@ -2779,6 +3175,7 @@ pub const cpu = struct {
27793175 .packed_tid,
27803176 .pk_fmac_f16_inst,
27813177 .sramecc_support,
3178 .vgpr_align2,
27823179 }),
27833180 };
27843181 pub const gfx90c: CpuModel = .{
......@@ -2842,6 +3239,7 @@ pub const cpu = struct {
28423239 .packed_tid,
28433240 .pk_fmac_f16_inst,
28443241 .sramecc_support,
3242 .vgpr_align2,
28453243 .xf32_insts,
28463244 }),
28473245 };
......@@ -2897,6 +3295,7 @@ pub const cpu = struct {
28973295 .pk_fmac_f16_inst,
28983296 .prng_inst,
28993297 .sramecc_support,
3298 .vgpr_align2,
29003299 }),
29013300 };
29023301 pub const gfx9_4_generic: CpuModel = .{
......@@ -2943,6 +3342,7 @@ pub const cpu = struct {
29433342 .pk_fmac_f16_inst,
29443343 .requires_cov6,
29453344 .sramecc_support,
3345 .vgpr_align2,
29463346 }),
29473347 };
29483348 pub const gfx9_generic: CpuModel = .{
lib/std/Target/arm.zig+40-6
......@@ -88,6 +88,7 @@ pub const Feature = enum {
8888 has_v9_4a,
8989 has_v9_5a,
9090 has_v9_6a,
91 has_v9_7a,
9192 has_v9a,
9293 hwdiv,
9394 hwdiv_arm,
......@@ -107,7 +108,6 @@ pub const Feature = enum {
107108 mve2beat,
108109 mve4beat,
109110 mve_fp,
110 nacl_trap,
111111 neon,
112112 neon_fpmovs,
113113 neonfp,
......@@ -187,6 +187,7 @@ pub const Feature = enum {
187187 v9_4a,
188188 v9_5a,
189189 v9_6a,
190 v9_7a,
190191 v9a,
191192 vfp2,
192193 vfp2sp,
......@@ -748,6 +749,13 @@ pub const all_features = blk: {
748749 .has_v9_5a,
749750 }),
750751 };
752 result[@intFromEnum(Feature.has_v9_7a)] = .{
753 .llvm_name = "v9.7a",
754 .description = "Support ARM v9.7a instructions",
755 .dependencies = featureSet(&[_]Feature{
756 .has_v9_6a,
757 }),
758 };
751759 result[@intFromEnum(Feature.has_v9a)] = .{
752760 .llvm_name = "v9a",
753761 .description = "Support ARM v9a instructions",
......@@ -859,11 +867,6 @@ pub const all_features = blk: {
859867 .mve,
860868 }),
861869 };
862 result[@intFromEnum(Feature.nacl_trap)] = .{
863 .llvm_name = "nacl-trap",
864 .description = "NaCl trap",
865 .dependencies = featureSet(&[_]Feature{}),
866 };
867870 result[@intFromEnum(Feature.neon)] = .{
868871 .llvm_name = "neon",
869872 .description = "Enable NEON instructions",
......@@ -1579,6 +1582,22 @@ pub const all_features = blk: {
15791582 .virtualization,
15801583 }),
15811584 };
1585 result[@intFromEnum(Feature.v9_7a)] = .{
1586 .llvm_name = "armv9.7-a",
1587 .description = "ARMv97a architecture",
1588 .dependencies = featureSet(&[_]Feature{
1589 .aclass,
1590 .crc,
1591 .db,
1592 .dsp,
1593 .fp_armv8,
1594 .has_v9_7a,
1595 .mp,
1596 .ras,
1597 .trustzone,
1598 .virtualization,
1599 }),
1600 };
15821601 result[@intFromEnum(Feature.v9a)] = .{
15831602 .llvm_name = "armv9-a",
15841603 .description = "ARMv9a architecture",
......@@ -2658,6 +2677,21 @@ pub const cpu = struct {
26582677 .v8m_main,
26592678 }),
26602679 };
2680 pub const star_mc3: CpuModel = .{
2681 .name = "star_mc3",
2682 .llvm_name = "star-mc3",
2683 .features = featureSet(&[_]Feature{
2684 .fp_armv8d16,
2685 .loop_align,
2686 .mve1beat,
2687 .mve_fp,
2688 .no_branch_predictor,
2689 .pacbti,
2690 .slowfpvmlx,
2691 .use_misched,
2692 .v8_1m_main,
2693 }),
2694 };
26612695 pub const strongarm: CpuModel = .{
26622696 .name = "strongarm",
26632697 .llvm_name = "strongarm",
lib/std/Target/bpf.zig+6
......@@ -5,6 +5,7 @@ const CpuFeature = std.Target.Cpu.Feature;
55const CpuModel = std.Target.Cpu.Model;
66
77pub const Feature = enum {
8 allows_misaligned_mem_access,
89 alu32,
910 dummy,
1011 dwarfris,
......@@ -19,6 +20,11 @@ pub const all_features = blk: {
1920 const len = @typeInfo(Feature).@"enum".fields.len;
2021 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
2122 var result: [len]CpuFeature = undefined;
23 result[@intFromEnum(Feature.allows_misaligned_mem_access)] = .{
24 .llvm_name = "allows-misaligned-mem-access",
25 .description = "Allows misaligned memory access",
26 .dependencies = featureSet(&[_]Feature{}),
27 };
2228 result[@intFromEnum(Feature.alu32)] = .{
2329 .llvm_name = "alu32",
2430 .description = "Enable ALU32 instructions",
lib/std/Target/hexagon.zig+41-6
......@@ -25,6 +25,7 @@ pub const Feature = enum {
2525 hvxv73,
2626 hvxv75,
2727 hvxv79,
28 hvxv81,
2829 long_calls,
2930 mem_noshuf,
3031 memops,
......@@ -36,7 +37,6 @@ pub const Feature = enum {
3637 reserved_r19,
3738 small_data,
3839 tinycore,
39 unsafe_fp,
4040 v5,
4141 v55,
4242 v60,
......@@ -50,6 +50,7 @@ pub const Feature = enum {
5050 v73,
5151 v75,
5252 v79,
53 v81,
5354 zreg,
5455};
5556
......@@ -189,6 +190,13 @@ pub const all_features = blk: {
189190 .hvxv75,
190191 }),
191192 };
193 result[@intFromEnum(Feature.hvxv81)] = .{
194 .llvm_name = "hvxv81",
195 .description = "Hexagon HVX instructions",
196 .dependencies = featureSet(&[_]Feature{
197 .hvxv79,
198 }),
199 };
192200 result[@intFromEnum(Feature.long_calls)] = .{
193201 .llvm_name = "long-calls",
194202 .description = "Use constant-extended calls",
......@@ -248,11 +256,6 @@ pub const all_features = blk: {
248256 .description = "Hexagon Tiny Core",
249257 .dependencies = featureSet(&[_]Feature{}),
250258 };
251 result[@intFromEnum(Feature.unsafe_fp)] = .{
252 .llvm_name = "unsafe-fp",
253 .description = "Use unsafe FP math",
254 .dependencies = featureSet(&[_]Feature{}),
255 };
256259 result[@intFromEnum(Feature.v5)] = .{
257260 .llvm_name = "v5",
258261 .description = "Enable Hexagon V5 architecture",
......@@ -318,6 +321,11 @@ pub const all_features = blk: {
318321 .description = "Enable Hexagon V79 architecture",
319322 .dependencies = featureSet(&[_]Feature{}),
320323 };
324 result[@intFromEnum(Feature.v81)] = .{
325 .llvm_name = "v81",
326 .description = "Enable Hexagon V81 architecture",
327 .dependencies = featureSet(&[_]Feature{}),
328 };
321329 result[@intFromEnum(Feature.zreg)] = .{
322330 .llvm_name = "zreg",
323331 .description = "Hexagon ZReg extension instructions",
......@@ -662,4 +670,31 @@ pub const cpu = struct {
662670 .v79,
663671 }),
664672 };
673 pub const hexagonv81: CpuModel = .{
674 .name = "hexagonv81",
675 .llvm_name = "hexagonv81",
676 .features = featureSet(&[_]Feature{
677 .compound,
678 .duplex,
679 .mem_noshuf,
680 .memops,
681 .nvj,
682 .nvs,
683 .small_data,
684 .v5,
685 .v55,
686 .v60,
687 .v62,
688 .v65,
689 .v66,
690 .v67,
691 .v68,
692 .v69,
693 .v71,
694 .v73,
695 .v75,
696 .v79,
697 .v81,
698 }),
699 };
665700};
lib/std/Target/loongarch.zig+18
......@@ -175,6 +175,24 @@ pub const cpu = struct {
175175 .ual,
176176 }),
177177 };
178 pub const la32rv1_0: CpuModel = .{
179 .name = "la32rv1_0",
180 .llvm_name = null,
181 .features = featureSet(&[_]Feature{
182 .@"32bit",
183 .ual,
184 }),
185 };
186 pub const la32v1_0: CpuModel = .{
187 .name = "la32v1_0",
188 .llvm_name = null,
189 .features = featureSet(&[_]Feature{
190 .@"32bit",
191 .@"32s",
192 .d,
193 .ual,
194 }),
195 };
178196 pub const la464: CpuModel = .{
179197 .name = "la464",
180198 .llvm_name = "la464",
lib/std/Target/mips.zig+6
......@@ -56,6 +56,7 @@ pub const Feature = enum {
5656 soft_float,
5757 strict_align,
5858 sym32,
59 use_compact_branches,
5960 use_indirect_jump_hazard,
6061 use_tcc_in_div,
6162 vfpu,
......@@ -391,6 +392,11 @@ pub const all_features = blk: {
391392 .description = "Symbols are 32 bit on Mips64",
392393 .dependencies = featureSet(&[_]Feature{}),
393394 };
395 result[@intFromEnum(Feature.use_compact_branches)] = .{
396 .llvm_name = "use-compact-branches",
397 .description = "Use compact branch instructions for MIPS32R6/MIPS64R6",
398 .dependencies = featureSet(&[_]Feature{}),
399 };
394400 result[@intFromEnum(Feature.use_indirect_jump_hazard)] = .{
395401 .llvm_name = "use-indirect-jump-hazard",
396402 .description = "Use indirect jump guards to prevent certain speculation based attacks",
lib/std/Target/nvptx.zig+58-35
......@@ -35,6 +35,7 @@ pub const Feature = enum {
3535 ptx86,
3636 ptx87,
3737 ptx88,
38 ptx90,
3839 sm_100,
3940 sm_100a,
4041 sm_100f,
......@@ -44,6 +45,9 @@ pub const Feature = enum {
4445 sm_103,
4546 sm_103a,
4647 sm_103f,
48 sm_110,
49 sm_110a,
50 sm_110f,
4751 sm_120,
4852 sm_120a,
4953 sm_120f,
......@@ -68,6 +72,7 @@ pub const Feature = enum {
6872 sm_80,
6973 sm_86,
7074 sm_87,
75 sm_88,
7176 sm_89,
7277 sm_90,
7378 sm_90a,
......@@ -232,6 +237,11 @@ pub const all_features = blk: {
232237 .description = "Use PTX version 88",
233238 .dependencies = featureSet(&[_]Feature{}),
234239 };
240 result[@intFromEnum(Feature.ptx90)] = .{
241 .llvm_name = "ptx90",
242 .description = "Use PTX version 90",
243 .dependencies = featureSet(&[_]Feature{}),
244 };
235245 result[@intFromEnum(Feature.sm_100)] = .{
236246 .llvm_name = "sm_100",
237247 .description = "Target SM 100",
......@@ -277,6 +287,21 @@ pub const all_features = blk: {
277287 .description = "Target SM 103f",
278288 .dependencies = featureSet(&[_]Feature{}),
279289 };
290 result[@intFromEnum(Feature.sm_110)] = .{
291 .llvm_name = "sm_110",
292 .description = "Target SM 110",
293 .dependencies = featureSet(&[_]Feature{}),
294 };
295 result[@intFromEnum(Feature.sm_110a)] = .{
296 .llvm_name = "sm_110a",
297 .description = "Target SM 110a",
298 .dependencies = featureSet(&[_]Feature{}),
299 };
300 result[@intFromEnum(Feature.sm_110f)] = .{
301 .llvm_name = "sm_110f",
302 .description = "Target SM 110f",
303 .dependencies = featureSet(&[_]Feature{}),
304 };
280305 result[@intFromEnum(Feature.sm_120)] = .{
281306 .llvm_name = "sm_120",
282307 .description = "Target SM 120",
......@@ -397,6 +422,11 @@ pub const all_features = blk: {
397422 .description = "Target SM 87",
398423 .dependencies = featureSet(&[_]Feature{}),
399424 };
425 result[@intFromEnum(Feature.sm_88)] = .{
426 .llvm_name = "sm_88",
427 .description = "Target SM 88",
428 .dependencies = featureSet(&[_]Feature{}),
429 };
400430 result[@intFromEnum(Feature.sm_89)] = .{
401431 .llvm_name = "sm_89",
402432 .description = "Target SM 89",
......@@ -425,7 +455,6 @@ pub const cpu = struct {
425455 .name = "sm_100",
426456 .llvm_name = "sm_100",
427457 .features = featureSet(&[_]Feature{
428 .ptx86,
429458 .sm_100,
430459 }),
431460 };
......@@ -433,7 +462,6 @@ pub const cpu = struct {
433462 .name = "sm_100a",
434463 .llvm_name = "sm_100a",
435464 .features = featureSet(&[_]Feature{
436 .ptx86,
437465 .sm_100a,
438466 }),
439467 };
......@@ -441,7 +469,6 @@ pub const cpu = struct {
441469 .name = "sm_100f",
442470 .llvm_name = "sm_100f",
443471 .features = featureSet(&[_]Feature{
444 .ptx88,
445472 .sm_100f,
446473 }),
447474 };
......@@ -449,7 +476,6 @@ pub const cpu = struct {
449476 .name = "sm_101",
450477 .llvm_name = "sm_101",
451478 .features = featureSet(&[_]Feature{
452 .ptx86,
453479 .sm_101,
454480 }),
455481 };
......@@ -457,7 +483,6 @@ pub const cpu = struct {
457483 .name = "sm_101a",
458484 .llvm_name = "sm_101a",
459485 .features = featureSet(&[_]Feature{
460 .ptx86,
461486 .sm_101a,
462487 }),
463488 };
......@@ -465,7 +490,6 @@ pub const cpu = struct {
465490 .name = "sm_101f",
466491 .llvm_name = "sm_101f",
467492 .features = featureSet(&[_]Feature{
468 .ptx88,
469493 .sm_101f,
470494 }),
471495 };
......@@ -473,7 +497,6 @@ pub const cpu = struct {
473497 .name = "sm_103",
474498 .llvm_name = "sm_103",
475499 .features = featureSet(&[_]Feature{
476 .ptx88,
477500 .sm_103,
478501 }),
479502 };
......@@ -481,7 +504,6 @@ pub const cpu = struct {
481504 .name = "sm_103a",
482505 .llvm_name = "sm_103a",
483506 .features = featureSet(&[_]Feature{
484 .ptx88,
485507 .sm_103a,
486508 }),
487509 };
......@@ -489,15 +511,34 @@ pub const cpu = struct {
489511 .name = "sm_103f",
490512 .llvm_name = "sm_103f",
491513 .features = featureSet(&[_]Feature{
492 .ptx88,
493514 .sm_103f,
494515 }),
495516 };
517 pub const sm_110: CpuModel = .{
518 .name = "sm_110",
519 .llvm_name = "sm_110",
520 .features = featureSet(&[_]Feature{
521 .sm_110,
522 }),
523 };
524 pub const sm_110a: CpuModel = .{
525 .name = "sm_110a",
526 .llvm_name = "sm_110a",
527 .features = featureSet(&[_]Feature{
528 .sm_110a,
529 }),
530 };
531 pub const sm_110f: CpuModel = .{
532 .name = "sm_110f",
533 .llvm_name = "sm_110f",
534 .features = featureSet(&[_]Feature{
535 .sm_110f,
536 }),
537 };
496538 pub const sm_120: CpuModel = .{
497539 .name = "sm_120",
498540 .llvm_name = "sm_120",
499541 .features = featureSet(&[_]Feature{
500 .ptx87,
501542 .sm_120,
502543 }),
503544 };
......@@ -505,7 +546,6 @@ pub const cpu = struct {
505546 .name = "sm_120a",
506547 .llvm_name = "sm_120a",
507548 .features = featureSet(&[_]Feature{
508 .ptx87,
509549 .sm_120a,
510550 }),
511551 };
......@@ -513,7 +553,6 @@ pub const cpu = struct {
513553 .name = "sm_120f",
514554 .llvm_name = "sm_120f",
515555 .features = featureSet(&[_]Feature{
516 .ptx88,
517556 .sm_120f,
518557 }),
519558 };
......@@ -521,7 +560,6 @@ pub const cpu = struct {
521560 .name = "sm_121",
522561 .llvm_name = "sm_121",
523562 .features = featureSet(&[_]Feature{
524 .ptx88,
525563 .sm_121,
526564 }),
527565 };
......@@ -529,7 +567,6 @@ pub const cpu = struct {
529567 .name = "sm_121a",
530568 .llvm_name = "sm_121a",
531569 .features = featureSet(&[_]Feature{
532 .ptx88,
533570 .sm_121a,
534571 }),
535572 };
......@@ -537,7 +574,6 @@ pub const cpu = struct {
537574 .name = "sm_121f",
538575 .llvm_name = "sm_121f",
539576 .features = featureSet(&[_]Feature{
540 .ptx88,
541577 .sm_121f,
542578 }),
543579 };
......@@ -545,7 +581,6 @@ pub const cpu = struct {
545581 .name = "sm_20",
546582 .llvm_name = "sm_20",
547583 .features = featureSet(&[_]Feature{
548 .ptx32,
549584 .sm_20,
550585 }),
551586 };
......@@ -553,7 +588,6 @@ pub const cpu = struct {
553588 .name = "sm_21",
554589 .llvm_name = "sm_21",
555590 .features = featureSet(&[_]Feature{
556 .ptx32,
557591 .sm_21,
558592 }),
559593 };
......@@ -568,7 +602,6 @@ pub const cpu = struct {
568602 .name = "sm_32",
569603 .llvm_name = "sm_32",
570604 .features = featureSet(&[_]Feature{
571 .ptx40,
572605 .sm_32,
573606 }),
574607 };
......@@ -576,7 +609,6 @@ pub const cpu = struct {
576609 .name = "sm_35",
577610 .llvm_name = "sm_35",
578611 .features = featureSet(&[_]Feature{
579 .ptx32,
580612 .sm_35,
581613 }),
582614 };
......@@ -584,7 +616,6 @@ pub const cpu = struct {
584616 .name = "sm_37",
585617 .llvm_name = "sm_37",
586618 .features = featureSet(&[_]Feature{
587 .ptx41,
588619 .sm_37,
589620 }),
590621 };
......@@ -592,7 +623,6 @@ pub const cpu = struct {
592623 .name = "sm_50",
593624 .llvm_name = "sm_50",
594625 .features = featureSet(&[_]Feature{
595 .ptx40,
596626 .sm_50,
597627 }),
598628 };
......@@ -600,7 +630,6 @@ pub const cpu = struct {
600630 .name = "sm_52",
601631 .llvm_name = "sm_52",
602632 .features = featureSet(&[_]Feature{
603 .ptx41,
604633 .sm_52,
605634 }),
606635 };
......@@ -608,7 +637,6 @@ pub const cpu = struct {
608637 .name = "sm_53",
609638 .llvm_name = "sm_53",
610639 .features = featureSet(&[_]Feature{
611 .ptx42,
612640 .sm_53,
613641 }),
614642 };
......@@ -616,7 +644,6 @@ pub const cpu = struct {
616644 .name = "sm_60",
617645 .llvm_name = "sm_60",
618646 .features = featureSet(&[_]Feature{
619 .ptx50,
620647 .sm_60,
621648 }),
622649 };
......@@ -624,7 +651,6 @@ pub const cpu = struct {
624651 .name = "sm_61",
625652 .llvm_name = "sm_61",
626653 .features = featureSet(&[_]Feature{
627 .ptx50,
628654 .sm_61,
629655 }),
630656 };
......@@ -632,7 +658,6 @@ pub const cpu = struct {
632658 .name = "sm_62",
633659 .llvm_name = "sm_62",
634660 .features = featureSet(&[_]Feature{
635 .ptx50,
636661 .sm_62,
637662 }),
638663 };
......@@ -640,7 +665,6 @@ pub const cpu = struct {
640665 .name = "sm_70",
641666 .llvm_name = "sm_70",
642667 .features = featureSet(&[_]Feature{
643 .ptx60,
644668 .sm_70,
645669 }),
646670 };
......@@ -648,7 +672,6 @@ pub const cpu = struct {
648672 .name = "sm_72",
649673 .llvm_name = "sm_72",
650674 .features = featureSet(&[_]Feature{
651 .ptx61,
652675 .sm_72,
653676 }),
654677 };
......@@ -656,7 +679,6 @@ pub const cpu = struct {
656679 .name = "sm_75",
657680 .llvm_name = "sm_75",
658681 .features = featureSet(&[_]Feature{
659 .ptx63,
660682 .sm_75,
661683 }),
662684 };
......@@ -664,7 +686,6 @@ pub const cpu = struct {
664686 .name = "sm_80",
665687 .llvm_name = "sm_80",
666688 .features = featureSet(&[_]Feature{
667 .ptx70,
668689 .sm_80,
669690 }),
670691 };
......@@ -672,7 +693,6 @@ pub const cpu = struct {
672693 .name = "sm_86",
673694 .llvm_name = "sm_86",
674695 .features = featureSet(&[_]Feature{
675 .ptx71,
676696 .sm_86,
677697 }),
678698 };
......@@ -680,15 +700,20 @@ pub const cpu = struct {
680700 .name = "sm_87",
681701 .llvm_name = "sm_87",
682702 .features = featureSet(&[_]Feature{
683 .ptx74,
684703 .sm_87,
685704 }),
686705 };
706 pub const sm_88: CpuModel = .{
707 .name = "sm_88",
708 .llvm_name = "sm_88",
709 .features = featureSet(&[_]Feature{
710 .sm_88,
711 }),
712 };
687713 pub const sm_89: CpuModel = .{
688714 .name = "sm_89",
689715 .llvm_name = "sm_89",
690716 .features = featureSet(&[_]Feature{
691 .ptx78,
692717 .sm_89,
693718 }),
694719 };
......@@ -696,7 +721,6 @@ pub const cpu = struct {
696721 .name = "sm_90",
697722 .llvm_name = "sm_90",
698723 .features = featureSet(&[_]Feature{
699 .ptx78,
700724 .sm_90,
701725 }),
702726 };
......@@ -704,7 +728,6 @@ pub const cpu = struct {
704728 .name = "sm_90a",
705729 .llvm_name = "sm_90a",
706730 .features = featureSet(&[_]Feature{
707 .ptx80,
708731 .sm_90a,
709732 }),
710733 };
lib/std/Target/powerpc.zig+27-19
......@@ -6,6 +6,7 @@ const CpuModel = std.Target.Cpu.Model;
66
77pub const Feature = enum {
88 @"64bit",
9 @"64bit_support",
910 @"64bitregs",
1011 allow_unaligned_fp_access,
1112 altivec,
......@@ -97,7 +98,14 @@ pub const all_features = blk: {
9798 var result: [len]CpuFeature = undefined;
9899 result[@intFromEnum(Feature.@"64bit")] = .{
99100 .llvm_name = "64bit",
100 .description = "Enable 64-bit instructions",
101 .description = "Enable 64-bit mode",
102 .dependencies = featureSet(&[_]Feature{
103 .@"64bit_support",
104 }),
105 };
106 result[@intFromEnum(Feature.@"64bit_support")] = .{
107 .llvm_name = "64bit-support",
108 .description = "Supports 64-bit instructions",
101109 .dependencies = featureSet(&[_]Feature{}),
102110 };
103111 result[@intFromEnum(Feature.@"64bitregs")] = .{
......@@ -705,7 +713,7 @@ pub const cpu = struct {
705713 .name = "970",
706714 .llvm_name = "970",
707715 .features = featureSet(&[_]Feature{
708 .@"64bit",
716 .@"64bit_support",
709717 .altivec,
710718 .fres,
711719 .frsqrte,
......@@ -718,7 +726,7 @@ pub const cpu = struct {
718726 .name = "a2",
719727 .llvm_name = "a2",
720728 .features = featureSet(&[_]Feature{
721 .@"64bit",
729 .@"64bit_support",
722730 .booke,
723731 .cmpb,
724732 .fcpsgn,
......@@ -761,7 +769,7 @@ pub const cpu = struct {
761769 .name = "e5500",
762770 .llvm_name = "e5500",
763771 .features = featureSet(&[_]Feature{
764 .@"64bit",
772 .@"64bit_support",
765773 .booke,
766774 .isel,
767775 .mfocrf,
......@@ -772,7 +780,7 @@ pub const cpu = struct {
772780 .name = "future",
773781 .llvm_name = "future",
774782 .features = featureSet(&[_]Feature{
775 .@"64bit",
783 .@"64bit_support",
776784 .allow_unaligned_fp_access,
777785 .bpermd,
778786 .cmpb,
......@@ -846,7 +854,7 @@ pub const cpu = struct {
846854 .name = "g5",
847855 .llvm_name = "g5",
848856 .features = featureSet(&[_]Feature{
849 .@"64bit",
857 .@"64bit_support",
850858 .altivec,
851859 .fres,
852860 .frsqrte,
......@@ -873,7 +881,7 @@ pub const cpu = struct {
873881 .name = "ppc64",
874882 .llvm_name = "ppc64",
875883 .features = featureSet(&[_]Feature{
876 .@"64bit",
884 .@"64bit_support",
877885 .altivec,
878886 .fres,
879887 .frsqrte,
......@@ -886,7 +894,7 @@ pub const cpu = struct {
886894 .name = "ppc64le",
887895 .llvm_name = "ppc64le",
888896 .features = featureSet(&[_]Feature{
889 .@"64bit",
897 .@"64bit_support",
890898 .allow_unaligned_fp_access,
891899 .bpermd,
892900 .cmpb,
......@@ -926,7 +934,7 @@ pub const cpu = struct {
926934 .name = "pwr10",
927935 .llvm_name = "pwr10",
928936 .features = featureSet(&[_]Feature{
929 .@"64bit",
937 .@"64bit_support",
930938 .allow_unaligned_fp_access,
931939 .bpermd,
932940 .cmpb,
......@@ -973,7 +981,7 @@ pub const cpu = struct {
973981 .name = "pwr11",
974982 .llvm_name = "pwr11",
975983 .features = featureSet(&[_]Feature{
976 .@"64bit",
984 .@"64bit_support",
977985 .allow_unaligned_fp_access,
978986 .bpermd,
979987 .cmpb,
......@@ -1020,7 +1028,7 @@ pub const cpu = struct {
10201028 .name = "pwr3",
10211029 .llvm_name = "pwr3",
10221030 .features = featureSet(&[_]Feature{
1023 .@"64bit",
1031 .@"64bit_support",
10241032 .altivec,
10251033 .fres,
10261034 .frsqrte,
......@@ -1032,7 +1040,7 @@ pub const cpu = struct {
10321040 .name = "pwr4",
10331041 .llvm_name = "pwr4",
10341042 .features = featureSet(&[_]Feature{
1035 .@"64bit",
1043 .@"64bit_support",
10361044 .altivec,
10371045 .fres,
10381046 .frsqrte,
......@@ -1045,7 +1053,7 @@ pub const cpu = struct {
10451053 .name = "pwr5",
10461054 .llvm_name = "pwr5",
10471055 .features = featureSet(&[_]Feature{
1048 .@"64bit",
1056 .@"64bit_support",
10491057 .altivec,
10501058 .fre,
10511059 .fres,
......@@ -1060,7 +1068,7 @@ pub const cpu = struct {
10601068 .name = "pwr5x",
10611069 .llvm_name = "pwr5x",
10621070 .features = featureSet(&[_]Feature{
1063 .@"64bit",
1071 .@"64bit_support",
10641072 .altivec,
10651073 .fprnd,
10661074 .fre,
......@@ -1076,7 +1084,7 @@ pub const cpu = struct {
10761084 .name = "pwr6",
10771085 .llvm_name = "pwr6",
10781086 .features = featureSet(&[_]Feature{
1079 .@"64bit",
1087 .@"64bit_support",
10801088 .altivec,
10811089 .cmpb,
10821090 .fcpsgn,
......@@ -1096,7 +1104,7 @@ pub const cpu = struct {
10961104 .name = "pwr6x",
10971105 .llvm_name = "pwr6x",
10981106 .features = featureSet(&[_]Feature{
1099 .@"64bit",
1107 .@"64bit_support",
11001108 .altivec,
11011109 .cmpb,
11021110 .fcpsgn,
......@@ -1116,7 +1124,7 @@ pub const cpu = struct {
11161124 .name = "pwr7",
11171125 .llvm_name = "pwr7",
11181126 .features = featureSet(&[_]Feature{
1119 .@"64bit",
1127 .@"64bit_support",
11201128 .allow_unaligned_fp_access,
11211129 .bpermd,
11221130 .cmpb,
......@@ -1145,7 +1153,7 @@ pub const cpu = struct {
11451153 .name = "pwr8",
11461154 .llvm_name = "pwr8",
11471155 .features = featureSet(&[_]Feature{
1148 .@"64bit",
1156 .@"64bit_support",
11491157 .allow_unaligned_fp_access,
11501158 .bpermd,
11511159 .cmpb,
......@@ -1185,7 +1193,7 @@ pub const cpu = struct {
11851193 .name = "pwr9",
11861194 .llvm_name = "pwr9",
11871195 .features = featureSet(&[_]Feature{
1188 .@"64bit",
1196 .@"64bit_support",
11891197 .allow_unaligned_fp_access,
11901198 .bpermd,
11911199 .cmpb,
lib/std/Target/riscv.zig+415-177
......@@ -8,49 +8,40 @@ pub const Feature = enum {
88 @"32bit",
99 @"64bit",
1010 a,
11 add_load_fusion,
12 addi_load_fusion,
1113 andes45,
1214 auipc_addi_fusion,
15 auipc_load_fusion,
1316 b,
17 bfext_fusion,
1418 c,
1519 conditional_cmv_fusion,
1620 d,
1721 disable_latency_sched_heuristic,
22 disable_misched_load_clustering,
23 disable_misched_store_clustering,
24 disable_postmisched_load_clustering,
25 disable_postmisched_store_clustering,
1826 dlen_factor_2,
1927 e,
28 enable_vsetvli_sched_heuristic,
2029 exact_asm,
2130 experimental,
2231 experimental_p,
2332 experimental_rvm23u32,
24 experimental_smctr,
25 experimental_ssctr,
33 experimental_smpmpmt,
2634 experimental_svukte,
27 experimental_xqccmp,
28 experimental_xqcia,
29 experimental_xqciac,
30 experimental_xqcibi,
31 experimental_xqcibm,
32 experimental_xqcicli,
33 experimental_xqcicm,
34 experimental_xqcics,
35 experimental_xqcicsr,
36 experimental_xqciint,
37 experimental_xqciio,
38 experimental_xqcilb,
39 experimental_xqcili,
40 experimental_xqcilia,
41 experimental_xqcilo,
42 experimental_xqcilsm,
43 experimental_xqcisim,
44 experimental_xqcisls,
45 experimental_xqcisync,
4635 experimental_xrivosvisni,
4736 experimental_xrivosvizip,
4837 experimental_xsfmclic,
4938 experimental_xsfsclic,
50 experimental_zalasr,
39 experimental_zibi,
5140 experimental_zicfilp,
5241 experimental_zicfiss,
5342 experimental_zvbc32e,
43 experimental_zvfbfa,
44 experimental_zvfofp8min,
5445 experimental_zvkgs,
5546 experimental_zvqdotq,
5647 f,
......@@ -60,6 +51,7 @@ pub const Feature = enum {
6051 ld_add_fusion,
6152 log_vrgather,
6253 lui_addi_fusion,
54 lui_load_fusion,
6355 m,
6456 mips_p8700,
6557 no_default_unroll,
......@@ -73,6 +65,7 @@ pub const Feature = enum {
7365 optimized_nf7_segment_load_store,
7466 optimized_nf8_segment_load_store,
7567 optimized_zero_stride_load,
68 permissive_zalrsc,
7669 predictable_select_expensive,
7770 prefer_vsetvli_over_read_vlenb,
7871 prefer_w_inst,
......@@ -127,15 +120,21 @@ pub const Feature = enum {
127120 shgatpa,
128121 shifted_zextw_fusion,
129122 shlcofideleg,
130 short_forward_branch_opt,
123 short_forward_branch_ialu,
124 short_forward_branch_iload,
125 short_forward_branch_iminmax,
126 short_forward_branch_imul,
131127 shtvala,
132128 shvsatpa,
133129 shvstvala,
134130 shvstvecd,
131 shxadd_load_fusion,
132 single_element_vec_fp64,
135133 smaia,
136134 smcdeleg,
137135 smcntrpmf,
138136 smcsrind,
137 smctr,
139138 smdbltrp,
140139 smepmp,
141140 smmpm,
......@@ -148,6 +147,7 @@ pub const Feature = enum {
148147 sscofpmf,
149148 sscounterenw,
150149 sscsrind,
150 ssctr,
151151 ssdbltrp,
152152 ssnpm,
153153 sspm,
......@@ -179,6 +179,7 @@ pub const Feature = enum {
179179 xandesvbfhcvt,
180180 xandesvdot,
181181 xandesvpackfph,
182 xandesvsinth,
182183 xandesvsintload,
183184 xcvalu,
184185 xcvbi,
......@@ -189,7 +190,28 @@ pub const Feature = enum {
189190 xcvsimd,
190191 xmipscbop,
191192 xmipscmov,
193 xmipsexectl,
192194 xmipslsp,
195 xqccmp,
196 xqci,
197 xqcia,
198 xqciac,
199 xqcibi,
200 xqcibm,
201 xqcicli,
202 xqcicm,
203 xqcics,
204 xqcicsr,
205 xqciint,
206 xqciio,
207 xqcilb,
208 xqcili,
209 xqcilia,
210 xqcilo,
211 xqcilsm,
212 xqcisim,
213 xqcisls,
214 xqcisync,
193215 xsfcease,
194216 xsfmm128t,
195217 xsfmm16t,
......@@ -202,12 +224,18 @@ pub const Feature = enum {
202224 xsfmm64t,
203225 xsfmmbase,
204226 xsfvcp,
227 xsfvfbfexp16e,
228 xsfvfexp16e,
229 xsfvfexp32e,
230 xsfvfexpa,
231 xsfvfexpa64e,
205232 xsfvfnrclipxfqf,
206233 xsfvfwmaccqqq,
207234 xsfvqmaccdod,
208235 xsfvqmaccqoq,
209236 xsifivecdiscarddlone,
210237 xsifivecflushdlone,
238 xsmtvdot,
211239 xtheadba,
212240 xtheadbb,
213241 xtheadbs,
......@@ -226,6 +254,7 @@ pub const Feature = enum {
226254 zaamo,
227255 zabha,
228256 zacas,
257 zalasr,
229258 zalrsc,
230259 zama16b,
231260 zawrs,
......@@ -272,6 +301,7 @@ pub const Feature = enum {
272301 zihintpause,
273302 zihpm,
274303 zilsd,
304 zilsd_4byte_align,
275305 zimop,
276306 zk,
277307 zkn,
......@@ -352,6 +382,16 @@ pub const all_features = blk: {
352382 .zalrsc,
353383 }),
354384 };
385 result[@intFromEnum(Feature.add_load_fusion)] = .{
386 .llvm_name = "add-load-fusion",
387 .description = "Enable ADD(.UW) + load macrofusion",
388 .dependencies = featureSet(&[_]Feature{}),
389 };
390 result[@intFromEnum(Feature.addi_load_fusion)] = .{
391 .llvm_name = "addi-load-fusion",
392 .description = "Enable ADDI + load macrofusion",
393 .dependencies = featureSet(&[_]Feature{}),
394 };
355395 result[@intFromEnum(Feature.andes45)] = .{
356396 .llvm_name = "andes45",
357397 .description = "Andes 45-Series processors",
......@@ -362,6 +402,11 @@ pub const all_features = blk: {
362402 .description = "Enable AUIPC+ADDI macrofusion",
363403 .dependencies = featureSet(&[_]Feature{}),
364404 };
405 result[@intFromEnum(Feature.auipc_load_fusion)] = .{
406 .llvm_name = "auipc-load-fusion",
407 .description = "Enable AUIPC + load macrofusion",
408 .dependencies = featureSet(&[_]Feature{}),
409 };
365410 result[@intFromEnum(Feature.b)] = .{
366411 .llvm_name = "b",
367412 .description = "'B' (the collection of the Zba, Zbb, Zbs extensions)",
......@@ -371,6 +416,11 @@ pub const all_features = blk: {
371416 .zbs,
372417 }),
373418 };
419 result[@intFromEnum(Feature.bfext_fusion)] = .{
420 .llvm_name = "bfext-fusion",
421 .description = "Enable SLLI+SRLI (bitfield extract) macrofusion",
422 .dependencies = featureSet(&[_]Feature{}),
423 };
374424 result[@intFromEnum(Feature.c)] = .{
375425 .llvm_name = "c",
376426 .description = "'C' (Compressed Instructions)",
......@@ -395,6 +445,26 @@ pub const all_features = blk: {
395445 .description = "Disable latency scheduling heuristic",
396446 .dependencies = featureSet(&[_]Feature{}),
397447 };
448 result[@intFromEnum(Feature.disable_misched_load_clustering)] = .{
449 .llvm_name = "disable-misched-load-clustering",
450 .description = "Disable load clustering in the machine scheduler",
451 .dependencies = featureSet(&[_]Feature{}),
452 };
453 result[@intFromEnum(Feature.disable_misched_store_clustering)] = .{
454 .llvm_name = "disable-misched-store-clustering",
455 .description = "Disable store clustering in the machine scheduler",
456 .dependencies = featureSet(&[_]Feature{}),
457 };
458 result[@intFromEnum(Feature.disable_postmisched_load_clustering)] = .{
459 .llvm_name = "disable-postmisched-load-clustering",
460 .description = "Disable PostRA load clustering in the machine scheduler",
461 .dependencies = featureSet(&[_]Feature{}),
462 };
463 result[@intFromEnum(Feature.disable_postmisched_store_clustering)] = .{
464 .llvm_name = "disable-postmisched-store-clustering",
465 .description = "Disable PostRA store clustering in the machine scheduler",
466 .dependencies = featureSet(&[_]Feature{}),
467 };
398468 result[@intFromEnum(Feature.dlen_factor_2)] = .{
399469 .llvm_name = "dlen-factor-2",
400470 .description = "Vector unit DLEN(data path width) is half of VLEN",
......@@ -405,6 +475,11 @@ pub const all_features = blk: {
405475 .description = "'E' (Embedded Instruction Set with 16 GPRs)",
406476 .dependencies = featureSet(&[_]Feature{}),
407477 };
478 result[@intFromEnum(Feature.enable_vsetvli_sched_heuristic)] = .{
479 .llvm_name = "enable-vsetvli-sched-heuristic",
480 .description = "Enable vsetvli-based scheduling heuristic",
481 .dependencies = featureSet(&[_]Feature{}),
482 };
408483 result[@intFromEnum(Feature.exact_asm)] = .{
409484 .llvm_name = "exact-asm",
410485 .description = "Enable Exact Assembly (Disables Compression and Relaxation)",
......@@ -437,144 +512,16 @@ pub const all_features = blk: {
437512 .zimop,
438513 }),
439514 };
440 result[@intFromEnum(Feature.experimental_smctr)] = .{
441 .llvm_name = "experimental-smctr",
442 .description = "'Smctr' (Control Transfer Records Machine Level)",
443 .dependencies = featureSet(&[_]Feature{
444 .sscsrind,
445 }),
446 };
447 result[@intFromEnum(Feature.experimental_ssctr)] = .{
448 .llvm_name = "experimental-ssctr",
449 .description = "'Ssctr' (Control Transfer Records Supervisor Level)",
450 .dependencies = featureSet(&[_]Feature{
451 .sscsrind,
452 }),
515 result[@intFromEnum(Feature.experimental_smpmpmt)] = .{
516 .llvm_name = "experimental-smpmpmt",
517 .description = "'Smpmpmt' (PMP-based Memory Types Extension)",
518 .dependencies = featureSet(&[_]Feature{}),
453519 };
454520 result[@intFromEnum(Feature.experimental_svukte)] = .{
455521 .llvm_name = "experimental-svukte",
456522 .description = "'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)",
457523 .dependencies = featureSet(&[_]Feature{}),
458524 };
459 result[@intFromEnum(Feature.experimental_xqccmp)] = .{
460 .llvm_name = "experimental-xqccmp",
461 .description = "'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves)",
462 .dependencies = featureSet(&[_]Feature{
463 .zca,
464 }),
465 };
466 result[@intFromEnum(Feature.experimental_xqcia)] = .{
467 .llvm_name = "experimental-xqcia",
468 .description = "'Xqcia' (Qualcomm uC Arithmetic Extension)",
469 .dependencies = featureSet(&[_]Feature{}),
470 };
471 result[@intFromEnum(Feature.experimental_xqciac)] = .{
472 .llvm_name = "experimental-xqciac",
473 .description = "'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)",
474 .dependencies = featureSet(&[_]Feature{
475 .zca,
476 }),
477 };
478 result[@intFromEnum(Feature.experimental_xqcibi)] = .{
479 .llvm_name = "experimental-xqcibi",
480 .description = "'Xqcibi' (Qualcomm uC Branch Immediate Extension)",
481 .dependencies = featureSet(&[_]Feature{
482 .zca,
483 }),
484 };
485 result[@intFromEnum(Feature.experimental_xqcibm)] = .{
486 .llvm_name = "experimental-xqcibm",
487 .description = "'Xqcibm' (Qualcomm uC Bit Manipulation Extension)",
488 .dependencies = featureSet(&[_]Feature{
489 .zca,
490 }),
491 };
492 result[@intFromEnum(Feature.experimental_xqcicli)] = .{
493 .llvm_name = "experimental-xqcicli",
494 .description = "'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)",
495 .dependencies = featureSet(&[_]Feature{}),
496 };
497 result[@intFromEnum(Feature.experimental_xqcicm)] = .{
498 .llvm_name = "experimental-xqcicm",
499 .description = "'Xqcicm' (Qualcomm uC Conditional Move Extension)",
500 .dependencies = featureSet(&[_]Feature{
501 .zca,
502 }),
503 };
504 result[@intFromEnum(Feature.experimental_xqcics)] = .{
505 .llvm_name = "experimental-xqcics",
506 .description = "'Xqcics' (Qualcomm uC Conditional Select Extension)",
507 .dependencies = featureSet(&[_]Feature{}),
508 };
509 result[@intFromEnum(Feature.experimental_xqcicsr)] = .{
510 .llvm_name = "experimental-xqcicsr",
511 .description = "'Xqcicsr' (Qualcomm uC CSR Extension)",
512 .dependencies = featureSet(&[_]Feature{}),
513 };
514 result[@intFromEnum(Feature.experimental_xqciint)] = .{
515 .llvm_name = "experimental-xqciint",
516 .description = "'Xqciint' (Qualcomm uC Interrupts Extension)",
517 .dependencies = featureSet(&[_]Feature{
518 .zca,
519 }),
520 };
521 result[@intFromEnum(Feature.experimental_xqciio)] = .{
522 .llvm_name = "experimental-xqciio",
523 .description = "'Xqciio' (Qualcomm uC External Input Output Extension)",
524 .dependencies = featureSet(&[_]Feature{}),
525 };
526 result[@intFromEnum(Feature.experimental_xqcilb)] = .{
527 .llvm_name = "experimental-xqcilb",
528 .description = "'Xqcilb' (Qualcomm uC Long Branch Extension)",
529 .dependencies = featureSet(&[_]Feature{
530 .zca,
531 }),
532 };
533 result[@intFromEnum(Feature.experimental_xqcili)] = .{
534 .llvm_name = "experimental-xqcili",
535 .description = "'Xqcili' (Qualcomm uC Load Large Immediate Extension)",
536 .dependencies = featureSet(&[_]Feature{
537 .zca,
538 }),
539 };
540 result[@intFromEnum(Feature.experimental_xqcilia)] = .{
541 .llvm_name = "experimental-xqcilia",
542 .description = "'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)",
543 .dependencies = featureSet(&[_]Feature{
544 .zca,
545 }),
546 };
547 result[@intFromEnum(Feature.experimental_xqcilo)] = .{
548 .llvm_name = "experimental-xqcilo",
549 .description = "'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)",
550 .dependencies = featureSet(&[_]Feature{
551 .zca,
552 }),
553 };
554 result[@intFromEnum(Feature.experimental_xqcilsm)] = .{
555 .llvm_name = "experimental-xqcilsm",
556 .description = "'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)",
557 .dependencies = featureSet(&[_]Feature{}),
558 };
559 result[@intFromEnum(Feature.experimental_xqcisim)] = .{
560 .llvm_name = "experimental-xqcisim",
561 .description = "'Xqcisim' (Qualcomm uC Simulation Hint Extension)",
562 .dependencies = featureSet(&[_]Feature{
563 .zca,
564 }),
565 };
566 result[@intFromEnum(Feature.experimental_xqcisls)] = .{
567 .llvm_name = "experimental-xqcisls",
568 .description = "'Xqcisls' (Qualcomm uC Scaled Load Store Extension)",
569 .dependencies = featureSet(&[_]Feature{}),
570 };
571 result[@intFromEnum(Feature.experimental_xqcisync)] = .{
572 .llvm_name = "experimental-xqcisync",
573 .description = "'Xqcisync' (Qualcomm uC Sync Delay Extension)",
574 .dependencies = featureSet(&[_]Feature{
575 .zca,
576 }),
577 };
578525 result[@intFromEnum(Feature.experimental_xrivosvisni)] = .{
579526 .llvm_name = "experimental-xrivosvisni",
580527 .description = "'XRivosVisni' (Rivos Vector Integer Small New)",
......@@ -595,9 +542,9 @@ pub const all_features = blk: {
595542 .description = "'XSfsclic' (SiFive CLIC Supervisor-mode CSRs)",
596543 .dependencies = featureSet(&[_]Feature{}),
597544 };
598 result[@intFromEnum(Feature.experimental_zalasr)] = .{
599 .llvm_name = "experimental-zalasr",
600 .description = "'Zalasr' (Load-Acquire and Store-Release Instructions)",
545 result[@intFromEnum(Feature.experimental_zibi)] = .{
546 .llvm_name = "experimental-zibi",
547 .description = "'Zibi' (Branch with Immediate)",
601548 .dependencies = featureSet(&[_]Feature{}),
602549 };
603550 result[@intFromEnum(Feature.experimental_zicfilp)] = .{
......@@ -622,6 +569,21 @@ pub const all_features = blk: {
622569 .zve32x,
623570 }),
624571 };
572 result[@intFromEnum(Feature.experimental_zvfbfa)] = .{
573 .llvm_name = "experimental-zvfbfa",
574 .description = "'Zvfbfa' (Additional BF16 vector compute support)",
575 .dependencies = featureSet(&[_]Feature{
576 .zfbfmin,
577 .zve32f,
578 }),
579 };
580 result[@intFromEnum(Feature.experimental_zvfofp8min)] = .{
581 .llvm_name = "experimental-zvfofp8min",
582 .description = "'Zvfofp8min' (Vector OFP8 Converts)",
583 .dependencies = featureSet(&[_]Feature{
584 .zve32f,
585 }),
586 };
625587 result[@intFromEnum(Feature.experimental_zvkgs)] = .{
626588 .llvm_name = "experimental-zvkgs",
627589 .description = "'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)",
......@@ -673,6 +635,11 @@ pub const all_features = blk: {
673635 .description = "Enable LUI+ADDI macro fusion",
674636 .dependencies = featureSet(&[_]Feature{}),
675637 };
638 result[@intFromEnum(Feature.lui_load_fusion)] = .{
639 .llvm_name = "lui-load-fusion",
640 .description = "Enable LUI + load macrofusion",
641 .dependencies = featureSet(&[_]Feature{}),
642 };
676643 result[@intFromEnum(Feature.m)] = .{
677644 .llvm_name = "m",
678645 .description = "'M' (Integer Multiplication and Division)",
......@@ -740,6 +707,11 @@ pub const all_features = blk: {
740707 .description = "Optimized (perform fewer memory operations)zero-stride vector load",
741708 .dependencies = featureSet(&[_]Feature{}),
742709 };
710 result[@intFromEnum(Feature.permissive_zalrsc)] = .{
711 .llvm_name = "permissive-zalrsc",
712 .description = "Implementation permits non-base instructions between LR/SC pairs",
713 .dependencies = featureSet(&[_]Feature{}),
714 };
743715 result[@intFromEnum(Feature.predictable_select_expensive)] = .{
744716 .llvm_name = "predictable-select-expensive",
745717 .description = "Prefer likely predicted branches over selects",
......@@ -1262,11 +1234,32 @@ pub const all_features = blk: {
12621234 .description = "'Shlcofideleg' (Delegating LCOFI Interrupts to VS-mode)",
12631235 .dependencies = featureSet(&[_]Feature{}),
12641236 };
1265 result[@intFromEnum(Feature.short_forward_branch_opt)] = .{
1266 .llvm_name = "short-forward-branch-opt",
1267 .description = "Enable short forward branch optimization",
1237 result[@intFromEnum(Feature.short_forward_branch_ialu)] = .{
1238 .llvm_name = "short-forward-branch-ialu",
1239 .description = "Enable short forward branch optimization for RVI base instructions",
12681240 .dependencies = featureSet(&[_]Feature{}),
12691241 };
1242 result[@intFromEnum(Feature.short_forward_branch_iload)] = .{
1243 .llvm_name = "short-forward-branch-iload",
1244 .description = "Enable short forward branch optimization for load instructions",
1245 .dependencies = featureSet(&[_]Feature{
1246 .short_forward_branch_ialu,
1247 }),
1248 };
1249 result[@intFromEnum(Feature.short_forward_branch_iminmax)] = .{
1250 .llvm_name = "short-forward-branch-iminmax",
1251 .description = "Enable short forward branch optimization for MIN,MAX instructions in Zbb",
1252 .dependencies = featureSet(&[_]Feature{
1253 .short_forward_branch_ialu,
1254 }),
1255 };
1256 result[@intFromEnum(Feature.short_forward_branch_imul)] = .{
1257 .llvm_name = "short-forward-branch-imul",
1258 .description = "Enable short forward branch optimization for MUL instruction",
1259 .dependencies = featureSet(&[_]Feature{
1260 .short_forward_branch_ialu,
1261 }),
1262 };
12701263 result[@intFromEnum(Feature.shtvala)] = .{
12711264 .llvm_name = "shtvala",
12721265 .description = "'Shtvala' (htval provides all needed values)",
......@@ -1287,6 +1280,16 @@ pub const all_features = blk: {
12871280 .description = "'Shvstvecd' (vstvec supports Direct mode)",
12881281 .dependencies = featureSet(&[_]Feature{}),
12891282 };
1283 result[@intFromEnum(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 };
1288 result[@intFromEnum(Feature.single_element_vec_fp64)] = .{
1289 .llvm_name = "single-element-vec-fp64",
1290 .description = "Certain vector FP64 operations produce a single result element per cycle",
1291 .dependencies = featureSet(&[_]Feature{}),
1292 };
12901293 result[@intFromEnum(Feature.smaia)] = .{
12911294 .llvm_name = "smaia",
12921295 .description = "'Smaia' (Advanced Interrupt Architecture Machine Level)",
......@@ -1307,6 +1310,13 @@ pub const all_features = blk: {
13071310 .description = "'Smcsrind' (Indirect CSR Access Machine Level)",
13081311 .dependencies = featureSet(&[_]Feature{}),
13091312 };
1313 result[@intFromEnum(Feature.smctr)] = .{
1314 .llvm_name = "smctr",
1315 .description = "'Smctr' (Control Transfer Records Machine Level)",
1316 .dependencies = featureSet(&[_]Feature{
1317 .sscsrind,
1318 }),
1319 };
13101320 result[@intFromEnum(Feature.smdbltrp)] = .{
13111321 .llvm_name = "smdbltrp",
13121322 .description = "'Smdbltrp' (Double Trap Machine Level)",
......@@ -1369,6 +1379,13 @@ pub const all_features = blk: {
13691379 .description = "'Sscsrind' (Indirect CSR Access Supervisor Level)",
13701380 .dependencies = featureSet(&[_]Feature{}),
13711381 };
1382 result[@intFromEnum(Feature.ssctr)] = .{
1383 .llvm_name = "ssctr",
1384 .description = "'Ssctr' (Control Transfer Records Supervisor Level)",
1385 .dependencies = featureSet(&[_]Feature{
1386 .sscsrind,
1387 }),
1388 };
13721389 result[@intFromEnum(Feature.ssdbltrp)] = .{
13731390 .llvm_name = "ssdbltrp",
13741391 .description = "'Ssdbltrp' (Double Trap Supervisor Level)",
......@@ -1537,6 +1554,13 @@ pub const all_features = blk: {
15371554 .f,
15381555 }),
15391556 };
1557 result[@intFromEnum(Feature.xandesvsinth)] = .{
1558 .llvm_name = "xandesvsinth",
1559 .description = "'XAndesVSIntH' (Andes Vector Small INT Handling Extension)",
1560 .dependencies = featureSet(&[_]Feature{
1561 .zve32x,
1562 }),
1563 };
15401564 result[@intFromEnum(Feature.xandesvsintload)] = .{
15411565 .llvm_name = "xandesvsintload",
15421566 .description = "'XAndesVSIntLoad' (Andes Vector INT4 Load Extension)",
......@@ -1589,11 +1613,159 @@ pub const all_features = blk: {
15891613 .description = "'XMIPSCMov' (MIPS conditional move instruction (mips.ccmov))",
15901614 .dependencies = featureSet(&[_]Feature{}),
15911615 };
1616 result[@intFromEnum(Feature.xmipsexectl)] = .{
1617 .llvm_name = "xmipsexectl",
1618 .description = "'XMIPSEXECTL' (MIPS execution control)",
1619 .dependencies = featureSet(&[_]Feature{}),
1620 };
15921621 result[@intFromEnum(Feature.xmipslsp)] = .{
15931622 .llvm_name = "xmipslsp",
15941623 .description = "'XMIPSLSP' (MIPS optimization for hardware load-store bonding)",
15951624 .dependencies = featureSet(&[_]Feature{}),
15961625 };
1626 result[@intFromEnum(Feature.xqccmp)] = .{
1627 .llvm_name = "xqccmp",
1628 .description = "'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves)",
1629 .dependencies = featureSet(&[_]Feature{
1630 .zca,
1631 }),
1632 };
1633 result[@intFromEnum(Feature.xqci)] = .{
1634 .llvm_name = "xqci",
1635 .description = "'Xqci' (Qualcomm uC Extension)",
1636 .dependencies = featureSet(&[_]Feature{
1637 .xqcia,
1638 .xqciac,
1639 .xqcibi,
1640 .xqcibm,
1641 .xqcicli,
1642 .xqcicm,
1643 .xqcics,
1644 .xqcicsr,
1645 .xqciint,
1646 .xqciio,
1647 .xqcilb,
1648 .xqcili,
1649 .xqcilia,
1650 .xqcilo,
1651 .xqcilsm,
1652 .xqcisim,
1653 .xqcisls,
1654 .xqcisync,
1655 }),
1656 };
1657 result[@intFromEnum(Feature.xqcia)] = .{
1658 .llvm_name = "xqcia",
1659 .description = "'Xqcia' (Qualcomm uC Arithmetic Extension)",
1660 .dependencies = featureSet(&[_]Feature{}),
1661 };
1662 result[@intFromEnum(Feature.xqciac)] = .{
1663 .llvm_name = "xqciac",
1664 .description = "'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)",
1665 .dependencies = featureSet(&[_]Feature{
1666 .zca,
1667 }),
1668 };
1669 result[@intFromEnum(Feature.xqcibi)] = .{
1670 .llvm_name = "xqcibi",
1671 .description = "'Xqcibi' (Qualcomm uC Branch Immediate Extension)",
1672 .dependencies = featureSet(&[_]Feature{
1673 .zca,
1674 }),
1675 };
1676 result[@intFromEnum(Feature.xqcibm)] = .{
1677 .llvm_name = "xqcibm",
1678 .description = "'Xqcibm' (Qualcomm uC Bit Manipulation Extension)",
1679 .dependencies = featureSet(&[_]Feature{
1680 .zca,
1681 }),
1682 };
1683 result[@intFromEnum(Feature.xqcicli)] = .{
1684 .llvm_name = "xqcicli",
1685 .description = "'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)",
1686 .dependencies = featureSet(&[_]Feature{}),
1687 };
1688 result[@intFromEnum(Feature.xqcicm)] = .{
1689 .llvm_name = "xqcicm",
1690 .description = "'Xqcicm' (Qualcomm uC Conditional Move Extension)",
1691 .dependencies = featureSet(&[_]Feature{
1692 .zca,
1693 }),
1694 };
1695 result[@intFromEnum(Feature.xqcics)] = .{
1696 .llvm_name = "xqcics",
1697 .description = "'Xqcics' (Qualcomm uC Conditional Select Extension)",
1698 .dependencies = featureSet(&[_]Feature{}),
1699 };
1700 result[@intFromEnum(Feature.xqcicsr)] = .{
1701 .llvm_name = "xqcicsr",
1702 .description = "'Xqcicsr' (Qualcomm uC CSR Extension)",
1703 .dependencies = featureSet(&[_]Feature{}),
1704 };
1705 result[@intFromEnum(Feature.xqciint)] = .{
1706 .llvm_name = "xqciint",
1707 .description = "'Xqciint' (Qualcomm uC Interrupts Extension)",
1708 .dependencies = featureSet(&[_]Feature{
1709 .zca,
1710 }),
1711 };
1712 result[@intFromEnum(Feature.xqciio)] = .{
1713 .llvm_name = "xqciio",
1714 .description = "'Xqciio' (Qualcomm uC External Input Output Extension)",
1715 .dependencies = featureSet(&[_]Feature{}),
1716 };
1717 result[@intFromEnum(Feature.xqcilb)] = .{
1718 .llvm_name = "xqcilb",
1719 .description = "'Xqcilb' (Qualcomm uC Long Branch Extension)",
1720 .dependencies = featureSet(&[_]Feature{
1721 .zca,
1722 }),
1723 };
1724 result[@intFromEnum(Feature.xqcili)] = .{
1725 .llvm_name = "xqcili",
1726 .description = "'Xqcili' (Qualcomm uC Load Large Immediate Extension)",
1727 .dependencies = featureSet(&[_]Feature{
1728 .zca,
1729 }),
1730 };
1731 result[@intFromEnum(Feature.xqcilia)] = .{
1732 .llvm_name = "xqcilia",
1733 .description = "'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)",
1734 .dependencies = featureSet(&[_]Feature{
1735 .zca,
1736 }),
1737 };
1738 result[@intFromEnum(Feature.xqcilo)] = .{
1739 .llvm_name = "xqcilo",
1740 .description = "'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)",
1741 .dependencies = featureSet(&[_]Feature{
1742 .zca,
1743 }),
1744 };
1745 result[@intFromEnum(Feature.xqcilsm)] = .{
1746 .llvm_name = "xqcilsm",
1747 .description = "'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)",
1748 .dependencies = featureSet(&[_]Feature{}),
1749 };
1750 result[@intFromEnum(Feature.xqcisim)] = .{
1751 .llvm_name = "xqcisim",
1752 .description = "'Xqcisim' (Qualcomm uC Simulation Hint Extension)",
1753 .dependencies = featureSet(&[_]Feature{
1754 .zca,
1755 }),
1756 };
1757 result[@intFromEnum(Feature.xqcisls)] = .{
1758 .llvm_name = "xqcisls",
1759 .description = "'Xqcisls' (Qualcomm uC Scaled Load Store Extension)",
1760 .dependencies = featureSet(&[_]Feature{}),
1761 };
1762 result[@intFromEnum(Feature.xqcisync)] = .{
1763 .llvm_name = "xqcisync",
1764 .description = "'Xqcisync' (Qualcomm uC Sync Delay Extension)",
1765 .dependencies = featureSet(&[_]Feature{
1766 .zca,
1767 }),
1768 };
15971769 result[@intFromEnum(Feature.xsfcease)] = .{
15981770 .llvm_name = "xsfcease",
15991771 .description = "'XSfcease' (SiFive sf.cease Instruction)",
......@@ -1684,6 +1856,40 @@ pub const all_features = blk: {
16841856 .zve32x,
16851857 }),
16861858 };
1859 result[@intFromEnum(Feature.xsfvfbfexp16e)] = .{
1860 .llvm_name = "xsfvfbfexp16e",
1861 .description = "'XSfvfbfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, BFloat16)",
1862 .dependencies = featureSet(&[_]Feature{}),
1863 };
1864 result[@intFromEnum(Feature.xsfvfexp16e)] = .{
1865 .llvm_name = "xsfvfexp16e",
1866 .description = "'XSfvfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, Half Precision)",
1867 .dependencies = featureSet(&[_]Feature{
1868 .zvfh,
1869 }),
1870 };
1871 result[@intFromEnum(Feature.xsfvfexp32e)] = .{
1872 .llvm_name = "xsfvfexp32e",
1873 .description = "'XSfvfexp32e' (SiFive Vector Floating-Point Exponential Function Instruction, Single Precision)",
1874 .dependencies = featureSet(&[_]Feature{
1875 .zve32f,
1876 }),
1877 };
1878 result[@intFromEnum(Feature.xsfvfexpa)] = .{
1879 .llvm_name = "xsfvfexpa",
1880 .description = "'XSfvfexpa' (SiFive Vector Floating-Point Exponential Approximation Instruction)",
1881 .dependencies = featureSet(&[_]Feature{
1882 .zve32f,
1883 }),
1884 };
1885 result[@intFromEnum(Feature.xsfvfexpa64e)] = .{
1886 .llvm_name = "xsfvfexpa64e",
1887 .description = "'XSfvfexpa64e' (SiFive Vector Floating-Point Exponential Approximation Instruction with Double-Precision)",
1888 .dependencies = featureSet(&[_]Feature{
1889 .xsfvfexpa,
1890 .zve64d,
1891 }),
1892 };
16871893 result[@intFromEnum(Feature.xsfvfnrclipxfqf)] = .{
16881894 .llvm_name = "xsfvfnrclipxfqf",
16891895 .description = "'XSfvfnrclipxfqf' (SiFive FP32-to-int8 Ranged Clip Instructions)",
......@@ -1696,6 +1902,7 @@ pub const all_features = blk: {
16961902 .description = "'XSfvfwmaccqqq' (SiFive Matrix Multiply Accumulate Instruction (4-by-4))",
16971903 .dependencies = featureSet(&[_]Feature{
16981904 .zvfbfmin,
1905 .zvl128b,
16991906 }),
17001907 };
17011908 result[@intFromEnum(Feature.xsfvqmaccdod)] = .{
......@@ -1703,6 +1910,7 @@ pub const all_features = blk: {
17031910 .description = "'XSfvqmaccdod' (SiFive Int8 Matrix Multiplication Instructions (2-by-8 and 8-by-2))",
17041911 .dependencies = featureSet(&[_]Feature{
17051912 .zve32x,
1913 .zvl128b,
17061914 }),
17071915 };
17081916 result[@intFromEnum(Feature.xsfvqmaccqoq)] = .{
......@@ -1710,6 +1918,7 @@ pub const all_features = blk: {
17101918 .description = "'XSfvqmaccqoq' (SiFive Int8 Matrix Multiplication Instructions (4-by-8 and 8-by-4))",
17111919 .dependencies = featureSet(&[_]Feature{
17121920 .zve32x,
1921 .zvl256b,
17131922 }),
17141923 };
17151924 result[@intFromEnum(Feature.xsifivecdiscarddlone)] = .{
......@@ -1722,6 +1931,13 @@ pub const all_features = blk: {
17221931 .description = "'XSiFivecflushdlone' (SiFive sf.cflush.d.l1 Instruction)",
17231932 .dependencies = featureSet(&[_]Feature{}),
17241933 };
1934 result[@intFromEnum(Feature.xsmtvdot)] = .{
1935 .llvm_name = "xsmtvdot",
1936 .description = "'XSMTVDot' (SpacemiT Vector Dot Product Extension)",
1937 .dependencies = featureSet(&[_]Feature{
1938 .zve32f,
1939 }),
1940 };
17251941 result[@intFromEnum(Feature.xtheadba)] = .{
17261942 .llvm_name = "xtheadba",
17271943 .description = "'XTHeadBa' (T-Head address calculation instructions)",
......@@ -1820,6 +2036,11 @@ pub const all_features = blk: {
18202036 .zaamo,
18212037 }),
18222038 };
2039 result[@intFromEnum(Feature.zalasr)] = .{
2040 .llvm_name = "zalasr",
2041 .description = "'Zalasr' (Load-Acquire and Store-Release Instructions)",
2042 .dependencies = featureSet(&[_]Feature{}),
2043 };
18232044 result[@intFromEnum(Feature.zalrsc)] = .{
18242045 .llvm_name = "zalrsc",
18252046 .description = "'Zalrsc' (Load-Reserved/Store-Conditional)",
......@@ -2092,6 +2313,11 @@ pub const all_features = blk: {
20922313 .description = "'Zilsd' (Load/Store Pair Instructions)",
20932314 .dependencies = featureSet(&[_]Feature{}),
20942315 };
2316 result[@intFromEnum(Feature.zilsd_4byte_align)] = .{
2317 .llvm_name = "zilsd-4byte-align",
2318 .description = "Allow 4-byte alignment for Zilsd LD/SD instructions",
2319 .dependencies = featureSet(&[_]Feature{}),
2320 };
20952321 result[@intFromEnum(Feature.zimop)] = .{
20962322 .llvm_name = "zimop",
20972323 .description = "'Zimop' (May-Be-Operations)",
......@@ -2461,7 +2687,7 @@ pub const cpu = struct {
24612687 .features = featureSet(&[_]Feature{
24622688 .andes45,
24632689 .no_default_unroll,
2464 .short_forward_branch_opt,
2690 .short_forward_branch_ialu,
24652691 .use_postra_scheduler,
24662692 }),
24672693 };
......@@ -2491,7 +2717,7 @@ pub const cpu = struct {
24912717 .i,
24922718 .m,
24932719 .no_default_unroll,
2494 .short_forward_branch_opt,
2720 .short_forward_branch_ialu,
24952721 .use_postra_scheduler,
24962722 .xandesperf,
24972723 .zifencei,
......@@ -2523,7 +2749,7 @@ pub const cpu = struct {
25232749 .i,
25242750 .m,
25252751 .no_default_unroll,
2526 .short_forward_branch_opt,
2752 .short_forward_branch_ialu,
25272753 .use_postra_scheduler,
25282754 .xandesperf,
25292755 .zifencei,
......@@ -2540,7 +2766,7 @@ pub const cpu = struct {
25402766 .i,
25412767 .m,
25422768 .no_default_unroll,
2543 .short_forward_branch_opt,
2769 .short_forward_branch_ialu,
25442770 .use_postra_scheduler,
25452771 .v,
25462772 .xandesperf,
......@@ -2559,7 +2785,7 @@ pub const cpu = struct {
25592785 .i,
25602786 .m,
25612787 .no_default_unroll,
2562 .short_forward_branch_opt,
2788 .short_forward_branch_ialu,
25632789 .use_postra_scheduler,
25642790 .xandesperf,
25652791 .zifencei,
......@@ -2577,7 +2803,7 @@ pub const cpu = struct {
25772803 .i,
25782804 .m,
25792805 .no_default_unroll,
2580 .short_forward_branch_opt,
2806 .short_forward_branch_ialu,
25812807 .use_postra_scheduler,
25822808 .xandesperf,
25832809 .zifencei,
......@@ -2648,6 +2874,7 @@ pub const cpu = struct {
26482874 .mips_p8700,
26492875 .xmipscbop,
26502876 .xmipscmov,
2877 .xmipsexectl,
26512878 .xmipslsp,
26522879 .zba,
26532880 .zbb,
......@@ -2703,7 +2930,7 @@ pub const cpu = struct {
27032930 .llvm_name = "sifive-7-series",
27042931 .features = featureSet(&[_]Feature{
27052932 .no_default_unroll,
2706 .short_forward_branch_opt,
2933 .short_forward_branch_ialu,
27072934 .use_postra_scheduler,
27082935 }),
27092936 };
......@@ -2782,7 +3009,7 @@ pub const cpu = struct {
27823009 .i,
27833010 .m,
27843011 .no_default_unroll,
2785 .short_forward_branch_opt,
3012 .short_forward_branch_ialu,
27863013 .use_postra_scheduler,
27873014 .zifencei,
27883015 }),
......@@ -2815,7 +3042,6 @@ pub const cpu = struct {
28153042 .ziccif,
28163043 .zicclsm,
28173044 .ziccrse,
2818 .zicntr,
28193045 .zifencei,
28203046 .zihintntl,
28213047 .zihintpause,
......@@ -2855,7 +3081,6 @@ pub const cpu = struct {
28553081 .ziccif,
28563082 .zicclsm,
28573083 .ziccrse,
2858 .zicntr,
28593084 .zifencei,
28603085 .zihintntl,
28613086 .zihintpause,
......@@ -2918,7 +3143,6 @@ pub const cpu = struct {
29183143 .ziccif,
29193144 .zicclsm,
29203145 .ziccrse,
2921 .zicntr,
29223146 .zifencei,
29233147 .zihintntl,
29243148 .zihintpause,
......@@ -3035,7 +3259,7 @@ pub const cpu = struct {
30353259 .i,
30363260 .m,
30373261 .no_default_unroll,
3038 .short_forward_branch_opt,
3262 .short_forward_branch_ialu,
30393263 .use_postra_scheduler,
30403264 .zifencei,
30413265 .zihintpause,
......@@ -3065,7 +3289,7 @@ pub const cpu = struct {
30653289 .i,
30663290 .m,
30673291 .no_default_unroll,
3068 .short_forward_branch_opt,
3292 .short_forward_branch_ialu,
30693293 .use_postra_scheduler,
30703294 .zifencei,
30713295 }),
......@@ -3083,7 +3307,7 @@ pub const cpu = struct {
30833307 .no_default_unroll,
30843308 .optimized_nf2_segment_load_store,
30853309 .optimized_zero_stride_load,
3086 .short_forward_branch_opt,
3310 .short_forward_branch_ialu,
30873311 .use_postra_scheduler,
30883312 .v,
30893313 .vl_dependent_latency,
......@@ -3111,7 +3335,8 @@ pub const cpu = struct {
31113335 .no_default_unroll,
31123336 .optimized_nf2_segment_load_store,
31133337 .optimized_zero_stride_load,
3114 .short_forward_branch_opt,
3338 .short_forward_branch_ialu,
3339 .single_element_vec_fp64,
31153340 .use_postra_scheduler,
31163341 .v,
31173342 .vl_dependent_latency,
......@@ -3173,6 +3398,7 @@ pub const cpu = struct {
31733398 .unaligned_scalar_mem,
31743399 .v,
31753400 .vxrm_pipeline_flush,
3401 .xsmtvdot,
31763402 .za64rs,
31773403 .zbc,
31783404 .zbkc,
......@@ -3341,6 +3567,13 @@ pub const cpu = struct {
33413567 .log_vrgather,
33423568 .m,
33433569 .no_default_unroll,
3570 .optimized_nf2_segment_load_store,
3571 .optimized_nf3_segment_load_store,
3572 .optimized_nf4_segment_load_store,
3573 .optimized_nf5_segment_load_store,
3574 .optimized_nf6_segment_load_store,
3575 .optimized_nf7_segment_load_store,
3576 .optimized_nf8_segment_load_store,
33443577 .optimized_zero_stride_load,
33453578 .sha,
33463579 .smaia,
......@@ -3400,12 +3633,17 @@ pub const cpu = struct {
34003633 .features = featureSet(&[_]Feature{
34013634 .@"64bit",
34023635 .a,
3636 .add_load_fusion,
34033637 .auipc_addi_fusion,
3638 .auipc_load_fusion,
34043639 .c,
34053640 .d,
3641 .disable_misched_load_clustering,
3642 .disable_postmisched_load_clustering,
3643 .disable_postmisched_store_clustering,
34063644 .i,
3407 .ld_add_fusion,
34083645 .lui_addi_fusion,
3646 .lui_load_fusion,
34093647 .m,
34103648 .shifted_zextw_fusion,
34113649 .ventana_veyron,
lib/std/Target/sparc.zig+17
......@@ -5,6 +5,7 @@ const CpuFeature = std.Target.Cpu.Feature;
55const CpuModel = std.Target.Cpu.Model;
66
77pub const Feature = enum {
8 @"64bit",
89 crypto,
910 deprecated_v8,
1011 detectroundchange,
......@@ -23,6 +24,7 @@ pub const Feature = enum {
2324 leonpwrpsr,
2425 no_fmuls,
2526 no_fsmuld,
27 no_predictor,
2628 osa2011,
2729 popc,
2830 reserve_g1,
......@@ -73,6 +75,13 @@ pub const all_features = blk: {
7375 const len = @typeInfo(Feature).@"enum".fields.len;
7476 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
7577 var result: [len]CpuFeature = undefined;
78 result[@intFromEnum(Feature.@"64bit")] = .{
79 .llvm_name = "64bit",
80 .description = "Enable 64-bit mode",
81 .dependencies = featureSet(&[_]Feature{
82 .v9,
83 }),
84 };
7685 result[@intFromEnum(Feature.crypto)] = .{
7786 .llvm_name = "crypto",
7887 .description = "Enable cryptographic extensions",
......@@ -165,6 +174,11 @@ pub const all_features = blk: {
165174 .description = "Disable the fsmuld instruction.",
166175 .dependencies = featureSet(&[_]Feature{}),
167176 };
177 result[@intFromEnum(Feature.no_predictor)] = .{
178 .llvm_name = "no-predictor",
179 .description = "Processor has no branch predictor, branches stall execution",
180 .dependencies = featureSet(&[_]Feature{}),
181 };
168182 result[@intFromEnum(Feature.osa2011)] = .{
169183 .llvm_name = "osa2011",
170184 .description = "Enable Oracle SPARC Architecture 2011 extensions",
......@@ -586,6 +600,7 @@ pub const cpu = struct {
586600 .llvm_name = "niagara",
587601 .features = featureSet(&[_]Feature{
588602 .deprecated_v8,
603 .no_predictor,
589604 .ua2005,
590605 }),
591606 };
......@@ -594,6 +609,7 @@ pub const cpu = struct {
594609 .llvm_name = "niagara2",
595610 .features = featureSet(&[_]Feature{
596611 .deprecated_v8,
612 .no_predictor,
597613 .popc,
598614 .ua2005,
599615 }),
......@@ -603,6 +619,7 @@ pub const cpu = struct {
603619 .llvm_name = "niagara3",
604620 .features = featureSet(&[_]Feature{
605621 .deprecated_v8,
622 .no_predictor,
606623 .popc,
607624 .ua2005,
608625 .ua2007,
lib/std/Target/wasm.zig+7
......@@ -12,6 +12,7 @@ pub const Feature = enum {
1212 exception_handling,
1313 extended_const,
1414 fp16,
15 gc,
1516 multimemory,
1617 multivalue,
1718 mutable_globals,
......@@ -71,6 +72,11 @@ pub const all_features = blk: {
7172 .description = "Enable FP16 instructions",
7273 .dependencies = featureSet(&[_]Feature{}),
7374 };
75 result[@intFromEnum(Feature.gc)] = .{
76 .llvm_name = "gc",
77 .description = "Enable wasm gc",
78 .dependencies = featureSet(&[_]Feature{}),
79 };
7480 result[@intFromEnum(Feature.multimemory)] = .{
7581 .llvm_name = "multimemory",
7682 .description = "Enable multiple memories",
......@@ -148,6 +154,7 @@ pub const cpu = struct {
148154 .exception_handling,
149155 .extended_const,
150156 .fp16,
157 .gc,
151158 .multimemory,
152159 .multivalue,
153160 .mutable_globals,
lib/std/Target/x86.zig+200-31
......@@ -22,7 +22,6 @@ pub const Feature = enum {
2222 amx_movrs,
2323 amx_tf32,
2424 amx_tile,
25 amx_transpose,
2625 avx,
2726 avx10_1,
2827 avx10_2,
......@@ -67,7 +66,6 @@ pub const Feature = enum {
6766 egpr,
6867 enqcmd,
6968 ermsb,
70 evex512,
7169 f16c,
7270 false_deps_getmant,
7371 false_deps_lzcnt_tzcnt,
......@@ -136,6 +134,7 @@ pub const Feature = enum {
136134 ppx,
137135 prefer_128_bit,
138136 prefer_256_bit,
137 prefer_legacy_setcc,
139138 prefer_mask_registers,
140139 prefer_movmsk_over_vtest,
141140 prefer_no_gather,
......@@ -168,6 +167,7 @@ pub const Feature = enum {
168167 slow_lea,
169168 slow_pmaddwd,
170169 slow_pmulld,
170 slow_pmullq,
171171 slow_shld,
172172 slow_two_mem_ops,
173173 slow_unaligned_mem_16,
......@@ -199,6 +199,7 @@ pub const Feature = enum {
199199 waitpkg,
200200 wbnoinvd,
201201 widekl,
202 x32,
202203 x87,
203204 xop,
204205 xsave,
......@@ -324,13 +325,6 @@ pub const all_features = blk: {
324325 .description = "Support AMX-TILE instructions",
325326 .dependencies = featureSet(&[_]Feature{}),
326327 };
327 result[@intFromEnum(Feature.amx_transpose)] = .{
328 .llvm_name = "amx-transpose",
329 .description = "Support AMX amx-transpose instructions",
330 .dependencies = featureSet(&[_]Feature{
331 .amx_tile,
332 }),
333 };
334328 result[@intFromEnum(Feature.avx)] = .{
335329 .llvm_name = "avx",
336330 .description = "Enable AVX instructions",
......@@ -339,8 +333,8 @@ pub const all_features = blk: {
339333 }),
340334 };
341335 result[@intFromEnum(Feature.avx10_1)] = .{
342 .llvm_name = "avx10.1-512",
343 .description = "Support AVX10.1 up to 512-bit instruction",
336 .llvm_name = "avx10.1",
337 .description = "Support AVX10.1 instruction",
344338 .dependencies = featureSet(&[_]Feature{
345339 .avx512bf16,
346340 .avx512bitalg,
......@@ -356,8 +350,8 @@ pub const all_features = blk: {
356350 }),
357351 };
358352 result[@intFromEnum(Feature.avx10_2)] = .{
359 .llvm_name = "avx10.2-512",
360 .description = "Support AVX10.2 up to 512-bit instruction",
353 .llvm_name = "avx10.2",
354 .description = "Support AVX10.2 instruction",
361355 .dependencies = featureSet(&[_]Feature{
362356 .avx10_1,
363357 }),
......@@ -416,7 +410,6 @@ pub const all_features = blk: {
416410 .description = "Enable AVX-512 instructions",
417411 .dependencies = featureSet(&[_]Feature{
418412 .avx2,
419 .evex512,
420413 .f16c,
421414 .fma,
422415 }),
......@@ -616,11 +609,6 @@ pub const all_features = blk: {
616609 .description = "REP MOVS/STOS are fast",
617610 .dependencies = featureSet(&[_]Feature{}),
618611 };
619 result[@intFromEnum(Feature.evex512)] = .{
620 .llvm_name = "evex512",
621 .description = "Support ZMM and 64-bit mask instructions",
622 .dependencies = featureSet(&[_]Feature{}),
623 };
624612 result[@intFromEnum(Feature.f16c)] = .{
625613 .llvm_name = "f16c",
626614 .description = "Support 16-bit floating point conversion instructions",
......@@ -974,6 +962,11 @@ pub const all_features = blk: {
974962 .description = "Prefer 256-bit AVX instructions",
975963 .dependencies = featureSet(&[_]Feature{}),
976964 };
965 result[@intFromEnum(Feature.prefer_legacy_setcc)] = .{
966 .llvm_name = "prefer-legacy-setcc",
967 .description = "Prefer to emit legacy SetCC.",
968 .dependencies = featureSet(&[_]Feature{}),
969 };
977970 result[@intFromEnum(Feature.prefer_mask_registers)] = .{
978971 .llvm_name = "prefer-mask-registers",
979972 .description = "Prefer AVX512 mask registers over PTEST/MOVMSK",
......@@ -1145,6 +1138,11 @@ pub const all_features = blk: {
11451138 .description = "PMULLD instruction is slow (compared to PMULLW/PMULHW and PMULUDQ)",
11461139 .dependencies = featureSet(&[_]Feature{}),
11471140 };
1141 result[@intFromEnum(Feature.slow_pmullq)] = .{
1142 .llvm_name = "slow-pmullq",
1143 .description = "PMULLQ instruction is slow",
1144 .dependencies = featureSet(&[_]Feature{}),
1145 };
11481146 result[@intFromEnum(Feature.slow_shld)] = .{
11491147 .llvm_name = "slow-shld",
11501148 .description = "SHLD instruction is slow",
......@@ -1325,6 +1323,11 @@ pub const all_features = blk: {
13251323 .kl,
13261324 }),
13271325 };
1326 result[@intFromEnum(Feature.x32)] = .{
1327 .llvm_name = "x32",
1328 .description = "64-bit with ILP32 programming model (e.g. x32 ABI)",
1329 .dependencies = featureSet(&[_]Feature{}),
1330 };
13281331 result[@intFromEnum(Feature.x87)] = .{
13291332 .llvm_name = "x87",
13301333 .description = "Enable X87 float instructions",
......@@ -1393,7 +1396,6 @@ pub const cpu = struct {
13931396 .cx16,
13941397 .f16c,
13951398 .false_deps_perm,
1396 .false_deps_popcnt,
13971399 .fast_15bytenop,
13981400 .fast_gather,
13991401 .fast_scalar_fsqrt,
......@@ -1432,6 +1434,7 @@ pub const cpu = struct {
14321434 .sha,
14331435 .shstk,
14341436 .slow_3ops_lea,
1437 .slow_pmullq,
14351438 .smap,
14361439 .smep,
14371440 .tuning_fast_imm_vector_shift,
......@@ -1490,7 +1493,6 @@ pub const cpu = struct {
14901493 .enqcmd,
14911494 .f16c,
14921495 .false_deps_perm,
1493 .false_deps_popcnt,
14941496 .fast_15bytenop,
14951497 .fast_gather,
14961498 .fast_scalar_fsqrt,
......@@ -1529,6 +1531,7 @@ pub const cpu = struct {
15291531 .sha,
15301532 .shstk,
15311533 .slow_3ops_lea,
1534 .slow_pmullq,
15321535 .smap,
15331536 .smep,
15341537 .tuning_fast_imm_vector_shift,
......@@ -1566,7 +1569,6 @@ pub const cpu = struct {
15661569 .enqcmd,
15671570 .f16c,
15681571 .false_deps_perm,
1569 .false_deps_popcnt,
15701572 .fast_15bytenop,
15711573 .fast_gather,
15721574 .fast_scalar_fsqrt,
......@@ -1606,6 +1608,7 @@ pub const cpu = struct {
16061608 .sha512,
16071609 .shstk,
16081610 .slow_3ops_lea,
1611 .slow_pmullq,
16091612 .sm3,
16101613 .sm4,
16111614 .smap,
......@@ -2204,6 +2207,7 @@ pub const cpu = struct {
22042207 .sahf,
22052208 .sha,
22062209 .slow_3ops_lea,
2210 .slow_pmullq,
22072211 .smap,
22082212 .smep,
22092213 .tuning_fast_imm_vector_shift,
......@@ -2297,7 +2301,6 @@ pub const cpu = struct {
22972301 .enqcmd,
22982302 .f16c,
22992303 .false_deps_perm,
2300 .false_deps_popcnt,
23012304 .fast_15bytenop,
23022305 .fast_gather,
23032306 .fast_scalar_fsqrt,
......@@ -2338,6 +2341,7 @@ pub const cpu = struct {
23382341 .sha512,
23392342 .shstk,
23402343 .slow_3ops_lea,
2344 .slow_pmullq,
23412345 .sm3,
23422346 .sm4,
23432347 .tuning_fast_imm_vector_shift,
......@@ -2464,7 +2468,6 @@ pub const cpu = struct {
24642468 .amx_int8,
24652469 .amx_movrs,
24662470 .amx_tf32,
2467 .amx_transpose,
24682471 .avx10_2,
24692472 .avxifma,
24702473 .avxneconvert,
......@@ -2475,7 +2478,6 @@ pub const cpu = struct {
24752478 .bmi2,
24762479 .branch_hint,
24772480 .ccmp,
2478 .cf,
24792481 .cldemote,
24802482 .clflushopt,
24812483 .clwb,
......@@ -2533,12 +2535,12 @@ pub const cpu = struct {
25332535 .sha,
25342536 .sha512,
25352537 .shstk,
2538 .slow_pmullq,
25362539 .sm3,
25372540 .sm4,
25382541 .tsxldtrk,
25392542 .tuning_fast_imm_vector_shift,
25402543 .uintr,
2541 .usermsr,
25422544 .vaes,
25432545 .vpclmulqdq,
25442546 .vzeroupper,
......@@ -2622,6 +2624,7 @@ pub const cpu = struct {
26222624 .serialize,
26232625 .sha,
26242626 .shstk,
2627 .slow_pmullq,
26252628 .smap,
26262629 .smep,
26272630 .tsxldtrk,
......@@ -2935,6 +2938,7 @@ pub const cpu = struct {
29352938 .serialize,
29362939 .sha,
29372940 .shstk,
2941 .slow_pmullq,
29382942 .tsxldtrk,
29392943 .tuning_fast_imm_vector_shift,
29402944 .uintr,
......@@ -3024,6 +3028,7 @@ pub const cpu = struct {
30243028 .serialize,
30253029 .sha,
30263030 .shstk,
3031 .slow_pmullq,
30273032 .tsxldtrk,
30283033 .tuning_fast_imm_vector_shift,
30293034 .uintr,
......@@ -3181,6 +3186,7 @@ pub const cpu = struct {
31813186 .rdseed,
31823187 .sahf,
31833188 .sha,
3189 .slow_pmullq,
31843190 .tuning_fast_imm_vector_shift,
31853191 .vaes,
31863192 .vpclmulqdq,
......@@ -3245,6 +3251,7 @@ pub const cpu = struct {
32453251 .rdseed,
32463252 .sahf,
32473253 .sha,
3254 .slow_pmullq,
32483255 .tuning_fast_imm_vector_shift,
32493256 .vaes,
32503257 .vpclmulqdq,
......@@ -3475,7 +3482,6 @@ pub const cpu = struct {
34753482 .enqcmd,
34763483 .f16c,
34773484 .false_deps_perm,
3478 .false_deps_popcnt,
34793485 .fast_15bytenop,
34803486 .fast_gather,
34813487 .fast_scalar_fsqrt,
......@@ -3515,6 +3521,7 @@ pub const cpu = struct {
35153521 .sha512,
35163522 .shstk,
35173523 .slow_3ops_lea,
3524 .slow_pmullq,
35183525 .sm3,
35193526 .sm4,
35203527 .tuning_fast_imm_vector_shift,
......@@ -3546,7 +3553,6 @@ pub const cpu = struct {
35463553 .cx16,
35473554 .f16c,
35483555 .false_deps_perm,
3549 .false_deps_popcnt,
35503556 .fast_15bytenop,
35513557 .fast_gather,
35523558 .fast_scalar_fsqrt,
......@@ -3585,6 +3591,7 @@ pub const cpu = struct {
35853591 .sha,
35863592 .shstk,
35873593 .slow_3ops_lea,
3594 .slow_pmullq,
35883595 .smap,
35893596 .smep,
35903597 .tuning_fast_imm_vector_shift,
......@@ -3635,6 +3642,90 @@ pub const cpu = struct {
36353642 .x87,
36363643 }),
36373644 };
3645 pub const novalake: CpuModel = .{
3646 .name = "novalake",
3647 .llvm_name = "novalake",
3648 .features = featureSet(&[_]Feature{
3649 .@"64bit",
3650 .adx,
3651 .allow_light_256_bit,
3652 .avx10_2,
3653 .avxifma,
3654 .avxneconvert,
3655 .avxvnni,
3656 .avxvnniint16,
3657 .avxvnniint8,
3658 .bmi,
3659 .bmi2,
3660 .ccmp,
3661 .clflushopt,
3662 .clwb,
3663 .cmov,
3664 .cmpccxadd,
3665 .cx16,
3666 .egpr,
3667 .enqcmd,
3668 .false_deps_perm,
3669 .fast_15bytenop,
3670 .fast_gather,
3671 .fast_scalar_fsqrt,
3672 .fast_shld_rotate,
3673 .fast_variable_crosslane_shuffle,
3674 .fast_variable_perlane_shuffle,
3675 .fast_vector_fsqrt,
3676 .fsgsbase,
3677 .fxsr,
3678 .gfni,
3679 .hreset,
3680 .idivq_to_divl,
3681 .invpcid,
3682 .lzcnt,
3683 .macrofusion,
3684 .mmx,
3685 .movbe,
3686 .movdir64b,
3687 .movdiri,
3688 .movrs,
3689 .ndd,
3690 .nf,
3691 .no_bypass_delay_blend,
3692 .no_bypass_delay_mov,
3693 .no_bypass_delay_shuffle,
3694 .nopl,
3695 .pconfig,
3696 .pku,
3697 .popcnt,
3698 .ppx,
3699 .prefer_movmsk_over_vtest,
3700 .prefetchi,
3701 .prfchw,
3702 .ptwrite,
3703 .push2pop2,
3704 .rdpid,
3705 .rdrnd,
3706 .rdseed,
3707 .sahf,
3708 .serialize,
3709 .sha,
3710 .sha512,
3711 .shstk,
3712 .slow_3ops_lea,
3713 .slow_pmullq,
3714 .sm3,
3715 .sm4,
3716 .tuning_fast_imm_vector_shift,
3717 .uintr,
3718 .vaes,
3719 .vpclmulqdq,
3720 .vzeroupper,
3721 .waitpkg,
3722 .x87,
3723 .xsavec,
3724 .xsaveopt,
3725 .xsaves,
3726 .zu,
3727 }),
3728 };
36383729 pub const opteron: CpuModel = .{
36393730 .name = "opteron",
36403731 .llvm_name = "opteron",
......@@ -3697,7 +3788,6 @@ pub const cpu = struct {
36973788 .enqcmd,
36983789 .f16c,
36993790 .false_deps_perm,
3700 .false_deps_popcnt,
37013791 .fast_15bytenop,
37023792 .fast_gather,
37033793 .fast_scalar_fsqrt,
......@@ -3726,7 +3816,6 @@ pub const cpu = struct {
37263816 .pku,
37273817 .popcnt,
37283818 .prefer_movmsk_over_vtest,
3729 .prefetchi,
37303819 .prfchw,
37313820 .ptwrite,
37323821 .rdpid,
......@@ -3738,6 +3827,7 @@ pub const cpu = struct {
37383827 .sha512,
37393828 .shstk,
37403829 .slow_3ops_lea,
3830 .slow_pmullq,
37413831 .sm3,
37423832 .sm4,
37433833 .tuning_fast_imm_vector_shift,
......@@ -3908,7 +3998,6 @@ pub const cpu = struct {
39083998 .cx16,
39093999 .f16c,
39104000 .false_deps_perm,
3911 .false_deps_popcnt,
39124001 .fast_15bytenop,
39134002 .fast_gather,
39144003 .fast_scalar_fsqrt,
......@@ -3947,6 +4036,7 @@ pub const cpu = struct {
39474036 .sha,
39484037 .shstk,
39494038 .slow_3ops_lea,
4039 .slow_pmullq,
39504040 .smap,
39514041 .smep,
39524042 .tuning_fast_imm_vector_shift,
......@@ -4013,6 +4103,7 @@ pub const cpu = struct {
40134103 .rdseed,
40144104 .sahf,
40154105 .sha,
4106 .slow_pmullq,
40164107 .smap,
40174108 .smep,
40184109 .tuning_fast_imm_vector_shift,
......@@ -4124,6 +4215,7 @@ pub const cpu = struct {
41244215 .serialize,
41254216 .sha,
41264217 .shstk,
4218 .slow_pmullq,
41274219 .smap,
41284220 .smep,
41294221 .tsxldtrk,
......@@ -4494,6 +4586,7 @@ pub const cpu = struct {
44944586 .sahf,
44954587 .sha,
44964588 .shstk,
4589 .slow_pmullq,
44974590 .smap,
44984591 .smep,
44994592 .tuning_fast_imm_vector_shift,
......@@ -4567,6 +4660,82 @@ pub const cpu = struct {
45674660 .x87,
45684661 }),
45694662 };
4663 pub const wildcatlake: CpuModel = .{
4664 .name = "wildcatlake",
4665 .llvm_name = "wildcatlake",
4666 .features = featureSet(&[_]Feature{
4667 .@"64bit",
4668 .adx,
4669 .allow_light_256_bit,
4670 .avxifma,
4671 .avxneconvert,
4672 .avxvnni,
4673 .avxvnniint16,
4674 .avxvnniint8,
4675 .bmi,
4676 .bmi2,
4677 .clflushopt,
4678 .clwb,
4679 .cmov,
4680 .cmpccxadd,
4681 .cx16,
4682 .enqcmd,
4683 .f16c,
4684 .false_deps_perm,
4685 .fast_15bytenop,
4686 .fast_gather,
4687 .fast_scalar_fsqrt,
4688 .fast_shld_rotate,
4689 .fast_variable_crosslane_shuffle,
4690 .fast_variable_perlane_shuffle,
4691 .fast_vector_fsqrt,
4692 .fma,
4693 .fsgsbase,
4694 .fxsr,
4695 .gfni,
4696 .hreset,
4697 .idivq_to_divl,
4698 .invpcid,
4699 .lzcnt,
4700 .macrofusion,
4701 .mmx,
4702 .movbe,
4703 .movdir64b,
4704 .movdiri,
4705 .no_bypass_delay_blend,
4706 .no_bypass_delay_mov,
4707 .no_bypass_delay_shuffle,
4708 .nopl,
4709 .pconfig,
4710 .pku,
4711 .popcnt,
4712 .prefer_movmsk_over_vtest,
4713 .prfchw,
4714 .ptwrite,
4715 .rdpid,
4716 .rdrnd,
4717 .rdseed,
4718 .sahf,
4719 .serialize,
4720 .sha,
4721 .sha512,
4722 .shstk,
4723 .slow_3ops_lea,
4724 .slow_pmullq,
4725 .sm3,
4726 .sm4,
4727 .tuning_fast_imm_vector_shift,
4728 .uintr,
4729 .vaes,
4730 .vpclmulqdq,
4731 .vzeroupper,
4732 .waitpkg,
4733 .x87,
4734 .xsavec,
4735 .xsaveopt,
4736 .xsaves,
4737 }),
4738 };
45704739 pub const winchip2: CpuModel = .{
45714740 .name = "winchip2",
45724741 .llvm_name = "winchip2",
lib/std/Target/xtensa.zig+65
......@@ -15,6 +15,7 @@ pub const Feature = enum {
1515 div32,
1616 exception,
1717 extendedl32r,
18 forced_atomics,
1819 fp,
1920 highpriinterrupts,
2021 highpriinterrupts_level3,
......@@ -34,6 +35,7 @@ pub const Feature = enum {
3435 prid,
3536 regprotect,
3637 rvector,
38 s32c1i,
3739 sext,
3840 threadptr,
3941 timers1,
......@@ -101,6 +103,11 @@ pub const all_features = blk: {
101103 .description = "Enable Xtensa Extended L32R option",
102104 .dependencies = featureSet(&[_]Feature{}),
103105 };
106 result[@intFromEnum(Feature.forced_atomics)] = .{
107 .llvm_name = "forced-atomics",
108 .description = "Assume that lock-free native-width atomics are available",
109 .dependencies = featureSet(&[_]Feature{}),
110 };
104111 result[@intFromEnum(Feature.fp)] = .{
105112 .llvm_name = "fp",
106113 .description = "Enable Xtensa Single FP instructions",
......@@ -206,6 +213,11 @@ pub const all_features = blk: {
206213 .description = "Enable Xtensa Relocatable Vector option",
207214 .dependencies = featureSet(&[_]Feature{}),
208215 };
216 result[@intFromEnum(Feature.s32c1i)] = .{
217 .llvm_name = "s32c1i",
218 .description = "Enable Xtensa S32C1I option",
219 .dependencies = featureSet(&[_]Feature{}),
220 };
209221 result[@intFromEnum(Feature.sext)] = .{
210222 .llvm_name = "sext",
211223 .description = "Enable Xtensa Sign Extend option",
......@@ -245,6 +257,59 @@ pub const all_features = blk: {
245257};
246258
247259pub const cpu = struct {
260 pub const esp32: CpuModel = .{
261 .name = "esp32",
262 .llvm_name = "esp32",
263 .features = featureSet(&[_]Feature{
264 .bool,
265 .clamps,
266 .coprocessor,
267 .dcache,
268 .debug,
269 .density,
270 .dfpaccel,
271 .div32,
272 .exception,
273 .fp,
274 .highpriinterrupts_level7,
275 .interrupt,
276 .loop,
277 .mac16,
278 .minmax,
279 .miscsr,
280 .mul16,
281 .mul32,
282 .mul32high,
283 .nsa,
284 .prid,
285 .regprotect,
286 .rvector,
287 .s32c1i,
288 .sext,
289 .threadptr,
290 .timers3,
291 .windowed,
292 }),
293 };
294 pub const esp8266: CpuModel = .{
295 .name = "esp8266",
296 .llvm_name = "esp8266",
297 .features = featureSet(&[_]Feature{
298 .debug,
299 .density,
300 .exception,
301 .extendedl32r,
302 .highpriinterrupts_level3,
303 .interrupt,
304 .mul16,
305 .mul32,
306 .nsa,
307 .prid,
308 .regprotect,
309 .rvector,
310 .timers1,
311 }),
312 };
248313 pub const generic: CpuModel = .{
249314 .name = "generic",
250315 .llvm_name = "generic",
lib/std/hash/xxhash.zig-6
......@@ -780,8 +780,6 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64)
780780}
781781
782782test "xxhash3" {
783 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23807
784
785783 const H = XxHash3;
786784 // Non-Seeded Tests
787785 try testExpect(H, 0, "", 0x2d06800538d394c2);
......@@ -813,8 +811,6 @@ test "xxhash3" {
813811}
814812
815813test "xxhash3 smhasher" {
816 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23807
817
818814 const Test = struct {
819815 fn do() !void {
820816 try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405);
......@@ -826,8 +822,6 @@ test "xxhash3 smhasher" {
826822}
827823
828824test "xxhash3 iterative api" {
829 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23807
830
831825 const Test = struct {
832826 fn do() !void {
833827 try verify.iterativeApi(XxHash3);
lib/std/math/big/int_test.zig+1-3
......@@ -484,7 +484,7 @@ fn toFloat(comptime Float: type) !void {
484484 );
485485}
486486test toFloat {
487 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/24191
487 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
488488 try toFloat(f16);
489489 try toFloat(f32);
490490 try toFloat(f64);
......@@ -2801,8 +2801,6 @@ test "bitNotWrap more than two limbs" {
28012801 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
28022802 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
28032803 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
2804 // LLVM: unexpected runtime library name: __umodei4
2805 if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
28062804
28072805 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
28082806 defer a.deinit();
lib/std/math/log10.zig-2
......@@ -139,8 +139,6 @@ test log10_int {
139139 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
140140 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
141141 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
142 if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
143 if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.cpu.arch == .hexagon) return error.SkipZigTest;
144142
145143 inline for (
146144 .{ u8, u16, u32, u64, u128, u256, u512 },
lib/std/math/modf.zig-1
......@@ -87,7 +87,6 @@ fn ModfTests(comptime T: type) type {
8787 test "vector" {
8888 if (builtin.os.tag.isDarwin() and builtin.cpu.arch == .aarch64) return error.SkipZigTest;
8989 if (builtin.cpu.arch == .s390x) return error.SkipZigTest;
90 if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/159529
9190
9291 const widths = [_]comptime_int{ 1, 2, 3, 4, 8, 16 };
9392
lib/std/mem.zig+1-2
......@@ -4809,8 +4809,7 @@ pub fn doNotOptimizeAway(val: anytype) void {
48094809 } else doNotOptimizeAway(&val);
48104810 },
48114811 .float => {
4812 // https://github.com/llvm/llvm-project/issues/159200
4813 if ((t.float.bits == 32 or t.float.bits == 64) and builtin.zig_backend != .stage2_c and !builtin.cpu.arch.isLoongArch()) {
4812 if ((t.float.bits == 32 or t.float.bits == 64) and builtin.zig_backend != .stage2_c) {
48144813 asm volatile (""
48154814 :
48164815 : [_] "rm" (val),
lib/std/os/linux/test.zig-2
......@@ -10,8 +10,6 @@ const expectEqual = std.testing.expectEqual;
1010const fs = std.fs;
1111
1212test "fallocate" {
13 if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30220
14
1513 const io = std.testing.io;
1614
1715 var tmp = std.testing.tmpDir(.{});
lib/std/os/windows.zig+130-1
......@@ -5665,7 +5665,136 @@ pub const PF = enum(DWORD) {
56655665 ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE = 44,
56665666
56675667 /// This Arm processor implements the Arm v8.3 LRCPC instructions (for example, LDAPR). Note that certain Arm v8.2 CPUs may optionally support the LRCPC instructions.
5668 ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE,
5668 ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE = 45,
5669
5670 /// This Arm processor implements the SVE (Scalable Vector Extension) instructions (FEAT_SVE).
5671 ARM_SVE_INSTRUCTIONS_AVAILABLE = 46,
5672
5673 /// This Arm processor implements the SVE2 instructions (FEAT_SVE2).
5674 ARM_SVE2_INSTRUCTIONS_AVAILABLE = 47,
5675
5676 /// This Arm processor implements the SVE2.1 instructions (FEAT_SVE2p1).
5677 ARM_SVE2_1_INSTRUCTIONS_AVAILABLE = 48,
5678
5679 /// This Arm processor implements the SVE AES instructions (FEAT_SVE_AES).
5680 ARM_SVE_AES_INSTRUCTIONS_AVAILABLE = 49,
5681
5682 /// This Arm processor implements the SVE 128-bit polynomial multiply long instructions (FEAT_SVE_PMULL128).
5683 ARM_SVE_PMULL128_INSTRUCTIONS_AVAILABLE = 50,
5684
5685 /// This Arm processor implements the SVE bit permute instructions (FEAT_SVE_BitPerm).
5686 ARM_SVE_BITPERM_INSTRUCTIONS_AVAILABLE = 51,
5687
5688 /// This Arm processor implements the SVE BF16 (BFloat16) instructions (FEAT_BF16).
5689 ARM_SVE_BF16_INSTRUCTIONS_AVAILABLE = 52,
5690
5691 /// This Arm processor implements the SVE EBF16 (Extended BFloat16) instructions (FEAT_EBF16).
5692 ARM_SVE_EBF16_INSTRUCTIONS_AVAILABLE = 53,
5693
5694 /// This Arm processor implements the SVE B16B16 instructions (FEAT_SVE_B16B16).
5695 ARM_SVE_B16B16_INSTRUCTIONS_AVAILABLE = 54,
5696
5697 /// This Arm processor implements the SVE SHA-3 cryptographic instructions (FEAT_SVE_SHA3).
5698 ARM_SVE_SHA3_INSTRUCTIONS_AVAILABLE = 55,
5699
5700 /// This Arm processor implements the SVE SM4 cryptographic instructions (FEAT_SVE_SM4).
5701 ARM_SVE_SM4_INSTRUCTIONS_AVAILABLE = 56,
5702
5703 /// This Arm processor implements the SVE I8MM (Int8 matrix multiply) instructions (FEAT_I8MM).
5704 ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE = 57,
5705
5706 /// This Arm processor implements the SVE F32MM (FP32 matrix multiply) instructions (FEAT_F32MM).
5707 ARM_SVE_F32MM_INSTRUCTIONS_AVAILABLE = 58,
5708
5709 /// This Arm processor implements the SVE F64MM (FP64 matrix multiply) instructions (FEAT_F64MM).
5710 ARM_SVE_F64MM_INSTRUCTIONS_AVAILABLE = 59,
5711
5712 /// This x64 processor implements the BMI2 instruction set.
5713 BMI2_INSTRUCTIONS_AVAILABLE = 60,
5714
5715 /// This x64 processor implements the MOVDIR64B instruction.
5716 MOVDIR64B_INSTRUCTION_AVAILABLE = 61,
5717
5718 /// This Arm processor implements the LSE2 atomic instructions (FEAT_LSE2).
5719 ARM_LSE2_AVAILABLE = 62,
5720
5721 /// This Arm processor implements the SHA-3 cryptographic instructions (FEAT_SHA3).
5722 ARM_SHA3_INSTRUCTIONS_AVAILABLE = 64,
5723
5724 /// This Arm processor implements the SHA-512 cryptographic instructions (FEAT_SHA512).
5725 ARM_SHA512_INSTRUCTIONS_AVAILABLE = 65,
5726
5727 /// This Arm processor implements the I8MM (Int8 matrix multiply) NEON instructions (FEAT_I8MM).
5728 ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE = 66,
5729
5730 /// This Arm processor implements the FP16 (half-precision floating point) NEON instructions (FEAT_FP16).
5731 ARM_V82_FP16_INSTRUCTIONS_AVAILABLE = 67,
5732
5733 /// This Arm processor implements the BF16 (BFloat16) NEON instructions (FEAT_BF16).
5734 ARM_V86_BF16_INSTRUCTIONS_AVAILABLE = 68,
5735
5736 /// This Arm processor implements the EBF16 (Extended BFloat16) NEON instructions (FEAT_EBF16).
5737 ARM_V86_EBF16_INSTRUCTIONS_AVAILABLE = 69,
5738
5739 /// This Arm processor implements the SME (Scalable Matrix Extension) instructions (FEAT_SME).
5740 ARM_SME_INSTRUCTIONS_AVAILABLE = 70,
5741
5742 /// This Arm processor implements the SME2 instructions (FEAT_SME2).
5743 ARM_SME2_INSTRUCTIONS_AVAILABLE = 71,
5744
5745 /// This Arm processor implements the SME2.1 instructions (FEAT_SME2p1).
5746 ARM_SME2_1_INSTRUCTIONS_AVAILABLE = 72,
5747
5748 /// This Arm processor implements the SME2.2 instructions (FEAT_SME2p2).
5749 ARM_SME2_2_INSTRUCTIONS_AVAILABLE = 73,
5750
5751 /// This Arm processor implements the SVE AES instructions when in Streaming SVE mode (FEAT_SSVE_AES).
5752 ARM_SME_AES_INSTRUCTIONS_AVAILABLE = 74,
5753
5754 /// This Arm processor implements the SVE bit permute instructions when in Streaming SVE mode (FEAT_SSVE_BitPerm).
5755 ARM_SME_SBITPERM_INSTRUCTIONS_AVAILABLE = 75,
5756
5757 /// This Arm processor implements the SVE FMMLA (widening, 4-way, FP8 to FP16) instruction when in Streaming SVE mode (FEAT_SSVE_F8F16MM).
5758 ARM_SME_SF8MM4_INSTRUCTIONS_AVAILABLE = 76,
5759
5760 /// This Arm processor implements the SVE FMMLA (widening, 8-way, FP8 to FP32) instruction when in Streaming SVE mode (FEAT_SSVE_F8F32MM).
5761 ARM_SME_SF8MM8_INSTRUCTIONS_AVAILABLE = 77,
5762
5763 /// This Arm processor implements the SVE2 FP8DOT2 instructions when in Streaming SVE mode (FEAT_SSVE_FP8DOT2).
5764 ARM_SME_SF8DP2_INSTRUCTIONS_AVAILABLE = 78,
5765
5766 /// This Arm processor implements the SVE2 FP8DOT4 instructions when in Streaming SVE mode (FEAT_SSVE_FP8DOT4).
5767 ARM_SME_SF8DP4_INSTRUCTIONS_AVAILABLE = 79,
5768
5769 /// This Arm processor implements the SVE2 FP8FMA instructions when in Streaming SVE mode (FEAT_SSVE_FP8FMA).
5770 ARM_SME_SF8FMA_INSTRUCTIONS_AVAILABLE = 80,
5771
5772 /// This Arm processor implements the SME F8F32 instructions (FEAT_SME_F8F32).
5773 ARM_SME_F8F32_INSTRUCTIONS_AVAILABLE = 81,
5774
5775 /// This Arm processor implements the SME F8F16 instructions (FEAT_SME_F8F16).
5776 ARM_SME_F8F16_INSTRUCTIONS_AVAILABLE = 82,
5777
5778 /// This Arm processor implements the SME F16F16 instructions (FEAT_SME_F16F16).
5779 ARM_SME_F16F16_INSTRUCTIONS_AVAILABLE = 83,
5780
5781 /// This Arm processor implements the SME B16B16 instructions (FEAT_SME_B16B16).
5782 ARM_SME_B16B16_INSTRUCTIONS_AVAILABLE = 84,
5783
5784 /// This Arm processor implements the SME F64F64 instructions (FEAT_SME_F64F64).
5785 ARM_SME_F64F64_INSTRUCTIONS_AVAILABLE = 85,
5786
5787 /// This Arm processor implements the SME I16I64 instructions (FEAT_SME_I16I64).
5788 ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE = 86,
5789
5790 /// This Arm processor implements the SME LUTv2 instructions (FEAT_SME_LUTv2).
5791 ARM_SME_LUTv2_INSTRUCTIONS_AVAILABLE = 87,
5792
5793 /// This Arm processor implements SME FA64 (Full AArch64 instruction set when in Streaming SVE mode) (FEAT_SME_FA64).
5794 ARM_SME_FA64_INSTRUCTIONS_AVAILABLE = 88,
5795
5796 /// This x64 processor implements the UMONITOR instruction.
5797 UMONITOR_INSTRUCTION_AVAILABLE = 89,
56695798};
56705799
56715800pub const MAX_WOW64_SHARED_ENTRIES = 16;
lib/std/simd.zig+4-21
......@@ -157,13 +157,6 @@ pub fn join(a: anytype, b: anytype) @Vector(vectorLength(@TypeOf(a)) + vectorLen
157157/// Returns a vector whose elements alternates between those of each input vector.
158158/// For example, `interlace(.{[4]u32{11, 12, 13, 14}, [4]u32{21, 22, 23, 24}})` returns a vector containing `.{11, 21, 12, 22, 13, 23, 14, 24}`.
159159pub fn interlace(vecs: anytype) @Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len, std.meta.Child(@TypeOf(vecs[0]))) {
160 // interlace doesn't work on MIPS, for some reason.
161 // Notes from earlier debug attempt:
162 // The indices are correct. The problem seems to be with the @shuffle builtin.
163 // On MIPS, the test that interlaces small_base gives { 0, 2, 0, 0, 64, 255, 248, 200, 0, 0 }.
164 // Calling this with two inputs seems to work fine, but I'll let the compile error trigger for all inputs, just to be safe.
165 if (builtin.cpu.arch.isMIPS()) @compileError("TODO: Find out why interlace() doesn't work on MIPS");
166
167160 const VecType = @TypeOf(vecs[0]);
168161 const vecs_arr = @as([vecs.len]VecType, vecs);
169162 const Child = std.meta.Child(@TypeOf(vecs_arr[0]));
......@@ -247,13 +240,11 @@ test "vector patterns" {
247240 try std.testing.expectEqual([8]u32{ 10, 20, 30, 40, 55, 66, 77, 88 }, join(base, other_base));
248241 try std.testing.expectEqual([2]u32{ 20, 30 }, extract(base, 1, 2));
249242
250 if (!builtin.cpu.arch.isMIPS()) {
251 try std.testing.expectEqual([8]u32{ 10, 55, 20, 66, 30, 77, 40, 88 }, interlace(.{ base, other_base }));
243 try std.testing.expectEqual([8]u32{ 10, 55, 20, 66, 30, 77, 40, 88 }, interlace(.{ base, other_base }));
252244
253 const small_braid = interlace(small_bases);
254 try std.testing.expectEqual([10]u8{ 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 }, small_braid);
255 try std.testing.expectEqual(small_bases, deinterlace(small_bases.len, small_braid));
256 }
245 const small_braid = interlace(small_bases);
246 try std.testing.expectEqual([10]u8{ 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 }, small_braid);
247 try std.testing.expectEqual(small_bases, deinterlace(small_bases.len, small_braid));
257248}
258249
259250/// Joins two vectors, shifts them leftwards (towards lower indices) and extracts the leftmost elements into a vector the length of a and b.
......@@ -384,9 +375,6 @@ pub fn prefixScanWithFunc(
384375 /// For example, this should be 0 for addition or 1 for multiplication.
385376 comptime identity: std.meta.Child(@TypeOf(vec)),
386377) if (ErrorType == void) @TypeOf(vec) else ErrorType!@TypeOf(vec) {
387 // I haven't debugged this, but it might be a cousin of sorts to what's going on with interlace.
388 if (builtin.cpu.arch.isMIPS()) @compileError("TODO: Find out why prefixScan doesn't work on MIPS");
389
390378 const len = vectorLength(@TypeOf(vec));
391379
392380 if (hop == 0) @compileError("hop can not be 0; you'd be going nowhere forever!");
......@@ -456,11 +444,6 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a
456444}
457445
458446test "vector prefix scan" {
459 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21893
460 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
461
462 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
463
464447 const int_base = @Vector(4, i32){ 11, 23, 9, -21 };
465448 const float_base = @Vector(4, f32){ 2, 0.5, -10, 6.54321 };
466449 const bool_base = @Vector(4, bool){ true, false, true, false };
lib/std/start.zig+4-3
......@@ -20,8 +20,9 @@ comptime {
2020 _ = root;
2121
2222 if (builtin.output_mode == .Lib and builtin.link_mode == .dynamic) {
23 if (native_os == .windows and !@hasDecl(root, "_DllMainCRTStartup")) {
24 @export(&_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" });
23 const dll_main_crt_startup = if (builtin.abi.isGnu()) "DllMainCRTStartup" else "_DllMainCRTStartup";
24 if (native_os == .windows and !builtin.link_libc and !@hasDecl(root, dll_main_crt_startup)) {
25 @export(&DllMainCRTStartup, .{ .name = dll_main_crt_startup });
2526 }
2627 } else if (builtin.output_mode == .Exe or @hasDecl(root, "main")) {
2728 if (builtin.link_libc and @hasDecl(root, "main")) {
......@@ -71,7 +72,7 @@ comptime {
7172 }
7273}
7374
74fn _DllMainCRTStartup(
75fn DllMainCRTStartup(
7576 hinstDLL: std.os.windows.HINSTANCE,
7677 fdwReason: std.os.windows.DWORD,
7778 lpReserved: std.os.windows.LPVOID,
lib/std/zig/llvm/Builder.zig+2-2
......@@ -13947,8 +13947,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco
1394713947 const bit_count = extra.type.scalarBits(self);
1394813948 const val: i64 = if (bit_count <= 64)
1394913949 bigint.toInt(i64) catch unreachable
13950 else if (bigint.toInt(u64)) |val|
13951 @bitCast(val)
13950 else if (bigint.toInt(u63)) |val|
13951 @bitCast(@as(u64, val))
1395213952 else |_| {
1395313953 const limbs = try record.addManyAsSlice(
1395413954 self.gpa,
lib/std/zig/system.zig-10
......@@ -460,16 +460,6 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
460460 if (result.cpu.arch.isArm() and result.abi.float() == .soft) {
461461 result.cpu.features.removeFeature(@intFromEnum(Target.arm.Feature.vfp2));
462462 }
463
464 // https://github.com/llvm/llvm-project/issues/135283
465 if (result.cpu.arch.isMIPS() and result.abi.float() == .soft) {
466 result.cpu.features.addFeature(@intFromEnum(Target.mips.Feature.soft_float));
467 }
468
469 // https://github.com/llvm/llvm-project/issues/168992
470 if (result.cpu.arch == .s390x) {
471 result.cpu.features.removeFeature(@intFromEnum(Target.s390x.Feature.vector));
472 }
473463 }
474464
475465 // It's possible that we detect the native ABI, but fail to detect the OS version or were told
lib/std/zig/system/arm.zig+56-2
......@@ -21,7 +21,7 @@ pub const cpu_models = struct {
2121 };
2222
2323 // implementer = 0x41
24 const ARM = [_]E{
24 const Arm = [_]E{
2525 E{ .part = 0x926, .m32 = &A32.arm926ej_s },
2626 E{ .part = 0xb02, .m32 = &A32.mpcore },
2727 E{ .part = 0xb36, .m32 = &A32.arm1136j_s },
......@@ -88,8 +88,12 @@ pub const cpu_models = struct {
8888 E{ .part = 0xd87, .m64 = &A64.cortex_a725 },
8989 E{ .part = 0xd88, .m64 = &A64.cortex_a520ae },
9090 E{ .part = 0xd89, .m64 = &A64.cortex_a720ae },
91 E{ .part = 0xd8a, .m64 = &A64.c1_nano },
92 E{ .part = 0xd8b, .m64 = &A64.c1_pro },
93 E{ .part = 0xd8c, .m64 = &A64.c1_ultra },
9194 E{ .part = 0xd8e, .m64 = &A64.neoverse_n3 },
9295 E{ .part = 0xd8f, .m64 = &A64.cortex_a320 },
96 E{ .part = 0xd90, .m64 = &A64.c1_premium },
9397 };
9498 // implementer = 0x42
9599 const Broadcom = [_]E{
......@@ -102,10 +106,17 @@ pub const cpu_models = struct {
102106 E{ .part = 0x0a3, .m64 = &A64.thunderxt83 },
103107 E{ .part = 0x0a1, .m64 = &A64.thunderxt88 },
104108 E{ .part = 0x0af, .m64 = &A64.thunderx2t99 },
109 E{ .part = 0x0b0, .m64 = &A64.cortex_a57 },
110 E{ .part = 0x0b1, .m64 = &A64.cortex_a57 },
111 E{ .part = 0x0b2, .m64 = &A64.cortex_a57 },
112 E{ .part = 0x0b3, .m64 = &A64.cortex_a57 },
113 E{ .part = 0x0b4, .m64 = &A64.cortex_a57 },
114 E{ .part = 0x0b5, .m64 = &A64.cortex_a57 },
105115 };
106116 // implementer = 0x46
107117 const Fujitsu = [_]E{
108118 E{ .part = 0x001, .m64 = &A64.a64fx },
119 E{ .part = 0x003, .m64 = &A64.fujitsu_monaka },
109120 };
110121 // implementer = 0x48
111122 const HiSilicon = [_]E{
......@@ -137,8 +148,14 @@ pub const cpu_models = struct {
137148 E{ .part = 0xc00, .m64 = &A64.falkor },
138149 E{ .part = 0xc01, .m64 = &A64.saphira },
139150 };
151 // implementer = 0x53
152 const Samsung = [_]E{
153 E{ .part = 0x000, .m64 = &A64.exynos_m1 },
154 };
140155 // implementer = 0x61
141156 const Apple = [_]E{
157 E{ .part = 0x020, .m64 = &A64.apple_m1 },
158 E{ .part = 0x021, .m64 = &A64.apple_m1 },
142159 E{ .part = 0x022, .m64 = &A64.apple_m1 },
143160 E{ .part = 0x023, .m64 = &A64.apple_m1 },
144161 E{ .part = 0x024, .m64 = &A64.apple_m1 },
......@@ -151,11 +168,43 @@ pub const cpu_models = struct {
151168 E{ .part = 0x035, .m64 = &A64.apple_m2 },
152169 E{ .part = 0x038, .m64 = &A64.apple_m2 },
153170 E{ .part = 0x039, .m64 = &A64.apple_m2 },
171 E{ .part = 0x042, .m64 = &A64.apple_m3 },
172 E{ .part = 0x043, .m64 = &A64.apple_m3 },
173 E{ .part = 0x044, .m64 = &A64.apple_m3 },
174 E{ .part = 0x045, .m64 = &A64.apple_m3 },
175 E{ .part = 0x048, .m64 = &A64.apple_m3 },
176 E{ .part = 0x049, .m64 = &A64.apple_m3 },
177 E{ .part = 0x052, .m64 = &A64.apple_m4 },
178 E{ .part = 0x053, .m64 = &A64.apple_m4 },
179 E{ .part = 0x054, .m64 = &A64.apple_m4 },
180 E{ .part = 0x055, .m64 = &A64.apple_m4 },
181 E{ .part = 0x058, .m64 = &A64.apple_m4 },
182 E{ .part = 0x059, .m64 = &A64.apple_m4 },
183 };
184 // implementer = 0x63
185 const ArmChina = [_]E{
186 E{ .part = 0x132, .m32 = &A32.star_mc1 },
187 E{ .part = 0xd25, .m32 = &A32.star_mc3 },
188 };
189 // implementer = 0x68
190 const Hxt = [_]E{
191 E{ .part = 0x000, .m64 = &A64.cortex_a57 },
192 };
193 // implementer = 0x6d
194 const Microsoft = [_]E{
195 E{ .part = 0xd49, .m64 = &A64.neoverse_n2 },
196 };
197 // implementer = 0xC0
198 const AmpereOne = [_]E{
199 E{ .part = 0xac3, .m64 = &A64.ampere1 },
200 E{ .part = 0xac4, .m64 = &A64.ampere1a },
201 E{ .part = 0xac5, .m64 = &A64.ampere1b },
202 E{ .part = 0xac7, .m64 = &A64.ampere1c },
154203 };
155204
156205 pub fn isKnown(core: CoreInfo, is_64bit: bool) ?*const Target.Cpu.Model {
157206 const models = switch (core.implementer) {
158 0x41 => &ARM,
207 0x41 => &Arm,
159208 0x42 => &Broadcom,
160209 0x43 => &Cavium,
161210 0x46 => &Fujitsu,
......@@ -163,7 +212,12 @@ pub const cpu_models = struct {
163212 0x4e => &Nvidia,
164213 0x50 => &Ampere,
165214 0x51 => &Qualcomm,
215 0x53 => &Samsung,
166216 0x61 => &Apple,
217 0x63 => &ArmChina,
218 0x68 => &Hxt,
219 0x6d => &Microsoft,
220 0xC0 => &AmpereOne,
167221 else => return null,
168222 };
169223
lib/std/zig/system/windows.zig+34-1
......@@ -215,10 +215,43 @@ fn genericCpuAndNativeFeatures(arch: Target.Cpu.Arch) Target.Cpu {
215215 // Override any features that are either present or absent
216216 setFeature(Feature, &cpu, .neon, IsProcessorFeaturePresent(PF.ARM_NEON_INSTRUCTIONS_AVAILABLE));
217217 setFeature(Feature, &cpu, .crc, IsProcessorFeaturePresent(PF.ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE));
218 setFeature(Feature, &cpu, .crypto, IsProcessorFeaturePresent(PF.ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE));
218 setFeature(Feature, &cpu, .aes, IsProcessorFeaturePresent(PF.ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE));
219 setFeature(Feature, &cpu, .sha2, IsProcessorFeaturePresent(PF.ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE));
219220 setFeature(Feature, &cpu, .lse, IsProcessorFeaturePresent(PF.ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE));
220221 setFeature(Feature, &cpu, .dotprod, IsProcessorFeaturePresent(PF.ARM_V82_DP_INSTRUCTIONS_AVAILABLE));
221222 setFeature(Feature, &cpu, .jsconv, IsProcessorFeaturePresent(PF.ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE));
223 setFeature(Feature, &cpu, .rcpc, IsProcessorFeaturePresent(PF.ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE));
224 setFeature(Feature, &cpu, .sve, IsProcessorFeaturePresent(PF.ARM_SVE_INSTRUCTIONS_AVAILABLE));
225 setFeature(Feature, &cpu, .sve2, IsProcessorFeaturePresent(PF.ARM_SVE2_INSTRUCTIONS_AVAILABLE));
226 setFeature(Feature, &cpu, .sve2p1, IsProcessorFeaturePresent(PF.ARM_SVE2_1_INSTRUCTIONS_AVAILABLE));
227 setFeature(Feature, &cpu, .sve_aes, IsProcessorFeaturePresent(PF.ARM_SVE_AES_INSTRUCTIONS_AVAILABLE) or IsProcessorFeaturePresent(PF.ARM_SVE_PMULL128_INSTRUCTIONS_AVAILABLE));
228 setFeature(Feature, &cpu, .sve_bitperm, IsProcessorFeaturePresent(PF.ARM_SVE_BITPERM_INSTRUCTIONS_AVAILABLE));
229 setFeature(Feature, &cpu, .bf16, IsProcessorFeaturePresent(PF.ARM_V86_BF16_INSTRUCTIONS_AVAILABLE));
230 setFeature(Feature, &cpu, .sve_b16b16, IsProcessorFeaturePresent(PF.ARM_SVE_B16B16_INSTRUCTIONS_AVAILABLE));
231 setFeature(Feature, &cpu, .sve_sha3, IsProcessorFeaturePresent(PF.ARM_SVE_SHA3_INSTRUCTIONS_AVAILABLE));
232 setFeature(Feature, &cpu, .sve_sm4, IsProcessorFeaturePresent(PF.ARM_SVE_SM4_INSTRUCTIONS_AVAILABLE));
233 setFeature(Feature, &cpu, .i8mm, IsProcessorFeaturePresent(PF.ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE));
234 setFeature(Feature, &cpu, .f32mm, IsProcessorFeaturePresent(PF.ARM_SVE_F32MM_INSTRUCTIONS_AVAILABLE));
235 setFeature(Feature, &cpu, .f64mm, IsProcessorFeaturePresent(PF.ARM_SVE_F64MM_INSTRUCTIONS_AVAILABLE));
236 setFeature(Feature, &cpu, .sme, IsProcessorFeaturePresent(PF.ARM_SME_INSTRUCTIONS_AVAILABLE));
237 setFeature(Feature, &cpu, .sme2, IsProcessorFeaturePresent(PF.ARM_SME2_INSTRUCTIONS_AVAILABLE));
238 setFeature(Feature, &cpu, .lse2, IsProcessorFeaturePresent(PF.ARM_LSE2_AVAILABLE));
239 setFeature(Feature, &cpu, .sha3, IsProcessorFeaturePresent(PF.ARM_SHA3_INSTRUCTIONS_AVAILABLE) and IsProcessorFeaturePresent(PF.ARM_SHA512_INSTRUCTIONS_AVAILABLE));
240 setFeature(Feature, &cpu, .fullfp16, IsProcessorFeaturePresent(PF.ARM_V82_FP16_INSTRUCTIONS_AVAILABLE));
241 setFeature(Feature, &cpu, .sme2p1, IsProcessorFeaturePresent(PF.ARM_SME2_1_INSTRUCTIONS_AVAILABLE));
242 setFeature(Feature, &cpu, .sme2p2, IsProcessorFeaturePresent(PF.ARM_SME2_2_INSTRUCTIONS_AVAILABLE));
243 setFeature(Feature, &cpu, .ssve_aes, IsProcessorFeaturePresent(PF.ARM_SME_AES_INSTRUCTIONS_AVAILABLE));
244 setFeature(Feature, &cpu, .ssve_bitperm, IsProcessorFeaturePresent(PF.ARM_SME_SBITPERM_INSTRUCTIONS_AVAILABLE));
245 setFeature(Feature, &cpu, .ssve_fp8dot2, IsProcessorFeaturePresent(PF.ARM_SME_SF8DP2_INSTRUCTIONS_AVAILABLE));
246 setFeature(Feature, &cpu, .ssve_fp8dot4, IsProcessorFeaturePresent(PF.ARM_SME_SF8DP4_INSTRUCTIONS_AVAILABLE));
247 setFeature(Feature, &cpu, .ssve_fp8fma, IsProcessorFeaturePresent(PF.ARM_SME_SF8FMA_INSTRUCTIONS_AVAILABLE));
248 setFeature(Feature, &cpu, .sme_f8f32, IsProcessorFeaturePresent(PF.ARM_SME_F8F32_INSTRUCTIONS_AVAILABLE));
249 setFeature(Feature, &cpu, .sme_f8f16, IsProcessorFeaturePresent(PF.ARM_SME_F8F16_INSTRUCTIONS_AVAILABLE));
250 setFeature(Feature, &cpu, .sme_b16b16, IsProcessorFeaturePresent(PF.ARM_SME_B16B16_INSTRUCTIONS_AVAILABLE));
251 setFeature(Feature, &cpu, .sme_f64f64, IsProcessorFeaturePresent(PF.ARM_SME_F64F64_INSTRUCTIONS_AVAILABLE));
252 setFeature(Feature, &cpu, .sme_i16i64, IsProcessorFeaturePresent(PF.ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE));
253 setFeature(Feature, &cpu, .sme_lutv2, IsProcessorFeaturePresent(PF.ARM_SME_LUTv2_INSTRUCTIONS_AVAILABLE));
254 setFeature(Feature, &cpu, .sme_fa64, IsProcessorFeaturePresent(PF.ARM_SME_FA64_INSTRUCTIONS_AVAILABLE));
222255 },
223256 else => {},
224257 }
lib/std/zig/system/x86.zig+60-16
......@@ -232,7 +232,7 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
232232 cpu.model = &Target.x86.cpu.lunarlake;
233233 return;
234234 },
235 0xcc => {
235 0xcc, 0xd5 => {
236236 cpu.model = &Target.x86.cpu.pantherlake;
237237 return;
238238 },
......@@ -307,6 +307,20 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
307307 cpu.model = &Target.x86.cpu.pentium4;
308308 return;
309309 },
310 18 => switch (model) {
311 0x01, 0x03 => {
312 cpu.model = &Target.x86.cpu.novalake;
313 return;
314 },
315 else => return, // Unknown CPU Model
316 },
317 19 => switch (model) {
318 0x01 => {
319 cpu.model = &Target.x86.cpu.diamondrapids;
320 return;
321 },
322 else => return, // Unknown CPU Model
323 },
310324 else => return, // Unknown CPU Model
311325 }
312326}
......@@ -412,6 +426,8 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
412426 // AMX requires additional context to be saved by the OS.
413427 const has_amx_save = xcr0.xtilecfg and xcr0.xtiledata;
414428
429 const has_apx_save = xcr0.apx;
430
415431 setFeature(cpu, .avx, has_avx_save);
416432 setFeature(cpu, .fma, bit(leaf.ecx, 12) and has_avx_save);
417433 // Only enable XSAVE if OS has enabled support for saving YMM state.
......@@ -470,7 +486,20 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
470486 }
471487 }
472488
473 if (max_level >= 0x7) {
489 if (max_ext_level >= 0x80000021) {
490 leaf = cpuid(0x80000021, 0);
491
492 // AMD uses a different bit for prefetchi.
493 setFeature(cpu, .prefetchi, bit(leaf.eax, 20));
494 } else {
495 for ([_]Target.x86.Feature{
496 .prefetchi,
497 }) |feat| {
498 setFeature(cpu, feat, false);
499 }
500 }
501
502 const has_avx10 = if (max_level >= 0x7) has_avx10: {
474503 leaf = cpuid(0x7, 0);
475504
476505 setFeature(cpu, .fsgsbase, bit(leaf.ebx, 0));
......@@ -484,7 +513,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
484513 setFeature(cpu, .rtm, bit(leaf.ebx, 11));
485514 // AVX512 is only supported if the OS supports the context save for it.
486515 setFeature(cpu, .avx512f, bit(leaf.ebx, 16) and has_avx512_save);
487 setFeature(cpu, .evex512, bit(leaf.ebx, 16) and has_avx512_save);
488516 setFeature(cpu, .avx512dq, bit(leaf.ebx, 17) and has_avx512_save);
489517 setFeature(cpu, .rdseed, bit(leaf.ebx, 18));
490518 setFeature(cpu, .adx, bit(leaf.ebx, 19));
......@@ -556,15 +584,20 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
556584 setFeature(cpu, .avxneconvert, bit(leaf.edx, 5) and has_avx_save);
557585 setFeature(cpu, .amx_complex, bit(leaf.edx, 8) and has_amx_save);
558586 setFeature(cpu, .avxvnniint16, bit(leaf.edx, 10) and has_avx_save);
559 setFeature(cpu, .prefetchi, bit(leaf.edx, 14));
587 // This needs to account for prefetchi already being detected above on AMD.
588 setFeature(cpu, .prefetchi, cpu.has(.x86, .prefetchi) or bit(leaf.edx, 14));
560589 setFeature(cpu, .usermsr, bit(leaf.edx, 15));
561590 // APX
562 setFeature(cpu, .egpr, bit(leaf.edx, 21));
563 setFeature(cpu, .push2pop2, bit(leaf.edx, 21));
564 setFeature(cpu, .ppx, bit(leaf.edx, 21));
565 setFeature(cpu, .ndd, bit(leaf.edx, 21));
566 setFeature(cpu, .ccmp, bit(leaf.edx, 21));
567 setFeature(cpu, .cf, bit(leaf.edx, 21));
591 setFeature(cpu, .egpr, bit(leaf.edx, 21) and has_apx_save);
592 setFeature(cpu, .push2pop2, bit(leaf.edx, 21) and has_apx_save);
593 setFeature(cpu, .ppx, bit(leaf.edx, 21) and has_apx_save);
594 setFeature(cpu, .ndd, bit(leaf.edx, 21) and has_apx_save);
595 setFeature(cpu, .ccmp, bit(leaf.edx, 21) and has_apx_save);
596 setFeature(cpu, .nf, bit(leaf.edx, 21) and has_apx_save);
597 setFeature(cpu, .cf, bit(leaf.edx, 21) and has_apx_save);
598 setFeature(cpu, .zu, bit(leaf.edx, 21) and has_apx_save);
599
600 break :has_avx10 bit(leaf.edx, 19);
568601 } else {
569602 for ([_]Target.x86.Feature{
570603 .sha512,
......@@ -582,19 +615,23 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
582615 .avxneconvert,
583616 .amx_complex,
584617 .avxvnniint16,
585 .prefetchi,
618 // prefetchi already handled earlier.
586619 .usermsr,
587620 .egpr,
588621 .push2pop2,
589622 .ppx,
590623 .ndd,
591624 .ccmp,
625 .nf,
592626 .cf,
627 .zu,
593628 }) |feat| {
594629 setFeature(cpu, feat, false);
595630 }
596631 }
597 } else {
632
633 break :has_avx10 false;
634 } else has_avx10: {
598635 for ([_]Target.x86.Feature{
599636 .fsgsbase,
600637 .sgx,
......@@ -605,7 +642,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
605642 .invpcid,
606643 .rtm,
607644 .avx512f,
608 .evex512,
609645 .avx512dq,
610646 .rdseed,
611647 .adx,
......@@ -664,18 +700,22 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
664700 .avxneconvert,
665701 .amx_complex,
666702 .avxvnniint16,
667 .prefetchi,
703 // prefetchi already handled earlier.
668704 .usermsr,
669705 .egpr,
670706 .push2pop2,
671707 .ppx,
672708 .ndd,
673709 .ccmp,
710 .nf,
674711 .cf,
712 .zu,
675713 }) |feat| {
676714 setFeature(cpu, feat, false);
677715 }
678 }
716
717 break :has_avx10 false;
718 };
679719
680720 if (max_level >= 0xD and has_avx_save) {
681721 leaf = cpuid(0xD, 0x1);
......@@ -721,10 +761,14 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
721761 if (max_level >= 0x24) {
722762 leaf = cpuid(0x24, 0);
723763
724 setFeature(cpu, .avx10_1, bit(leaf.ebx, 18));
764 const avx_ver = leaf.ebx & 0xff;
765
766 setFeature(cpu, .avx10_1, has_avx10 and avx_ver >= 1);
767 setFeature(cpu, .avx10_2, has_avx10 and avx_ver >= 2);
725768 } else {
726769 for ([_]Target.x86.Feature{
727770 .avx10_1,
771 .avx10_2,
728772 }) |feat| {
729773 setFeature(cpu, feat, false);
730774 }
src/Compilation.zig+18-2
......@@ -3013,6 +3013,13 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE
30133013 try comp.appendFileSystemInput(try .fromUnresolved(arena, comp.dirs, &.{c_object.src.src_path}));
30143014 }
30153015
3016 for (comp.link_inputs) |input| if (input.path()) |path| {
3017 try comp.appendFileSystemInput(try .fromUnresolved(arena, comp.dirs, &.{
3018 path.root_dir.path orelse ".",
3019 path.sub_path,
3020 }));
3021 };
3022
30163023 // For compiling Win32 resources, we rely on the cache hash system to avoid duplicating work.
30173024 // Add a Job for each Win32 resource file.
30183025 try comp.win32_resource_work_queue.ensureUnusedCapacity(gpa, comp.win32_resource_table.count());
......@@ -4763,12 +4770,12 @@ fn writeDepFile(
47634770
47644771 try w.print("{f}:", .{bin_file});
47654772
4766 {
4773 if (fsi.len > 0) {
47674774 var it = std.mem.splitScalar(u8, fsi, 0);
47684775 while (it.next()) |input| try w.print(" \\\n {f}{s}", .{ prefixes[input[0] - 1], input[1..] });
47694776 }
47704777
4771 {
4778 if (fsi.len > 0) {
47724779 var it = std.mem.splitScalar(u8, fsi, 0);
47734780 while (it.next()) |input| try w.print("\n\n{f}{s}:", .{ prefixes[input[0] - 1], input[1..] });
47744781 }
......@@ -6355,6 +6362,13 @@ fn addCommonCCArgs(
63556362 try argv.append(
63566363 try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}),
63576364 );
6365
6366 // MinGW-w64's inline functions in headers (e.g. `fabs`), which are emitted with `linkonce_odr`
6367 // linkage, sometimes cause duplicate symbol errors due to us providing the same symbols with
6368 // `weak` linkage in compiler-rt or libzigc. So just disable them. Besides, they undermine the
6369 // goal of moving more libc code to Zig, and they're also just kind of unnecessary since LLVM is
6370 // perfectly capable of recognizing and optimizing libcalls.
6371 try argv.append("-D__CRT__NO_INLINE");
63586372 } else if (target.isFreeBSDLibC()) {
63596373 // https://docs.freebsd.org/en/books/porters-handbook/versions
63606374 const min_ver = target.os.version_range.semver.min;
......@@ -6794,6 +6808,8 @@ pub fn addCCArgs(
67946808 // We communicate these to Clang through the dedicated options.
67956809 if (std.mem.startsWith(u8, llvm_name, "soft-float") or
67966810 std.mem.startsWith(u8, llvm_name, "hard-float") or
6811 (target.cpu.arch.isPowerPC() and std.mem.startsWith(u8, llvm_name, "64bit")) or
6812 (target.cpu.arch.isX86() and std.mem.startsWith(u8, llvm_name, "x32")) or
67976813 (target.cpu.arch == .s390x and std.mem.eql(u8, llvm_name, "backchain")))
67986814 continue;
67996815
src/Package/Module.zig+3
......@@ -347,6 +347,9 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
347347 // See https://github.com/ziglang/zig/issues/23539
348348 if (target_util.isDynamicAMDGCNFeature(target, feature)) continue;
349349
350 if (target.cpu.arch.isPowerPC() and @as(std.Target.powerpc.Feature, @enumFromInt(feature.index)) == .@"64bit") continue;
351 if (target.cpu.arch.isX86() and @as(std.Target.x86.Feature, @enumFromInt(feature.index)) == .x32) continue;
352
350353 var is_enabled = target.cpu.features.isEnabled(feature.index);
351354 if (target.cpu.arch == .s390x and @as(std.Target.s390x.Feature, @enumFromInt(feature.index)) == .backchain) {
352355 is_enabled = !omit_frame_pointer;
src/clang_options.zon+93-17
......@@ -273,6 +273,9 @@
273273.{ .name = "utf-8", .psl = true },
274274.{ .name = "validate-charset", .psl = true },
275275.{ .name = "validate-charset-", .psl = true },
276.{ .name = "vlen", .psl = true },
277.{ .name = "vlen=256", .psl = true },
278.{ .name = "vlen=512", .psl = true },
276279.{ .name = "vmb", .psl = true },
277280.{ .name = "vmg", .psl = true },
278281.{ .name = "vmm", .psl = true },
......@@ -692,9 +695,9 @@
692695.{ .name = "fnew-alignment", .syntax = .separate },
693696.{ .name = "faligned-new" },
694697.{ .name = "fno-aligned-new" },
695.{ .name = "fsched-interblock" },
696698.{ .name = "fcuda-rdc" },
697699.{ .name = "fno-cuda-rdc" },
700.{ .name = "fsched-interblock" },
698701.{ .name = "ftree-vectorize" },
699702.{ .name = "fno-tree-vectorize" },
700703.{ .name = "ftree-slp-vectorize" },
......@@ -723,6 +726,8 @@
723726.{ .name = "mtune=help", .ze = .mcpu },
724727.{ .name = "integrated-as" },
725728.{ .name = "no-integrated-as" },
729.{ .name = "shared-libasan" },
730.{ .name = "static-libasan" },
726731.{ .name = "fopenmp-is-device" },
727732.{ .name = "fcuda-approx-transcendentals" },
728733.{ .name = "fno-cuda-approx-transcendentals" },
......@@ -760,14 +765,12 @@
760765.{ .name = "Oy-", .psl = true },
761766.{ .name = "Qgather-", .psl = true },
762767.{ .name = "Qscatter-", .psl = true },
763.{ .name = "shared-libasan" },
764768.{ .name = "Xmicrosoft-visualc-tools-root", .syntax = .separate },
765769.{ .name = "Xmicrosoft-visualc-tools-version", .syntax = .separate },
766770.{ .name = "Xmicrosoft-windows-sdk-root", .syntax = .separate },
767771.{ .name = "Xmicrosoft-windows-sdk-version", .syntax = .separate },
768772.{ .name = "Xmicrosoft-windows-sys-root", .syntax = .separate },
769773.{ .name = "Qembed_debug", .psl = true },
770.{ .name = "static-libasan" },
771774.{ .name = "fslp-vectorize-aggressive" },
772775.{ .name = "fident" },
773776.{ .name = "fno-ident" },
......@@ -787,13 +790,13 @@
787790.{ .name = "fno-sanitize-blacklist" },
788791.{ .name = "fhonor-infinites" },
789792.{ .name = "fno-honor-infinites" },
790.{ .name = "findirect-virtual-calls" },
791793.{
792794 .name = "config",
793795 .syntax = .separate,
794796 .pd1 = false,
795797 .pd2 = true,
796798},
799.{ .name = "findirect-virtual-calls" },
797800.{ .name = "ansi", .pd2 = true },
798801.{ .name = "arch", .syntax = .separate },
799802.{ .name = "arch_errors_fatal" },
......@@ -900,6 +903,7 @@
900903.{ .name = "dead_strip" },
901904.{ .name = "debug-forward-template-params" },
902905.{ .name = "debug-info-macro" },
906.{ .name = "debug-info-macro-expansion-loc" },
903907.{ .name = "default-function-attr", .syntax = .separate },
904908.{
905909 .name = "defsym",
......@@ -934,14 +938,19 @@
934938.{ .name = "dwarf-debug-producer", .syntax = .separate },
935939.{ .name = "dwarf-explicit-import" },
936940.{ .name = "dwarf-ext-refs" },
941.{ .name = "all-resources-bound", .psl = true },
942.{ .name = "Zpc", .psl = true },
937943.{ .name = "Vd", .psl = true },
938944.{ .name = "Gis", .psl = true },
939945.{ .name = "hlsl-no-stdinc", .psl = true },
946.{ .name = "rootsig-define", .syntax = .separate },
940947.{
941948 .name = "force-rootsig-ver",
942949 .syntax = .separate,
943950 .psl = true,
944951},
952.{ .name = "Zpr", .psl = true },
953.{ .name = "Qstrip-rootsignature", .psl = true },
945954.{ .name = "dylib_file", .syntax = .separate },
946955.{ .name = "dylinker" },
947956.{ .name = "dynamic", .ze = .dynamic },
......@@ -1089,6 +1098,7 @@
10891098.{ .name = "fcheck-array-temporaries" },
10901099.{ .name = "fcheck-new" },
10911100.{ .name = "fclangir" },
1101.{ .name = "fcoarray" },
10921102.{ .name = "fcodegen-data-generate" },
10931103.{ .name = "fcodegen-data-use" },
10941104.{ .name = "fcolor-diagnostics", .ze = .color_diagnostics },
......@@ -1148,8 +1158,11 @@
11481158.{ .name = "fdeclspec" },
11491159.{ .name = "fdefault-double-8" },
11501160.{ .name = "fdefault-inline" },
1161.{ .name = "fdefault-integer-4" },
11511162.{ .name = "fdefault-integer-8" },
1163.{ .name = "fdefault-real-4" },
11521164.{ .name = "fdefault-real-8" },
1165.{ .name = "fdefer-ts" },
11531166.{ .name = "fdefine-target-os-macros" },
11541167.{ .name = "fdelayed-template-parsing" },
11551168.{ .name = "fdelete-null-pointer-checks" },
......@@ -1205,9 +1218,11 @@
12051218.{ .name = "ferror-limit", .syntax = .separate },
12061219.{ .name = "fescaping-block-tail-calls" },
12071220.{ .name = "fexceptions" },
1221.{ .name = "fexperimental-call-graph-section" },
12081222.{ .name = "fexperimental-isel" },
12091223.{ .name = "fexperimental-late-parse-attributes" },
12101224.{ .name = "fexperimental-library" },
1225.{ .name = "fexperimental-loop-fusion" },
12111226.{ .name = "fexperimental-new-constant-interpreter" },
12121227.{ .name = "fexperimental-omit-vtable-rtti" },
12131228.{ .name = "fexperimental-relative-c++-abi-vtables" },
......@@ -1221,6 +1236,7 @@
12211236.{ .name = "ff2c" },
12221237.{ .name = "ffake-address-space-map" },
12231238.{ .name = "ffast-math" },
1239.{ .name = "ffast-real-mod" },
12241240.{ .name = "ffat-lto-objects" },
12251241.{ .name = "ffile-reproducible" },
12261242.{ .name = "fimplicit-modules-use-lock" },
......@@ -1345,6 +1361,8 @@
13451361.{ .name = "fhip-fp32-correctly-rounded-divide-sqrt" },
13461362.{ .name = "fhip-kernel-arg-name" },
13471363.{ .name = "fhip-new-launch-api" },
1364.{ .name = "fspv-enable-maximal-reconvergence" },
1365.{ .name = "fspv-use-unknown-image-format" },
13481366.{ .name = "fhlsl-strict-availability" },
13491367.{ .name = "fhonor-infinities" },
13501368.{ .name = "fhonor-nans" },
......@@ -1393,6 +1411,7 @@
13931411.{ .name = "flat_namespace" },
13941412.{ .name = "flax-vector-conversions" },
13951413.{ .name = "fexperimental-lifetime-safety" },
1414.{ .name = "fexperimental-lifetime-safety-inference" },
13961415.{ .name = "flimit-debug-info" },
13971416.{ .name = "flogical-abbreviations" },
13981417.{ .name = "floop-interchange" },
......@@ -1428,7 +1447,9 @@
14281447.{ .name = "fmodules-force-validate-user-headers" },
14291448.{ .name = "fmodules-hash-content" },
14301449.{ .name = "fmodules-local-submodule-visibility" },
1450.{ .name = "fmodules-reduced-bmi" },
14311451.{ .name = "fmodules-search-all" },
1452.{ .name = "fmodules-single-module-parse-mode" },
14321453.{ .name = "fmodules-skip-diagnostic-options" },
14331454.{ .name = "fmodules-skip-header-search-paths" },
14341455.{ .name = "fmodules-strict-context-hash" },
......@@ -1448,8 +1469,10 @@
14481469.{ .name = "fms-volatile" },
14491470.{ .name = "fmudflap" },
14501471.{ .name = "fmudflapth" },
1472.{ .name = "fnamed-loops" },
14511473.{ .name = "fnative-half-arguments-and-returns" },
14521474.{ .name = "fnative-half-type" },
1475.{ .name = "fnative-int16-type" },
14531476.{ .name = "fnested-functions" },
14541477.{ .name = "fnew-infallible" },
14551478.{ .name = "fnext-runtime" },
......@@ -1539,6 +1562,7 @@
15391562.{ .name = "fno-debug-types-section" },
15401563.{ .name = "fno-declspec" },
15411564.{ .name = "fno-default-inline" },
1565.{ .name = "fno-defer-ts" },
15421566.{ .name = "fno-define-target-os-macros" },
15431567.{ .name = "fno-delayed-template-parsing" },
15441568.{ .name = "fno-delete-null-pointer-checks" },
......@@ -1573,14 +1597,17 @@
15731597.{ .name = "fno-emulated-tls" },
15741598.{ .name = "fno-escaping-block-tail-calls" },
15751599.{ .name = "fno-exceptions" },
1600.{ .name = "fno-experimental-call-graph-section" },
15761601.{ .name = "fno-experimental-isel" },
15771602.{ .name = "fno-experimental-late-parse-attributes" },
15781603.{ .name = "fno-experimental-library" },
1604.{ .name = "fno-experimental-loop-fusion" },
15791605.{ .name = "fno-experimental-omit-vtable-rtti" },
15801606.{ .name = "fno-experimental-relative-c++-abi-vtables" },
15811607.{ .name = "fno-external-blas" },
15821608.{ .name = "fno-f2c" },
15831609.{ .name = "fno-fast-math" },
1610.{ .name = "fno-fast-real-mod" },
15841611.{ .name = "fno-fat-lto-objects" },
15851612.{ .name = "fno-file-reproducible" },
15861613.{ .name = "fno-implicit-modules-use-lock" },
......@@ -1646,6 +1673,7 @@
16461673.{ .name = "fno-knr-functions" },
16471674.{ .name = "fno-lax-vector-conversions" },
16481675.{ .name = "fno-experimental-lifetime-safety" },
1676.{ .name = "fno-experimental-lifetime-safety-inference" },
16491677.{ .name = "fno-limit-debug-info" },
16501678.{ .name = "fno-logical-abbreviations" },
16511679.{ .name = "fno-loop-interchange" },
......@@ -1671,6 +1699,7 @@
16711699.{ .name = "fno-modules-force-validate-user-headers" },
16721700.{ .name = "fno-modules-global-index" },
16731701.{ .name = "fno-modules-prune-non-affecting-module-map-files" },
1702.{ .name = "fno-modules-reduced-bmi" },
16741703.{ .name = "fno-modules-search-all" },
16751704.{ .name = "fno-modules-share-filemanager" },
16761705.{ .name = "fno-modules-skip-diagnostic-options" },
......@@ -1685,12 +1714,14 @@
16851714.{ .name = "fno-ms-extensions" },
16861715.{ .name = "fno-ms-tls-guards" },
16871716.{ .name = "fno-ms-volatile" },
1717.{ .name = "fno-named-loops" },
16881718.{ .name = "fno-new-infallible" },
16891719.{ .name = "fno-non-call-exceptions" },
16901720.{ .name = "fno-objc-arc" },
16911721.{ .name = "fno-objc-arc-exceptions" },
16921722.{ .name = "fno-objc-avoid-heapify-local-blocks" },
16931723.{ .name = "fno-objc-convert-messages-to-runtime-calls" },
1724.{ .name = "fno-objc-direct-precondition-thunk" },
16941725.{ .name = "fno-objc-encode-cxx-class-template-spec" },
16951726.{ .name = "fno-objc-exceptions" },
16961727.{ .name = "fno-objc-infer-related-result-type" },
......@@ -1718,6 +1749,7 @@
17181749.{ .name = "fno-pack-derived" },
17191750.{ .name = "fno-pack-struct" },
17201751.{ .name = "fno-padding-on-unsigned-fixed-point" },
1752.{ .name = "fno-partition-static-data-sections" },
17211753.{ .name = "fno-pascal-strings" },
17221754.{ .name = "fno-pch-codegen" },
17231755.{ .name = "fno-pch-debuginfo" },
......@@ -1802,9 +1834,13 @@
18021834.{ .name = "fno-sanitize-address-poison-custom-array-cookie" },
18031835.{ .name = "fno-sanitize-address-use-after-scope" },
18041836.{ .name = "fno-sanitize-address-use-odr-indicator" },
1837.{ .name = "fno-sanitize-alloc-token-extended" },
1838.{ .name = "fno-sanitize-alloc-token-fast-abi" },
18051839.{ .name = "fno-sanitize-annotate-debug-info" },
18061840.{ .name = "fno-sanitize-cfi-canonical-jump-tables" },
18071841.{ .name = "fno-sanitize-cfi-cross-dso" },
1842.{ .name = "fno-sanitize-debug-trap-reasons" },
1843.{ .name = "fno-sanitize-handler-preserve-all-regs" },
18081844.{ .name = "fno-sanitize-hwaddress-experimental-aliasing" },
18091845.{ .name = "fno-sanitize-ignorelist" },
18101846.{ .name = "fno-sanitize-link-c++-runtime" },
......@@ -1821,6 +1857,7 @@
18211857.{ .name = "fno-sanitize-thread-func-entry-exit" },
18221858.{ .name = "fno-sanitize-thread-memory-access" },
18231859.{ .name = "fno-sanitize-trap", .ze = .no_sanitize_trap },
1860.{ .name = "fno-sanitize-type-outline-instrumentation" },
18241861.{ .name = "fno-sanitize-undefined-trap-on-error" },
18251862.{ .name = "fno-save-main-program" },
18261863.{ .name = "fno-save-optimization-record" },
......@@ -1887,6 +1924,7 @@
18871924.{ .name = "fno-unique-source-file-names" },
18881925.{ .name = "fno-unroll-all-loops" },
18891926.{ .name = "fno-unroll-loops" },
1927.{ .name = "fno-unsafe-cray-pointers" },
18901928.{ .name = "fno-unsafe-loop-optimizations" },
18911929.{ .name = "fno-unsafe-math-optimizations" },
18921930.{ .name = "fno-unsigned" },
......@@ -1938,6 +1976,7 @@
19381976.{ .name = "fobjc-avoid-heapify-local-blocks" },
19391977.{ .name = "fobjc-call-cxx-cdtors" },
19401978.{ .name = "fobjc-convert-messages-to-runtime-calls" },
1979.{ .name = "fobjc-direct-precondition-thunk" },
19411980.{ .name = "fobjc-disable-direct-methods-for-testing" },
19421981.{ .name = "fobjc-encode-cxx-class-template-spec" },
19431982.{ .name = "fobjc-exceptions" },
......@@ -1987,6 +2026,7 @@
19872026.{ .name = "fpack-struct" },
19882027.{ .name = "fpadding-on-unsigned-fixed-point" },
19892028.{ .name = "fparse-all-comments" },
2029.{ .name = "fpartition-static-data-sections" },
19902030.{ .name = "fpascal-strings" },
19912031.{ .name = "fpass-by-value-is-noalias" },
19922032.{ .name = "fpcc-struct-return" },
......@@ -2081,6 +2121,8 @@
20812121.{ .name = "fsanitize-address-poison-custom-array-cookie" },
20822122.{ .name = "fsanitize-address-use-after-scope" },
20832123.{ .name = "fsanitize-address-use-odr-indicator" },
2124.{ .name = "fsanitize-alloc-token-extended" },
2125.{ .name = "fsanitize-alloc-token-fast-abi" },
20842126.{ .name = "fsanitize-annotate-debug-info" },
20852127.{ .name = "fsanitize-cfi-canonical-jump-tables" },
20862128.{ .name = "fsanitize-cfi-cross-dso" },
......@@ -2102,6 +2144,8 @@
21022144.{ .name = "fsanitize-coverage-trace-pc" },
21032145.{ .name = "fsanitize-coverage-trace-pc-guard", .ze = .san_cov_trace_pc_guard },
21042146.{ .name = "fsanitize-coverage-trace-stores" },
2147.{ .name = "fsanitize-debug-trap-reasons" },
2148.{ .name = "fsanitize-handler-preserve-all-regs" },
21052149.{ .name = "fsanitize-hwaddress-experimental-aliasing" },
21062150.{ .name = "fsanitize-kcfi-arity" },
21072151.{ .name = "fsanitize-link-c++-runtime" },
......@@ -2118,6 +2162,7 @@
21182162.{ .name = "fsanitize-thread-func-entry-exit" },
21192163.{ .name = "fsanitize-thread-memory-access" },
21202164.{ .name = "fsanitize-trap", .ze = .sanitize_trap },
2165.{ .name = "fsanitize-type-outline-instrumentation" },
21212166.{ .name = "fsanitize-undefined-trap-on-error" },
21222167.{ .name = "fsave-main-program" },
21232168.{ .name = "fsave-optimization-record" },
......@@ -2205,6 +2250,7 @@
22052250.{ .name = "funknown-anytype" },
22062251.{ .name = "funroll-all-loops" },
22072252.{ .name = "funroll-loops" },
2253.{ .name = "funsafe-cray-pointers" },
22082254.{ .name = "funsafe-loop-optimizations" },
22092255.{ .name = "funsafe-math-optimizations" },
22102256.{ .name = "funsigned" },
......@@ -2259,6 +2305,7 @@
22592305.{ .name = "g2" },
22602306.{ .name = "g3" },
22612307.{ .name = "g", .ze = .debug },
2308.{ .name = "gcall-site-info" },
22622309.{ .name = "gcodeview" },
22632310.{ .name = "gcodeview-command-line" },
22642311.{ .name = "gcodeview-ghash" },
......@@ -2271,6 +2318,7 @@
22712318.{ .name = "gdwarf-3", .ze = .debug },
22722319.{ .name = "gdwarf-4", .ze = .debug },
22732320.{ .name = "gdwarf-5", .ze = .debug },
2321.{ .name = "gdwarf-6" },
22742322.{ .name = "gdwarf-aranges" },
22752323.{ .name = "gembed-source" },
22762324.{ .name = "gen-cdb-fragment-path", .syntax = .separate },
......@@ -2289,6 +2337,7 @@
22892337.{ .name = "glldb" },
22902338.{ .name = "gmlt" },
22912339.{ .name = "gmodules" },
2340.{ .name = "gno-call-site-info" },
22922341.{ .name = "gno-codeview-command-line" },
22932342.{ .name = "gno-codeview-ghash" },
22942343.{ .name = "gno-column-info" },
......@@ -2303,6 +2352,7 @@
23032352.{ .name = "gno-simple-template-names" },
23042353.{ .name = "gno-split-dwarf" },
23052354.{ .name = "gno-strict-dwarf" },
2355.{ .name = "gno-structor-decl-linkage-names" },
23062356.{ .name = "gno-template-alias" },
23072357.{ .name = "gomit-unreferenced-methods" },
23082358.{
......@@ -2319,9 +2369,15 @@
23192369.{ .name = "gpulibc" },
23202370.{ .name = "grecord-command-line" },
23212371.{ .name = "gsce" },
2372.{
2373 .name = "gsframe",
2374 .pd1 = false,
2375 .pd2 = true,
2376},
23222377.{ .name = "gsimple-template-names" },
23232378.{ .name = "gsplit-dwarf" },
23242379.{ .name = "gstrict-dwarf" },
2380.{ .name = "gstructor-decl-linkage-names" },
23252381.{ .name = "gtemplate-alias" },
23262382.{ .name = "gtoggle" },
23272383.{ .name = "gused" },
......@@ -2347,6 +2403,7 @@
23472403 .pd1 = false,
23482404 .pd2 = true,
23492405},
2406.{ .name = "hlsl-all-resources-bound", .psl = true },
23502407.{ .name = "ibuiltininc" },
23512408.{ .name = "ignore-pch" },
23522409.{ .name = "image_base", .syntax = .separate },
......@@ -2397,6 +2454,7 @@
23972454.{ .name = "maix-struct-return" },
23982455.{ .name = "malign-double" },
23992456.{ .name = "maltivec", .ze = .m },
2457.{ .name = "mamdgpu-expand-waitcnt-profiling" },
24002458.{ .name = "mamdgpu-ieee" },
24012459.{ .name = "mamdgpu-precise-memory-op" },
24022460.{ .name = "mamx-avx512", .ze = .m },
......@@ -2408,7 +2466,6 @@
24082466.{ .name = "mamx-movrs", .ze = .m },
24092467.{ .name = "mamx-tf32", .ze = .m },
24102468.{ .name = "mamx-tile", .ze = .m },
2411.{ .name = "mamx-transpose", .ze = .m },
24122469.{ .name = "mannotate-tablejump" },
24132470.{ .name = "mapx-inline-asm-use-gpr32" },
24142471.{ .name = "mapxf" },
......@@ -2418,11 +2475,7 @@
24182475.{ .name = "matomics", .ze = .m },
24192476.{ .name = "mavx", .ze = .m },
24202477.{ .name = "mavx10.1" },
2421.{ .name = "mavx10.1-256" },
2422.{ .name = "mavx10.1-512", .ze = .m },
24232478.{ .name = "mavx10.2" },
2424.{ .name = "mavx10.2-256" },
2425.{ .name = "mavx10.2-512", .ze = .m },
24262479.{ .name = "mavx2", .ze = .m },
24272480.{ .name = "mavx512bf16", .ze = .m },
24282481.{ .name = "mavx512bitalg", .ze = .m },
......@@ -2485,7 +2538,6 @@
24852538.{ .name = "menable-no-nans" },
24862539.{ .name = "menqcmd", .ze = .m },
24872540.{ .name = "metal", .psl = true },
2488.{ .name = "mevex512", .ze = .m },
24892541.{ .name = "mexception-handling", .ze = .m },
24902542.{ .name = "mexecute-only", .ze = .m },
24912543.{ .name = "mextended-const", .ze = .m },
......@@ -2517,6 +2569,7 @@
25172569.{ .name = "mfsgsbase", .ze = .m },
25182570.{ .name = "mfsmuld" },
25192571.{ .name = "mfxsr", .ze = .m },
2572.{ .name = "mgc" },
25202573.{ .name = "mgeneral-regs-only" },
25212574.{ .name = "mgfni", .ze = .m },
25222575.{ .name = "mginv", .ze = .m },
......@@ -2614,6 +2667,7 @@
26142667.{ .name = "mno-adx", .ze = .m },
26152668.{ .name = "mno-aes", .ze = .m },
26162669.{ .name = "mno-altivec", .ze = .m },
2670.{ .name = "mno-amdgpu-expand-waitcnt-profiling" },
26172671.{ .name = "mno-amdgpu-ieee" },
26182672.{ .name = "mno-amdgpu-precise-memory-op" },
26192673.{ .name = "mno-amx-avx512", .ze = .m },
......@@ -2625,14 +2679,11 @@
26252679.{ .name = "mno-amx-movrs", .ze = .m },
26262680.{ .name = "mno-amx-tf32", .ze = .m },
26272681.{ .name = "mno-amx-tile", .ze = .m },
2628.{ .name = "mno-amx-transpose", .ze = .m },
26292682.{ .name = "mno-annotate-tablejump" },
26302683.{ .name = "mno-apxf" },
26312684.{ .name = "mno-atomics", .ze = .m },
26322685.{ .name = "mno-avx", .ze = .m },
26332686.{ .name = "mno-avx10.1" },
2634.{ .name = "mno-avx10.1-256" },
2635.{ .name = "mno-avx10.1-512", .ze = .m },
26362687.{ .name = "mno-avx10.2" },
26372688.{ .name = "mno-avx2", .ze = .m },
26382689.{ .name = "mno-avx512bf16", .ze = .m },
......@@ -2682,7 +2733,6 @@
26822733.{ .name = "mno-dspr2", .ze = .m },
26832734.{ .name = "mno-embedded-data" },
26842735.{ .name = "mno-enqcmd", .ze = .m },
2685.{ .name = "mno-evex512", .ze = .m },
26862736.{ .name = "mno-exception-handling", .ze = .m },
26872737.{ .name = "mnoexecstack" },
26882738.{ .name = "mno-execute-only", .ze = .m },
......@@ -2707,6 +2757,7 @@
27072757.{ .name = "mno-fsmuld", .ze = .m },
27082758.{ .name = "mno-fxsr", .ze = .m },
27092759.{ .name = "mno-gather" },
2760.{ .name = "mno-gc" },
27102761.{ .name = "mno-gfni", .ze = .m },
27112762.{ .name = "mno-ginv", .ze = .m },
27122763.{ .name = "mno-global-merge" },
......@@ -2798,6 +2849,7 @@
27982849.{ .name = "mno-relax-all" },
27992850.{ .name = "mno-relax-pic-calls" },
28002851.{ .name = "mno-relaxed-simd", .ze = .m },
2852.{ .name = "mno-reserve-frame-pointer-reg" },
28012853.{ .name = "mno-restrict-it" },
28022854.{ .name = "mno-retpoline", .ze = .m },
28032855.{ .name = "mno-retpoline-external-thunk", .ze = .m },
......@@ -2886,7 +2938,6 @@
28862938.{ .name = "module-file-deps" },
28872939.{ .name = "module-file-info" },
28882940.{ .name = "module-suffix", .syntax = .separate },
2889.{ .name = "fmodules-reduced-bmi" },
28902941.{ .name = "momit-leaf-frame-pointer" },
28912942.{ .name = "moutline" },
28922943.{ .name = "moutline-atomics", .ze = .m },
......@@ -2931,6 +2982,7 @@
29312982.{ .name = "mrelax-relocations=no" },
29322983.{ .name = "mrelaxed-simd", .ze = .m },
29332984.{ .name = "mrelocation-model", .syntax = .separate },
2985.{ .name = "mreserve-frame-pointer-reg" },
29342986.{ .name = "mrestrict-it" },
29352987.{ .name = "mretpoline", .ze = .m },
29362988.{ .name = "mretpoline-external-thunk", .ze = .m },
......@@ -3007,6 +3059,7 @@
30073059.{ .name = "mv73", .ze = .m },
30083060.{ .name = "mv75", .ze = .m },
30093061.{ .name = "mv79", .ze = .m },
3062.{ .name = "mv81" },
30103063.{ .name = "mv8plus", .ze = .m },
30113064.{ .name = "mvaes", .ze = .m },
30123065.{ .name = "mvector-strict-align" },
......@@ -3101,6 +3154,7 @@
31013154.{ .name = "no-pthread" },
31023155.{ .name = "no-round-trip-args" },
31033156.{ .name = "no-struct-path-tbaa" },
3157.{ .name = "no-use-spirv-backend" },
31043158.{
31053159 .name = "no-wasm-opt",
31063160 .pd1 = false,
......@@ -3311,6 +3365,7 @@
33113365.{ .name = "static-openmp" },
33123366.{ .name = "static-pie" },
33133367.{ .name = "stats-file-append" },
3368.{ .name = "stats-file-timers" },
33143369.{ .name = "stdlib" },
33153370.{
33163371 .name = "sycl-link",
......@@ -3368,6 +3423,7 @@
33683423.{ .name = "Wrealloc-lhs-all", .pd2 = true },
33693424.{ .name = "Wfrontend-loop-interchange", .pd2 = true },
33703425.{ .name = "Wtarget-lifetime", .pd2 = true },
3426.{ .name = "use-spirv-backend" },
33713427.{ .name = "v", .ze = .verbose },
33723428.{ .name = "vectorize-loops" },
33733429.{ .name = "vectorize-slp" },
......@@ -3469,6 +3525,7 @@
34693525.{ .name = "fobjc-nonfragile-abi-version=", .syntax = .joined },
34703526.{ .name = "fprofile-instrument-use-path=", .syntax = .joined },
34713527.{ .name = "fsanitize-coverage-allowlist=", .syntax = .joined },
3528.{ .name = "fsanitize-debug-trap-reasons=", .syntax = .joined },
34723529.{ .name = "fxray-instrumentation-bundle=", .syntax = .joined },
34733530.{ .name = "fsanitize-address-destructor=", .syntax = .joined },
34743531.{
......@@ -3567,6 +3624,8 @@
35673624.{ .name = "analyzer-disable-checker=", .syntax = .joined },
35683625.{ .name = "fbuild-session-timestamp=", .syntax = .joined },
35693626.{ .name = "fdo-concurrent-to-openmp=", .syntax = .joined },
3627.{ .name = "fdx-rootsignature-define=", .syntax = .joined },
3628.{ .name = "fms-layout-compatibility=", .syntax = .joined },
35703629.{ .name = "fprofile-function-groups=", .syntax = .joined },
35713630.{ .name = "fprofile-instrument-path=", .syntax = .joined },
35723631.{ .name = "header-include-filtering=", .syntax = .joined },
......@@ -3589,11 +3648,13 @@
35893648.{ .name = "dump-minimization-hints=", .syntax = .joined },
35903649.{ .name = "fapinotes-swift-version=", .syntax = .joined },
35913650.{ .name = "fcomment-block-commands=", .syntax = .comma_joined },
3651.{ .name = "fintrinsic-modules-path=", .syntax = .joined },
35923652.{ .name = "flax-vector-conversions=", .syntax = .joined },
35933653.{ .name = "fmodules-embed-all-files", .syntax = .joined },
35943654.{ .name = "fmodules-prune-interval=", .syntax = .joined },
35953655.{ .name = "foverride-record-layout=", .syntax = .joined },
35963656.{ .name = "fprofile-instr-generate=", .syntax = .joined },
3657.{ .name = "fprofile-instrument-use=", .syntax = .joined },
35973658.{ .name = "fprofile-remapping-file=", .syntax = .joined },
35983659.{ .name = "fsanitize-coverage-type=", .syntax = .joined },
35993660.{ .name = "fsanitize-hwaddress-abi=", .syntax = .joined },
......@@ -3619,6 +3680,7 @@
36193680.{ .name = "fdebug-compilation-dir=", .syntax = .joined },
36203681.{ .name = "fdebug-default-version=", .syntax = .joined },
36213682.{ .name = "ffp-exception-behavior=", .syntax = .joined },
3683.{ .name = "finitial-counter-value=", .syntax = .joined },
36223684.{ .name = "fmacro-backtrace-limit=", .syntax = .joined },
36233685.{ .name = "fmax-array-constructor=", .syntax = .joined },
36243686.{ .name = "fmcdc-max-test-vectors=", .syntax = .joined },
......@@ -3640,6 +3702,7 @@
36403702.{ .name = "ffile-compilation-dir=", .syntax = .joined },
36413703.{ .name = "fgpu-inline-threshold=", .syntax = .joined },
36423704.{ .name = "finline-max-stacksize=", .syntax = .joined },
3705.{ .name = "fmatrix-memory-layout=", .syntax = .joined },
36433706.{ .name = "fmax-subrecord-length=", .syntax = .joined },
36443707.{ .name = "fmodules-ignore-macro=", .syntax = .joined },
36453708.{
......@@ -3732,6 +3795,7 @@
37323795.{ .name = "fms-omit-default-lib", .syntax = .joined },
37333796.{ .name = "fprofile-instrument=", .syntax = .joined },
37343797.{ .name = "fprofile-sample-use=", .syntax = .joined },
3798.{ .name = "fsanitize-kcfi-hash=", .syntax = .joined },
37353799.{ .name = "fstrict-flex-arrays=", .syntax = .joined },
37363800.{
37373801 .name = "hipstdpar-prim-path=",
......@@ -3817,6 +3881,7 @@
38173881 .pd1 = false,
38183882 .pd2 = true,
38193883},
3884.{ .name = "falloc-token-mode=", .syntax = .joined },
38203885.{ .name = "fbinutils-version=", .syntax = .joined },
38213886.{ .name = "fclang-abi-compat=", .syntax = .joined },
38223887.{ .name = "fcodegen-data-use=", .syntax = .joined },
......@@ -3865,6 +3930,7 @@
38653930 .pd2 = true,
38663931},
38673932.{ .name = "falign-functions=", .syntax = .joined },
3933.{ .name = "falloc-token-max=", .syntax = .joined },
38683934.{ .name = "fconstexpr-depth=", .syntax = .joined },
38693935.{ .name = "fconstexpr-steps=", .syntax = .joined },
38703936.{ .name = "ffile-prefix-map=", .syntax = .joined },
......@@ -3951,7 +4017,7 @@
39514017.{ .name = "mzos-hlq-csslib=", .syntax = .joined },
39524018.{
39534019 .name = "no-offload-arch=",
3954 .syntax = .joined,
4020 .syntax = .comma_joined,
39554021 .pd1 = false,
39564022 .pd2 = true,
39574023},
......@@ -4296,6 +4362,12 @@
42964362.{ .name = "inline-asm=", .syntax = .joined },
42974363.{ .name = "ivfsoverlay", .syntax = .joined_or_separate },
42984364.{ .name = "iwithprefix", .syntax = .joined_or_separate },
4365.{
4366 .name = "libclc-lib=",
4367 .syntax = .joined,
4368 .pd1 = false,
4369 .pd2 = true,
4370},
42994371.{ .name = "mfloat-abi=", .syntax = .joined },
43004372.{ .name = "plugin-arg-", .syntax = .joined_and_separate },
43014373.{
......@@ -4457,7 +4529,6 @@
44574529 .pd1 = false,
44584530 .pd2 = true,
44594531},
4460.{ .name = "fcoarray=", .syntax = .joined },
44614532.{ .name = "fconvert=", .syntax = .joined },
44624533.{ .name = "fc++-abi=", .syntax = .joined },
44634534.{ .name = "fextdirs=", .syntax = .joined },
......@@ -4782,6 +4853,11 @@
47824853 .syntax = .joined,
47834854 .psl = true,
47844855},
4856.{
4857 .name = "Frs",
4858 .syntax = .joined_or_separate,
4859 .psl = true,
4860},
47854861.{ .name = "gz=", .syntax = .joined },
47864862.{ .name = "A-", .syntax = .joined },
47874863.{ .name = "G=", .syntax = .joined },
src/codegen/c.zig+19-1
......@@ -3497,9 +3497,27 @@ fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info:
34973497 try w.writeAll(operation);
34983498 try w.writeAll("o_");
34993499 try f.dg.renderTypeForBuiltinFnName(w, scalar_ty);
3500 try w.writeAll("(&");
3500 try w.writeByte('(');
3501
3502 // '&dest', possibly preceded by a cast
3503 switch (zcu.intern_pool.indexToKey(scalar_ty.toIntern())) {
3504 .int_type => {}, // we already have a '[u]intX_t *'
3505 .simple_type => {
3506 // '&dest' will be something like a 'uintptr_t *', which might be a different C type to
3507 // the equivalent sized integer (e.g. 'uint64_t *'), so we need a cast. We don't need a
3508 // cast on the *operands* because they are passed by value (except for big integers,
3509 // where this issue doesn't exist because no "simple" int type needs bigint repr).
3510 try w.print("({s}int{d}_t *)", .{
3511 if (scalar_ty.isUnsignedInt(zcu)) "u" else "",
3512 scalar_ty.abiSize(zcu) * 8,
3513 });
3514 },
3515 else => unreachable,
3516 }
3517 try w.writeByte('&');
35013518 try f.writeCValueMember(w, local, .{ .field = 0 });
35023519 try v.elem(f, w);
3520
35033521 try w.writeAll(", ");
35043522 if (ref_arg) try w.writeByte('&');
35053523 try f.writeCValue(w, lhs, .other);
src/codegen/llvm.zig+15-35
......@@ -162,6 +162,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
162162 .{ .v9_4a, "v9.4a" },
163163 .{ .v9_5a, "v9.5a" },
164164 .{ .v9_6a, "v9.6a" },
165 .{ .v9_7a, "v9.7a" },
165166 }),
166167 .powerpc => subArchName(target, .powerpc, .{
167168 .{ .spe, "spe" },
......@@ -255,11 +256,15 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
255256 .none,
256257 .windows,
257258 => {},
258 .semver => |ver| try llvm_triple.print("{d}.{d}.{d}", .{
259 ver.min.major,
260 ver.min.minor,
261 ver.min.patch,
262 }),
259 .semver => |ver| if (target.os.tag == .wasi and ver.min.major == 0) {
260 try llvm_triple.print("p{d}", .{ver.min.minor});
261 } else {
262 try llvm_triple.print("{d}.{d}.{d}", .{
263 ver.min.major,
264 ver.min.minor,
265 ver.min.patch,
266 });
267 },
263268 inline .linux, .hurd => |ver| try llvm_triple.print("{d}.{d}.{d}", .{
264269 ver.range.min.major,
265270 ver.range.min.minor,
......@@ -383,16 +388,9 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
383388 .powerpc => "E-m:e-p:32:32-Fn32-i64:64-n32",
384389 .powerpcle => "e-m:e-p:32:32-Fn32-i64:64-n32",
385390 .powerpc64 => switch (target.os.tag) {
386 .linux => if (target.abi.isMusl())
387 "E-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512"
388 else
389 "E-m:e-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512",
391 .linux => "E-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512",
390392 .ps3 => "E-m:e-p:32:32-Fi64-i64:64-i128:128-n32:64",
391 else => if (target.os.tag == .openbsd or
392 (target.os.tag == .freebsd and target.os.version_range.semver.isAtLeast(.{ .major = 13, .minor = 0, .patch = 0 }) orelse false))
393 "E-m:e-Fn32-i64:64-i128:128-n32:64"
394 else
395 "E-m:e-Fi64-i64:64-i128:128-n32:64",
393 else => "E-m:e-Fn32-i64:64-i128:128-n32:64",
396394 },
397395 .powerpc64le => if (target.os.tag == .linux)
398396 "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512"
......@@ -400,7 +398,7 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
400398 "e-m:e-Fn32-i64:64-i128:128-n32:64",
401399 .nvptx => "e-p:32:32-p6:32:32-p7:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64",
402400 .nvptx64 => "e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64",
403 .amdgcn => "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9",
401 .amdgcn => "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9",
404402 .riscv32 => if (target.cpu.has(.riscv, .e))
405403 "e-m:e-p:32:32-i64:64-n32-S32"
406404 else
......@@ -1748,6 +1746,7 @@ pub const Object = struct {
17481746 if (name.eqlSlice("WinMainCRTStartup", ip)) flags.winmain_crt_startup = true;
17491747 if (name.eqlSlice("wWinMainCRTStartup", ip)) flags.wwinmain_crt_startup = true;
17501748 if (name.eqlSlice("DllMainCRTStartup", ip)) flags.dllmain_crt_startup = true;
1749 if (name.eqlSlice("_DllMainCRTStartup", ip)) flags.dllmain_crt_startup = true;
17511750 }
17521751 }
17531752
......@@ -4652,20 +4651,6 @@ fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, targ
46524651/// or if it produces miscompilations.
46534652pub fn backendSupportsF16(target: *const std.Target) bool {
46544653 return switch (target.cpu.arch) {
4655 // https://github.com/llvm/llvm-project/issues/97981
4656 .csky,
4657 // https://github.com/llvm/llvm-project/issues/97981
4658 .powerpc,
4659 .powerpcle,
4660 .powerpc64,
4661 .powerpc64le,
4662 // https://github.com/llvm/llvm-project/issues/97981
4663 .wasm32,
4664 .wasm64,
4665 // https://github.com/llvm/llvm-project/issues/97981
4666 .sparc,
4667 .sparc64,
4668 => false,
46694654 .arm,
46704655 .armeb,
46714656 .thumb,
......@@ -4692,11 +4677,6 @@ pub fn backendSupportsF128(target: *const std.Target) bool {
46924677 return switch (target.cpu.arch) {
46934678 // https://github.com/llvm/llvm-project/issues/121122
46944679 .amdgcn,
4695 // Test failures all over the place.
4696 .mips64,
4697 .mips64el,
4698 // https://github.com/llvm/llvm-project/issues/41838
4699 .sparc,
47004680 => false,
47014681 .arm,
47024682 .armeb,
......@@ -4839,7 +4819,7 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
48394819 bindings.LLVMInitializeXtensaTarget();
48404820 bindings.LLVMInitializeXtensaTargetInfo();
48414821 bindings.LLVMInitializeXtensaTargetMC();
4842 // There is no LLVMInitializeXtensaAsmPrinter function.
4822 bindings.LLVMInitializeXtensaAsmPrinter();
48434823 bindings.LLVMInitializeXtensaAsmParser();
48444824 }
48454825 },
src/codegen/llvm/FuncGen.zig+4-4
......@@ -6630,11 +6630,11 @@ const ParamTypeIterator = struct {
66306630 } else if (isByRef(ty, zcu)) {
66316631 return .byref;
66326632 } else if (target.cpu.arch.isX86() and
6633 !target.cpu.has(.x86, .evex512) and
6633 !target.cpu.has(.x86, .avx512f) and
66346634 ty.totalVectorBits(zcu) >= 512)
66356635 {
66366636 // As of LLVM 18, passing a vector byval with fastcc that is 512 bits or more returns
6637 // "512-bit vector arguments require 'evex512' for AVX512"
6637 // "512-bit vector arguments require 'avx512f' for AVX512"
66386638 return .byref;
66396639 } else {
66406640 return .byval;
......@@ -6903,11 +6903,11 @@ fn returnTypeByRef(zcu: *Zcu, target: *const std.Target, ty: Type) bool {
69036903 if (isByRef(ty, zcu)) {
69046904 return true;
69056905 } else if (target.cpu.arch.isX86() and
6906 !target.cpu.has(.x86, .evex512) and
6906 !target.cpu.has(.x86, .avx512f) and
69076907 ty.totalVectorBits(zcu) >= 512)
69086908 {
69096909 // As of LLVM 18, passing a vector byval with fastcc that is 512 bits or more returns
6910 // "512-bit vector arguments require 'evex512' for AVX512"
6910 // "512-bit vector arguments require 'avx512f' for AVX512"
69116911 return true;
69126912 } else {
69136913 return false;
src/codegen/llvm/bindings.zig+1
......@@ -279,6 +279,7 @@ pub extern fn LLVMInitializeSystemZAsmPrinter() void;
279279pub extern fn LLVMInitializeWebAssemblyAsmPrinter() void;
280280pub extern fn LLVMInitializeX86AsmPrinter() void;
281281pub extern fn LLVMInitializeXCoreAsmPrinter() void;
282pub extern fn LLVMInitializeXtensaAsmPrinter() void;
282283pub extern fn LLVMInitializeM68kAsmPrinter() void;
283284pub extern fn LLVMInitializeVEAsmPrinter() void;
284285pub extern fn LLVMInitializeARCAsmPrinter() void;
src/libs/libcxx.zig+14-5
......@@ -538,11 +538,20 @@ pub fn addCxxArgs(
538538 // Compilation.addCCArgs. This option makes it use serial backend which
539539 // is simple and works everywhere.
540540 try cflags.append("-D_LIBCPP_PSTL_BACKEND_SERIAL");
541 try cflags.append(switch (optimize_mode) {
542 .Debug => "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG",
543 .ReleaseFast, .ReleaseSmall => "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE",
544 .ReleaseSafe => "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
545 });
541 switch (optimize_mode) {
542 .Debug => {
543 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG");
544 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");
545 },
546 .ReleaseFast, .ReleaseSmall => {
547 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE");
548 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_IGNORE");
549 },
550 .ReleaseSafe => {
551 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST");
552 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");
553 },
554 }
546555 if (target.isGnuLibC()) {
547556 // glibc 2.16 introduced aligned_alloc
548557 if (target.os.versionRange().gnuLibCVersion().?.order(.{ .major = 2, .minor = 16, .patch = 0 }) == .lt) {
src/link/Lld.zig+3-12
......@@ -637,17 +637,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {
637637 try argv.append("-ALTERNATENAME:__image_base__=__ImageBase");
638638 }
639639
640 if (is_dyn_lib) {
641 try argv.append(try comp.crtFileAsString(arena, "dllcrt2.obj"));
642 if (target.cpu.arch == .x86) {
643 try argv.append("-ALTERNATENAME:__DllMainCRTStartup@12=_DllMainCRTStartup@12");
644 } else {
645 try argv.append("-ALTERNATENAME:_DllMainCRTStartup=DllMainCRTStartup");
646 }
647 } else {
648 try argv.append(try comp.crtFileAsString(arena, "crt2.obj"));
649 }
650
640 try argv.append(try comp.crtFileAsString(arena, if (is_dyn_lib) "dllcrt2.obj" else "crt2.obj"));
651641 try argv.append(try comp.crtFileAsString(arena, "libmingw32.lib"));
652642 } else {
653643 try argv.append(switch (comp.config.link_mode) {
......@@ -812,7 +802,8 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
812802 target.cpu.arch == .m68k or
813803 target.cpu.arch.isSPARC() or
814804 target.cpu.arch == .ve or
815 target.cpu.arch == .xcore))
805 target.cpu.arch == .xcore or
806 target.cpu.arch == .xtensa))
816807 {
817808 // In this case we must do a simple file copy
818809 // here. TODO: think carefully about how we can avoid this redundant operation when doing
src/link/Wasm.zig+3
......@@ -2829,6 +2829,7 @@ pub const Feature = packed struct(u8) {
28292829 @"exception-handling",
28302830 @"extended-const",
28312831 fp16,
2832 gc,
28322833 memory64,
28332834 multimemory,
28342835 multivalue,
......@@ -2852,6 +2853,7 @@ pub const Feature = packed struct(u8) {
28522853 .exception_handling => .@"exception-handling",
28532854 .extended_const => .@"extended-const",
28542855 .fp16 => .fp16,
2856 .gc => .gc,
28552857 .multimemory => .multimemory,
28562858 .multivalue => .multivalue,
28572859 .mutable_globals => .@"mutable-globals",
......@@ -2875,6 +2877,7 @@ pub const Feature = packed struct(u8) {
28752877 .@"exception-handling" => .exception_handling,
28762878 .@"extended-const" => .extended_const,
28772879 .fp16 => .fp16,
2880 .gc => .gc,
28782881 .memory64 => null, // Linker-only feature.
28792882 .multimemory => .multimemory,
28802883 .multivalue => .multivalue,
src/main.zig+5-2
......@@ -977,6 +977,11 @@ fn buildOutputType(
977977 var cc_argv: std.ArrayList([]const u8) = .empty;
978978 var deps: std.ArrayList(CliModule.Dep) = .empty;
979979
980 // We need to raise the FD limit *before* CLI parsing, because we open link inputs during CLI
981 // parsing (in `createModule`), so a large number of link inputs could push us past the limit on
982 // targets with a low soft limit (e.g. macOS has a default limit of 256).
983 process.raiseFileDescriptorLimit();
984
980985 // Contains every module specified via -M. The dependencies are added
981986 // after argument parsing is completed. We use a StringArrayHashMap to make
982987 // error output consistent. "root" is special.
......@@ -3534,8 +3539,6 @@ fn buildOutputType(
35343539 break :b .whole;
35353540 };
35363541
3537 process.raiseFileDescriptorLimit();
3538
35393542 var file_system_inputs: std.ArrayList(u8) = .empty;
35403543 defer file_system_inputs.deinit(gpa);
35413544
src/target.zig+5-3
......@@ -227,11 +227,11 @@ pub fn hasLlvmSupport(target: *const std.Target, ofmt: std.Target.ObjectFormat)
227227 .wasm32,
228228 .wasm64,
229229 .ve,
230 .xtensa,
230231 => true,
231232
232233 // LLVM backend exists but can produce neither assembly nor object files.
233234 .csky,
234 .xtensa,
235235 => false,
236236
237237 // Third-party LLVM backend exists.
......@@ -388,6 +388,8 @@ pub fn hasDebugInfo(target: *const std.Target) bool {
388388 .ptx85,
389389 .ptx86,
390390 .ptx87,
391 .ptx88,
392 .ptx90,
391393 }),
392394 .bpfel, .bpfeb => false,
393395 else => true,
......@@ -684,8 +686,8 @@ pub fn llvmMachineAbi(target: *const std.Target) ?[:0]const u8 {
684686 else => "lp64d",
685687 },
686688 .loongarch32 => switch (target.abi) {
687 .gnusf => "ilp32s",
688 .gnuf32 => "ilp32f",
689 .gnusf, .muslsf => "ilp32s",
690 .gnuf32, .muslf32 => "ilp32f",
689691 else => "ilp32d",
690692 },
691693 .mips, .mipsel => "o32",
src/zig_clang_cc1_main.cpp+26-27
......@@ -12,19 +12,20 @@
1212//
1313//===----------------------------------------------------------------------===//
1414
15#include "clang/Basic/DiagnosticFrontend.h"
1516#include "clang/Basic/Stack.h"
1617#include "clang/Basic/TargetOptions.h"
1718#include "clang/CodeGen/ObjectFilePCHContainerWriter.h"
1819#include "clang/Config/config.h"
20#include "clang/Driver/Driver.h"
1921#include "clang/Driver/DriverDiagnostic.h"
20#include "clang/Driver/Options.h"
2122#include "clang/Frontend/CompilerInstance.h"
2223#include "clang/Frontend/CompilerInvocation.h"
23#include "clang/Frontend/FrontendDiagnostic.h"
2424#include "clang/Frontend/TextDiagnosticBuffer.h"
2525#include "clang/Frontend/TextDiagnosticPrinter.h"
2626#include "clang/Frontend/Utils.h"
2727#include "clang/FrontendTool/Utils.h"
28#include "clang/Options/Options.h"
2829#include "clang/Serialization/ObjectFilePCHContainerReader.h"
2930#include "llvm/ADT/Statistic.h"
3031#include "llvm/ADT/StringExtras.h"
......@@ -38,6 +39,7 @@
3839#include "llvm/Support/BuryPointer.h"
3940#include "llvm/Support/Compiler.h"
4041#include "llvm/Support/ErrorHandling.h"
42#include "llvm/Support/IOSandbox.h"
4143#include "llvm/Support/ManagedStatic.h"
4244#include "llvm/Support/Path.h"
4345#include "llvm/Support/Process.h"
......@@ -217,7 +219,7 @@ static int PrintEnabledExtensions(const TargetOptions& TargetOpts) {
217219int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
218220 ensureSufficientStack();
219221
220 IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
222 IntrusiveRefCntPtr<DiagnosticIDs> DiagID = DiagnosticIDs::create();
221223
222224 // Register the support for object-file-wrapped Clang modules.
223225 auto PCHOps = std::make_shared<PCHContainerOperations>();
......@@ -269,12 +271,17 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
269271 if (Clang->getHeaderSearchOpts().UseBuiltinIncludes &&
270272 Clang->getHeaderSearchOpts().ResourceDir.empty())
271273 Clang->getHeaderSearchOpts().ResourceDir =
272 CompilerInvocation::GetResourcesPath(Argv0, MainAddr);
274 GetResourcesPath(Argv0, MainAddr);
275
276 /// Create the actual file system.
277 auto VFS = [] {
278 auto BypassSandbox = llvm::sys::sandbox::scopedDisable();
279 return llvm::vfs::getRealFileSystem();
280 }();
281 Clang->createVirtualFileSystem(std::move(VFS), DiagsBuffer);
273282
274283 // Create the actual diagnostics engine.
275 Clang->createDiagnostics(*llvm::vfs::getRealFileSystem());
276 if (!Clang->hasDiagnostics())
277 return 1;
284 Clang->createDiagnostics();
278285
279286 // Set an error handler, so that any LLVM backend diagnostics go through our
280287 // error handler.
......@@ -299,29 +306,21 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
299306
300307 // If any timers were active but haven't been destroyed yet, print their
301308 // results now. This happens in -disable-free mode.
302 std::unique_ptr<raw_ostream> IOFile = llvm::CreateInfoOutputFile();
303 if (Clang->getCodeGenOpts().TimePassesJson) {
304 *IOFile << "{\n";
305 llvm::TimerGroup::printAllJSONValues(*IOFile, "");
306 *IOFile << "\n}\n";
307 } else {
308 llvm::TimerGroup::printAll(*IOFile);
309 {
310 // This isn't a formal input or output of the compiler.
311 auto BypassSandbox = llvm::sys::sandbox::scopedDisable();
312 std::unique_ptr<raw_ostream> IOFile = llvm::CreateInfoOutputFile();
313 if (Clang->getCodeGenOpts().TimePassesJson) {
314 *IOFile << "{\n";
315 llvm::TimerGroup::printAllJSONValues(*IOFile, "");
316 *IOFile << "\n}\n";
317 } else if (!Clang->getCodeGenOpts().TimePassesStatsFile) {
318 llvm::TimerGroup::printAll(*IOFile);
319 }
320 llvm::TimerGroup::clearAll();
309321 }
310 llvm::TimerGroup::clearAll();
311322
312323 if (llvm::timeTraceProfilerEnabled()) {
313 // It is possible that the compiler instance doesn't own a file manager here
314 // if we're compiling a module unit. Since the file manager are owned by AST
315 // when we're compiling a module unit. So the file manager may be invalid
316 // here.
317 //
318 // It should be fine to create file manager here since the file system
319 // options are stored in the compiler invocation and we can recreate the VFS
320 // from the compiler invocation.
321 if (!Clang->hasFileManager())
322 Clang->createFileManager(createVFSFromCompilerInvocation(
323 Clang->getInvocation(), Clang->getDiagnostics()));
324
325324 if (auto profilerOutput = Clang->createOutputFile(
326325 Clang->getFrontendOpts().TimeTracePath, /*Binary=*/false,
327326 /*RemoveFileOnSignal=*/false,
src/zig_clang_cc1as_main.cpp+48-27
......@@ -12,12 +12,12 @@
1212//===----------------------------------------------------------------------===//
1313
1414#include "clang/Basic/Diagnostic.h"
15#include "clang/Basic/DiagnosticFrontend.h"
1516#include "clang/Basic/DiagnosticOptions.h"
1617#include "clang/Driver/DriverDiagnostic.h"
17#include "clang/Driver/Options.h"
18#include "clang/Frontend/FrontendDiagnostic.h"
1918#include "clang/Frontend/TextDiagnosticPrinter.h"
2019#include "clang/Frontend/Utils.h"
20#include "clang/Options/Options.h"
2121#include "llvm/ADT/STLExtras.h"
2222#include "llvm/ADT/StringExtras.h"
2323#include "llvm/ADT/StringSwitch.h"
......@@ -45,6 +45,7 @@
4545#include "llvm/Support/ErrorHandling.h"
4646#include "llvm/Support/FileSystem.h"
4747#include "llvm/Support/FormattedStream.h"
48#include "llvm/Support/IOSandbox.h"
4849#include "llvm/Support/MemoryBuffer.h"
4950#include "llvm/Support/Path.h"
5051#include "llvm/Support/Process.h"
......@@ -59,8 +60,7 @@
5960#include <optional>
6061#include <system_error>
6162using namespace clang;
62using namespace clang::driver;
63using namespace clang::driver::options;
63using namespace clang::options;
6464using namespace llvm;
6565using namespace llvm::opt;
6666
......@@ -71,8 +71,8 @@ struct AssemblerInvocation {
7171 /// @name Target Options
7272 /// @{
7373
74 /// The name of the target triple to assemble for.
75 std::string Triple;
74 /// The target triple to assemble for.
75 llvm::Triple Triple;
7676
7777 /// If given, the name of the target CPU to determine which instructions
7878 /// are legal.
......@@ -163,6 +163,10 @@ struct AssemblerInvocation {
163163 LLVM_PREFERRED_TYPE(bool)
164164 unsigned EmitCompactUnwindNonCanonical : 1;
165165
166 // Whether to emit sframe unwind sections.
167 LLVM_PREFERRED_TYPE(bool)
168 unsigned EmitSFrameUnwind : 1;
169
166170 LLVM_PREFERRED_TYPE(bool)
167171 unsigned Crel : 1;
168172 LLVM_PREFERRED_TYPE(bool)
......@@ -192,9 +196,12 @@ struct AssemblerInvocation {
192196 std::string AsSecureLogFile;
193197 /// @}
194198
199 void setTriple(llvm::StringRef Str) {
200 Triple = llvm::Triple(llvm::Triple::normalize(Str));
201 }
202
195203public:
196204 AssemblerInvocation() {
197 Triple = "";
198205 NoInitialTextSection = 0;
199206 InputFile = "-";
200207 OutputPath = "-";
......@@ -261,7 +268,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
261268 // Construct the invocation.
262269
263270 // Target Options
264 Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
271 Opts.setTriple(Args.getLastArgValue(OPT_triple));
265272 if (Arg *A = Args.getLastArg(options::OPT_darwin_target_variant_triple))
266273 Opts.DarwinTargetVariantTriple = llvm::Triple(A->getValue());
267274 if (Arg *A = Args.getLastArg(OPT_darwin_target_variant_sdk_version_EQ)) {
......@@ -278,7 +285,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
278285
279286 // Use the default target triple if unspecified.
280287 if (Opts.Triple.empty())
281 Opts.Triple = llvm::sys::getDefaultTargetTriple();
288 Opts.setTriple(llvm::sys::getDefaultTargetTriple());
282289
283290 // Language Options
284291 Opts.IncludePaths = Args.getAllArgValues(OPT_I);
......@@ -385,6 +392,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
385392
386393 Opts.EmitCompactUnwindNonCanonical =
387394 Args.hasArg(OPT_femit_compact_unwind_non_canonical);
395 Opts.EmitSFrameUnwind = Args.hasArg(OPT_gsframe);
388396 Opts.Crel = Args.hasArg(OPT_crel);
389397 Opts.ImplicitMapsyms = Args.hasArg(OPT_mmapsyms_implicit);
390398 Opts.X86RelaxRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
......@@ -414,15 +422,19 @@ getOutputStream(StringRef Path, DiagnosticsEngine &Diags, bool Binary) {
414422}
415423
416424static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
417 DiagnosticsEngine &Diags) {
425 DiagnosticsEngine &Diags,
426 IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
418427 // Get the target specific parser.
419428 std::string Error;
420429 const Target *TheTarget = TargetRegistry::lookupTarget(Opts.Triple, Error);
421430 if (!TheTarget)
422 return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple;
431 return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str();
423432
424 ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer =
425 MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true);
433 ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer = [&] {
434 // FIXME(sandboxing): Make this a proper input file.
435 auto BypassSandbox = sys::sandbox::scopedDisable();
436 return MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true);
437 }();
426438
427439 if (std::error_code EC = Buffer.getError()) {
428440 return Diags.Report(diag::err_fe_error_reading)
......@@ -437,6 +449,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
437449 // Record the location of the include directories so that the lexer can find
438450 // it later.
439451 SrcMgr.setIncludeDirs(Opts.IncludePaths);
452 SrcMgr.setVirtualFileSystem(VFS);
440453
441454 std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(Opts.Triple));
442455 assert(MRI && "Unable to create target register info!");
......@@ -445,11 +458,13 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
445458 MCOptions.MCRelaxAll = Opts.RelaxAll;
446459 MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
447460 MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
461 MCOptions.EmitSFrameUnwind = Opts.EmitSFrameUnwind;
448462 MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels;
449463 MCOptions.Crel = Opts.Crel;
450464 MCOptions.ImplicitMapSyms = Opts.ImplicitMapsyms;
451465 MCOptions.X86RelaxRelocations = Opts.X86RelaxRelocations;
452466 MCOptions.X86Sse2Avx = Opts.X86Sse2Avx;
467 MCOptions.MCNoExecStack = Opts.NoExecStack;
453468 MCOptions.CompressDebugSections = Opts.CompressDebugSections;
454469 MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
455470
......@@ -477,7 +492,10 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
477492
478493 std::unique_ptr<MCSubtargetInfo> STI(
479494 TheTarget->createMCSubtargetInfo(Opts.Triple, Opts.CPU, FS));
480 assert(STI && "Unable to create subtarget info!");
495 if (!STI) {
496 return Diags.Report(diag::err_fe_unable_to_create_subtarget)
497 << Opts.CPU << FS.empty() << FS;
498 }
481499
482500 MCContext Ctx(Triple(Opts.Triple), MAI.get(), MRI.get(), STI.get(), &SrcMgr,
483501 &MCOptions);
......@@ -509,9 +527,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
509527 Ctx.setCompilationDir(Opts.DebugCompilationDir);
510528 else {
511529 // If no compilation dir is set, try to use the current directory.
512 SmallString<128> CWD;
513 if (!sys::fs::current_path(CWD))
514 Ctx.setCompilationDir(CWD);
530 if (auto CWD = VFS->getCurrentWorkingDirectory())
531 Ctx.setCompilationDir(*CWD);
515532 }
516533 if (!Opts.DebugPrefixMap.empty())
517534 for (const auto &KV : Opts.DebugPrefixMap)
......@@ -577,7 +594,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
577594 Triple T(Opts.Triple);
578595 Str.reset(TheTarget->createMCObjectStreamer(
579596 T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
580 Str->initSections(Opts.NoExecStack, *STI);
581597 if (T.isOSBinFormatMachO() && T.isOSDarwin()) {
582598 Triple *TVT = Opts.DarwinTargetVariantTriple
583599 ? &*Opts.DarwinTargetVariantTriple
......@@ -605,7 +621,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
605621 std::unique_ptr<MCTargetAsmParser> TAP(
606622 TheTarget->createMCAsmParser(*STI, *Parser, *MCII, MCOptions));
607623 if (!TAP)
608 Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple;
624 Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str();
609625
610626 // Set values for symbols, if any.
611627 for (auto &S : Opts.SymbolDefs) {
......@@ -627,8 +643,9 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
627643}
628644
629645static bool ExecuteAssembler(AssemblerInvocation &Opts,
630 DiagnosticsEngine &Diags) {
631 bool Failed = ExecuteAssemblerImpl(Opts, Diags);
646 DiagnosticsEngine &Diags,
647 IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
648 bool Failed = ExecuteAssemblerImpl(Opts, Diags, VFS);
632649
633650 // Delete output file if there were errors.
634651 if (Failed) {
......@@ -662,8 +679,12 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
662679 TextDiagnosticPrinter *DiagClient =
663680 new TextDiagnosticPrinter(errs(), DiagOpts);
664681 DiagClient->setPrefix("clang -cc1as");
665 IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
666 DiagnosticsEngine Diags(DiagID, DiagOpts, DiagClient);
682 DiagnosticsEngine Diags(DiagnosticIDs::create(), DiagOpts, DiagClient);
683
684 auto VFS = [] {
685 auto BypassSandbox = sys::sandbox::scopedDisable();
686 return vfs::getRealFileSystem();
687 }();
667688
668689 // Set an error handler, so that any LLVM backend diagnostics go through our
669690 // error handler.
......@@ -679,8 +700,7 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
679700 getDriverOptTable().printHelp(
680701 llvm::outs(), "clang -cc1as [options] file...",
681702 "Clang Integrated Assembler", /*ShowHidden=*/false,
682 /*ShowAllAliases=*/false,
683 llvm::opt::Visibility(driver::options::CC1AsOption));
703 /*ShowAllAliases=*/false, llvm::opt::Visibility(options::CC1AsOption));
684704
685705 return 0;
686706 }
......@@ -703,11 +723,12 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
703723 for (unsigned i = 0; i != NumArgs; ++i)
704724 Args[i + 1] = Asm.LLVMArgs[i].c_str();
705725 Args[NumArgs + 1] = nullptr;
706 llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get());
726 llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get(), /*Overview=*/"",
727 /*Errs=*/nullptr, /*VFS=*/VFS.get());
707728 }
708729
709730 // Execute the invocation, unless there were parsing errors.
710 bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags);
731 bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags, VFS);
711732
712733 // If any timers were active but haven't been destroyed yet, print their
713734 // results now.
src/zig_clang_driver.cpp+22-14
......@@ -18,13 +18,13 @@
1818#include "clang/Config/config.h"
1919#include "clang/Driver/Compilation.h"
2020#include "clang/Driver/DriverDiagnostic.h"
21#include "clang/Driver/Options.h"
2221#include "clang/Driver/ToolChain.h"
2322#include "clang/Frontend/ChainedDiagnosticConsumer.h"
2423#include "clang/Frontend/CompilerInvocation.h"
2524#include "clang/Frontend/SerializedDiagnosticPrinter.h"
2625#include "clang/Frontend/TextDiagnosticPrinter.h"
2726#include "clang/Frontend/Utils.h"
27#include "clang/Options/Options.h"
2828#include "llvm/ADT/ArrayRef.h"
2929#include "llvm/ADT/SmallString.h"
3030#include "llvm/ADT/SmallVector.h"
......@@ -38,6 +38,7 @@
3838#include "llvm/Support/CrashRecoveryContext.h"
3939#include "llvm/Support/ErrorHandling.h"
4040#include "llvm/Support/FileSystem.h"
41#include "llvm/Support/IOSandbox.h"
4142#include "llvm/Support/LLVMDriver.h"
4243#include "llvm/Support/Path.h"
4344#include "llvm/Support/PrettyStackTrace.h"
......@@ -201,7 +202,8 @@ static void FixupDiagPrefixExeName(TextDiagnosticPrinter *DiagClient,
201202}
202203
203204static int ExecuteCC1Tool(SmallVectorImpl<const char *> &ArgV,
204 const llvm::ToolContext &ToolContext) {
205 const llvm::ToolContext &ToolContext,
206 IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
205207 // If we call the cc1 tool from the clangDriver library (through
206208 // Driver::CC1Main), we need to clean up the options usage count. The options
207209 // are currently global, and they might have been used previously by the
......@@ -209,7 +211,8 @@ static int ExecuteCC1Tool(SmallVectorImpl<const char *> &ArgV,
209211 llvm::cl::ResetAllOptionOccurrences();
210212
211213 llvm::BumpPtrAllocator A;
212 llvm::cl::ExpansionContext ECtx(A, llvm::cl::TokenizeGNUCommandLine);
214 llvm::cl::ExpansionContext ECtx(A, llvm::cl::TokenizeGNUCommandLine,
215 VFS.get());
213216 if (llvm::Error Err = ECtx.expandResponseFiles(ArgV)) {
214217 llvm::errs() << toString(std::move(Err)) << '\n';
215218 return 1;
......@@ -249,14 +252,22 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
249252 bool ClangCLMode =
250253 IsClangCL(getDriverMode(ProgName, llvm::ArrayRef(Args).slice(1)));
251254
252 if (llvm::Error Err = expandResponseFiles(Args, ClangCLMode, A)) {
255 auto VFS = llvm::vfs::getRealFileSystem();
256
257 if (llvm::Error Err = expandResponseFiles(Args, ClangCLMode, A, VFS.get())) {
253258 llvm::errs() << toString(std::move(Err)) << '\n';
254259 return 1;
255260 }
256261
257262 // Handle -cc1 integrated tools.
258 if (Args.size() >= 2 && StringRef(Args[1]).starts_with("-cc1"))
259 return ExecuteCC1Tool(Args, ToolContext);
263 if (Args.size() >= 2 && StringRef(Args[1]).starts_with("-cc1")) {
264 // Note that this only enables the sandbox for direct -cc1 invocations and
265 // out-of-process -cc1 invocations launched by the driver. For in-process
266 // -cc1 invocations launched by the driver, the sandbox is enabled in
267 // CC1Command::Execute() for better crash recovery.
268 auto EnableSandbox = llvm::sys::sandbox::scopedEnable();
269 return ExecuteCC1Tool(Args, ToolContext, VFS);
270 }
260271
261272 // Handle options that need handling before the real command line parsing in
262273 // Driver::BuildCompilation()
......@@ -326,9 +337,7 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
326337 new TextDiagnosticPrinter(llvm::errs(), *DiagOpts);
327338 FixupDiagPrefixExeName(DiagClient, ProgName);
328339
329 IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
330
331 DiagnosticsEngine Diags(DiagID, *DiagOpts, DiagClient);
340 DiagnosticsEngine Diags(DiagnosticIDs::create(), *DiagOpts, DiagClient);
332341
333342 if (!DiagOpts->DiagnosticSerializationFile.empty()) {
334343 auto SerializedConsumer =
......@@ -338,7 +347,6 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
338347 Diags.takeClient(), std::move(SerializedConsumer)));
339348 }
340349
341 auto VFS = llvm::vfs::getRealFileSystem();
342350 ProcessWarningOptions(Diags, *DiagOpts, *VFS, /*ReportDiags=*/false);
343351
344352 Driver TheDriver(Path, llvm::sys::getDefaultTargetTriple(), Diags,
......@@ -358,10 +366,10 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
358366 if (!SetBackdoorDriverOutputsFromEnvVars(TheDriver))
359367 return 1;
360368
361 auto ExecuteCC1WithContext =
362 [&ToolContext](SmallVectorImpl<const char *> &ArgV) {
363 return ExecuteCC1Tool(ArgV, ToolContext);
364 };
369 auto ExecuteCC1WithContext = [&ToolContext,
370 &VFS](SmallVectorImpl<const char *> &ArgV) {
371 return ExecuteCC1Tool(ArgV, ToolContext, VFS);
372 };
365373 if (!UseNewCC1Process) {
366374 TheDriver.CC1Main = ExecuteCC1WithContext;
367375 // Ensure the CC1Command actually catches cc1 crashes
src/zig_llvm-ar.cpp+1
......@@ -12,6 +12,7 @@
1212//===----------------------------------------------------------------------===//
1313
1414#include "llvm/ADT/StringExtras.h"
15#include "llvm/ADT/StringMap.h"
1516#include "llvm/ADT/StringSwitch.h"
1617#include "llvm/BinaryFormat/Magic.h"
1718#include "llvm/IR/LLVMContext.h"
src/zig_llvm.cpp+1-1
......@@ -439,7 +439,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
439439
440440void ZigLLVMSetOptBisectLimit(LLVMContextRef context_ref, int limit) {
441441 static OptBisect opt_bisect;
442 opt_bisect.setLimit(limit);
442 opt_bisect.setIntervals({0, limit});
443443 unwrap(context_ref)->setOptPassGate(opt_bisect);
444444}
445445
stage1/zig.h+354-1
......@@ -79,6 +79,9 @@
7979#elif defined(__I86__)
8080#define zig_x86_16
8181#define zig_x86
82#elif defined (__ez80)
83#define zig_ez80
84#define zig_z80
8285#endif
8386
8487#if defined(zig_msvc) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
......@@ -409,6 +412,8 @@
409412#define zig_trap() __asm__ volatile("int $0x3")
410413#elif defined(zig_x86)
411414#define zig_trap() __asm__ volatile("ud2")
415#elif defined(zig_z80)
416#define zig_trap() __asm__ volatile("rst 00h")
412417#else
413418#define zig_trap() zig_trap_unavailable
414419#endif
......@@ -511,7 +516,7 @@ zig_extern void *memcpy (void *zig_restrict, void const *zig_restrict, size_t);
511516zig_extern void *memset (void *, int, size_t);
512517zig_extern void *memmove (void *, void const *, size_t);
513518
514/* ================ Bool and 8/16/32/64-bit Integer Support ================= */
519/* ================ Bool and 8/16/24/32/48/64-bit Integer Support ================= */
515520
516521#include <limits.h>
517522
......@@ -590,6 +595,16 @@ typedef signed long long int16_t;
590595#define INT16_MAX ( INT16_C(0x7FFF))
591596#define UINT16_MAX ( INT16_C(0xFFFF))
592597
598#if defined(zig_ez80)
599typedef unsigned int uint24_t;
600typedef signed int int24_t;
601#define INT24_C(c) c
602#define UINT24_C(c) c##U
603#endif
604#define INT24_MIN (~INT24_C(0x7FFF))
605#define INT24_MAX ( INT24_C(0x7FFF))
606#define UINT24_MAX ( INT24_C(0xFFFF))
607
593608#if SCHAR_MIN == ~0x7FFFFFFF && SCHAR_MAX == 0x7FFFFFFF && UCHAR_MAX == 0xFFFFFFFF
594609typedef unsigned char uint32_t;
595610typedef signed char int32_t;
......@@ -620,6 +635,17 @@ typedef signed long long int32_t;
620635#define INT32_MAX ( INT32_C(0x7FFFFFFF))
621636#define UINT32_MAX ( INT32_C(0xFFFFFFFF))
622637
638#if defined(zig_ez80)
639typedef unsigned __int48 uint48_t;
640typedef signed __int48 int48_t;
641#define INT48_C(c) c
642/* no suffix */
643#define UINT48_C(c) ((uint48_t)(c))
644#endif
645#define INT48_MIN (~INT48_C(0x7FFFFFFFFFFF))
646#define INT48_MAX ( INT48_C(0x7FFFFFFFFFFF))
647#define UINT48_MAX ( INT48_C(0xFFFFFFFFFFFF))
648
623649#if SCHAR_MIN == ~0x7FFFFFFFFFFFFFFF && SCHAR_MAX == 0x7FFFFFFFFFFFFFFF && UCHAR_MAX == 0xFFFFFFFFFFFFFFFF
624650typedef unsigned char uint64_t;
625651typedef signed char int64_t;
......@@ -663,10 +689,18 @@ typedef ptrdiff_t intptr_t;
663689#define zig_maxInt_i16 INT16_MAX
664690#define zig_minInt_u16 UINT16_C(0)
665691#define zig_maxInt_u16 UINT16_MAX
692#define zig_minInt_i24 INT24_MIN
693#define zig_maxInt_i24 INT24_MAX
694#define zig_minInt_u24 UINT24_C(0)
695#define zig_maxInt_u24 UINT24_MAX
666696#define zig_minInt_i32 INT32_MIN
667697#define zig_maxInt_i32 INT32_MAX
668698#define zig_minInt_u32 UINT32_C(0)
669699#define zig_maxInt_u32 UINT32_MAX
700#define zig_minInt_i48 INT48_MIN
701#define zig_maxInt_i48 INT48_MAX
702#define zig_minInt_u48 UINT48_C(0)
703#define zig_maxInt_u48 UINT48_MAX
670704#define zig_minInt_i64 INT64_MIN
671705#define zig_maxInt_i64 INT64_MAX
672706#define zig_minInt_u64 UINT64_C(0)
......@@ -786,6 +820,17 @@ zig_int_helpers(16, unsigned long long)
786820#else
787821zig_int_helpers(16, uint16_t)
788822#endif
823#if defined(zig_ez80)
824#if UINT24_MAX <= UINT_MAX
825zig_int_helpers(24, unsigned int)
826#elif UINT24_MAX <= ULONG_MAX
827zig_int_helpers(24, unsigned long)
828#elif UINT24_MAX <= ULLONG_MAX
829zig_int_helpers(24, unsigned long long)
830#else
831zig_int_helpers(24, uint24_t)
832#endif
833#endif
789834#if UINT32_MAX <= UINT_MAX
790835zig_int_helpers(32, unsigned int)
791836#elif UINT32_MAX <= ULONG_MAX
......@@ -795,6 +840,17 @@ zig_int_helpers(32, unsigned long long)
795840#else
796841zig_int_helpers(32, uint32_t)
797842#endif
843#if defined(zig_ez80)
844#if UINT24_MAX <= UINT_MAX
845zig_int_helpers(48, unsigned int)
846#elif UINT24_MAX <= ULONG_MAX
847zig_int_helpers(48, unsigned long)
848#elif UINT24_MAX <= ULLONG_MAX
849zig_int_helpers(48, unsigned long long)
850#else
851zig_int_helpers(48, uint48_t)
852#endif
853#endif
798854#if UINT64_MAX <= UINT_MAX
799855zig_int_helpers(64, unsigned int)
800856#elif UINT64_MAX <= ULONG_MAX
......@@ -909,6 +965,66 @@ static inline bool zig_addo_i16(int16_t *res, int16_t lhs, int16_t rhs, uint8_t
909965#endif
910966}
911967
968#if defined(zig_ez80)
969static inline bool zig_addo_u24(uint24_t *res, uint24_t lhs, uint24_t rhs, uint8_t bits) {
970#if zig_has_builtin(add_overflow) || defined(zig_gcc)
971 uint24_t full_res;
972 bool overflow = __builtin_add_overflow(lhs, rhs, &full_res);
973 *res = zig_wrap_u24(full_res, bits);
974 return overflow || full_res < zig_minInt_u(24, bits) || full_res > zig_maxInt_u(24, bits);
975#else
976 uint32_t full_res;
977 bool overflow = zig_addo_u32(&full_res, lhs, rhs, bits);
978 *res = (uint24_t)full_res;
979 return overflow;
980#endif
981}
982
983static inline bool zig_addo_i24(int24_t *res, int24_t lhs, int24_t rhs, uint8_t bits) {
984#if zig_has_builtin(add_overflow) || defined(zig_gcc)
985 int24_t full_res;
986 bool overflow = __builtin_add_overflow(lhs, rhs, &full_res);
987 *res = zig_wrap_i24(full_res, bits);
988 return overflow || full_res < zig_minInt_i(24, bits) || full_res > zig_maxInt_i(24, bits);
989#else
990 int32_t full_res;
991 bool overflow = zig_addo_i32(&full_res, lhs, rhs, bits);
992 *res = (int24_t)full_res;
993 return overflow;
994#endif
995}
996#endif
997
998#if defined(zig_ez80)
999static inline bool zig_addo_u48(uint48_t *res, uint48_t lhs, uint48_t rhs, uint8_t bits) {
1000#if zig_has_builtin(add_overflow) || defined(zig_gcc)
1001 uint48_t full_res;
1002 bool overflow = __builtin_add_overflow(lhs, rhs, &full_res);
1003 *res = zig_wrap_u48(full_res, bits);
1004 return overflow || full_res < zig_minInt_u(48, bits) || full_res > zig_maxInt_u(48, bits);
1005#else
1006 uint64_t full_res;
1007 bool overflow = zig_addo_u64(&full_res, lhs, rhs, bits);
1008 *res = (uint48_t)full_res;
1009 return overflow;
1010#endif
1011}
1012
1013static inline bool zig_addo_i48(int48_t *res, int48_t lhs, int48_t rhs, uint8_t bits) {
1014#if zig_has_builtin(add_overflow) || defined(zig_gcc)
1015 int48_t full_res;
1016 bool overflow = __builtin_add_overflow(lhs, rhs, &full_res);
1017 *res = zig_wrap_i48(full_res, bits);
1018 return overflow || full_res < zig_minInt_i(48, bits) || full_res > zig_maxInt_i(48, bits);
1019#else
1020 int64_t full_res;
1021 bool overflow = zig_addo_i64(&full_res, lhs, rhs, bits);
1022 *res = (int48_t)full_res;
1023 return overflow;
1024#endif
1025}
1026#endif
1027
9121028static inline bool zig_subo_u32(uint32_t *res, uint32_t lhs, uint32_t rhs, uint8_t bits) {
9131029#if zig_has_builtin(sub_overflow) || defined(zig_gcc)
9141030 uint32_t full_res;
......@@ -933,6 +1049,7 @@ static inline bool zig_subo_i32(int32_t *res, int32_t lhs, int32_t rhs, uint8_t
9331049 return overflow || full_res < zig_minInt_i(32, bits) || full_res > zig_maxInt_i(32, bits);
9341050}
9351051
1052
9361053static inline bool zig_subo_u64(uint64_t *res, uint64_t lhs, uint64_t rhs, uint8_t bits) {
9371054#if zig_has_builtin(sub_overflow) || defined(zig_gcc)
9381055 uint64_t full_res;
......@@ -1013,6 +1130,66 @@ static inline bool zig_subo_i16(int16_t *res, int16_t lhs, int16_t rhs, uint8_t
10131130#endif
10141131}
10151132
1133#if defined(zig_ez80)
1134static inline bool zig_subo_u24(uint24_t *res, uint24_t lhs, uint24_t rhs, uint8_t bits) {
1135#if zig_has_builtin(sub_overflow) || defined(zig_gcc)
1136 uint24_t full_res;
1137 bool overflow = __builtin_sub_overflow(lhs, rhs, &full_res);
1138 *res = zig_wrap_u24(full_res, bits);
1139 return overflow || full_res < zig_minInt_u(24, bits) || full_res > zig_maxInt_u(24, bits);
1140#else
1141 uint32_t full_res;
1142 bool overflow = zig_subo_u32(&full_res, lhs, rhs, bits);
1143 *res = (uint24_t)full_res;
1144 return overflow;
1145#endif
1146}
1147
1148static inline bool zig_subo_i24(int24_t *res, int24_t lhs, int24_t rhs, uint8_t bits) {
1149#if zig_has_builtin(sub_overflow) || defined(zig_gcc)
1150 int24_t full_res;
1151 bool overflow = __builtin_sub_overflow(lhs, rhs, &full_res);
1152 *res = zig_wrap_i24(full_res, bits);
1153 return overflow || full_res < zig_minInt_i(24, bits) || full_res > zig_maxInt_i(24, bits);
1154#else
1155 int32_t full_res;
1156 bool overflow = zig_subo_i32(&full_res, lhs, rhs, bits);
1157 *res = (int24_t)full_res;
1158 return overflow;
1159#endif
1160}
1161#endif
1162
1163#if defined(zig_ez80)
1164static inline bool zig_subo_u48(uint48_t *res, uint48_t lhs, uint48_t rhs, uint8_t bits) {
1165#if zig_has_builtin(sub_overflow) || defined(zig_gcc)
1166 uint48_t full_res;
1167 bool overflow = __builtin_sub_overflow(lhs, rhs, &full_res);
1168 *res = zig_wrap_u48(full_res, bits);
1169 return overflow || full_res < zig_minInt_u(48, bits) || full_res > zig_maxInt_u(48, bits);
1170#else
1171 uint64_t full_res;
1172 bool overflow = zig_subo_u64(&full_res, lhs, rhs, bits);
1173 *res = (uint48_t)full_res;
1174 return overflow;
1175#endif
1176}
1177
1178static inline bool zig_subo_i48(int48_t *res, int48_t lhs, int48_t rhs, uint8_t bits) {
1179#if zig_has_builtin(sub_overflow) || defined(zig_gcc)
1180 int48_t full_res;
1181 bool overflow = __builtin_sub_overflow(lhs, rhs, &full_res);
1182 *res = zig_wrap_i48(full_res, bits);
1183 return overflow || full_res < zig_minInt_i(48, bits) || full_res > zig_maxInt_i(48, bits);
1184#else
1185 int64_t full_res;
1186 bool overflow = zig_subo_i64(&full_res, lhs, rhs, bits);
1187 *res = (int48_t)full_res;
1188 return overflow;
1189#endif
1190}
1191#endif
1192
10161193static inline bool zig_mulo_u32(uint32_t *res, uint32_t lhs, uint32_t rhs, uint8_t bits) {
10171194#if zig_has_builtin(mul_overflow) || defined(zig_gcc)
10181195 uint32_t full_res;
......@@ -1121,6 +1298,66 @@ static inline bool zig_mulo_i16(int16_t *res, int16_t lhs, int16_t rhs, uint8_t
11211298#endif
11221299}
11231300
1301#if defined(zig_ez80)
1302static inline bool zig_mulo_u24(uint24_t *res, uint24_t lhs, uint24_t rhs, uint8_t bits) {
1303#if zig_has_builtin(mul_overflow) || defined(zig_gcc)
1304 uint24_t full_res;
1305 bool overflow = __builtin_mul_overflow(lhs, rhs, &full_res);
1306 *res = zig_wrap_u24(full_res, bits);
1307 return overflow || full_res < zig_minInt_u(24, bits) || full_res > zig_maxInt_u(24, bits);
1308#else
1309 uint32_t full_res;
1310 bool overflow = zig_mulo_u32(&full_res, lhs, rhs, bits);
1311 *res = (uint24_t)full_res;
1312 return overflow;
1313#endif
1314}
1315
1316static inline bool zig_mulo_i24(int24_t *res, int24_t lhs, int24_t rhs, uint8_t bits) {
1317#if zig_has_builtin(mul_overflow) || defined(zig_gcc)
1318 int24_t full_res;
1319 bool overflow = __builtin_mul_overflow(lhs, rhs, &full_res);
1320 *res = zig_wrap_i24(full_res, bits);
1321 return overflow || full_res < zig_minInt_i(24, bits) || full_res > zig_maxInt_i(24, bits);
1322#else
1323 int32_t full_res;
1324 bool overflow = zig_mulo_i32(&full_res, lhs, rhs, bits);
1325 *res = (int24_t)full_res;
1326 return overflow;
1327#endif
1328}
1329#endif
1330
1331#if defined(zig_ez80)
1332static inline bool zig_mulo_u48(uint48_t *res, uint48_t lhs, uint48_t rhs, uint8_t bits) {
1333#if zig_has_builtin(mul_overflow) || defined(zig_gcc)
1334 uint48_t full_res;
1335 bool overflow = __builtin_mul_overflow(lhs, rhs, &full_res);
1336 *res = zig_wrap_u48(full_res, bits);
1337 return overflow || full_res < zig_minInt_u(48, bits) || full_res > zig_maxInt_u(48, bits);
1338#else
1339 uint64_t full_res;
1340 bool overflow = zig_mulo_u64(&full_res, lhs, rhs, bits);
1341 *res = (uint48_t)full_res;
1342 return overflow;
1343#endif
1344}
1345
1346static inline bool zig_mulo_i48(int48_t *res, int48_t lhs, int48_t rhs, uint8_t bits) {
1347#if zig_has_builtin(mul_overflow) || defined(zig_gcc)
1348 int48_t full_res;
1349 bool overflow = __builtin_mul_overflow(lhs, rhs, &full_res);
1350 *res = zig_wrap_i48(full_res, bits);
1351 return overflow || full_res < zig_minInt_i(48, bits) || full_res > zig_maxInt_i(48, bits);
1352#else
1353 int64_t full_res;
1354 bool overflow = zig_mulo_i64(&full_res, lhs, rhs, bits);
1355 *res = (int48_t)full_res;
1356 return overflow;
1357#endif
1358}
1359#endif
1360
11241361#define zig_int_builtins(w) \
11251362 static inline bool zig_shlo_u##w(uint##w##_t *res, uint##w##_t lhs, uint8_t rhs, uint8_t bits) { \
11261363 *res = zig_shlw_u##w(lhs, rhs, bits); \
......@@ -1180,7 +1417,13 @@ static inline bool zig_mulo_i16(int16_t *res, int16_t lhs, int16_t rhs, uint8_t
11801417 }
11811418zig_int_builtins(8)
11821419zig_int_builtins(16)
1420#if defined(zig_ez80)
1421zig_int_builtins(24)
1422#endif
11831423zig_int_builtins(32)
1424#if defined(zig_ez80)
1425zig_int_builtins(48)
1426#endif
11841427zig_int_builtins(64)
11851428
11861429#define zig_builtin8(name, val) __builtin_##name(val)
......@@ -1189,6 +1432,11 @@ typedef unsigned int zig_Builtin8;
11891432#define zig_builtin16(name, val) __builtin_##name(val)
11901433typedef unsigned int zig_Builtin16;
11911434
1435#if defined(zig_ez80)
1436#define zig_builtin24(name, val) __builtin_##name(val)
1437typedef unsigned int zig_Builtin24;
1438#endif
1439
11921440#if INT_MIN <= INT32_MIN
11931441#define zig_builtin32(name, val) __builtin_##name(val)
11941442typedef unsigned int zig_Builtin32;
......@@ -1197,6 +1445,11 @@ typedef unsigned int zig_Builtin32;
11971445typedef unsigned long zig_Builtin32;
11981446#endif
11991447
1448#if defined(zig_ez80)
1449#define zig_builtin48(name, val) __builtin_##name(val)
1450typedef unsigned long long zig_Builtin48;
1451#endif
1452
12001453#if INT_MIN <= INT64_MIN
12011454#define zig_builtin64(name, val) __builtin_##name(val)
12021455typedef unsigned int zig_Builtin64;
......@@ -1231,6 +1484,23 @@ static inline int16_t zig_byte_swap_i16(int16_t val, uint8_t bits) {
12311484 return zig_wrap_i16((int16_t)zig_byte_swap_u16((uint16_t)val, bits), bits);
12321485}
12331486
1487#if defined(zig_ez80)
1488static inline uint16_t zig_byte_swap_u24(uint24_t val, uint8_t bits) {
1489 uint24_t full_res;
1490#if zig_has_builtin(bswap24) || defined(zig_gcc)
1491 full_res = __builtin_bswap24(val);
1492#else
1493 full_res = (uint24_t)zig_byte_swap_u8((uint8_t)(val >> 0), 8) << 16 |
1494 (uint24_t)zig_byte_swap_u16((uint16_t)(val >> 8), 16) >> 0;
1495#endif
1496 return zig_wrap_u24(full_res >> (24 - bits), bits);
1497}
1498
1499static inline int16_t zig_byte_swap_i24(int24_t val, uint8_t bits) {
1500 return zig_wrap_i24((int24_t)zig_byte_swap_u24((uint24_t)val, bits), bits);
1501}
1502#endif
1503
12341504static inline uint32_t zig_byte_swap_u32(uint32_t val, uint8_t bits) {
12351505 uint32_t full_res;
12361506#if zig_has_builtin(bswap32) || defined(zig_gcc)
......@@ -1246,6 +1516,23 @@ static inline int32_t zig_byte_swap_i32(int32_t val, uint8_t bits) {
12461516 return zig_wrap_i32((int32_t)zig_byte_swap_u32((uint32_t)val, bits), bits);
12471517}
12481518
1519#if defined(zig_ez80)
1520static inline uint32_t zig_byte_swap_u48(uint48_t val, uint8_t bits) {
1521 uint48_t full_res;
1522#if zig_has_builtin(bswap48) || defined(zig_gcc)
1523 full_res = __builtin_bswap48(val);
1524#else
1525 full_res = (uint48_t)zig_byte_swap_u24((uint24_t)(val >> 0), 24) << 24 |
1526 (uint48_t)zig_byte_swap_u24((uint24_t)(val >> 24), 24) >> 0;
1527#endif
1528 return zig_wrap_u48(full_res >> (48 - bits), bits);
1529}
1530
1531static inline int32_t zig_byte_swap_i48(int48_t val, uint8_t bits) {
1532 return zig_wrap_i48((int48_t)zig_byte_swap_u48((uint48_t)val, bits), bits);
1533}
1534#endif
1535
12491536static inline uint64_t zig_byte_swap_u64(uint64_t val, uint8_t bits) {
12501537 uint64_t full_res;
12511538#if zig_has_builtin(bswap64) || defined(zig_gcc)
......@@ -1294,6 +1581,23 @@ static inline int16_t zig_bit_reverse_i16(int16_t val, uint8_t bits) {
12941581 return zig_wrap_i16((int16_t)zig_bit_reverse_u16((uint16_t)val, bits), bits);
12951582}
12961583
1584#if defined(zig_ez80)
1585static inline uint24_t zig_bit_reverse_u24(uint24_t val, uint8_t bits) {
1586 uint24_t full_res;
1587#if zig_has_builtin(bitreverse24)
1588 full_res = __builtin_bitreverse24(val);
1589#else
1590 full_res = (uint24_t)zig_bit_reverse_u8((uint8_t)(val >> 0), 8) << 16 |
1591 (uint24_t)zig_bit_reverse_u16((uint16_t)(val >> 8), 16) >> 0;
1592#endif
1593 return zig_wrap_u24(full_res >> (24 - bits), bits);
1594}
1595
1596static inline int24_t zig_bit_reverse_i24(int24_t val, uint8_t bits) {
1597 return zig_wrap_i24((int24_t)zig_bit_reverse_u24((uint24_t)val, bits), bits);
1598}
1599#endif
1600
12971601static inline uint32_t zig_bit_reverse_u32(uint32_t val, uint8_t bits) {
12981602 uint32_t full_res;
12991603#if zig_has_builtin(bitreverse32)
......@@ -1309,6 +1613,23 @@ static inline int32_t zig_bit_reverse_i32(int32_t val, uint8_t bits) {
13091613 return zig_wrap_i32((int32_t)zig_bit_reverse_u32((uint32_t)val, bits), bits);
13101614}
13111615
1616#if defined(zig_ez80)
1617static inline uint32_t zig_bit_reverse_u48(uint48_t val, uint8_t bits) {
1618 uint48_t full_res;
1619#if zig_has_builtin(bitreverse48)
1620 full_res = __builtin_bitreverse48(val);
1621#else
1622 full_res = (uint48_t)zig_bit_reverse_u24((uint24_t)(val >> 0), 24) << 24 |
1623 (uint48_t)zig_bit_reverse_u24((uint24_t)(val >> 24), 24) >> 0;
1624#endif
1625 return zig_wrap_u32(full_res >> (48 - bits), bits);
1626}
1627
1628static inline int32_t zig_bit_reverse_i48(int48_t val, uint8_t bits) {
1629 return zig_wrap_i48((int48_t)zig_bit_reverse_u48((uint48_t)val, bits), bits);
1630}
1631#endif
1632
13121633static inline uint64_t zig_bit_reverse_u64(uint64_t val, uint8_t bits) {
13131634 uint64_t full_res;
13141635#if zig_has_builtin(bitreverse64)
......@@ -1350,7 +1671,13 @@ static inline int64_t zig_bit_reverse_i64(int64_t val, uint8_t bits) {
13501671#endif
13511672zig_builtin_popcount(8)
13521673zig_builtin_popcount(16)
1674#if defined(zig_ez80)
1675zig_builtin_popcount(24)
1676#endif
13531677zig_builtin_popcount(32)
1678#if defined(zig_ez80)
1679zig_builtin_popcount(48)
1680#endif
13541681zig_builtin_popcount(64)
13551682
13561683#define zig_builtin_ctz_common(w) \
......@@ -1375,7 +1702,13 @@ zig_builtin_popcount(64)
13751702#endif
13761703zig_builtin_ctz(8)
13771704zig_builtin_ctz(16)
1705#if defined(zig_ez80)
1706zig_builtin_ctz(24)
1707#endif
13781708zig_builtin_ctz(32)
1709#if defined(zig_ez80)
1710zig_builtin_ctz(48)
1711#endif
13791712zig_builtin_ctz(64)
13801713
13811714#define zig_builtin_clz_common(w) \
......@@ -1400,7 +1733,13 @@ zig_builtin_ctz(64)
14001733#endif
14011734zig_builtin_clz(8)
14021735zig_builtin_clz(16)
1736#if defined(zig_ez80)
1737zig_builtin_clz(24)
1738#endif
14031739zig_builtin_clz(32)
1740#if defined(zig_ez80)
1741zig_builtin_clz(48)
1742#endif
14041743zig_builtin_clz(64)
14051744
14061745/* ======================== 128-bit Integer Support ========================= */
......@@ -1981,6 +2320,20 @@ static inline zig_i128 zig_bit_reverse_i128(zig_i128 val, uint8_t bits) {
19812320 return zig_bitCast_i128(zig_bit_reverse_u128(zig_bitCast_u128(val), bits));
19822321}
19832322
2323#if zig_has_int128
2324#define zig_switch_int128(operand) switch (operand)
2325#define zig_switch_prong_begin_int128()
2326#define zig_switch_case_int128(Type, operand, value) case value:
2327#define zig_switch_prong_end_int128()
2328#define zig_switch_default_int128() default:
2329#else // zig_has_int128
2330#define zig_switch_int128(operand)
2331#define zig_switch_prong_begin_int128() if (0
2332#define zig_switch_case_int128(Type, operand, value) || (zig_cmp_##Type(operand, value) == 0)
2333#define zig_switch_prong_end_int128() )
2334#define zig_switch_default_int128()
2335#endif // zig_has_int128
2336
19842337/* ========================== Big Integer Support =========================== */
19852338
19862339static inline uint16_t zig_int_bytes(uint16_t bits) {
stage1/zig1.wasm
Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ
test/behavior/align.zig-1
......@@ -317,7 +317,6 @@ test "@alignCast functions" {
317317
318318 // function alignment is a compile error on wasm
319319 if (native_arch.isWasm()) return error.SkipZigTest;
320 if (native_arch.isThumb()) return error.SkipZigTest;
321320
322321 try expect(fnExpectsOnly1(simple4) == 0x19);
323322}
test/behavior/asm.zig+1-5
......@@ -67,7 +67,6 @@ test "alternative constraints" {
6767 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
6868 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
6969 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
70 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/159200
7170
7271 if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows) return error.SkipZigTest; // MSVC doesn't support inline assembly
7372
......@@ -247,12 +246,9 @@ test "extern output types (x86_64)" {
247246 }
248247}
249248
250test "riscv abi register aliases as clobbers" {
249test "abi register aliases as clobbers (RISC-V)" {
251250 if (!builtin.target.cpu.arch.isRISCV()) return error.SkipZigTest;
252251 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
253 if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows) return error.SkipZigTest;
254
255 if (!comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
256252
257253 // Verify that ABI alias names are accepted as clobbers for RISC-V.
258254 asm volatile ("" ::: .{ .ra = true, .sp = true, .gp = true, .tp = true });
test/behavior/basic.zig+1-5
......@@ -1407,11 +1407,7 @@ test "allocation and looping over 3-byte integer" {
14071407 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
14081408 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
14091409 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1410
1411 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag.isDarwin()) {
1412 return error.SkipZigTest; // TODO
1413 }
1414 if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // TODO
1410 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag.isDarwin()) return error.SkipZigTest; // TODO
14151411
14161412 try expect(@sizeOf(u24) == 4);
14171413 try expect(@sizeOf([1]u24) == 4);
test/behavior/field_parent_ptr.zig-1
......@@ -1757,7 +1757,6 @@ test "@fieldParentPtr packed union" {
17571757 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
17581758 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
17591759 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
1760 if (builtin.target.cpu.arch.endian() == .big) return error.SkipZigTest; // TODO
17611760
17621761 const C = packed union {
17631762 a: packed struct(u32) {
test/behavior/floatop.zig+4-10
......@@ -136,7 +136,6 @@ test "cmp f32" {
136136test "cmp f64" {
137137 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
138138 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
139 if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234
140139
141140 try testCmp(f64);
142141 try comptime testCmp(f64);
......@@ -155,7 +154,6 @@ test "cmp f128" {
155154test "cmp f80/c_longdouble" {
156155 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
157156 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
158 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
159157 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
160158 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
161159
......@@ -223,8 +221,7 @@ test "vector cmp f16" {
223221 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
224222 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
225223 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
226 if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
227 if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
224 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isArm()) return error.SkipZigTest;
228225 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
229226
230227 try testCmpVector(f16);
......@@ -236,8 +233,8 @@ test "vector cmp f32" {
236233 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
237234 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
238235 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
239 if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
240 if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
236 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isArm()) return error.SkipZigTest;
237 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
241238 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
242239
243240 try testCmpVector(f32);
......@@ -248,8 +245,6 @@ test "vector cmp f64" {
248245 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
249246 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
250247 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
251 if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
252 if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
253248 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
254249
255250 try testCmpVector(f64);
......@@ -262,8 +257,7 @@ test "vector cmp f128" {
262257 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
263258 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
264259 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
265 if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
266 if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
260 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .powerpc64le) return error.SkipZigTest;
267261 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
268262
269263 try testCmpVector(f128);
test/behavior/generics.zig-4
......@@ -305,8 +305,6 @@ test "generic function instantiation non-duplicates" {
305305 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
306306 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
307307
308 if (builtin.os.tag == .wasi) return error.SkipZigTest;
309
310308 const S = struct {
311309 fn copy(comptime T: type, dest: []T, source: []const T) void {
312310 @export(&foo, .{ .name = "test_generic_instantiation_non_dupe" });
......@@ -323,8 +321,6 @@ test "generic function instantiation non-duplicates" {
323321test "generic instantiation of tagged union with only one field" {
324322 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
325323
326 if (builtin.os.tag == .wasi) return error.SkipZigTest;
327
328324 const S = struct {
329325 const U = union(enum) {
330326 s: []const u8,
test/behavior/math.zig-6
......@@ -110,8 +110,6 @@ test "@clz vectors" {
110110}
111111
112112fn testClzVectors() !void {
113 if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/159529
114
115113 const Vu4 = @Vector(64, u4);
116114 const Vu8 = @Vector(64, u8);
117115 const Vu128 = @Vector(64, u128);
......@@ -193,8 +191,6 @@ test "@ctz vectors" {
193191}
194192
195193fn testCtzVectors() !void {
196 if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/159529
197
198194 const Vu4 = @Vector(64, u4);
199195 const Vu8 = @Vector(64, u8);
200196 @setEvalBranchQuota(10_000);
......@@ -2429,7 +2425,6 @@ test "runtime comparison to NaN is comptime-known" {
24292425 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
24302426 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
24312427 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
2432 if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234
24332428
24342429 const S = struct {
24352430 fn doTheTest(comptime F: type, x: F) void {
......@@ -2458,7 +2453,6 @@ test "runtime int comparison to inf is comptime-known" {
24582453 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
24592454 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
24602455 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
2461 if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234
24622456
24632457 const S = struct {
24642458 fn doTheTest(comptime F: type, x: u32) void {
test/behavior/maximum_minimum.zig-2
......@@ -138,8 +138,6 @@ test "@min/max for floats" {
138138 };
139139
140140 inline for (.{ f16, f32, f64, f80, f128, c_longdouble }) |T| {
141 if (T == c_longdouble and builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21090
142
143141 try S.doTheTest(T);
144142 try comptime S.doTheTest(T);
145143 }
test/behavior/packed-struct.zig-1
......@@ -1196,7 +1196,6 @@ test "packed struct with signed field" {
11961196
11971197test "assign packed struct initialized with RLS to packed struct literal field" {
11981198 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
1199 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isWasm()) return error.SkipZigTest;
12001199 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
12011200 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
12021201
test/behavior/saturating_arithmetic.zig-10
......@@ -147,11 +147,6 @@ test "saturating multiplication <= 32 bits" {
147147 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
148148 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
149149
150 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isWasm()) {
151 // https://github.com/ziglang/zig/issues/9660
152 return error.SkipZigTest;
153 }
154
155150 try testSatMul(u8, 0, maxInt(u8), 0);
156151 try testSatMul(u8, 1 << 7, 1 << 7, maxInt(u8));
157152 try testSatMul(u8, maxInt(u8) - 1, 2, maxInt(u8));
......@@ -246,11 +241,6 @@ test "saturating multiplication" {
246241 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
247242 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
248243
249 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isWasm()) {
250 // https://github.com/ziglang/zig/issues/9660
251 return error.SkipZigTest;
252 }
253
254244 const S = struct {
255245 fn doTheTest() !void {
256246 try testSatMul(i8, -3, 10, -30);
test/behavior/struct.zig-2
......@@ -404,7 +404,6 @@ test "packed struct 24bits" {
404404 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
405405 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
406406 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
407 if (builtin.cpu.arch.isArm()) return error.SkipZigTest; // TODO
408407 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
409408 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO
410409
......@@ -921,7 +920,6 @@ test "tuple assigned to variable" {
921920
922921test "comptime struct field" {
923922 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
924 if (builtin.cpu.arch.isArm()) return error.SkipZigTest; // TODO
925923
926924 const T = struct {
927925 a: i32,
test/behavior/switch.zig+1
......@@ -683,6 +683,7 @@ test "switch on pointer type" {
683683 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
684684 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
685685 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
686 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/176634
686687
687688 const S = struct {
688689 const X = struct {
test/behavior/union.zig-3
......@@ -1592,7 +1592,6 @@ test "memset packed union" {
15921592
15931593 try comptime S.doTheTest();
15941594
1595 if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
15961595 try S.doTheTest();
15971596}
15981597
......@@ -1750,8 +1749,6 @@ test "reinterpret packed union" {
17501749 try comptime S.doTheTest();
17511750
17521751 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1753 if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; // TODO
1754 if (builtin.cpu.arch.endian() == .big) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21050
17551752 try S.doTheTest();
17561753}
17571754
test/behavior/vector.zig-23
......@@ -7,7 +7,6 @@ const expect = std.testing.expect;
77const expectEqual = std.testing.expectEqual;
88
99test "implicit cast vector to array - bool" {
10 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
1110 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
1211
1312 const S = struct {
......@@ -622,11 +621,6 @@ test "vector bitwise not operator" {
622621 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
623622 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
624623
625 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) {
626 // https://github.com/ziglang/zig/issues/24061
627 return error.SkipZigTest;
628 }
629
630624 const S = struct {
631625 fn doTheTestNot(comptime T: type, x: @Vector(4, T)) !void {
632626 const y = ~x;
......@@ -660,11 +654,6 @@ test "vector boolean not operator" {
660654 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
661655 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
662656
663 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) {
664 // https://github.com/ziglang/zig/issues/24061
665 return error.SkipZigTest;
666 }
667
668657 const S = struct {
669658 fn doTheTestNot(comptime T: type, x: @Vector(4, T)) !void {
670659 const y = !x;
......@@ -759,7 +748,6 @@ test "vector reduce operation" {
759748 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
760749 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
761750 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
762 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21091
763751 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isSPARC()) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23719
764752
765753 const S = struct {
......@@ -1096,9 +1084,6 @@ test "saturating multiplication" {
10961084 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
10971085 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
10981086
1099 // TODO: once #9660 has been solved, remove this line
1100 if (builtin.target.cpu.arch.isWasm()) return error.SkipZigTest;
1101
11021087 const S = struct {
11031088 fn doTheTest() !void {
11041089 // Broken out to avoid https://github.com/ziglang/zig/issues/11251
......@@ -1165,7 +1150,6 @@ test "@addWithOverflow" {
11651150 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
11661151 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
11671152 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1168 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
11691153
11701154 const S = struct {
11711155 fn doTheTest() !void {
......@@ -1213,7 +1197,6 @@ test "@subWithOverflow" {
12131197 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
12141198 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
12151199 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1216 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
12171200
12181201 const S = struct {
12191202 fn doTheTest() !void {
......@@ -1244,7 +1227,6 @@ test "@mulWithOverflow" {
12441227 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12451228 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
12461229 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1247 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
12481230
12491231 const S = struct {
12501232 fn doTheTest() !void {
......@@ -1265,7 +1247,6 @@ test "@shlWithOverflow" {
12651247 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12661248 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
12671249 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1268 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
12691250
12701251 const S = struct {
12711252 fn doTheTest() !void {
......@@ -1347,7 +1328,6 @@ test "byte vector initialized in inline function" {
13471328 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
13481329 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
13491330 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1350 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
13511331 if (builtin.cpu.arch == .hexagon and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
13521332
13531333 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .x86_64 and comptime builtin.cpu.has(.x86, .avx512f)) {
......@@ -1463,7 +1443,6 @@ test "store packed vector element" {
14631443 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
14641444 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
14651445 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1466 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
14671446
14681447 var v = @Vector(4, u1){ 1, 1, 1, 1 };
14691448 try expectEqual(@Vector(4, u1){ 1, 1, 1, 1 }, v);
......@@ -1496,7 +1475,6 @@ test "store vector with memset" {
14961475 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO
14971476 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
14981477 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1499 if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
15001478
15011479 var a: [5]@Vector(2, i1) = undefined;
15021480 var b: [5]@Vector(2, u2) = undefined;
......@@ -1596,7 +1574,6 @@ test "bitcast to vector with different child type" {
15961574 }
15971575 };
15981576
1599 // Originally reported at https://github.com/ziglang/zig/issues/8184
16001577 try S.doTheTest();
16011578 try comptime S.doTheTest();
16021579}
test/behavior/wrapping_arithmetic.zig-3
......@@ -82,9 +82,6 @@ test "wrapping multiplication" {
8282 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
8383 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
8484
85 // TODO: once #9660 has been solved, remove this line
86 if (builtin.cpu.arch.isWasm()) return error.SkipZigTest;
87
8885 const S = struct {
8986 fn doTheTest() !void {
9087 try testWrapMul(i8, -3, 10, -30);
test/c_abi/cfuncs.c+4
......@@ -65,6 +65,10 @@ static void assert_or_panic(bool ok) {
6565# define ZIG_NO_COMPLEX
6666#endif
6767
68#if defined(__loongarch__) && defined(__loongarch_soft_float)
69# define ZIG_NO_COMPLEX
70#endif
71
6872#ifdef __powerpc__
6973# define ZIG_NO_COMPLEX
7074#endif
test/c_abi/main.zig+3-1
......@@ -187,7 +187,8 @@ extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble;
187187const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isMIPS() and
188188 !builtin.cpu.arch.isArm() and !builtin.cpu.arch.isPowerPC32() and !builtin.cpu.arch.isRISCV() and
189189 builtin.cpu.arch != .hexagon and
190 builtin.cpu.arch != .s390x;
190 builtin.cpu.arch != .s390x and
191 !(builtin.cpu.arch.isLoongArch() and builtin.abi.float() == .soft);
191192
192193test "C ABI complex float" {
193194 if (!complex_abi_compatible) return error.SkipZigTest;
......@@ -5676,6 +5677,7 @@ test "C ABI pointer sized float struct" {
56765677 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
56775678 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
56785679 if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest;
5680 if (builtin.cpu.arch.isLoongArch() and builtin.abi.float() == .soft) return error.SkipZigTest;
56795681 if (builtin.cpu.arch == .s390x) return error.SkipZigTest;
56805682
56815683 c_ptr_size_float_struct(.{ .x = 1, .y = 2 });
test/llvm_targets.zig+14-4
......@@ -52,6 +52,7 @@ const targets = [_]std.Target.Query{
5252 .{ .cpu_arch = .arm, .os_tag = .freebsd, .abi = .eabihf },
5353 .{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabi },
5454 .{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabihf },
55 .{ .cpu_arch = .arm, .os_tag = .fuchsia, .abi = .eabihf },
5556 .{ .cpu_arch = .arm, .os_tag = .haiku, .abi = .eabi },
5657 .{ .cpu_arch = .arm, .os_tag = .haiku, .abi = .eabihf },
5758 .{ .cpu_arch = .arm, .os_tag = .linux, .abi = .androideabi },
......@@ -99,12 +100,19 @@ const targets = [_]std.Target.Query{
99100 // .{ .cpu_arch = .csky, .os_tag = .linux, .abi = .gnueabihf },
100101
101102 .{ .cpu_arch = .hexagon, .os_tag = .freestanding, .abi = .none },
103 .{ .cpu_arch = .hexagon, .os_tag = .linux, .abi = .musl },
102104 .{ .cpu_arch = .hexagon, .os_tag = .linux, .abi = .none },
103105
104106 .{ .cpu_arch = .lanai, .os_tag = .freestanding, .abi = .none },
105107
106 // .{ .cpu_arch = .loongarch32, .os_tag = .freestanding, .abi = .none },
107 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .none },
108 .{ .cpu_arch = .loongarch32, .os_tag = .freestanding, .abi = .none },
109 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .gnu },
110 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .gnuf32 },
111 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .gnusf },
112 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .musl },
113 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .muslf32 },
114 // .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .muslsf },
115 .{ .cpu_arch = .loongarch32, .os_tag = .linux, .abi = .none },
108116 // .{ .cpu_arch = .loongarch32, .os_tag = .uefi, .abi = .none },
109117
110118 .{ .cpu_arch = .loongarch64, .os_tag = .freestanding, .abi = .none },
......@@ -172,6 +180,7 @@ const targets = [_]std.Target.Query{
172180
173181 .{ .cpu_arch = .nvptx, .os_tag = .cuda, .abi = .none },
174182 .{ .cpu_arch = .nvptx, .os_tag = .nvcl, .abi = .none },
183
175184 .{ .cpu_arch = .nvptx64, .os_tag = .cuda, .abi = .none },
176185 .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none },
177186
......@@ -255,6 +264,7 @@ const targets = [_]std.Target.Query{
255264
256265 .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .eabi },
257266 .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .eabihf },
267 .{ .cpu_arch = .thumb, .os_tag = .fuchsia, .abi = .eabihf },
258268 .{ .cpu_arch = .thumb, .os_tag = .linux, .abi = .eabi },
259269 .{ .cpu_arch = .thumb, .os_tag = .linux, .abi = .eabihf },
260270 .{ .cpu_arch = .thumb, .os_tag = .linux, .abi = .musleabi },
......@@ -342,8 +352,8 @@ const targets = [_]std.Target.Query{
342352
343353 .{ .cpu_arch = .xcore, .os_tag = .freestanding, .abi = .none },
344354
345 // .{ .cpu_arch = .xtensa, .os_tag = .freestanding, .abi = .none },
346 // .{ .cpu_arch = .xtensa, .os_tag = .linux, .abi = .none },
355 .{ .cpu_arch = .xtensa, .os_tag = .freestanding, .abi = .none },
356 .{ .cpu_arch = .xtensa, .os_tag = .linux, .abi = .none },
347357};
348358
349359pub fn addCases(
test/tests.zig+50-8
......@@ -410,6 +410,14 @@ const module_test_targets = blk: {
410410 .extra_target = true,
411411 },
412412
413 .{
414 .target = .{
415 .cpu_arch = .loongarch32,
416 .os_tag = .linux,
417 .abi = .none,
418 },
419 },
420
413421 .{
414422 .target = .{
415423 .cpu_arch = .loongarch64,
......@@ -435,6 +443,25 @@ const module_test_targets = blk: {
435443 .link_libc = true,
436444 .extra_target = true,
437445 },
446 .{
447 .target = .{
448 .cpu_arch = .loongarch64,
449 .os_tag = .linux,
450 .abi = .muslsf,
451 },
452 .link_libc = true,
453 .extra_target = true,
454 },
455 .{
456 .target = .{
457 .cpu_arch = .loongarch64,
458 .os_tag = .linux,
459 .abi = .muslsf,
460 },
461 .linkage = .dynamic,
462 .link_libc = true,
463 .extra_target = true,
464 },
438465 .{
439466 .target = .{
440467 .cpu_arch = .loongarch64,
......@@ -443,6 +470,15 @@ const module_test_targets = blk: {
443470 },
444471 .link_libc = true,
445472 },
473 .{
474 .target = .{
475 .cpu_arch = .loongarch64,
476 .os_tag = .linux,
477 .abi = .gnusf,
478 },
479 .link_libc = true,
480 .extra_target = true,
481 },
446482
447483 .{
448484 .target = .{
......@@ -1713,14 +1749,13 @@ const c_abi_targets = blk: {
17131749 },
17141750 },
17151751
1716 // https://gitlab.com/qemu-project/qemu/-/issues/3291
1717 // .{
1718 // .target = .{
1719 // .cpu_arch = .hexagon,
1720 // .os_tag = .linux,
1721 // .abi = .musl,
1722 // },
1723 // },
1752 .{
1753 .target = .{
1754 .cpu_arch = .hexagon,
1755 .os_tag = .linux,
1756 .abi = .musl,
1757 },
1758 },
17241759
17251760 .{
17261761 .target = .{
......@@ -1729,6 +1764,13 @@ const c_abi_targets = blk: {
17291764 .abi = .musl,
17301765 },
17311766 },
1767 .{
1768 .target = .{
1769 .cpu_arch = .loongarch64,
1770 .os_tag = .linux,
1771 .abi = .muslsf,
1772 },
1773 },
17321774
17331775 .{
17341776 .target = .{
tools/update_clang_options.zig+1-1
......@@ -675,7 +675,7 @@ pub fn main(init: std.process.Init) !void {
675675 const child_args = [_][]const u8{
676676 llvm_tblgen_exe,
677677 "--dump-json",
678 try std.fmt.allocPrint(arena, "{s}/clang/include/clang/Driver/Options.td", .{llvm_src_root}),
678 try std.fmt.allocPrint(arena, "{s}/clang/include/clang/Options/Options.td", .{llvm_src_root}),
679679 try std.fmt.allocPrint(arena, "-I={s}/llvm/include", .{llvm_src_root}),
680680 try std.fmt.allocPrint(arena, "-I={s}/clang/include/clang/Driver", .{llvm_src_root}),
681681 };
tools/update_cpu_features.zig+55-13
......@@ -203,6 +203,10 @@ const targets = [_]ArchTarget{
203203 .llvm_name = "ampere1a",
204204 .flatten = true,
205205 },
206 .{
207 .llvm_name = "ampere1c",
208 .flatten = true,
209 },
206210 .{
207211 .llvm_name = "apple-a7",
208212 .flatten = true,
......@@ -247,6 +251,26 @@ const targets = [_]ArchTarget{
247251 .llvm_name = "apple-m4",
248252 .flatten = true,
249253 },
254 .{
255 .llvm_name = "apple-m5",
256 .flatten = true,
257 },
258 .{
259 .llvm_name = "c1-nano",
260 .flatten = true,
261 },
262 .{
263 .llvm_name = "c1-premium",
264 .flatten = true,
265 },
266 .{
267 .llvm_name = "c1-pro",
268 .flatten = true,
269 },
270 .{
271 .llvm_name = "c1-ultra",
272 .flatten = true,
273 },
250274 .{
251275 .llvm_name = "carmel",
252276 .flatten = true,
......@@ -862,6 +886,10 @@ const targets = [_]ArchTarget{
862886 .llvm_name = "armv9.6-a",
863887 .zig_name = "v9_6a",
864888 },
889 .{
890 .llvm_name = "armv9.7-a",
891 .zig_name = "v9_7a",
892 },
865893 .{
866894 .llvm_name = "armv9-a",
867895 .zig_name = "v9a",
......@@ -982,6 +1010,10 @@ const targets = [_]ArchTarget{
9821010 .llvm_name = "v9.6a",
9831011 .zig_name = "has_v9_6a",
9841012 },
1013 .{
1014 .llvm_name = "v9.7a",
1015 .zig_name = "has_v9_7a",
1016 },
9851017 },
9861018 .extra_cpus = &.{
9871019 .{
......@@ -1249,6 +1281,24 @@ const targets = [_]ArchTarget{
12491281 .td_name = "LoongArch",
12501282 },
12511283 .extra_cpus = &.{
1284 .{
1285 .llvm_name = null,
1286 .zig_name = "la32v1_0",
1287 .features = &.{
1288 "32bit",
1289 "32s",
1290 "d",
1291 "ual",
1292 },
1293 },
1294 .{
1295 .llvm_name = null,
1296 .zig_name = "la32rv1_0",
1297 .features = &.{
1298 "32bit",
1299 "ual",
1300 },
1301 },
12521302 .{
12531303 .llvm_name = null,
12541304 .zig_name = "la64v1_0",
......@@ -1276,6 +1326,7 @@ const targets = [_]ArchTarget{
12761326 },
12771327 .omit_cpus = &.{
12781328 "generic",
1329 "loongarch32",
12791330 "loongarch64",
12801331 },
12811332 },
......@@ -1557,26 +1608,17 @@ const targets = [_]ArchTarget{
15571608 .llvm_name = "64bit-mode",
15581609 .omit = true,
15591610 },
1560 // Remove these when LLVM removes AVX10.N-256 support.
1561 .{
1562 .llvm_name = "avx10.1-256",
1563 .flatten = true,
1564 },
1565 .{
1566 .llvm_name = "avx10.2-256",
1567 .flatten = true,
1568 },
15691611 .{
15701612 .llvm_name = "avx10.1-512",
1571 .zig_name = "avx10_1",
1613 .omit = true,
15721614 },
15731615 .{
15741616 .llvm_name = "avx10.2-512",
1575 .zig_name = "avx10_2",
1617 .omit = true,
15761618 },
15771619 .{
1578 .llvm_name = "avx512f",
1579 .extra_deps = &.{"evex512"},
1620 .llvm_name = "evex512",
1621 .omit = true,
15801622 },
15811623 .{
15821624 .llvm_name = "alderlake",