Merge remote-tracking branch 'origin/llvm12'
Happy LLVM 12 Release Day. Please note that the llvm 12 tag does not include the latest commit in the release/12.x branch, which is in fact a bug fix for a regression that is causing a failure in Zig's test suite. Zig master branch is tracking release/12.x, and will be enabling the test that is fixed by that commit.
This commit is contained in:
@@ -9,27 +9,27 @@
|
||||
|
||||
find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
|
||||
PATHS
|
||||
/usr/lib/llvm/11/include
|
||||
/usr/lib/llvm-11/include
|
||||
/usr/lib/llvm-11.0/include
|
||||
/usr/local/llvm110/include
|
||||
/usr/local/llvm11/include
|
||||
/usr/lib/llvm/12/include
|
||||
/usr/lib/llvm-12/include
|
||||
/usr/lib/llvm-12.0/include
|
||||
/usr/local/llvm120/include
|
||||
/usr/local/llvm12/include
|
||||
/mingw64/include
|
||||
)
|
||||
|
||||
if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
||||
find_library(CLANG_LIBRARIES
|
||||
NAMES
|
||||
clang-cpp-11.0
|
||||
clang-cpp110
|
||||
clang-cpp-12.0
|
||||
clang-cpp120
|
||||
clang-cpp
|
||||
PATHS
|
||||
${CLANG_LIBDIRS}
|
||||
/usr/lib/llvm/11/lib
|
||||
/usr/lib/llvm/11/lib64
|
||||
/usr/lib/llvm-11/lib
|
||||
/usr/local/llvm110/lib
|
||||
/usr/local/llvm11/lib
|
||||
/usr/lib/llvm/12/lib
|
||||
/usr/lib/llvm/12/lib64
|
||||
/usr/lib/llvm-12/lib
|
||||
/usr/local/llvm120/lib
|
||||
/usr/local/llvm12/lib
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -39,11 +39,11 @@ if(NOT CLANG_LIBRARIES)
|
||||
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_}
|
||||
PATHS
|
||||
${CLANG_LIBDIRS}
|
||||
/usr/lib/llvm/11/lib
|
||||
/usr/lib/llvm-11/lib
|
||||
/usr/lib/llvm-11.0/lib
|
||||
/usr/local/llvm110/lib
|
||||
/usr/local/llvm11/lib
|
||||
/usr/lib/llvm/12/lib
|
||||
/usr/lib/llvm-12/lib
|
||||
/usr/lib/llvm-12.0/lib
|
||||
/usr/local/llvm120/lib
|
||||
/usr/local/llvm12/lib
|
||||
/mingw64/lib
|
||||
/c/msys64/mingw64/lib
|
||||
c:\\msys64\\mingw64\\lib
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
|
||||
find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
|
||||
PATHS
|
||||
/usr/lib/llvm-11/include
|
||||
/usr/local/llvm110/include
|
||||
/usr/local/llvm11/include
|
||||
/usr/lib/llvm-12/include
|
||||
/usr/local/llvm120/include
|
||||
/usr/local/llvm12/include
|
||||
/mingw64/include)
|
||||
|
||||
find_library(LLD_LIBRARY NAMES lld-11.0 lld110 lld
|
||||
find_library(LLD_LIBRARY NAMES lld-12.0 lld120 lld
|
||||
PATHS
|
||||
/usr/lib/llvm-11/lib
|
||||
/usr/local/llvm110/lib
|
||||
/usr/local/llvm11/lib
|
||||
/usr/lib/llvm-12/lib
|
||||
/usr/local/llvm120/lib
|
||||
/usr/local/llvm12/lib
|
||||
)
|
||||
if(EXISTS ${LLD_LIBRARY})
|
||||
set(LLD_LIBRARIES ${LLD_LIBRARY})
|
||||
@@ -27,9 +27,9 @@ else()
|
||||
find_library(LLD_${_prettylibname_}_LIB NAMES ${_libname_}
|
||||
PATHS
|
||||
${LLD_LIBDIRS}
|
||||
/usr/lib/llvm-11/lib
|
||||
/usr/local/llvm110/lib
|
||||
/usr/local/llvm11/lib
|
||||
/usr/lib/llvm-12/lib
|
||||
/usr/local/llvm120/lib
|
||||
/usr/local/llvm12/lib
|
||||
/mingw64/lib
|
||||
/c/msys64/mingw64/lib
|
||||
c:/msys64/mingw64/lib)
|
||||
|
||||
@@ -9,37 +9,37 @@
|
||||
|
||||
find_path(LLVM_INCLUDE_DIRS NAMES llvm/IR/IRBuilder.h
|
||||
PATHS
|
||||
/usr/lib/llvm/11/include
|
||||
/usr/lib/llvm-11/include
|
||||
/usr/lib/llvm-11.0/include
|
||||
/usr/local/llvm11/include
|
||||
/usr/local/llvm110/include
|
||||
/usr/lib/llvm/12/include
|
||||
/usr/lib/llvm-12/include
|
||||
/usr/lib/llvm-12.0/include
|
||||
/usr/local/llvm12/include
|
||||
/usr/local/llvm120/include
|
||||
/mingw64/include
|
||||
)
|
||||
|
||||
if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
||||
find_library(LLVM_LIBRARIES
|
||||
NAMES
|
||||
LLVM-11.0
|
||||
LLVM-11
|
||||
LLVM-110
|
||||
LLVM-12.0
|
||||
LLVM-12
|
||||
LLVM-120
|
||||
LLVM
|
||||
PATHS
|
||||
${LLVM_LIBDIRS}
|
||||
/usr/lib/llvm/11/lib
|
||||
/usr/lib/llvm/11/lib64
|
||||
/usr/lib/llvm-11/lib
|
||||
/usr/local/llvm11/lib
|
||||
/usr/local/llvm110/lib
|
||||
/usr/lib/llvm/12/lib
|
||||
/usr/lib/llvm/12/lib64
|
||||
/usr/lib/llvm-12/lib
|
||||
/usr/local/llvm12/lib
|
||||
/usr/local/llvm120/lib
|
||||
)
|
||||
|
||||
find_program(LLVM_CONFIG_EXE
|
||||
NAMES llvm-config-11 llvm-config-11.0 llvm-config110 llvm-config11 llvm-config
|
||||
NAMES llvm-config-12 llvm-config-12.0 llvm-config120 llvm-config12 llvm-config
|
||||
PATHS
|
||||
"/mingw64/bin"
|
||||
"/c/msys64/mingw64/bin"
|
||||
"c:/msys64/mingw64/bin"
|
||||
"C:/Libraries/llvm-11.0.0/bin")
|
||||
"C:/Libraries/llvm-12.0.0/bin")
|
||||
|
||||
if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
|
||||
message(FATAL_ERROR "unable to find llvm-config")
|
||||
@@ -54,23 +54,23 @@ if(ZIG_PREFER_CLANG_CPP_DYLIB)
|
||||
OUTPUT_VARIABLE LLVM_CONFIG_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 11)
|
||||
message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 12)
|
||||
message(FATAL_ERROR "expected LLVM 12.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
endif()
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 12)
|
||||
message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 13)
|
||||
message(FATAL_ERROR "expected LLVM 12.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
endif()
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 12)
|
||||
message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 13)
|
||||
message(FATAL_ERROR "expected LLVM 12.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
endif()
|
||||
elseif(ZIG_USE_LLVM_CONFIG)
|
||||
find_program(LLVM_CONFIG_EXE
|
||||
NAMES llvm-config-11 llvm-config-11.0 llvm-config110 llvm-config11 llvm-config
|
||||
NAMES llvm-config-12 llvm-config-12.0 llvm-config120 llvm-config12 llvm-config
|
||||
PATHS
|
||||
"/mingw64/bin"
|
||||
"/c/msys64/mingw64/bin"
|
||||
"c:/msys64/mingw64/bin"
|
||||
"C:/Libraries/llvm-11.0.0/bin")
|
||||
"C:/Libraries/llvm-12.0.0/bin")
|
||||
|
||||
if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
|
||||
message(FATAL_ERROR "unable to find llvm-config")
|
||||
@@ -85,14 +85,14 @@ elseif(ZIG_USE_LLVM_CONFIG)
|
||||
OUTPUT_VARIABLE LLVM_CONFIG_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 11)
|
||||
message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 12)
|
||||
message(FATAL_ERROR "expected LLVM 12.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
endif()
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 12)
|
||||
message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 13)
|
||||
message(FATAL_ERROR "expected LLVM 12.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
endif()
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 12)
|
||||
message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 13)
|
||||
message(FATAL_ERROR "expected LLVM 12.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
@@ -166,7 +166,7 @@ elseif(ZIG_USE_LLVM_CONFIG)
|
||||
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
|
||||
|
||||
if(NOT LLVM_LIBRARIES)
|
||||
find_library(LLVM_LIBRARIES NAMES LLVM LLVM-11 LLVM-11.0)
|
||||
find_library(LLVM_LIBRARIES NAMES LLVM LLVM-12 LLVM-12.0)
|
||||
endif()
|
||||
|
||||
link_directories("${CMAKE_PREFIX_PATH}/lib")
|
||||
@@ -180,11 +180,11 @@ else()
|
||||
find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_}
|
||||
PATHS
|
||||
${LLVM_LIBDIRS}
|
||||
/usr/lib/llvm/11/lib
|
||||
/usr/lib/llvm-11/lib
|
||||
/usr/lib/llvm-11.0/lib
|
||||
/usr/local/llvm110/lib
|
||||
/usr/local/llvm11/lib
|
||||
/usr/lib/llvm/12/lib
|
||||
/usr/lib/llvm-12/lib
|
||||
/usr/lib/llvm-12.0/lib
|
||||
/usr/local/llvm120/lib
|
||||
/usr/local/llvm12/lib
|
||||
/mingw64/lib
|
||||
/c/msys64/mingw64/lib
|
||||
c:\\msys64\\mingw64\\lib)
|
||||
@@ -194,78 +194,57 @@ else()
|
||||
# This list can be re-generated with `llvm-config --libfiles` and then
|
||||
# reformatting using your favorite text editor. Note we do not execute
|
||||
# `llvm-config` here because we are cross compiling.
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXRay)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWindowsManifest)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSymbolize)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoPDB)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcJIT)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcError)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMJITLink)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjectYAML)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCA)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLTO)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPasses)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCoroutines)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjCARCOpts)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMExtensions)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLineEditor)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXRay)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLibDriver)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInterpreter)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFuzzMutate)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCJIT)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMExecutionEngine)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRuntimeDyld)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWARFLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDlltoolDriver)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOption)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoGSYM)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCoverage)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLineEditor)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXCoreDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXCoreCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXCoreDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMXCoreInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMX86Disassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMX86CodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMX86AsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMX86CodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMX86Desc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMX86Info)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSystemZInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSparcInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVUtils)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRISCVInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPowerPCDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPowerPCCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPowerPCAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPowerPCCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPowerPCDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPowerPCInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMNVPTXCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMNVPTXDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMNVPTXInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMSP430Disassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMSP430CodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMSP430AsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMSP430CodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMSP430Desc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMSP430Info)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMipsDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMipsCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMipsAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMipsCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMipsDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMipsInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLanaiDisassembler)
|
||||
@@ -279,44 +258,73 @@ else()
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMHexagonDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMHexagonInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBPFDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBPFCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBPFAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBPFCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBPFDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBPFInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAVRDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAVRCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAVRAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAVRCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAVRDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAVRInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMUtils)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMARMInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMIRParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMipo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInstrumentation)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMVectorize)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMIRReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenMP)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUDesc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUUtils)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUInfo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Disassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64AsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64CodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Desc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Utils)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Info)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcJIT)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCJIT)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMJITLink)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcTargetProcess)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOrcShared)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInterpreter)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMExecutionEngine)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRuntimeDyld)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSymbolize)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoPDB)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoGSYM)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMOption)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjectYAML)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCA)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCDisassembler)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLTO)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMPasses)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCFGuard)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCoroutines)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObjCARCOpts)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMHelloNew)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMipo)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMVectorize)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInstrumentation)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenMP)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenACC)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMExtensions)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDWARFLinker)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMGlobalISel)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSelectionDAG)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMIRParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAsmPrinter)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARF)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSelectionDAG)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCodeGen)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMIRReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInterfaceStub)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFileCheck)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMFuzzMutate)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMTarget)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMScalarOpts)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMInstCombine)
|
||||
@@ -327,19 +335,15 @@ else()
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMProfileData)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMObject)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMTextAPI)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMC)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoCodeView)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoMSF)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBitReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMCore)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMRemarks)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBitstreamReader)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64AsmParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMCParser)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Desc)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMMC)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoCodeView)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoMSF)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMBinaryFormat)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Utils)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMAArch64Info)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMSupport)
|
||||
FIND_AND_ADD_LLVM_LIB(LLVMDemangle)
|
||||
endif()
|
||||
|
||||
9
lib/include/__clang_cuda_builtin_vars.h
vendored
9
lib/include/__clang_cuda_builtin_vars.h
vendored
@@ -55,7 +55,9 @@ struct __cuda_builtin_threadIdx_t {
|
||||
__CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_tid_z());
|
||||
// threadIdx should be convertible to uint3 (in fact in nvcc, it *is* a
|
||||
// uint3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator dim3() const;
|
||||
__attribute__((device)) operator uint3() const;
|
||||
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_threadIdx_t);
|
||||
};
|
||||
@@ -66,7 +68,9 @@ struct __cuda_builtin_blockIdx_t {
|
||||
__CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ctaid_z());
|
||||
// blockIdx should be convertible to uint3 (in fact in nvcc, it *is* a
|
||||
// uint3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator dim3() const;
|
||||
__attribute__((device)) operator uint3() const;
|
||||
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockIdx_t);
|
||||
};
|
||||
@@ -78,6 +82,8 @@ struct __cuda_builtin_blockDim_t {
|
||||
// blockDim should be convertible to dim3 (in fact in nvcc, it *is* a
|
||||
// dim3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator dim3() const;
|
||||
__attribute__((device)) operator uint3() const;
|
||||
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockDim_t);
|
||||
};
|
||||
@@ -89,6 +95,8 @@ struct __cuda_builtin_gridDim_t {
|
||||
// gridDim should be convertible to dim3 (in fact in nvcc, it *is* a
|
||||
// dim3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator dim3() const;
|
||||
__attribute__((device)) operator uint3() const;
|
||||
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_gridDim_t);
|
||||
};
|
||||
@@ -108,5 +116,6 @@ __attribute__((device)) const int warpSize = 32;
|
||||
#undef __CUDA_DEVICE_BUILTIN
|
||||
#undef __CUDA_BUILTIN_VAR
|
||||
#undef __CUDA_DISALLOW_BUILTINVAR_ACCESS
|
||||
#undef __DELETE
|
||||
|
||||
#endif /* __CUDA_BUILTIN_VARS_H */
|
||||
|
||||
50
lib/include/__clang_cuda_cmath.h
vendored
50
lib/include/__clang_cuda_cmath.h
vendored
@@ -66,10 +66,38 @@ __DEVICE__ float frexp(float __arg, int *__exp) {
|
||||
}
|
||||
|
||||
// For inscrutable reasons, the CUDA headers define these functions for us on
|
||||
// Windows. For OpenMP we omit these as some old system headers have
|
||||
// non-conforming `isinf(float)` and `isnan(float)` implementations that return
|
||||
// an `int`. The system versions of these functions should be fine anyway.
|
||||
#if !defined(_MSC_VER) && !defined(__OPENMP_NVPTX__)
|
||||
// Windows.
|
||||
#if !defined(_MSC_VER) || defined(__OPENMP_NVPTX__)
|
||||
|
||||
// For OpenMP we work around some old system headers that have non-conforming
|
||||
// `isinf(float)` and `isnan(float)` implementations that return an `int`. We do
|
||||
// this by providing two versions of these functions, differing only in the
|
||||
// return type. To avoid conflicting definitions we disable implicit base
|
||||
// function generation. That means we will end up with two specializations, one
|
||||
// per type, but only one has a base function defined by the system header.
|
||||
#if defined(__OPENMP_NVPTX__)
|
||||
#pragma omp begin declare variant match( \
|
||||
implementation = {extension(disable_implicit_base)})
|
||||
|
||||
// FIXME: We lack an extension to customize the mangling of the variants, e.g.,
|
||||
// add a suffix. This means we would clash with the names of the variants
|
||||
// (note that we do not create implicit base functions here). To avoid
|
||||
// this clash we add a new trait to some of them that is always true
|
||||
// (this is LLVM after all ;)). It will only influence the mangled name
|
||||
// of the variants inside the inner region and avoid the clash.
|
||||
#pragma omp begin declare variant match(implementation = {vendor(llvm)})
|
||||
|
||||
__DEVICE__ int isinf(float __x) { return ::__isinff(__x); }
|
||||
__DEVICE__ int isinf(double __x) { return ::__isinf(__x); }
|
||||
__DEVICE__ int isfinite(float __x) { return ::__finitef(__x); }
|
||||
__DEVICE__ int isfinite(double __x) { return ::__isfinited(__x); }
|
||||
__DEVICE__ int isnan(float __x) { return ::__isnanf(__x); }
|
||||
__DEVICE__ int isnan(double __x) { return ::__isnan(__x); }
|
||||
|
||||
#pragma omp end declare variant
|
||||
|
||||
#endif
|
||||
|
||||
__DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
|
||||
__DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
|
||||
__DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
|
||||
@@ -79,6 +107,11 @@ __DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
|
||||
__DEVICE__ bool isfinite(double __x) { return ::__isfinited(__x); }
|
||||
__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
|
||||
__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
|
||||
|
||||
#if defined(__OPENMP_NVPTX__)
|
||||
#pragma omp end declare variant
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
__DEVICE__ bool isgreater(float __x, float __y) {
|
||||
@@ -142,6 +175,15 @@ __DEVICE__ float sqrt(float __x) { return ::sqrtf(__x); }
|
||||
__DEVICE__ float tan(float __x) { return ::tanf(__x); }
|
||||
__DEVICE__ float tanh(float __x) { return ::tanhf(__x); }
|
||||
|
||||
// There was a redefinition error for this this overload in CUDA mode.
|
||||
// We restrict it to OpenMP mode for now, that is where it is actually needed
|
||||
// anyway.
|
||||
#ifdef __OPENMP_NVPTX__
|
||||
__DEVICE__ float remquo(float __n, float __d, int *__q) {
|
||||
return ::remquof(__n, __d, __q);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Notably missing above is nexttoward. We omit it because
|
||||
// libdevice doesn't provide an implementation, and we don't want to be in the
|
||||
// business of implementing tricky libm functions in this header.
|
||||
|
||||
30
lib/include/__clang_cuda_complex_builtins.h
vendored
30
lib/include/__clang_cuda_complex_builtins.h
vendored
@@ -41,6 +41,27 @@
|
||||
#define _ABSf std::abs
|
||||
#define _LOGBd std::logb
|
||||
#define _LOGBf std::logb
|
||||
// Rather than pulling in std::max from algorithm everytime, use available ::max.
|
||||
#define _fmaxd max
|
||||
#define _fmaxf max
|
||||
#else
|
||||
#ifdef __AMDGCN__
|
||||
#define _ISNANd __ocml_isnan_f64
|
||||
#define _ISNANf __ocml_isnan_f32
|
||||
#define _ISINFd __ocml_isinf_f64
|
||||
#define _ISINFf __ocml_isinf_f32
|
||||
#define _ISFINITEd __ocml_isfinite_f64
|
||||
#define _ISFINITEf __ocml_isfinite_f32
|
||||
#define _COPYSIGNd __ocml_copysign_f64
|
||||
#define _COPYSIGNf __ocml_copysign_f32
|
||||
#define _SCALBNd __ocml_scalbn_f64
|
||||
#define _SCALBNf __ocml_scalbn_f32
|
||||
#define _ABSd __ocml_fabs_f64
|
||||
#define _ABSf __ocml_fabs_f32
|
||||
#define _LOGBd __ocml_logb_f64
|
||||
#define _LOGBf __ocml_logb_f32
|
||||
#define _fmaxd __ocml_fmax_f64
|
||||
#define _fmaxf __ocml_fmax_f32
|
||||
#else
|
||||
#define _ISNANd __nv_isnand
|
||||
#define _ISNANf __nv_isnanf
|
||||
@@ -56,6 +77,9 @@
|
||||
#define _ABSf __nv_fabsf
|
||||
#define _LOGBd __nv_logb
|
||||
#define _LOGBf __nv_logbf
|
||||
#define _fmaxd __nv_fmax
|
||||
#define _fmaxf __nv_fmaxf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@@ -167,7 +191,7 @@ __DEVICE__ double _Complex __divdc3(double __a, double __b, double __c,
|
||||
// Can't use std::max, because that's defined in <algorithm>, and we don't
|
||||
// want to pull that in for every compile. The CUDA headers define
|
||||
// ::max(float, float) and ::max(double, double), which is sufficient for us.
|
||||
double __logbw = _LOGBd(max(_ABSd(__c), _ABSd(__d)));
|
||||
double __logbw = _LOGBd(_fmaxd(_ABSd(__c), _ABSd(__d)));
|
||||
if (_ISFINITEd(__logbw)) {
|
||||
__ilogbw = (int)__logbw;
|
||||
__c = _SCALBNd(__c, -__ilogbw);
|
||||
@@ -200,7 +224,7 @@ __DEVICE__ double _Complex __divdc3(double __a, double __b, double __c,
|
||||
|
||||
__DEVICE__ float _Complex __divsc3(float __a, float __b, float __c, float __d) {
|
||||
int __ilogbw = 0;
|
||||
float __logbw = _LOGBf(max(_ABSf(__c), _ABSf(__d)));
|
||||
float __logbw = _LOGBf(_fmaxf(_ABSf(__c), _ABSf(__d)));
|
||||
if (_ISFINITEf(__logbw)) {
|
||||
__ilogbw = (int)__logbw;
|
||||
__c = _SCALBNf(__c, -__ilogbw);
|
||||
@@ -249,6 +273,8 @@ __DEVICE__ float _Complex __divsc3(float __a, float __b, float __c, float __d) {
|
||||
#undef _ABSf
|
||||
#undef _LOGBd
|
||||
#undef _LOGBf
|
||||
#undef _fmaxd
|
||||
#undef _fmaxf
|
||||
|
||||
#ifdef __OPENMP_NVPTX__
|
||||
#pragma omp end declare target
|
||||
|
||||
9
lib/include/__clang_cuda_math.h
vendored
9
lib/include/__clang_cuda_math.h
vendored
@@ -195,8 +195,8 @@ __DEVICE__ int max(int __a, int __b) { return __nv_max(__a, __b); }
|
||||
__DEVICE__ int min(int __a, int __b) { return __nv_min(__a, __b); }
|
||||
__DEVICE__ double modf(double __a, double *__b) { return __nv_modf(__a, __b); }
|
||||
__DEVICE__ float modff(float __a, float *__b) { return __nv_modff(__a, __b); }
|
||||
__DEVICE__ double nearbyint(double __a) { return __nv_nearbyint(__a); }
|
||||
__DEVICE__ float nearbyintf(float __a) { return __nv_nearbyintf(__a); }
|
||||
__DEVICE__ double nearbyint(double __a) { return __builtin_nearbyint(__a); }
|
||||
__DEVICE__ float nearbyintf(float __a) { return __builtin_nearbyintf(__a); }
|
||||
__DEVICE__ double nextafter(double __a, double __b) {
|
||||
return __nv_nextafter(__a, __b);
|
||||
}
|
||||
@@ -249,8 +249,9 @@ __DEVICE__ double rhypot(double __a, double __b) {
|
||||
__DEVICE__ float rhypotf(float __a, float __b) {
|
||||
return __nv_rhypotf(__a, __b);
|
||||
}
|
||||
__DEVICE__ double rint(double __a) { return __nv_rint(__a); }
|
||||
__DEVICE__ float rintf(float __a) { return __nv_rintf(__a); }
|
||||
// __nv_rint* in libdevice is buggy and produces incorrect results.
|
||||
__DEVICE__ double rint(double __a) { return __builtin_rint(__a); }
|
||||
__DEVICE__ float rintf(float __a) { return __builtin_rintf(__a); }
|
||||
__DEVICE__ double rnorm(int __a, const double *__b) {
|
||||
return __nv_rnorm(__a, __b);
|
||||
}
|
||||
|
||||
@@ -160,6 +160,9 @@ __DEVICE__ double scalbln(double, long);
|
||||
__DEVICE__ float scalbln(float, long);
|
||||
__DEVICE__ double scalbn(double, int);
|
||||
__DEVICE__ float scalbn(float, int);
|
||||
#ifdef _MSC_VER
|
||||
__DEVICE__ bool signbit(long double);
|
||||
#endif
|
||||
__DEVICE__ bool signbit(double);
|
||||
__DEVICE__ bool signbit(float);
|
||||
__DEVICE__ double sin(double);
|
||||
|
||||
28
lib/include/__clang_cuda_runtime_wrapper.h
vendored
28
lib/include/__clang_cuda_runtime_wrapper.h
vendored
@@ -377,30 +377,38 @@ __device__ static inline void *malloc(size_t __size) {
|
||||
// Out-of-line implementations from __clang_cuda_builtin_vars.h. These need to
|
||||
// come after we've pulled in the definition of uint3 and dim3.
|
||||
|
||||
__device__ inline __cuda_builtin_threadIdx_t::operator dim3() const {
|
||||
return dim3(x, y, z);
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_threadIdx_t::operator uint3() const {
|
||||
uint3 ret;
|
||||
ret.x = x;
|
||||
ret.y = y;
|
||||
ret.z = z;
|
||||
return ret;
|
||||
return {x, y, z};
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_blockIdx_t::operator dim3() const {
|
||||
return dim3(x, y, z);
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_blockIdx_t::operator uint3() const {
|
||||
uint3 ret;
|
||||
ret.x = x;
|
||||
ret.y = y;
|
||||
ret.z = z;
|
||||
return ret;
|
||||
return {x, y, z};
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_blockDim_t::operator dim3() const {
|
||||
return dim3(x, y, z);
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_blockDim_t::operator uint3() const {
|
||||
return {x, y, z};
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_gridDim_t::operator dim3() const {
|
||||
return dim3(x, y, z);
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_gridDim_t::operator uint3() const {
|
||||
return {x, y, z};
|
||||
}
|
||||
|
||||
#include <__clang_cuda_cmath.h>
|
||||
#include <__clang_cuda_intrinsics.h>
|
||||
#include <__clang_cuda_complex_builtins.h>
|
||||
|
||||
664
lib/include/__clang_hip_cmath.h
vendored
Normal file
664
lib/include/__clang_hip_cmath.h
vendored
Normal file
@@ -0,0 +1,664 @@
|
||||
/*===---- __clang_hip_cmath.h - HIP cmath decls -----------------------------===
|
||||
*
|
||||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
* See https://llvm.org/LICENSE.txt for license information.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __CLANG_HIP_CMATH_H__
|
||||
#define __CLANG_HIP_CMATH_H__
|
||||
|
||||
#if !defined(__HIP__)
|
||||
#error "This file is for HIP and OpenMP AMDGCN device compilation only."
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma push_macro("__DEVICE__")
|
||||
#define __DEVICE__ static __device__ inline __attribute__((always_inline))
|
||||
|
||||
// Start with functions that cannot be defined by DEF macros below.
|
||||
#if defined(__cplusplus)
|
||||
__DEVICE__ double abs(double __x) { return ::fabs(__x); }
|
||||
__DEVICE__ float abs(float __x) { return ::fabsf(__x); }
|
||||
__DEVICE__ long long abs(long long __n) { return ::llabs(__n); }
|
||||
__DEVICE__ long abs(long __n) { return ::labs(__n); }
|
||||
__DEVICE__ float fma(float __x, float __y, float __z) {
|
||||
return ::fmaf(__x, __y, __z);
|
||||
}
|
||||
__DEVICE__ int fpclassify(float __x) {
|
||||
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
|
||||
FP_ZERO, __x);
|
||||
}
|
||||
__DEVICE__ int fpclassify(double __x) {
|
||||
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
|
||||
FP_ZERO, __x);
|
||||
}
|
||||
__DEVICE__ float frexp(float __arg, int *__exp) {
|
||||
return ::frexpf(__arg, __exp);
|
||||
}
|
||||
__DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
|
||||
__DEVICE__ bool isfinite(double __x) { return ::__finite(__x); }
|
||||
__DEVICE__ bool isgreater(float __x, float __y) {
|
||||
return __builtin_isgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isgreater(double __x, double __y) {
|
||||
return __builtin_isgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isgreaterequal(float __x, float __y) {
|
||||
return __builtin_isgreaterequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isgreaterequal(double __x, double __y) {
|
||||
return __builtin_isgreaterequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
|
||||
__DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
|
||||
__DEVICE__ bool isless(float __x, float __y) {
|
||||
return __builtin_isless(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isless(double __x, double __y) {
|
||||
return __builtin_isless(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessequal(float __x, float __y) {
|
||||
return __builtin_islessequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessequal(double __x, double __y) {
|
||||
return __builtin_islessequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessgreater(float __x, float __y) {
|
||||
return __builtin_islessgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessgreater(double __x, double __y) {
|
||||
return __builtin_islessgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
|
||||
__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
|
||||
__DEVICE__ bool isnormal(float __x) { return __builtin_isnormal(__x); }
|
||||
__DEVICE__ bool isnormal(double __x) { return __builtin_isnormal(__x); }
|
||||
__DEVICE__ bool isunordered(float __x, float __y) {
|
||||
return __builtin_isunordered(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isunordered(double __x, double __y) {
|
||||
return __builtin_isunordered(__x, __y);
|
||||
}
|
||||
__DEVICE__ float modf(float __x, float *__iptr) { return ::modff(__x, __iptr); }
|
||||
__DEVICE__ float pow(float __base, int __iexp) {
|
||||
return ::powif(__base, __iexp);
|
||||
}
|
||||
__DEVICE__ double pow(double __base, int __iexp) {
|
||||
return ::powi(__base, __iexp);
|
||||
}
|
||||
__DEVICE__ float remquo(float __x, float __y, int *__quo) {
|
||||
return ::remquof(__x, __y, __quo);
|
||||
}
|
||||
__DEVICE__ float scalbln(float __x, long int __n) {
|
||||
return ::scalblnf(__x, __n);
|
||||
}
|
||||
__DEVICE__ bool signbit(float __x) { return ::__signbitf(__x); }
|
||||
__DEVICE__ bool signbit(double __x) { return ::__signbit(__x); }
|
||||
|
||||
// Notably missing above is nexttoward. We omit it because
|
||||
// ocml doesn't provide an implementation, and we don't want to be in the
|
||||
// business of implementing tricky libm functions in this header.
|
||||
|
||||
// Other functions.
|
||||
__DEVICE__ _Float16 fma(_Float16 __x, _Float16 __y, _Float16 __z) {
|
||||
return __ocml_fma_f16(__x, __y, __z);
|
||||
}
|
||||
__DEVICE__ _Float16 pow(_Float16 __base, int __iexp) {
|
||||
return __ocml_pown_f16(__base, __iexp);
|
||||
}
|
||||
|
||||
// BEGIN DEF_FUN and HIP_OVERLOAD
|
||||
|
||||
// BEGIN DEF_FUN
|
||||
|
||||
#pragma push_macro("__DEF_FUN1")
|
||||
#pragma push_macro("__DEF_FUN2")
|
||||
#pragma push_macro("__DEF_FUN2_FI")
|
||||
|
||||
// Define cmath functions with float argument and returns __retty.
|
||||
#define __DEF_FUN1(__retty, __func) \
|
||||
__DEVICE__ \
|
||||
__retty __func(float __x) { return __func##f(__x); }
|
||||
|
||||
// Define cmath functions with two float arguments and returns __retty.
|
||||
#define __DEF_FUN2(__retty, __func) \
|
||||
__DEVICE__ \
|
||||
__retty __func(float __x, float __y) { return __func##f(__x, __y); }
|
||||
|
||||
// Define cmath functions with a float and an int argument and returns __retty.
|
||||
#define __DEF_FUN2_FI(__retty, __func) \
|
||||
__DEVICE__ \
|
||||
__retty __func(float __x, int __y) { return __func##f(__x, __y); }
|
||||
|
||||
__DEF_FUN1(float, acos)
|
||||
__DEF_FUN1(float, acosh)
|
||||
__DEF_FUN1(float, asin)
|
||||
__DEF_FUN1(float, asinh)
|
||||
__DEF_FUN1(float, atan)
|
||||
__DEF_FUN2(float, atan2)
|
||||
__DEF_FUN1(float, atanh)
|
||||
__DEF_FUN1(float, cbrt)
|
||||
__DEF_FUN1(float, ceil)
|
||||
__DEF_FUN2(float, copysign)
|
||||
__DEF_FUN1(float, cos)
|
||||
__DEF_FUN1(float, cosh)
|
||||
__DEF_FUN1(float, erf)
|
||||
__DEF_FUN1(float, erfc)
|
||||
__DEF_FUN1(float, exp)
|
||||
__DEF_FUN1(float, exp2)
|
||||
__DEF_FUN1(float, expm1)
|
||||
__DEF_FUN1(float, fabs)
|
||||
__DEF_FUN2(float, fdim)
|
||||
__DEF_FUN1(float, floor)
|
||||
__DEF_FUN2(float, fmax)
|
||||
__DEF_FUN2(float, fmin)
|
||||
__DEF_FUN2(float, fmod)
|
||||
__DEF_FUN2(float, hypot)
|
||||
__DEF_FUN1(int, ilogb)
|
||||
__DEF_FUN2_FI(float, ldexp)
|
||||
__DEF_FUN1(float, lgamma)
|
||||
__DEF_FUN1(float, log)
|
||||
__DEF_FUN1(float, log10)
|
||||
__DEF_FUN1(float, log1p)
|
||||
__DEF_FUN1(float, log2)
|
||||
__DEF_FUN1(float, logb)
|
||||
__DEF_FUN1(long long, llrint)
|
||||
__DEF_FUN1(long long, llround)
|
||||
__DEF_FUN1(long, lrint)
|
||||
__DEF_FUN1(long, lround)
|
||||
__DEF_FUN1(float, nearbyint)
|
||||
__DEF_FUN2(float, nextafter)
|
||||
__DEF_FUN2(float, pow)
|
||||
__DEF_FUN2(float, remainder)
|
||||
__DEF_FUN1(float, rint)
|
||||
__DEF_FUN1(float, round)
|
||||
__DEF_FUN2_FI(float, scalbn)
|
||||
__DEF_FUN1(float, sin)
|
||||
__DEF_FUN1(float, sinh)
|
||||
__DEF_FUN1(float, sqrt)
|
||||
__DEF_FUN1(float, tan)
|
||||
__DEF_FUN1(float, tanh)
|
||||
__DEF_FUN1(float, tgamma)
|
||||
__DEF_FUN1(float, trunc)
|
||||
|
||||
#pragma pop_macro("__DEF_FUN1")
|
||||
#pragma pop_macro("__DEF_FUN2")
|
||||
#pragma pop_macro("__DEF_FUN2_FI")
|
||||
|
||||
// END DEF_FUN
|
||||
|
||||
// BEGIN HIP_OVERLOAD
|
||||
|
||||
#pragma push_macro("__HIP_OVERLOAD1")
|
||||
#pragma push_macro("__HIP_OVERLOAD2")
|
||||
|
||||
// __hip_enable_if::type is a type function which returns __T if __B is true.
|
||||
template <bool __B, class __T = void> struct __hip_enable_if {};
|
||||
|
||||
template <class __T> struct __hip_enable_if<true, __T> { typedef __T type; };
|
||||
|
||||
// decltype is only available in C++11 and above.
|
||||
#if __cplusplus >= 201103L
|
||||
// __hip_promote
|
||||
namespace __hip {
|
||||
|
||||
template <class _Tp> struct __numeric_type {
|
||||
static void __test(...);
|
||||
static _Float16 __test(_Float16);
|
||||
static float __test(float);
|
||||
static double __test(char);
|
||||
static double __test(int);
|
||||
static double __test(unsigned);
|
||||
static double __test(long);
|
||||
static double __test(unsigned long);
|
||||
static double __test(long long);
|
||||
static double __test(unsigned long long);
|
||||
static double __test(double);
|
||||
// No support for long double, use double instead.
|
||||
static double __test(long double);
|
||||
|
||||
typedef decltype(__test(std::declval<_Tp>())) type;
|
||||
static const bool value = !std::is_same<type, void>::value;
|
||||
};
|
||||
|
||||
template <> struct __numeric_type<void> { static const bool value = true; };
|
||||
|
||||
template <class _A1, class _A2 = void, class _A3 = void,
|
||||
bool = __numeric_type<_A1>::value &&__numeric_type<_A2>::value
|
||||
&&__numeric_type<_A3>::value>
|
||||
class __promote_imp {
|
||||
public:
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _A1, class _A2, class _A3>
|
||||
class __promote_imp<_A1, _A2, _A3, true> {
|
||||
private:
|
||||
typedef typename __promote_imp<_A1>::type __type1;
|
||||
typedef typename __promote_imp<_A2>::type __type2;
|
||||
typedef typename __promote_imp<_A3>::type __type3;
|
||||
|
||||
public:
|
||||
typedef decltype(__type1() + __type2() + __type3()) type;
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class _A1, class _A2> class __promote_imp<_A1, _A2, void, true> {
|
||||
private:
|
||||
typedef typename __promote_imp<_A1>::type __type1;
|
||||
typedef typename __promote_imp<_A2>::type __type2;
|
||||
|
||||
public:
|
||||
typedef decltype(__type1() + __type2()) type;
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class _A1> class __promote_imp<_A1, void, void, true> {
|
||||
public:
|
||||
typedef typename __numeric_type<_A1>::type type;
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class _A1, class _A2 = void, class _A3 = void>
|
||||
class __promote : public __promote_imp<_A1, _A2, _A3> {};
|
||||
|
||||
} // namespace __hip
|
||||
#endif //__cplusplus >= 201103L
|
||||
|
||||
// __HIP_OVERLOAD1 is used to resolve function calls with integer argument to
|
||||
// avoid compilation error due to ambibuity. e.g. floor(5) is resolved with
|
||||
// floor(double).
|
||||
#define __HIP_OVERLOAD1(__retty, __fn) \
|
||||
template <typename __T> \
|
||||
__DEVICE__ typename __hip_enable_if<std::numeric_limits<__T>::is_integer, \
|
||||
__retty>::type \
|
||||
__fn(__T __x) { \
|
||||
return ::__fn((double)__x); \
|
||||
}
|
||||
|
||||
// __HIP_OVERLOAD2 is used to resolve function calls with mixed float/double
|
||||
// or integer argument to avoid compilation error due to ambibuity. e.g.
|
||||
// max(5.0f, 6.0) is resolved with max(double, double).
|
||||
#if __cplusplus >= 201103L
|
||||
#define __HIP_OVERLOAD2(__retty, __fn) \
|
||||
template <typename __T1, typename __T2> \
|
||||
__DEVICE__ typename __hip_enable_if< \
|
||||
std::numeric_limits<__T1>::is_specialized && \
|
||||
std::numeric_limits<__T2>::is_specialized, \
|
||||
typename __hip::__promote<__T1, __T2>::type>::type \
|
||||
__fn(__T1 __x, __T2 __y) { \
|
||||
typedef typename __hip::__promote<__T1, __T2>::type __result_type; \
|
||||
return __fn((__result_type)__x, (__result_type)__y); \
|
||||
}
|
||||
#else
|
||||
#define __HIP_OVERLOAD2(__retty, __fn) \
|
||||
template <typename __T1, typename __T2> \
|
||||
__DEVICE__ \
|
||||
typename __hip_enable_if<std::numeric_limits<__T1>::is_specialized && \
|
||||
std::numeric_limits<__T2>::is_specialized, \
|
||||
__retty>::type \
|
||||
__fn(__T1 __x, __T2 __y) { \
|
||||
return __fn((double)__x, (double)__y); \
|
||||
}
|
||||
#endif
|
||||
|
||||
__HIP_OVERLOAD1(double, abs)
|
||||
__HIP_OVERLOAD1(double, acos)
|
||||
__HIP_OVERLOAD1(double, acosh)
|
||||
__HIP_OVERLOAD1(double, asin)
|
||||
__HIP_OVERLOAD1(double, asinh)
|
||||
__HIP_OVERLOAD1(double, atan)
|
||||
__HIP_OVERLOAD2(double, atan2)
|
||||
__HIP_OVERLOAD1(double, atanh)
|
||||
__HIP_OVERLOAD1(double, cbrt)
|
||||
__HIP_OVERLOAD1(double, ceil)
|
||||
__HIP_OVERLOAD2(double, copysign)
|
||||
__HIP_OVERLOAD1(double, cos)
|
||||
__HIP_OVERLOAD1(double, cosh)
|
||||
__HIP_OVERLOAD1(double, erf)
|
||||
__HIP_OVERLOAD1(double, erfc)
|
||||
__HIP_OVERLOAD1(double, exp)
|
||||
__HIP_OVERLOAD1(double, exp2)
|
||||
__HIP_OVERLOAD1(double, expm1)
|
||||
__HIP_OVERLOAD1(double, fabs)
|
||||
__HIP_OVERLOAD2(double, fdim)
|
||||
__HIP_OVERLOAD1(double, floor)
|
||||
__HIP_OVERLOAD2(double, fmax)
|
||||
__HIP_OVERLOAD2(double, fmin)
|
||||
__HIP_OVERLOAD2(double, fmod)
|
||||
__HIP_OVERLOAD1(int, fpclassify)
|
||||
__HIP_OVERLOAD2(double, hypot)
|
||||
__HIP_OVERLOAD1(int, ilogb)
|
||||
__HIP_OVERLOAD1(bool, isfinite)
|
||||
__HIP_OVERLOAD2(bool, isgreater)
|
||||
__HIP_OVERLOAD2(bool, isgreaterequal)
|
||||
__HIP_OVERLOAD1(bool, isinf)
|
||||
__HIP_OVERLOAD2(bool, isless)
|
||||
__HIP_OVERLOAD2(bool, islessequal)
|
||||
__HIP_OVERLOAD2(bool, islessgreater)
|
||||
__HIP_OVERLOAD1(bool, isnan)
|
||||
__HIP_OVERLOAD1(bool, isnormal)
|
||||
__HIP_OVERLOAD2(bool, isunordered)
|
||||
__HIP_OVERLOAD1(double, lgamma)
|
||||
__HIP_OVERLOAD1(double, log)
|
||||
__HIP_OVERLOAD1(double, log10)
|
||||
__HIP_OVERLOAD1(double, log1p)
|
||||
__HIP_OVERLOAD1(double, log2)
|
||||
__HIP_OVERLOAD1(double, logb)
|
||||
__HIP_OVERLOAD1(long long, llrint)
|
||||
__HIP_OVERLOAD1(long long, llround)
|
||||
__HIP_OVERLOAD1(long, lrint)
|
||||
__HIP_OVERLOAD1(long, lround)
|
||||
__HIP_OVERLOAD1(double, nearbyint)
|
||||
__HIP_OVERLOAD2(double, nextafter)
|
||||
__HIP_OVERLOAD2(double, pow)
|
||||
__HIP_OVERLOAD2(double, remainder)
|
||||
__HIP_OVERLOAD1(double, rint)
|
||||
__HIP_OVERLOAD1(double, round)
|
||||
__HIP_OVERLOAD1(bool, signbit)
|
||||
__HIP_OVERLOAD1(double, sin)
|
||||
__HIP_OVERLOAD1(double, sinh)
|
||||
__HIP_OVERLOAD1(double, sqrt)
|
||||
__HIP_OVERLOAD1(double, tan)
|
||||
__HIP_OVERLOAD1(double, tanh)
|
||||
__HIP_OVERLOAD1(double, tgamma)
|
||||
__HIP_OVERLOAD1(double, trunc)
|
||||
|
||||
// Overload these but don't add them to std, they are not part of cmath.
|
||||
__HIP_OVERLOAD2(double, max)
|
||||
__HIP_OVERLOAD2(double, min)
|
||||
|
||||
// Additional Overloads that don't quite match HIP_OVERLOAD.
|
||||
#if __cplusplus >= 201103L
|
||||
template <typename __T1, typename __T2, typename __T3>
|
||||
__DEVICE__ typename __hip_enable_if<
|
||||
std::numeric_limits<__T1>::is_specialized &&
|
||||
std::numeric_limits<__T2>::is_specialized &&
|
||||
std::numeric_limits<__T3>::is_specialized,
|
||||
typename __hip::__promote<__T1, __T2, __T3>::type>::type
|
||||
fma(__T1 __x, __T2 __y, __T3 __z) {
|
||||
typedef typename __hip::__promote<__T1, __T2, __T3>::type __result_type;
|
||||
return ::fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
|
||||
}
|
||||
#else
|
||||
template <typename __T1, typename __T2, typename __T3>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T1>::is_specialized &&
|
||||
std::numeric_limits<__T2>::is_specialized &&
|
||||
std::numeric_limits<__T3>::is_specialized,
|
||||
double>::type
|
||||
fma(__T1 __x, __T2 __y, __T3 __z) {
|
||||
return ::fma((double)__x, (double)__y, (double)__z);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename __T>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T>::is_integer, double>::type
|
||||
frexp(__T __x, int *__exp) {
|
||||
return ::frexp((double)__x, __exp);
|
||||
}
|
||||
|
||||
template <typename __T>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T>::is_integer, double>::type
|
||||
ldexp(__T __x, int __exp) {
|
||||
return ::ldexp((double)__x, __exp);
|
||||
}
|
||||
|
||||
template <typename __T>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T>::is_integer, double>::type
|
||||
modf(__T __x, double *__exp) {
|
||||
return ::modf((double)__x, __exp);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template <typename __T1, typename __T2>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T1>::is_specialized &&
|
||||
std::numeric_limits<__T2>::is_specialized,
|
||||
typename __hip::__promote<__T1, __T2>::type>::type
|
||||
remquo(__T1 __x, __T2 __y, int *__quo) {
|
||||
typedef typename __hip::__promote<__T1, __T2>::type __result_type;
|
||||
return ::remquo((__result_type)__x, (__result_type)__y, __quo);
|
||||
}
|
||||
#else
|
||||
template <typename __T1, typename __T2>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T1>::is_specialized &&
|
||||
std::numeric_limits<__T2>::is_specialized,
|
||||
double>::type
|
||||
remquo(__T1 __x, __T2 __y, int *__quo) {
|
||||
return ::remquo((double)__x, (double)__y, __quo);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename __T>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T>::is_integer, double>::type
|
||||
scalbln(__T __x, long int __exp) {
|
||||
return ::scalbln((double)__x, __exp);
|
||||
}
|
||||
|
||||
template <typename __T>
|
||||
__DEVICE__
|
||||
typename __hip_enable_if<std::numeric_limits<__T>::is_integer, double>::type
|
||||
scalbn(__T __x, int __exp) {
|
||||
return ::scalbn((double)__x, __exp);
|
||||
}
|
||||
|
||||
#pragma pop_macro("__HIP_OVERLOAD1")
|
||||
#pragma pop_macro("__HIP_OVERLOAD2")
|
||||
|
||||
// END HIP_OVERLOAD
|
||||
|
||||
// END DEF_FUN and HIP_OVERLOAD
|
||||
|
||||
#endif // defined(__cplusplus)
|
||||
|
||||
// Define these overloads inside the namespace our standard library uses.
|
||||
#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
#else
|
||||
namespace std {
|
||||
#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Pull the new overloads we defined above into namespace std.
|
||||
// using ::abs; - This may be considered for C++.
|
||||
using ::acos;
|
||||
using ::acosh;
|
||||
using ::asin;
|
||||
using ::asinh;
|
||||
using ::atan;
|
||||
using ::atan2;
|
||||
using ::atanh;
|
||||
using ::cbrt;
|
||||
using ::ceil;
|
||||
using ::copysign;
|
||||
using ::cos;
|
||||
using ::cosh;
|
||||
using ::erf;
|
||||
using ::erfc;
|
||||
using ::exp;
|
||||
using ::exp2;
|
||||
using ::expm1;
|
||||
using ::fabs;
|
||||
using ::fdim;
|
||||
using ::floor;
|
||||
using ::fma;
|
||||
using ::fmax;
|
||||
using ::fmin;
|
||||
using ::fmod;
|
||||
using ::fpclassify;
|
||||
using ::frexp;
|
||||
using ::hypot;
|
||||
using ::ilogb;
|
||||
using ::isfinite;
|
||||
using ::isgreater;
|
||||
using ::isgreaterequal;
|
||||
using ::isless;
|
||||
using ::islessequal;
|
||||
using ::islessgreater;
|
||||
using ::isnormal;
|
||||
using ::isunordered;
|
||||
using ::ldexp;
|
||||
using ::lgamma;
|
||||
using ::llrint;
|
||||
using ::llround;
|
||||
using ::log;
|
||||
using ::log10;
|
||||
using ::log1p;
|
||||
using ::log2;
|
||||
using ::logb;
|
||||
using ::lrint;
|
||||
using ::lround;
|
||||
using ::modf;
|
||||
// using ::nan; - This may be considered for C++.
|
||||
// using ::nanf; - This may be considered for C++.
|
||||
// using ::nanl; - This is not yet defined.
|
||||
using ::nearbyint;
|
||||
using ::nextafter;
|
||||
// using ::nexttoward; - Omit this since we do not have a definition.
|
||||
using ::pow;
|
||||
using ::remainder;
|
||||
using ::remquo;
|
||||
using ::rint;
|
||||
using ::round;
|
||||
using ::scalbln;
|
||||
using ::scalbn;
|
||||
using ::signbit;
|
||||
using ::sin;
|
||||
using ::sinh;
|
||||
using ::sqrt;
|
||||
using ::tan;
|
||||
using ::tanh;
|
||||
using ::tgamma;
|
||||
using ::trunc;
|
||||
|
||||
// Well this is fun: We need to pull these symbols in for libc++, but we can't
|
||||
// pull them in with libstdc++, because its ::isinf and ::isnan are different
|
||||
// than its std::isinf and std::isnan.
|
||||
#ifndef __GLIBCXX__
|
||||
using ::isinf;
|
||||
using ::isnan;
|
||||
#endif
|
||||
|
||||
// Finally, pull the "foobarf" functions that HIP defines into std.
|
||||
using ::acosf;
|
||||
using ::acoshf;
|
||||
using ::asinf;
|
||||
using ::asinhf;
|
||||
using ::atan2f;
|
||||
using ::atanf;
|
||||
using ::atanhf;
|
||||
using ::cbrtf;
|
||||
using ::ceilf;
|
||||
using ::copysignf;
|
||||
using ::cosf;
|
||||
using ::coshf;
|
||||
using ::erfcf;
|
||||
using ::erff;
|
||||
using ::exp2f;
|
||||
using ::expf;
|
||||
using ::expm1f;
|
||||
using ::fabsf;
|
||||
using ::fdimf;
|
||||
using ::floorf;
|
||||
using ::fmaf;
|
||||
using ::fmaxf;
|
||||
using ::fminf;
|
||||
using ::fmodf;
|
||||
using ::frexpf;
|
||||
using ::hypotf;
|
||||
using ::ilogbf;
|
||||
using ::ldexpf;
|
||||
using ::lgammaf;
|
||||
using ::llrintf;
|
||||
using ::llroundf;
|
||||
using ::log10f;
|
||||
using ::log1pf;
|
||||
using ::log2f;
|
||||
using ::logbf;
|
||||
using ::logf;
|
||||
using ::lrintf;
|
||||
using ::lroundf;
|
||||
using ::modff;
|
||||
using ::nearbyintf;
|
||||
using ::nextafterf;
|
||||
// using ::nexttowardf; - Omit this since we do not have a definition.
|
||||
using ::powf;
|
||||
using ::remainderf;
|
||||
using ::remquof;
|
||||
using ::rintf;
|
||||
using ::roundf;
|
||||
using ::scalblnf;
|
||||
using ::scalbnf;
|
||||
using ::sinf;
|
||||
using ::sinhf;
|
||||
using ::sqrtf;
|
||||
using ::tanf;
|
||||
using ::tanhf;
|
||||
using ::tgammaf;
|
||||
using ::truncf;
|
||||
|
||||
#ifdef _LIBCPP_END_NAMESPACE_STD
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
#else
|
||||
#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
// Define device-side math functions from <ymath.h> on MSVC.
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
// Before VS2019, `<ymath.h>` is also included in `<limits>` and other headers.
|
||||
// But, from VS2019, it's only included in `<complex>`. Need to include
|
||||
// `<ymath.h>` here to ensure C functions declared there won't be markded as
|
||||
// `__host__` and `__device__` through `<complex>` wrapper.
|
||||
#include <ymath.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // defined(__cplusplus)
|
||||
__DEVICE__ __attribute__((overloadable)) double _Cosh(double x, double y) {
|
||||
return cosh(x) * y;
|
||||
}
|
||||
__DEVICE__ __attribute__((overloadable)) float _FCosh(float x, float y) {
|
||||
return coshf(x) * y;
|
||||
}
|
||||
__DEVICE__ __attribute__((overloadable)) short _Dtest(double *p) {
|
||||
return fpclassify(*p);
|
||||
}
|
||||
__DEVICE__ __attribute__((overloadable)) short _FDtest(float *p) {
|
||||
return fpclassify(*p);
|
||||
}
|
||||
__DEVICE__ __attribute__((overloadable)) double _Sinh(double x, double y) {
|
||||
return sinh(x) * y;
|
||||
}
|
||||
__DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
|
||||
return sinhf(x) * y;
|
||||
}
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // defined(__cplusplus)
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
#pragma pop_macro("__DEVICE__")
|
||||
|
||||
#endif // __CLANG_HIP_CMATH_H__
|
||||
26
lib/include/__clang_hip_libdevice_declares.h
vendored
26
lib/include/__clang_hip_libdevice_declares.h
vendored
@@ -10,7 +10,9 @@
|
||||
#ifndef __CLANG_HIP_LIBDEVICE_DECLARES_H__
|
||||
#define __CLANG_HIP_LIBDEVICE_DECLARES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// BEGIN FLOAT
|
||||
__device__ __attribute__((const)) float __ocml_acos_f32(float);
|
||||
@@ -78,6 +80,7 @@ __device__ __attribute__((const)) float __ocml_len4_f32(float, float, float,
|
||||
__device__ __attribute__((pure)) float __ocml_ncdf_f32(float);
|
||||
__device__ __attribute__((pure)) float __ocml_ncdfinv_f32(float);
|
||||
__device__ __attribute__((pure)) float __ocml_pow_f32(float, float);
|
||||
__device__ __attribute__((pure)) float __ocml_pown_f32(float, int);
|
||||
__device__ __attribute__((pure)) float __ocml_rcbrt_f32(float);
|
||||
__device__ __attribute__((const)) float __ocml_remainder_f32(float, float);
|
||||
__device__ float __ocml_remquo_f32(float, float,
|
||||
@@ -126,10 +129,10 @@ __device__ __attribute__((const)) float __ocml_div_rte_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_div_rtn_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_div_rtp_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_div_rtz_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rte_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rtn_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rtp_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rtz_f32(float, float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rte_f32(float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rtn_f32(float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rtp_f32(float);
|
||||
__device__ __attribute__((const)) float __ocml_sqrt_rtz_f32(float);
|
||||
__device__ __attribute__((const)) float __ocml_fma_rte_f32(float, float, float);
|
||||
__device__ __attribute__((const)) float __ocml_fma_rtn_f32(float, float, float);
|
||||
__device__ __attribute__((const)) float __ocml_fma_rtp_f32(float, float, float);
|
||||
@@ -205,6 +208,7 @@ __device__ __attribute__((const)) double __ocml_len4_f64(double, double, double,
|
||||
__device__ __attribute__((pure)) double __ocml_ncdf_f64(double);
|
||||
__device__ __attribute__((pure)) double __ocml_ncdfinv_f64(double);
|
||||
__device__ __attribute__((pure)) double __ocml_pow_f64(double, double);
|
||||
__device__ __attribute__((pure)) double __ocml_pown_f64(double, int);
|
||||
__device__ __attribute__((pure)) double __ocml_rcbrt_f64(double);
|
||||
__device__ __attribute__((const)) double __ocml_remainder_f64(double, double);
|
||||
__device__ double __ocml_remquo_f64(double, double,
|
||||
@@ -252,10 +256,10 @@ __device__ __attribute__((const)) double __ocml_div_rte_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_div_rtn_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_div_rtp_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_div_rtz_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rte_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rtn_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rtp_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rtz_f64(double, double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rte_f64(double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rtn_f64(double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rtp_f64(double);
|
||||
__device__ __attribute__((const)) double __ocml_sqrt_rtz_f64(double);
|
||||
__device__ __attribute__((const)) double __ocml_fma_rte_f64(double, double,
|
||||
double);
|
||||
__device__ __attribute__((const)) double __ocml_fma_rtn_f64(double, double,
|
||||
@@ -290,6 +294,7 @@ __device__ __attribute__((const)) _Float16 __ocml_rsqrt_f16(_Float16);
|
||||
__device__ _Float16 __ocml_sin_f16(_Float16);
|
||||
__device__ __attribute__((const)) _Float16 __ocml_sqrt_f16(_Float16);
|
||||
__device__ __attribute__((const)) _Float16 __ocml_trunc_f16(_Float16);
|
||||
__device__ __attribute__((pure)) _Float16 __ocml_pown_f16(_Float16, int);
|
||||
|
||||
typedef _Float16 __2f16 __attribute__((ext_vector_type(2)));
|
||||
typedef short __2i16 __attribute__((ext_vector_type(2)));
|
||||
@@ -313,14 +318,17 @@ __device__ __attribute__((pure)) __2f16 __ocml_log2_2f16(__2f16);
|
||||
__device__ inline __2f16
|
||||
__llvm_amdgcn_rcp_2f16(__2f16 __x) // Not currently exposed by ROCDL.
|
||||
{
|
||||
return __2f16{__llvm_amdgcn_rcp_f16(__x.x), __llvm_amdgcn_rcp_f16(__x.y)};
|
||||
return (__2f16)(__llvm_amdgcn_rcp_f16(__x.x), __llvm_amdgcn_rcp_f16(__x.y));
|
||||
}
|
||||
__device__ __attribute__((const)) __2f16 __ocml_rint_2f16(__2f16);
|
||||
__device__ __attribute__((const)) __2f16 __ocml_rsqrt_2f16(__2f16);
|
||||
__device__ __2f16 __ocml_sin_2f16(__2f16);
|
||||
__device__ __attribute__((const)) __2f16 __ocml_sqrt_2f16(__2f16);
|
||||
__device__ __attribute__((const)) __2f16 __ocml_trunc_2f16(__2f16);
|
||||
__device__ __attribute__((const)) __2f16 __ocml_pown_2f16(__2f16, __2i16);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __CLANG_HIP_LIBDEVICE_DECLARES_H__
|
||||
|
||||
1194
lib/include/__clang_hip_math.h
vendored
1194
lib/include/__clang_hip_math.h
vendored
File diff suppressed because it is too large
Load Diff
5
lib/include/__clang_hip_runtime_wrapper.h
vendored
5
lib/include/__clang_hip_runtime_wrapper.h
vendored
@@ -28,6 +28,10 @@
|
||||
#define __shared__ __attribute__((shared))
|
||||
#define __constant__ __attribute__((constant))
|
||||
|
||||
#if !defined(__cplusplus) || __cplusplus < 201103L
|
||||
#define nullptr NULL;
|
||||
#endif
|
||||
|
||||
#if __HIP_ENABLE_DEVICE_MALLOC__
|
||||
extern "C" __device__ void *__hip_malloc(size_t __size);
|
||||
extern "C" __device__ void *__hip_free(void *__ptr);
|
||||
@@ -51,6 +55,7 @@ static inline __device__ void *free(void *__ptr) {
|
||||
|
||||
#if !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
|
||||
#include <__clang_cuda_math_forward_declares.h>
|
||||
#include <__clang_hip_cmath.h>
|
||||
#include <__clang_cuda_complex_builtins.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
1209
lib/include/altivec.h
vendored
1209
lib/include/altivec.h
vendored
File diff suppressed because it is too large
Load Diff
97
lib/include/amxintrin.h
vendored
97
lib/include/amxintrin.h
vendored
@@ -15,8 +15,8 @@
|
||||
#define __AMXINTRIN_H
|
||||
#ifdef __x86_64__
|
||||
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("amx-tile")))
|
||||
#define __DEFAULT_FN_ATTRS_TILE \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("amx-tile")))
|
||||
|
||||
/// Load tile configuration from a 64-byte memory location specified by
|
||||
/// "mem_addr". The tile configuration includes the tile type palette, the
|
||||
@@ -31,9 +31,8 @@
|
||||
///
|
||||
/// \param __config
|
||||
/// A pointer to 512-bits configuration
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_tile_loadconfig(const void *__config)
|
||||
{
|
||||
static __inline__ void __DEFAULT_FN_ATTRS_TILE
|
||||
_tile_loadconfig(const void *__config) {
|
||||
__builtin_ia32_tile_loadconfig(__config);
|
||||
}
|
||||
|
||||
@@ -48,9 +47,8 @@ _tile_loadconfig(const void *__config)
|
||||
///
|
||||
/// \param __config
|
||||
/// A pointer to 512-bits configuration
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_tile_storeconfig(void *__config)
|
||||
{
|
||||
static __inline__ void __DEFAULT_FN_ATTRS_TILE
|
||||
_tile_storeconfig(void *__config) {
|
||||
__builtin_ia32_tile_storeconfig(__config);
|
||||
}
|
||||
|
||||
@@ -60,9 +58,7 @@ _tile_storeconfig(void *__config)
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> TILERELEASE </c> instruction.
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_tile_release(void)
|
||||
{
|
||||
static __inline__ void __DEFAULT_FN_ATTRS_TILE _tile_release(void) {
|
||||
__builtin_ia32_tilerelease();
|
||||
}
|
||||
|
||||
@@ -80,8 +76,9 @@ _tile_release(void)
|
||||
/// A pointer to base address.
|
||||
/// \param stride
|
||||
/// The stride between the rows' data to be loaded in memory.
|
||||
#define _tile_loadd(dst, base, stride) \
|
||||
__builtin_ia32_tileloadd64((dst), ((const void *)(base)), (__SIZE_TYPE__)(stride))
|
||||
#define _tile_loadd(dst, base, stride) \
|
||||
__builtin_ia32_tileloadd64((dst), ((const void *)(base)), \
|
||||
(__SIZE_TYPE__)(stride))
|
||||
|
||||
/// Load tile rows from memory specifieid by "base" address and "stride" into
|
||||
/// destination tile "dst" using the tile configuration previously configured
|
||||
@@ -99,8 +96,9 @@ _tile_release(void)
|
||||
/// A pointer to base address.
|
||||
/// \param stride
|
||||
/// The stride between the rows' data to be loaded in memory.
|
||||
#define _tile_stream_loadd(dst, base, stride) \
|
||||
__builtin_ia32_tileloaddt164((dst), ((const void *)(base)), (__SIZE_TYPE__)(stride))
|
||||
#define _tile_stream_loadd(dst, base, stride) \
|
||||
__builtin_ia32_tileloaddt164((dst), ((const void *)(base)), \
|
||||
(__SIZE_TYPE__)(stride))
|
||||
|
||||
/// Store the tile specified by "src" to memory specifieid by "base" address and
|
||||
/// "stride" using the tile configuration previously configured via
|
||||
@@ -116,7 +114,7 @@ _tile_release(void)
|
||||
/// A pointer to base address.
|
||||
/// \param stride
|
||||
/// The stride between the rows' data to be stored in memory.
|
||||
#define _tile_stored(dst, base, stride) \
|
||||
#define _tile_stored(dst, base, stride) \
|
||||
__builtin_ia32_tilestored64((dst), ((void *)(base)), (__SIZE_TYPE__)(stride))
|
||||
|
||||
/// Zero the tile specified by "tdest".
|
||||
@@ -145,7 +143,8 @@ _tile_release(void)
|
||||
/// The 1st source tile. Max size is 1024 Bytes.
|
||||
/// \param src1
|
||||
/// The 2nd source tile. Max size is 1024 Bytes.
|
||||
#define _tile_dpbssd(dst, src0, src1) __builtin_ia32_tdpbssd((dst), (src0), (src1))
|
||||
#define _tile_dpbssd(dst, src0, src1) \
|
||||
__builtin_ia32_tdpbssd((dst), (src0), (src1))
|
||||
|
||||
/// Compute dot-product of bytes in tiles with a source/destination accumulator.
|
||||
/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in src0 with
|
||||
@@ -163,7 +162,8 @@ _tile_release(void)
|
||||
/// The 1st source tile. Max size is 1024 Bytes.
|
||||
/// \param src1
|
||||
/// The 2nd source tile. Max size is 1024 Bytes.
|
||||
#define _tile_dpbsud(dst, src0, src1) __builtin_ia32_tdpbsud((dst), (src0), (src1))
|
||||
#define _tile_dpbsud(dst, src0, src1) \
|
||||
__builtin_ia32_tdpbsud((dst), (src0), (src1))
|
||||
|
||||
/// Compute dot-product of bytes in tiles with a source/destination accumulator.
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in src0 with
|
||||
@@ -181,7 +181,8 @@ _tile_release(void)
|
||||
/// The 1st source tile. Max size is 1024 Bytes.
|
||||
/// \param src1
|
||||
/// The 2nd source tile. Max size is 1024 Bytes.
|
||||
#define _tile_dpbusd(dst, src0, src1) __builtin_ia32_tdpbusd((dst), (src0), (src1))
|
||||
#define _tile_dpbusd(dst, src0, src1) \
|
||||
__builtin_ia32_tdpbusd((dst), (src0), (src1))
|
||||
|
||||
/// Compute dot-product of bytes in tiles with a source/destination accumulator.
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in src0 with
|
||||
@@ -199,7 +200,8 @@ _tile_release(void)
|
||||
/// The 1st source tile. Max size is 1024 Bytes.
|
||||
/// \param src1
|
||||
/// The 2nd source tile. Max size is 1024 Bytes.
|
||||
#define _tile_dpbuud(dst, src0, src1) __builtin_ia32_tdpbuud((dst), (src0), (src1))
|
||||
#define _tile_dpbuud(dst, src0, src1) \
|
||||
__builtin_ia32_tdpbuud((dst), (src0), (src1))
|
||||
|
||||
/// Compute dot-product of BF16 (16-bit) floating-point pairs in tiles src0 and
|
||||
/// src1, accumulating the intermediate single-precision (32-bit) floating-point
|
||||
@@ -216,10 +218,61 @@ _tile_release(void)
|
||||
/// The 1st source tile. Max size is 1024 Bytes.
|
||||
/// \param src1
|
||||
/// The 2nd source tile. Max size is 1024 Bytes.
|
||||
#define _tile_dpbf16ps(dst, src0, src1) \
|
||||
#define _tile_dpbf16ps(dst, src0, src1) \
|
||||
__builtin_ia32_tdpbf16ps((dst), (src0), (src1))
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#define __DEFAULT_FN_ATTRS_INT8 \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("amx-int8")))
|
||||
|
||||
typedef int _tile1024i __attribute__((__vector_size__(1024), __aligned__(64)));
|
||||
static __inline__ _tile1024i __DEFAULT_FN_ATTRS_INT8
|
||||
_tile_loadd_internal(unsigned short m, unsigned short n, const void *base,
|
||||
__SIZE_TYPE__ stride) {
|
||||
return __builtin_ia32_tileloadd64_internal(m, n, base,
|
||||
(__SIZE_TYPE__)(stride));
|
||||
}
|
||||
|
||||
static __inline__ _tile1024i __DEFAULT_FN_ATTRS_INT8
|
||||
_tile_dpbssd_internal(unsigned short m, unsigned short n, unsigned short k,
|
||||
_tile1024i dst, _tile1024i src1, _tile1024i src2) {
|
||||
return __builtin_ia32_tdpbssd_internal(m, n, k, dst, src1, src2);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS_INT8
|
||||
_tile_stored_internal(unsigned short m, unsigned short n, void *base,
|
||||
__SIZE_TYPE__ stride, _tile1024i tile) {
|
||||
return __builtin_ia32_tilestored64_internal(m, n, base,
|
||||
(__SIZE_TYPE__)(stride), tile);
|
||||
}
|
||||
|
||||
typedef struct __tile1024i_str {
|
||||
const unsigned short row;
|
||||
const unsigned short col;
|
||||
_tile1024i tile;
|
||||
} __tile1024i;
|
||||
|
||||
__DEFAULT_FN_ATTRS_TILE
|
||||
static void __tile_loadd(__tile1024i *dst, const void *base,
|
||||
__SIZE_TYPE__ stride) {
|
||||
dst->tile = _tile_loadd_internal(dst->row, dst->col, base, stride);
|
||||
}
|
||||
|
||||
__DEFAULT_FN_ATTRS_INT8
|
||||
static void __tile_dpbssd(__tile1024i *dst, __tile1024i src1,
|
||||
__tile1024i src2) {
|
||||
dst->tile = _tile_dpbssd_internal(src1.row, src2.col, src1.col, dst->tile,
|
||||
src1.tile, src2.tile);
|
||||
}
|
||||
|
||||
__DEFAULT_FN_ATTRS_TILE
|
||||
static void __tile_stored(void *base, __SIZE_TYPE__ stride, __tile1024i src) {
|
||||
_tile_stored_internal(src.row, src.col, base, stride, src.tile);
|
||||
}
|
||||
|
||||
__DEFAULT_FN_ATTRS_TILE
|
||||
static void __tile_zero(__tile1024i *dst) {
|
||||
dst->tile = __builtin_ia32_tilezero_internal(dst->row, dst->col);
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
#endif /* __AMXINTRIN_H */
|
||||
|
||||
26
lib/include/arm_acle.h
vendored
26
lib/include/arm_acle.h
vendored
@@ -639,6 +639,32 @@ __jcvt(double __a) {
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Armv8.7-A load/store 64-byte intrinsics */
|
||||
#if __ARM_64BIT_STATE && defined(__ARM_FEATURE_LS64)
|
||||
typedef struct {
|
||||
uint64_t val[8];
|
||||
} data512_t;
|
||||
|
||||
static __inline__ data512_t __attribute__((__always_inline__, __nodebug__))
|
||||
__arm_ld64b(const void *__addr) {
|
||||
data512_t __value;
|
||||
__builtin_arm_ld64b(__addr, __value.val);
|
||||
return __value;
|
||||
}
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
__arm_st64b(void *__addr, data512_t __value) {
|
||||
__builtin_arm_st64b(__addr, __value.val);
|
||||
}
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__arm_st64bv(void *__addr, data512_t __value) {
|
||||
return __builtin_arm_st64bv(__addr, __value.val);
|
||||
}
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__arm_st64bv0(void *__addr, data512_t __value) {
|
||||
return __builtin_arm_st64bv0(__addr, __value.val);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 10.1 Special register intrinsics */
|
||||
#define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg)
|
||||
#define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg)
|
||||
|
||||
12574
lib/include/arm_neon.h
vendored
12574
lib/include/arm_neon.h
vendored
File diff suppressed because it is too large
Load Diff
160
lib/include/arm_sve.h
vendored
160
lib/include/arm_sve.h
vendored
@@ -94,7 +94,7 @@ typedef __clang_svbfloat16x2_t svbfloat16x2_t;
|
||||
typedef __clang_svbfloat16x3_t svbfloat16x3_t;
|
||||
typedef __clang_svbfloat16x4_t svbfloat16x4_t;
|
||||
#endif
|
||||
typedef enum
|
||||
enum svpattern
|
||||
{
|
||||
SV_POW2 = 0,
|
||||
SV_VL1 = 1,
|
||||
@@ -113,9 +113,9 @@ typedef enum
|
||||
SV_MUL4 = 29,
|
||||
SV_MUL3 = 30,
|
||||
SV_ALL = 31
|
||||
} sv_pattern;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum svprfop
|
||||
{
|
||||
SV_PLDL1KEEP = 0,
|
||||
SV_PLDL1STRM = 1,
|
||||
@@ -129,7 +129,7 @@ typedef enum
|
||||
SV_PSTL2STRM = 11,
|
||||
SV_PSTL3KEEP = 12,
|
||||
SV_PSTL3STRM = 13
|
||||
} sv_prfop;
|
||||
};
|
||||
|
||||
/* Function attributes */
|
||||
#define __aio static inline __attribute__((__always_inline__, __nodebug__, __overloadable__))
|
||||
@@ -10013,69 +10013,69 @@ int16_t svorv(svbool_t, svint16_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svpfirst_b)))
|
||||
svbool_t svpfirst(svbool_t, svbool_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_u32base)))
|
||||
void svprfb_gather(svbool_t, svuint32_t, sv_prfop);
|
||||
void svprfb_gather(svbool_t, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_u64base)))
|
||||
void svprfb_gather(svbool_t, svuint64_t, sv_prfop);
|
||||
void svprfb_gather(svbool_t, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_u32base_offset)))
|
||||
void svprfb_gather_offset(svbool_t, svuint32_t, int64_t, sv_prfop);
|
||||
void svprfb_gather_offset(svbool_t, svuint32_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_u64base_offset)))
|
||||
void svprfb_gather_offset(svbool_t, svuint64_t, int64_t, sv_prfop);
|
||||
void svprfb_gather_offset(svbool_t, svuint64_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_s32offset)))
|
||||
void svprfb_gather_offset(svbool_t, void const *, svint32_t, sv_prfop);
|
||||
void svprfb_gather_offset(svbool_t, void const *, svint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_u32offset)))
|
||||
void svprfb_gather_offset(svbool_t, void const *, svuint32_t, sv_prfop);
|
||||
void svprfb_gather_offset(svbool_t, void const *, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_s64offset)))
|
||||
void svprfb_gather_offset(svbool_t, void const *, svint64_t, sv_prfop);
|
||||
void svprfb_gather_offset(svbool_t, void const *, svint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfb_gather_u64offset)))
|
||||
void svprfb_gather_offset(svbool_t, void const *, svuint64_t, sv_prfop);
|
||||
void svprfb_gather_offset(svbool_t, void const *, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_u32base)))
|
||||
void svprfd_gather(svbool_t, svuint32_t, sv_prfop);
|
||||
void svprfd_gather(svbool_t, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_u64base)))
|
||||
void svprfd_gather(svbool_t, svuint64_t, sv_prfop);
|
||||
void svprfd_gather(svbool_t, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_u32base_index)))
|
||||
void svprfd_gather_index(svbool_t, svuint32_t, int64_t, sv_prfop);
|
||||
void svprfd_gather_index(svbool_t, svuint32_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_u64base_index)))
|
||||
void svprfd_gather_index(svbool_t, svuint64_t, int64_t, sv_prfop);
|
||||
void svprfd_gather_index(svbool_t, svuint64_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_s32index)))
|
||||
void svprfd_gather_index(svbool_t, void const *, svint32_t, sv_prfop);
|
||||
void svprfd_gather_index(svbool_t, void const *, svint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_u32index)))
|
||||
void svprfd_gather_index(svbool_t, void const *, svuint32_t, sv_prfop);
|
||||
void svprfd_gather_index(svbool_t, void const *, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_s64index)))
|
||||
void svprfd_gather_index(svbool_t, void const *, svint64_t, sv_prfop);
|
||||
void svprfd_gather_index(svbool_t, void const *, svint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfd_gather_u64index)))
|
||||
void svprfd_gather_index(svbool_t, void const *, svuint64_t, sv_prfop);
|
||||
void svprfd_gather_index(svbool_t, void const *, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_u32base)))
|
||||
void svprfh_gather(svbool_t, svuint32_t, sv_prfop);
|
||||
void svprfh_gather(svbool_t, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_u64base)))
|
||||
void svprfh_gather(svbool_t, svuint64_t, sv_prfop);
|
||||
void svprfh_gather(svbool_t, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_u32base_index)))
|
||||
void svprfh_gather_index(svbool_t, svuint32_t, int64_t, sv_prfop);
|
||||
void svprfh_gather_index(svbool_t, svuint32_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_u64base_index)))
|
||||
void svprfh_gather_index(svbool_t, svuint64_t, int64_t, sv_prfop);
|
||||
void svprfh_gather_index(svbool_t, svuint64_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_s32index)))
|
||||
void svprfh_gather_index(svbool_t, void const *, svint32_t, sv_prfop);
|
||||
void svprfh_gather_index(svbool_t, void const *, svint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_u32index)))
|
||||
void svprfh_gather_index(svbool_t, void const *, svuint32_t, sv_prfop);
|
||||
void svprfh_gather_index(svbool_t, void const *, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_s64index)))
|
||||
void svprfh_gather_index(svbool_t, void const *, svint64_t, sv_prfop);
|
||||
void svprfh_gather_index(svbool_t, void const *, svint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfh_gather_u64index)))
|
||||
void svprfh_gather_index(svbool_t, void const *, svuint64_t, sv_prfop);
|
||||
void svprfh_gather_index(svbool_t, void const *, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_u32base)))
|
||||
void svprfw_gather(svbool_t, svuint32_t, sv_prfop);
|
||||
void svprfw_gather(svbool_t, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_u64base)))
|
||||
void svprfw_gather(svbool_t, svuint64_t, sv_prfop);
|
||||
void svprfw_gather(svbool_t, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_u32base_index)))
|
||||
void svprfw_gather_index(svbool_t, svuint32_t, int64_t, sv_prfop);
|
||||
void svprfw_gather_index(svbool_t, svuint32_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_u64base_index)))
|
||||
void svprfw_gather_index(svbool_t, svuint64_t, int64_t, sv_prfop);
|
||||
void svprfw_gather_index(svbool_t, svuint64_t, int64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_s32index)))
|
||||
void svprfw_gather_index(svbool_t, void const *, svint32_t, sv_prfop);
|
||||
void svprfw_gather_index(svbool_t, void const *, svint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_u32index)))
|
||||
void svprfw_gather_index(svbool_t, void const *, svuint32_t, sv_prfop);
|
||||
void svprfw_gather_index(svbool_t, void const *, svuint32_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_s64index)))
|
||||
void svprfw_gather_index(svbool_t, void const *, svint64_t, sv_prfop);
|
||||
void svprfw_gather_index(svbool_t, void const *, svint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svprfw_gather_u64index)))
|
||||
void svprfw_gather_index(svbool_t, void const *, svuint64_t, sv_prfop);
|
||||
void svprfw_gather_index(svbool_t, void const *, svuint64_t, enum svprfop);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqadd_n_s8)))
|
||||
svint8_t svqadd(svint8_t, int8_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqadd_n_s32)))
|
||||
@@ -10117,13 +10117,13 @@ uint32_t svqdecb(uint32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecb_n_u64)))
|
||||
uint64_t svqdecb(uint64_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecb_pat_n_s32)))
|
||||
int32_t svqdecb_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqdecb_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecb_pat_n_s64)))
|
||||
int64_t svqdecb_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqdecb_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecb_pat_n_u32)))
|
||||
uint32_t svqdecb_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqdecb_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecb_pat_n_u64)))
|
||||
uint64_t svqdecb_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqdecb_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_n_s32)))
|
||||
int32_t svqdecd(int32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_n_s64)))
|
||||
@@ -10137,17 +10137,17 @@ svint64_t svqdecd(svint64_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_u64)))
|
||||
svuint64_t svqdecd(svuint64_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_pat_n_s32)))
|
||||
int32_t svqdecd_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqdecd_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_pat_n_s64)))
|
||||
int64_t svqdecd_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqdecd_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_pat_n_u32)))
|
||||
uint32_t svqdecd_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqdecd_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_pat_n_u64)))
|
||||
uint64_t svqdecd_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqdecd_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_pat_s64)))
|
||||
svint64_t svqdecd_pat(svint64_t, sv_pattern, uint64_t);
|
||||
svint64_t svqdecd_pat(svint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecd_pat_u64)))
|
||||
svuint64_t svqdecd_pat(svuint64_t, sv_pattern, uint64_t);
|
||||
svuint64_t svqdecd_pat(svuint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_n_s32)))
|
||||
int32_t svqdech(int32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_n_s64)))
|
||||
@@ -10161,17 +10161,17 @@ svint16_t svqdech(svint16_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_u16)))
|
||||
svuint16_t svqdech(svuint16_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_pat_n_s32)))
|
||||
int32_t svqdech_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqdech_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_pat_n_s64)))
|
||||
int64_t svqdech_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqdech_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_pat_n_u32)))
|
||||
uint32_t svqdech_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqdech_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_pat_n_u64)))
|
||||
uint64_t svqdech_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqdech_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_pat_s16)))
|
||||
svint16_t svqdech_pat(svint16_t, sv_pattern, uint64_t);
|
||||
svint16_t svqdech_pat(svint16_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdech_pat_u16)))
|
||||
svuint16_t svqdech_pat(svuint16_t, sv_pattern, uint64_t);
|
||||
svuint16_t svqdech_pat(svuint16_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecp_n_s32_b8)))
|
||||
int32_t svqdecp_b8(int32_t, svbool_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecp_n_s32_b32)))
|
||||
@@ -10229,17 +10229,17 @@ svint32_t svqdecw(svint32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_u32)))
|
||||
svuint32_t svqdecw(svuint32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_pat_n_s32)))
|
||||
int32_t svqdecw_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqdecw_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_pat_n_s64)))
|
||||
int64_t svqdecw_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqdecw_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_pat_n_u32)))
|
||||
uint32_t svqdecw_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqdecw_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_pat_n_u64)))
|
||||
uint64_t svqdecw_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqdecw_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_pat_s32)))
|
||||
svint32_t svqdecw_pat(svint32_t, sv_pattern, uint64_t);
|
||||
svint32_t svqdecw_pat(svint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqdecw_pat_u32)))
|
||||
svuint32_t svqdecw_pat(svuint32_t, sv_pattern, uint64_t);
|
||||
svuint32_t svqdecw_pat(svuint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_n_s32)))
|
||||
int32_t svqincb(int32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_n_s64)))
|
||||
@@ -10249,13 +10249,13 @@ uint32_t svqincb(uint32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_n_u64)))
|
||||
uint64_t svqincb(uint64_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_pat_n_s32)))
|
||||
int32_t svqincb_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqincb_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_pat_n_s64)))
|
||||
int64_t svqincb_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqincb_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_pat_n_u32)))
|
||||
uint32_t svqincb_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqincb_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincb_pat_n_u64)))
|
||||
uint64_t svqincb_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqincb_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_n_s32)))
|
||||
int32_t svqincd(int32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_n_s64)))
|
||||
@@ -10269,17 +10269,17 @@ svint64_t svqincd(svint64_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_u64)))
|
||||
svuint64_t svqincd(svuint64_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_pat_n_s32)))
|
||||
int32_t svqincd_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqincd_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_pat_n_s64)))
|
||||
int64_t svqincd_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqincd_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_pat_n_u32)))
|
||||
uint32_t svqincd_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqincd_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_pat_n_u64)))
|
||||
uint64_t svqincd_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqincd_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_pat_s64)))
|
||||
svint64_t svqincd_pat(svint64_t, sv_pattern, uint64_t);
|
||||
svint64_t svqincd_pat(svint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincd_pat_u64)))
|
||||
svuint64_t svqincd_pat(svuint64_t, sv_pattern, uint64_t);
|
||||
svuint64_t svqincd_pat(svuint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_n_s32)))
|
||||
int32_t svqinch(int32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_n_s64)))
|
||||
@@ -10293,17 +10293,17 @@ svint16_t svqinch(svint16_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_u16)))
|
||||
svuint16_t svqinch(svuint16_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_pat_n_s32)))
|
||||
int32_t svqinch_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqinch_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_pat_n_s64)))
|
||||
int64_t svqinch_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqinch_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_pat_n_u32)))
|
||||
uint32_t svqinch_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqinch_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_pat_n_u64)))
|
||||
uint64_t svqinch_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqinch_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_pat_s16)))
|
||||
svint16_t svqinch_pat(svint16_t, sv_pattern, uint64_t);
|
||||
svint16_t svqinch_pat(svint16_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqinch_pat_u16)))
|
||||
svuint16_t svqinch_pat(svuint16_t, sv_pattern, uint64_t);
|
||||
svuint16_t svqinch_pat(svuint16_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincp_n_s32_b8)))
|
||||
int32_t svqincp_b8(int32_t, svbool_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincp_n_s32_b32)))
|
||||
@@ -10361,17 +10361,17 @@ svint32_t svqincw(svint32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_u32)))
|
||||
svuint32_t svqincw(svuint32_t, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_pat_n_s32)))
|
||||
int32_t svqincw_pat(int32_t, sv_pattern, uint64_t);
|
||||
int32_t svqincw_pat(int32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_pat_n_s64)))
|
||||
int64_t svqincw_pat(int64_t, sv_pattern, uint64_t);
|
||||
int64_t svqincw_pat(int64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_pat_n_u32)))
|
||||
uint32_t svqincw_pat(uint32_t, sv_pattern, uint64_t);
|
||||
uint32_t svqincw_pat(uint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_pat_n_u64)))
|
||||
uint64_t svqincw_pat(uint64_t, sv_pattern, uint64_t);
|
||||
uint64_t svqincw_pat(uint64_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_pat_s32)))
|
||||
svint32_t svqincw_pat(svint32_t, sv_pattern, uint64_t);
|
||||
svint32_t svqincw_pat(svint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqincw_pat_u32)))
|
||||
svuint32_t svqincw_pat(svuint32_t, sv_pattern, uint64_t);
|
||||
svuint32_t svqincw_pat(svuint32_t, enum svpattern, uint64_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqsub_n_s8)))
|
||||
svint8_t svqsub(svint8_t, int8_t);
|
||||
__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqsub_n_s32)))
|
||||
|
||||
165
lib/include/avx512fintrin.h
vendored
165
lib/include/avx512fintrin.h
vendored
@@ -9297,303 +9297,232 @@ _mm512_mask_abs_pd(__m512d __W, __mmask8 __K, __m512d __A)
|
||||
|
||||
/* Vector-reduction arithmetic accepts vectors as inputs and produces scalars as
|
||||
* outputs. This class of vector operation forms the basis of many scientific
|
||||
* computations. In vector-reduction arithmetic, the evaluation off is
|
||||
* computations. In vector-reduction arithmetic, the evaluation order is
|
||||
* independent of the order of the input elements of V.
|
||||
|
||||
* For floating point types, we always assume the elements are reassociable even
|
||||
* if -fast-math is off.
|
||||
|
||||
* Used bisection method. At each step, we partition the vector with previous
|
||||
* step in half, and the operation is performed on its two halves.
|
||||
* This takes log2(n) steps where n is the number of elements in the vector.
|
||||
*/
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__v4du __t1 = (__v4du)_mm512_extracti64x4_epi64(__W, 0); \
|
||||
__v4du __t2 = (__v4du)_mm512_extracti64x4_epi64(__W, 1); \
|
||||
__m256i __t3 = (__m256i)(__t1 op __t2); \
|
||||
__v2du __t4 = (__v2du)_mm256_extracti128_si256(__t3, 0); \
|
||||
__v2du __t5 = (__v2du)_mm256_extracti128_si256(__t3, 1); \
|
||||
__v2du __t6 = __t4 op __t5; \
|
||||
__v2du __t7 = __builtin_shufflevector(__t6, __t6, 1, 0); \
|
||||
__v2du __t8 = __t6 op __t7; \
|
||||
return __t8[0]
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_add_epi64(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_add_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_mul_epi64(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_mul_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_and_epi64(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(&);
|
||||
return __builtin_ia32_reduce_and_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512 _mm512_reduce_or_epi64(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(|);
|
||||
return __builtin_ia32_reduce_or_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_add_epi64(__mmask8 __M, __m512i __W) {
|
||||
__W = _mm512_maskz_mov_epi64(__M, __W);
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_add_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_mul_epi64(__mmask8 __M, __m512i __W) {
|
||||
__W = _mm512_mask_mov_epi64(_mm512_set1_epi64(1), __M, __W);
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_mul_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_and_epi64(__mmask8 __M, __m512i __W) {
|
||||
__W = _mm512_mask_mov_epi64(_mm512_set1_epi64(~0ULL), __M, __W);
|
||||
_mm512_mask_reduce_operator(&);
|
||||
return __builtin_ia32_reduce_and_q512(__W);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W) {
|
||||
__W = _mm512_maskz_mov_epi64(__M, __W);
|
||||
_mm512_mask_reduce_operator(|);
|
||||
return __builtin_ia32_reduce_or_q512(__W);
|
||||
}
|
||||
#undef _mm512_mask_reduce_operator
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__m256d __t1 = _mm512_extractf64x4_pd(__W, 0); \
|
||||
__m256d __t2 = _mm512_extractf64x4_pd(__W, 1); \
|
||||
__m256d __t3 = __t1 op __t2; \
|
||||
__m128d __t4 = _mm256_extractf128_pd(__t3, 0); \
|
||||
__m128d __t5 = _mm256_extractf128_pd(__t3, 1); \
|
||||
__m128d __t6 = __t4 op __t5; \
|
||||
__m128d __t7 = __builtin_shufflevector(__t6, __t6, 1, 0); \
|
||||
__m128d __t8 = __t6 op __t7; \
|
||||
return __t8[0]
|
||||
|
||||
// -0.0 is used to ignore the start value since it is the neutral value of
|
||||
// floating point addition. For more information, please refer to
|
||||
// https://llvm.org/docs/LangRef.html#llvm-vector-reduce-fadd-intrinsic
|
||||
static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_add_pd(__m512d __W) {
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_fadd_pd512(-0.0, __W);
|
||||
}
|
||||
|
||||
static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_mul_pd(__m512d __W) {
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_fmul_pd512(1.0, __W);
|
||||
}
|
||||
|
||||
static __inline__ double __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_add_pd(__mmask8 __M, __m512d __W) {
|
||||
__W = _mm512_maskz_mov_pd(__M, __W);
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_fadd_pd512(-0.0, __W);
|
||||
}
|
||||
|
||||
static __inline__ double __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_mul_pd(__mmask8 __M, __m512d __W) {
|
||||
__W = _mm512_mask_mov_pd(_mm512_set1_pd(1.0), __M, __W);
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_fmul_pd512(1.0, __W);
|
||||
}
|
||||
#undef _mm512_mask_reduce_operator
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__v8su __t1 = (__v8su)_mm512_extracti64x4_epi64(__W, 0); \
|
||||
__v8su __t2 = (__v8su)_mm512_extracti64x4_epi64(__W, 1); \
|
||||
__m256i __t3 = (__m256i)(__t1 op __t2); \
|
||||
__v4su __t4 = (__v4su)_mm256_extracti128_si256(__t3, 0); \
|
||||
__v4su __t5 = (__v4su)_mm256_extracti128_si256(__t3, 1); \
|
||||
__v4su __t6 = __t4 op __t5; \
|
||||
__v4su __t7 = __builtin_shufflevector(__t6, __t6, 2, 3, 0, 1); \
|
||||
__v4su __t8 = __t6 op __t7; \
|
||||
__v4su __t9 = __builtin_shufflevector(__t8, __t8, 1, 0, 3, 2); \
|
||||
__v4su __t10 = __t8 op __t9; \
|
||||
return __t10[0]
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_add_epi32(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_add_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_mul_epi32(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_mul_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_and_epi32(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(&);
|
||||
return __builtin_ia32_reduce_and_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_or_epi32(__m512i __W) {
|
||||
_mm512_mask_reduce_operator(|);
|
||||
return __builtin_ia32_reduce_or_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_add_epi32( __mmask16 __M, __m512i __W) {
|
||||
__W = _mm512_maskz_mov_epi32(__M, __W);
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_add_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_mul_epi32( __mmask16 __M, __m512i __W) {
|
||||
__W = _mm512_mask_mov_epi32(_mm512_set1_epi32(1), __M, __W);
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_mul_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_and_epi32( __mmask16 __M, __m512i __W) {
|
||||
__W = _mm512_mask_mov_epi32(_mm512_set1_epi32(~0U), __M, __W);
|
||||
_mm512_mask_reduce_operator(&);
|
||||
return __builtin_ia32_reduce_and_d512((__v16si)__W);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_or_epi32(__mmask16 __M, __m512i __W) {
|
||||
__W = _mm512_maskz_mov_epi32(__M, __W);
|
||||
_mm512_mask_reduce_operator(|);
|
||||
return __builtin_ia32_reduce_or_d512((__v16si)__W);
|
||||
}
|
||||
#undef _mm512_mask_reduce_operator
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__m256 __t1 = (__m256)_mm512_extractf64x4_pd((__m512d)__W, 0); \
|
||||
__m256 __t2 = (__m256)_mm512_extractf64x4_pd((__m512d)__W, 1); \
|
||||
__m256 __t3 = __t1 op __t2; \
|
||||
__m128 __t4 = _mm256_extractf128_ps(__t3, 0); \
|
||||
__m128 __t5 = _mm256_extractf128_ps(__t3, 1); \
|
||||
__m128 __t6 = __t4 op __t5; \
|
||||
__m128 __t7 = __builtin_shufflevector(__t6, __t6, 2, 3, 0, 1); \
|
||||
__m128 __t8 = __t6 op __t7; \
|
||||
__m128 __t9 = __builtin_shufflevector(__t8, __t8, 1, 0, 3, 2); \
|
||||
__m128 __t10 = __t8 op __t9; \
|
||||
return __t10[0]
|
||||
|
||||
static __inline__ float __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_add_ps(__m512 __W) {
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_fadd_ps512(-0.0f, __W);
|
||||
}
|
||||
|
||||
static __inline__ float __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_mul_ps(__m512 __W) {
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_fmul_ps512(1.0f, __W);
|
||||
}
|
||||
|
||||
static __inline__ float __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_add_ps(__mmask16 __M, __m512 __W) {
|
||||
__W = _mm512_maskz_mov_ps(__M, __W);
|
||||
_mm512_mask_reduce_operator(+);
|
||||
return __builtin_ia32_reduce_fadd_ps512(-0.0f, __W);
|
||||
}
|
||||
|
||||
static __inline__ float __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_mul_ps(__mmask16 __M, __m512 __W) {
|
||||
__W = _mm512_mask_mov_ps(_mm512_set1_ps(1.0f), __M, __W);
|
||||
_mm512_mask_reduce_operator(*);
|
||||
return __builtin_ia32_reduce_fmul_ps512(1.0f, __W);
|
||||
}
|
||||
#undef _mm512_mask_reduce_operator
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__m512i __t1 = (__m512i)__builtin_shufflevector((__v8di)__V, (__v8di)__V, 4, 5, 6, 7, 0, 1, 2, 3); \
|
||||
__m512i __t2 = _mm512_##op(__V, __t1); \
|
||||
__m512i __t3 = (__m512i)__builtin_shufflevector((__v8di)__t2, (__v8di)__t2, 2, 3, 0, 1, 6, 7, 4, 5); \
|
||||
__m512i __t4 = _mm512_##op(__t2, __t3); \
|
||||
__m512i __t5 = (__m512i)__builtin_shufflevector((__v8di)__t4, (__v8di)__t4, 1, 0, 3, 2, 5, 4, 7, 6); \
|
||||
__v8di __t6 = (__v8di)_mm512_##op(__t4, __t5); \
|
||||
return __t6[0]
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_max_epi64(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(max_epi64);
|
||||
return __builtin_ia32_reduce_smax_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_max_epu64(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(max_epu64);
|
||||
return __builtin_ia32_reduce_umax_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_min_epi64(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(min_epi64);
|
||||
return __builtin_ia32_reduce_smin_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_min_epu64(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(min_epu64);
|
||||
return __builtin_ia32_reduce_umin_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_max_epi64(__mmask8 __M, __m512i __V) {
|
||||
__V = _mm512_mask_mov_epi64(_mm512_set1_epi64(-__LONG_LONG_MAX__ - 1LL), __M, __V);
|
||||
_mm512_mask_reduce_operator(max_epi64);
|
||||
return __builtin_ia32_reduce_smax_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_max_epu64(__mmask8 __M, __m512i __V) {
|
||||
__V = _mm512_maskz_mov_epi64(__M, __V);
|
||||
_mm512_mask_reduce_operator(max_epu64);
|
||||
return __builtin_ia32_reduce_umax_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_min_epi64(__mmask8 __M, __m512i __V) {
|
||||
__V = _mm512_mask_mov_epi64(_mm512_set1_epi64(__LONG_LONG_MAX__), __M, __V);
|
||||
_mm512_mask_reduce_operator(min_epi64);
|
||||
return __builtin_ia32_reduce_smin_q512(__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_min_epu64(__mmask8 __M, __m512i __V) {
|
||||
__V = _mm512_mask_mov_epi64(_mm512_set1_epi64(~0ULL), __M, __V);
|
||||
_mm512_mask_reduce_operator(min_epu64);
|
||||
return __builtin_ia32_reduce_umin_q512(__V);
|
||||
}
|
||||
#undef _mm512_mask_reduce_operator
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__m256i __t1 = _mm512_extracti64x4_epi64(__V, 0); \
|
||||
__m256i __t2 = _mm512_extracti64x4_epi64(__V, 1); \
|
||||
__m256i __t3 = _mm256_##op(__t1, __t2); \
|
||||
__m128i __t4 = _mm256_extracti128_si256(__t3, 0); \
|
||||
__m128i __t5 = _mm256_extracti128_si256(__t3, 1); \
|
||||
__m128i __t6 = _mm_##op(__t4, __t5); \
|
||||
__m128i __t7 = (__m128i)__builtin_shufflevector((__v4si)__t6, (__v4si)__t6, 2, 3, 0, 1); \
|
||||
__m128i __t8 = _mm_##op(__t6, __t7); \
|
||||
__m128i __t9 = (__m128i)__builtin_shufflevector((__v4si)__t8, (__v4si)__t8, 1, 0, 3, 2); \
|
||||
__v4si __t10 = (__v4si)_mm_##op(__t8, __t9); \
|
||||
return __t10[0]
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_max_epi32(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(max_epi32);
|
||||
return __builtin_ia32_reduce_smax_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_max_epu32(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(max_epu32);
|
||||
return __builtin_ia32_reduce_umax_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_min_epi32(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(min_epi32);
|
||||
return __builtin_ia32_reduce_smin_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS512
|
||||
_mm512_reduce_min_epu32(__m512i __V) {
|
||||
_mm512_mask_reduce_operator(min_epu32);
|
||||
return __builtin_ia32_reduce_umin_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_max_epi32(__mmask16 __M, __m512i __V) {
|
||||
__V = _mm512_mask_mov_epi32(_mm512_set1_epi32(-__INT_MAX__ - 1), __M, __V);
|
||||
_mm512_mask_reduce_operator(max_epi32);
|
||||
return __builtin_ia32_reduce_smax_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_max_epu32(__mmask16 __M, __m512i __V) {
|
||||
__V = _mm512_maskz_mov_epi32(__M, __V);
|
||||
_mm512_mask_reduce_operator(max_epu32);
|
||||
return __builtin_ia32_reduce_umax_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_min_epi32(__mmask16 __M, __m512i __V) {
|
||||
__V = _mm512_mask_mov_epi32(_mm512_set1_epi32(__INT_MAX__), __M, __V);
|
||||
_mm512_mask_reduce_operator(min_epi32);
|
||||
return __builtin_ia32_reduce_smin_d512((__v16si)__V);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS512
|
||||
_mm512_mask_reduce_min_epu32(__mmask16 __M, __m512i __V) {
|
||||
__V = _mm512_mask_mov_epi32(_mm512_set1_epi32(~0U), __M, __V);
|
||||
_mm512_mask_reduce_operator(min_epu32);
|
||||
return __builtin_ia32_reduce_umin_d512((__v16si)__V);
|
||||
}
|
||||
#undef _mm512_mask_reduce_operator
|
||||
|
||||
#define _mm512_mask_reduce_operator(op) \
|
||||
__m256d __t1 = _mm512_extractf64x4_pd(__V, 0); \
|
||||
|
||||
205
lib/include/avx512vlvnniintrin.h
vendored
205
lib/include/avx512vlvnniintrin.h
vendored
@@ -18,13 +18,157 @@
|
||||
#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512vnni"), __min_vector_width__(128)))
|
||||
#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512vnni"), __min_vector_width__(256)))
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
|
||||
/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a S, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.word := Signed(ZeroExtend16(A.byte[4*j]) * SignExtend16(B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(A.byte[4*j+1]) * SignExtend16(B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(A.byte[4*j+2]) * SignExtend16(B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(A.byte[4*j+3]) * SignExtend16(B.byte[4*j+3]))
|
||||
/// DST.dword[j] := S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
#define _mm256_dpbusd_epi32(S, A, B) \
|
||||
(__m256i)__builtin_ia32_vpdpbusd256((__v8si)(S), (__v8si)(A), (__v8si)(B))
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpbusd_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpbusd256((__v8si)__S, (__v8si)__A,
|
||||
(__v8si)__B);
|
||||
}
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
|
||||
/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a S using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.word := Signed(ZeroExtend16(A.byte[4*j]) * SignExtend16(B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(A.byte[4*j+1]) * SignExtend16(B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(A.byte[4*j+2]) * SignExtend16(B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(A.byte[4*j+3]) * SignExtend16(B.byte[4*j+3]))
|
||||
/// DST.dword[j] := Saturate32(S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
#define _mm256_dpbusds_epi32(S, A, B) \
|
||||
(__m256i)__builtin_ia32_vpdpbusds256((__v8si)(S), (__v8si)(A), (__v8si)(B))
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
|
||||
/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a S,
|
||||
/// and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.dword := SignExtend32(A.word[2*j]) * SignExtend32(B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(A.word[2*j+1]) * SignExtend32(B.word[2*j+1])
|
||||
/// DST.dword[j] := S.dword[j] + tmp1 + tmp2
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
#define _mm256_dpwssd_epi32(S, A, B) \
|
||||
(__m256i)__builtin_ia32_vpdpwssd256((__v8si)(S), (__v8si)(A), (__v8si)(B))
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
|
||||
/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a S
|
||||
/// using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.dword := SignExtend32(A.word[2*j]) * SignExtend32(B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(A.word[2*j+1]) * SignExtend32(B.word[2*j+1])
|
||||
/// DST.dword[j] := Saturate32(S.dword[j] + tmp1 + tmp2)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
#define _mm256_dpwssds_epi32(S, A, B) \
|
||||
(__m256i)__builtin_ia32_vpdpwssds256((__v8si)(S), (__v8si)(A), (__v8si)(B))
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
|
||||
/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a S, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.word := Signed(ZeroExtend16(A.byte[4*j]) * SignExtend16(B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(A.byte[4*j+1]) * SignExtend16(B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(A.byte[4*j+2]) * SignExtend16(B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(A.byte[4*j+3]) * SignExtend16(B.byte[4*j+3]))
|
||||
/// DST.dword[j] := S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
#define _mm_dpbusd_epi32(S, A, B) \
|
||||
(__m128i)__builtin_ia32_vpdpbusd128((__v4si)(S), (__v4si)(A), (__v4si)(B))
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
|
||||
/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a S using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.word := Signed(ZeroExtend16(A.byte[4*j]) * SignExtend16(B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(A.byte[4*j+1]) * SignExtend16(B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(A.byte[4*j+2]) * SignExtend16(B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(A.byte[4*j+3]) * SignExtend16(B.byte[4*j+3]))
|
||||
/// DST.dword[j] := Saturate32(S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
#define _mm_dpbusds_epi32(S, A, B) \
|
||||
(__m128i)__builtin_ia32_vpdpbusds128((__v4si)(S), (__v4si)(A), (__v4si)(B))
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
|
||||
/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a S,
|
||||
/// and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.dword := SignExtend32(A.word[2*j]) * SignExtend32(B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(A.word[2*j+1]) * SignExtend32(B.word[2*j+1])
|
||||
/// DST.dword[j] := S.dword[j] + tmp1 + tmp2
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
#define _mm_dpwssd_epi32(S, A, B) \
|
||||
(__m128i)__builtin_ia32_vpdpwssd128((__v4si)(S), (__v4si)(A), (__v4si)(B))
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a A with
|
||||
/// corresponding 16-bit integers in \a B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a S
|
||||
/// using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.dword := SignExtend32(A.word[2*j]) * SignExtend32(B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(A.word[2*j+1]) * SignExtend32(B.word[2*j+1])
|
||||
/// DST.dword[j] := Saturate32(S.dword[j] + tmp1 + tmp2)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
#define _mm_dpwssds_epi32(S, A, B) \
|
||||
(__m128i)__builtin_ia32_vpdpwssds128((__v4si)(S), (__v4si)(A), (__v4si)(B))
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_mask_dpbusd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
|
||||
@@ -42,13 +186,6 @@ _mm256_maskz_dpbusd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
|
||||
(__v8si)_mm256_setzero_si256());
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpbusds_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpbusds256((__v8si)__S, (__v8si)__A,
|
||||
(__v8si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_mask_dpbusds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
@@ -65,13 +202,6 @@ _mm256_maskz_dpbusds_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
|
||||
(__v8si)_mm256_setzero_si256());
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpwssd_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpwssd256((__v8si)__S, (__v8si)__A,
|
||||
(__v8si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_mask_dpwssd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
@@ -88,13 +218,6 @@ _mm256_maskz_dpwssd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
|
||||
(__v8si)_mm256_setzero_si256());
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpwssds_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpwssds256((__v8si)__S, (__v8si)__A,
|
||||
(__v8si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_mask_dpwssds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
@@ -111,13 +234,6 @@ _mm256_maskz_dpwssds_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
|
||||
(__v8si)_mm256_setzero_si256());
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpbusd_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpbusd128((__v4si)__S, (__v4si)__A,
|
||||
(__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_mask_dpbusd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
@@ -134,13 +250,6 @@ _mm_maskz_dpbusd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
|
||||
(__v4si)_mm_setzero_si128());
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpbusds_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpbusds128((__v4si)__S, (__v4si)__A,
|
||||
(__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_mask_dpbusds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
@@ -157,13 +266,6 @@ _mm_maskz_dpbusds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
|
||||
(__v4si)_mm_setzero_si128());
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpwssd_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpwssd128((__v4si)__S, (__v4si)__A,
|
||||
(__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_mask_dpwssd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
@@ -180,13 +282,6 @@ _mm_maskz_dpwssd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
|
||||
(__v4si)_mm_setzero_si128());
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpwssds_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpwssds128((__v4si)__S, (__v4si)__A,
|
||||
(__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_mask_dpwssds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
|
||||
6
lib/include/avxintrin.h
vendored
6
lib/include/avxintrin.h
vendored
@@ -2245,7 +2245,7 @@ _mm256_cvttps_epi32(__m256 __a)
|
||||
|
||||
/// Returns the first element of the input vector of [4 x double].
|
||||
///
|
||||
/// \headerfile <avxintrin.h>
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic is a utility function and does not correspond to a specific
|
||||
/// instruction.
|
||||
@@ -2261,7 +2261,7 @@ _mm256_cvtsd_f64(__m256d __a)
|
||||
|
||||
/// Returns the first element of the input vector of [8 x i32].
|
||||
///
|
||||
/// \headerfile <avxintrin.h>
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic is a utility function and does not correspond to a specific
|
||||
/// instruction.
|
||||
@@ -2278,7 +2278,7 @@ _mm256_cvtsi256_si32(__m256i __a)
|
||||
|
||||
/// Returns the first element of the input vector of [8 x float].
|
||||
///
|
||||
/// \headerfile <avxintrin.h>
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic is a utility function and does not correspond to a specific
|
||||
/// instruction.
|
||||
|
||||
225
lib/include/avxvnniintrin.h
vendored
Normal file
225
lib/include/avxvnniintrin.h
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
/*===--------------- avxvnniintrin.h - VNNI intrinsics --------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avxvnniintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __AVXVNNIINTRIN_H
|
||||
#define __AVXVNNIINTRIN_H
|
||||
|
||||
/* Below intrinsics defined in avx512vlvnniintrin.h can be used for AVXVNNI */
|
||||
/// \fn __m256i _mm256_dpbusd_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
/// \fn __m256i _mm256_dpbusds_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
/// \fn __m256i _mm256_dpwssd_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
/// \fn __m256i _mm256_dpwssds_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
/// \fn __m128i _mm_dpbusd_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
/// \fn __m128i _mm_dpbusds_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
/// \fn __m128i _mm_dpwssd_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
/// \fn __m128i _mm_dpwssds_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
|
||||
/* Intrinsics with _avx_ prefix are for compatibility with msvc. */
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), __min_vector_width__(256)))
|
||||
#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), __min_vector_width__(128)))
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
|
||||
/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a __S, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.word := Signed(ZeroExtend16(__A.byte[4*j]) * SignExtend16(__B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(__A.byte[4*j+1]) * SignExtend16(__B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(__A.byte[4*j+2]) * SignExtend16(__B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(__A.byte[4*j+3]) * SignExtend16(__B.byte[4*j+3]))
|
||||
/// DST.dword[j] := __S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpbusd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpbusd256((__v8si)__S, (__v8si)__A, (__v8si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
|
||||
/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a __S using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.word := Signed(ZeroExtend16(__A.byte[4*j]) * SignExtend16(__B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(__A.byte[4*j+1]) * SignExtend16(__B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(__A.byte[4*j+2]) * SignExtend16(__B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(__A.byte[4*j+3]) * SignExtend16(__B.byte[4*j+3]))
|
||||
/// DST.dword[j] := Saturate32(__S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpbusds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpbusds256((__v8si)__S, (__v8si)__A, (__v8si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
|
||||
/// corresponding 16-bit integers in \a __B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a __S,
|
||||
/// and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.dword := SignExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
|
||||
/// DST.dword[j] := __S.dword[j] + tmp1 + tmp2
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpwssd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpwssd256((__v8si)__S, (__v8si)__A, (__v8si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
|
||||
/// corresponding 16-bit integers in \a __B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a __S
|
||||
/// using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 7
|
||||
/// tmp1.dword := SignExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
|
||||
/// DST.dword[j] := Saturate32(__S.dword[j] + tmp1 + tmp2)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:256] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS256
|
||||
_mm256_dpwssds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpdpwssds256((__v8si)__S, (__v8si)__A, (__v8si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
|
||||
/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a __S, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.word := Signed(ZeroExtend16(__A.byte[4*j]) * SignExtend16(__B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(__A.byte[4*j+1]) * SignExtend16(__B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(__A.byte[4*j+2]) * SignExtend16(__B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(__A.byte[4*j+3]) * SignExtend16(__B.byte[4*j+3]))
|
||||
/// DST.dword[j] := __S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpbusd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpbusd128((__v4si)__S, (__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
|
||||
/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate signed
|
||||
/// 16-bit results. Sum these 4 results with the corresponding 32-bit integer
|
||||
/// in \a __S using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPBUSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.word := Signed(ZeroExtend16(__A.byte[4*j]) * SignExtend16(__B.byte[4*j]))
|
||||
/// tmp2.word := Signed(ZeroExtend16(__A.byte[4*j+1]) * SignExtend16(__B.byte[4*j+1]))
|
||||
/// tmp3.word := Signed(ZeroExtend16(__A.byte[4*j+2]) * SignExtend16(__B.byte[4*j+2]))
|
||||
/// tmp4.word := Signed(ZeroExtend16(__A.byte[4*j+3]) * SignExtend16(__B.byte[4*j+3]))
|
||||
/// DST.dword[j] := Saturate32(__S.dword[j] + tmp1 + tmp2 + tmp3 + tmp4)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpbusds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpbusds128((__v4si)__S, (__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
|
||||
/// corresponding 16-bit integers in \a __B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a __S,
|
||||
/// and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSD </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.dword := SignExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
|
||||
/// DST.dword[j] := __S.dword[j] + tmp1 + tmp2
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpwssd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpwssd128((__v4si)__S, (__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
/// Multiply groups of 2 adjacent pairs of signed 16-bit integers in \a __A with
|
||||
/// corresponding 16-bit integers in \a __B, producing 2 intermediate signed 32-bit
|
||||
/// results. Sum these 2 results with the corresponding 32-bit integer in \a __S
|
||||
/// using signed saturation, and store the packed 32-bit results in DST.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> VPDPWSSDS </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// FOR j := 0 to 3
|
||||
/// tmp1.dword := SignExtend32(__A.word[2*j]) * SignExtend32(__B.word[2*j])
|
||||
/// tmp2.dword := SignExtend32(__A.word[2*j+1]) * SignExtend32(__B.word[2*j+1])
|
||||
/// DST.dword[j] := Saturate32(__S.dword[j] + tmp1 + tmp2)
|
||||
/// ENDFOR
|
||||
/// DST[MAX:128] := 0
|
||||
/// \endoperation
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS128
|
||||
_mm_dpwssds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpdpwssds128((__v4si)__S, (__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS128
|
||||
#undef __DEFAULT_FN_ATTRS256
|
||||
|
||||
#endif // __AVXVNNIINTRIN_H
|
||||
8
lib/include/cpuid.h
vendored
8
lib/include/cpuid.h
vendored
@@ -7,6 +7,9 @@
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __CPUID_H
|
||||
#define __CPUID_H
|
||||
|
||||
#if !(__x86_64__ || __i386__)
|
||||
#error this header is for x86 only
|
||||
#endif
|
||||
@@ -186,6 +189,7 @@
|
||||
/* Features in %edx for leaf 7 sub-leaf 0 */
|
||||
#define bit_AVX5124VNNIW 0x00000004
|
||||
#define bit_AVX5124FMAPS 0x00000008
|
||||
#define bit_UINTR 0x00000020
|
||||
#define bit_SERIALIZE 0x00004000
|
||||
#define bit_TSXLDTRK 0x00010000
|
||||
#define bit_PCONFIG 0x00040000
|
||||
@@ -195,7 +199,9 @@
|
||||
#define bit_AMXINT8 0x02000000
|
||||
|
||||
/* Features in %eax for leaf 7 sub-leaf 1 */
|
||||
#define bit_AVXVNNI 0x00000008
|
||||
#define bit_AVX512BF16 0x00000020
|
||||
#define bit_HRESET 0x00400000
|
||||
|
||||
/* Features in %eax for leaf 13 sub-leaf 1 */
|
||||
#define bit_XSAVEOPT 0x00000001
|
||||
@@ -309,3 +315,5 @@ static __inline int __get_cpuid_count (unsigned int __leaf,
|
||||
__cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* __CPUID_H */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*===---- complex - CUDA wrapper for <algorithm> ----------------------------===
|
||||
/*===---- algorithm - CUDA wrapper for <algorithm> -------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*===---- complex - CUDA wrapper for <new> ------------------------------===
|
||||
/*===---- new - CUDA wrapper for <new> -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +26,13 @@
|
||||
|
||||
#include_next <new>
|
||||
|
||||
#if !defined(__device__)
|
||||
// The header has been included too early from the standard C++ library
|
||||
// and CUDA-specific macros are not available yet.
|
||||
// Undo the include guard and try again later.
|
||||
#undef __CLANG_CUDA_WRAPPERS_NEW
|
||||
#else
|
||||
|
||||
#pragma push_macro("CUDA_NOEXCEPT")
|
||||
#if __cplusplus >= 201103L
|
||||
#define CUDA_NOEXCEPT noexcept
|
||||
@@ -95,4 +102,5 @@ __device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {}
|
||||
|
||||
#pragma pop_macro("CUDA_NOEXCEPT")
|
||||
|
||||
#endif // __device__
|
||||
#endif // include guard
|
||||
|
||||
2
lib/include/emmintrin.h
vendored
2
lib/include/emmintrin.h
vendored
@@ -4025,7 +4025,7 @@ _mm_storeu_si128(__m128i_u *__p, __m128i __b)
|
||||
///
|
||||
/// \param __p
|
||||
/// A pointer to a 64-bit memory location. The address of the memory
|
||||
/// location does not have to be algned.
|
||||
/// location does not have to be aligned.
|
||||
/// \param __b
|
||||
/// A 128-bit integer vector containing the value to be stored.
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
|
||||
209
lib/include/gfniintrin.h
vendored
209
lib/include/gfniintrin.h
vendored
@@ -14,38 +14,56 @@
|
||||
#ifndef __GFNIINTRIN_H
|
||||
#define __GFNIINTRIN_H
|
||||
|
||||
/* Default attributes for simple form (no masking). */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("gfni"), __min_vector_width__(128)))
|
||||
|
||||
/* Default attributes for YMM unmasked form. */
|
||||
#define __DEFAULT_FN_ATTRS_Y __attribute__((__always_inline__, __nodebug__, __target__("avx,gfni"), __min_vector_width__(256)))
|
||||
|
||||
/* Default attributes for ZMM forms. */
|
||||
#define __DEFAULT_FN_ATTRS_Z __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,gfni"), __min_vector_width__(512)))
|
||||
|
||||
/* Default attributes for VLX forms. */
|
||||
#define __DEFAULT_FN_ATTRS_VL128 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,avx512vl,gfni"), __min_vector_width__(128)))
|
||||
#define __DEFAULT_FN_ATTRS_VL256 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,avx512vl,gfni"), __min_vector_width__(256)))
|
||||
|
||||
#define _mm_gf2p8affineinv_epi64_epi8(A, B, I) \
|
||||
(__m128i)__builtin_ia32_vgf2p8affineinvqb_v16qi((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), \
|
||||
(char)(I))
|
||||
|
||||
#define _mm_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, I) \
|
||||
(__m128i)__builtin_ia32_selectb_128((__mmask16)(U), \
|
||||
(__v16qi)_mm_gf2p8affineinv_epi64_epi8(A, B, I), \
|
||||
(__v16qi)(__m128i)(S))
|
||||
|
||||
|
||||
#define _mm_maskz_gf2p8affineinv_epi64_epi8(U, A, B, I) \
|
||||
(__m128i)_mm_mask_gf2p8affineinv_epi64_epi8((__m128i)_mm_setzero_si128(), \
|
||||
U, A, B, I)
|
||||
#define _mm_gf2p8affine_epi64_epi8(A, B, I) \
|
||||
(__m128i)__builtin_ia32_vgf2p8affineqb_v16qi((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), \
|
||||
(char)(I))
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_gf2p8mul_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vgf2p8mulb_v16qi((__v16qi) __A,
|
||||
(__v16qi) __B);
|
||||
}
|
||||
|
||||
#ifdef __AVXINTRIN_H
|
||||
#define _mm256_gf2p8affineinv_epi64_epi8(A, B, I) \
|
||||
(__m256i)__builtin_ia32_vgf2p8affineinvqb_v32qi((__v32qi)(__m256i)(A), \
|
||||
(__v32qi)(__m256i)(B), \
|
||||
(char)(I))
|
||||
|
||||
#define _mm256_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, I) \
|
||||
(__m256i)__builtin_ia32_selectb_256((__mmask32)(U), \
|
||||
(__v32qi)_mm256_gf2p8affineinv_epi64_epi8(A, B, I), \
|
||||
(__v32qi)(__m256i)(S))
|
||||
|
||||
#define _mm256_maskz_gf2p8affineinv_epi64_epi8(U, A, B, I) \
|
||||
(__m256i)_mm256_mask_gf2p8affineinv_epi64_epi8((__m256i)_mm256_setzero_si256(), \
|
||||
U, A, B, I)
|
||||
#define _mm256_gf2p8affine_epi64_epi8(A, B, I) \
|
||||
(__m256i)__builtin_ia32_vgf2p8affineqb_v32qi((__v32qi)(__m256i)(A), \
|
||||
(__v32qi)(__m256i)(B), \
|
||||
(char)(I))
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS_Y
|
||||
_mm256_gf2p8mul_epi8(__m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vgf2p8mulb_v32qi((__v32qi) __A,
|
||||
(__v32qi) __B);
|
||||
}
|
||||
#endif /* __AVXINTRIN_H */
|
||||
|
||||
#ifdef __AVX512BWINTRIN_H
|
||||
#define _mm512_gf2p8affineinv_epi64_epi8(A, B, I) \
|
||||
(__m512i)__builtin_ia32_vgf2p8affineinvqb_v64qi((__v64qi)(__m512i)(A), \
|
||||
(__v64qi)(__m512i)(B), \
|
||||
@@ -60,37 +78,6 @@
|
||||
(__m512i)_mm512_mask_gf2p8affineinv_epi64_epi8((__m512i)_mm512_setzero_si512(), \
|
||||
U, A, B, I)
|
||||
|
||||
#define _mm_gf2p8affine_epi64_epi8(A, B, I) \
|
||||
(__m128i)__builtin_ia32_vgf2p8affineqb_v16qi((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), \
|
||||
(char)(I))
|
||||
|
||||
#define _mm_mask_gf2p8affine_epi64_epi8(S, U, A, B, I) \
|
||||
(__m128i)__builtin_ia32_selectb_128((__mmask16)(U), \
|
||||
(__v16qi)_mm_gf2p8affine_epi64_epi8(A, B, I), \
|
||||
(__v16qi)(__m128i)(S))
|
||||
|
||||
|
||||
#define _mm_maskz_gf2p8affine_epi64_epi8(U, A, B, I) \
|
||||
(__m128i)_mm_mask_gf2p8affine_epi64_epi8((__m128i)_mm_setzero_si128(), \
|
||||
U, A, B, I)
|
||||
|
||||
|
||||
#define _mm256_gf2p8affine_epi64_epi8(A, B, I) \
|
||||
(__m256i)__builtin_ia32_vgf2p8affineqb_v32qi((__v32qi)(__m256i)(A), \
|
||||
(__v32qi)(__m256i)(B), \
|
||||
(char)(I))
|
||||
|
||||
#define _mm256_mask_gf2p8affine_epi64_epi8(S, U, A, B, I) \
|
||||
(__m256i)__builtin_ia32_selectb_256((__mmask32)(U), \
|
||||
(__v32qi)_mm256_gf2p8affine_epi64_epi8(A, B, I), \
|
||||
(__v32qi)(__m256i)(S))
|
||||
|
||||
#define _mm256_maskz_gf2p8affine_epi64_epi8(U, A, B, I) \
|
||||
(__m256i)_mm256_mask_gf2p8affine_epi64_epi8((__m256i)_mm256_setzero_si256(), \
|
||||
U, A, B, I)
|
||||
|
||||
|
||||
#define _mm512_gf2p8affine_epi64_epi8(A, B, I) \
|
||||
(__m512i)__builtin_ia32_vgf2p8affineqb_v64qi((__v64qi)(__m512i)(A), \
|
||||
(__v64qi)(__m512i)(B), \
|
||||
@@ -105,63 +92,6 @@
|
||||
(__m512i)_mm512_mask_gf2p8affine_epi64_epi8((__m512i)_mm512_setzero_si512(), \
|
||||
U, A, B, I)
|
||||
|
||||
/* Default attributes for simple form (no masking). */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("gfni"), __min_vector_width__(128)))
|
||||
|
||||
/* Default attributes for YMM unmasked form. */
|
||||
#define __DEFAULT_FN_ATTRS_Y __attribute__((__always_inline__, __nodebug__, __target__("avx,gfni"), __min_vector_width__(256)))
|
||||
|
||||
/* Default attributes for ZMM forms. */
|
||||
#define __DEFAULT_FN_ATTRS_Z __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,gfni"), __min_vector_width__(512)))
|
||||
|
||||
/* Default attributes for VLX forms. */
|
||||
#define __DEFAULT_FN_ATTRS_VL128 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,avx512vl,gfni"), __min_vector_width__(128)))
|
||||
#define __DEFAULT_FN_ATTRS_VL256 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw,avx512vl,gfni"), __min_vector_width__(256)))
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_gf2p8mul_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vgf2p8mulb_v16qi((__v16qi) __A,
|
||||
(__v16qi) __B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS_VL128
|
||||
_mm_mask_gf2p8mul_epi8(__m128i __S, __mmask16 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_selectb_128(__U,
|
||||
(__v16qi) _mm_gf2p8mul_epi8(__A, __B),
|
||||
(__v16qi) __S);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS_VL128
|
||||
_mm_maskz_gf2p8mul_epi8(__mmask16 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_mask_gf2p8mul_epi8((__m128i)_mm_setzero_si128(),
|
||||
__U, __A, __B);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS_Y
|
||||
_mm256_gf2p8mul_epi8(__m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vgf2p8mulb_v32qi((__v32qi) __A,
|
||||
(__v32qi) __B);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS_VL256
|
||||
_mm256_mask_gf2p8mul_epi8(__m256i __S, __mmask32 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_selectb_256(__U,
|
||||
(__v32qi) _mm256_gf2p8mul_epi8(__A, __B),
|
||||
(__v32qi) __S);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS_VL256
|
||||
_mm256_maskz_gf2p8mul_epi8(__mmask32 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
return _mm256_mask_gf2p8mul_epi8((__m256i)_mm256_setzero_si256(),
|
||||
__U, __A, __B);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS_Z
|
||||
_mm512_gf2p8mul_epi8(__m512i __A, __m512i __B)
|
||||
{
|
||||
@@ -183,6 +113,75 @@ _mm512_maskz_gf2p8mul_epi8(__mmask64 __U, __m512i __A, __m512i __B)
|
||||
return _mm512_mask_gf2p8mul_epi8((__m512i)_mm512_setzero_si512(),
|
||||
__U, __A, __B);
|
||||
}
|
||||
#endif /* __AVX512BWINTRIN_H */
|
||||
|
||||
#ifdef __AVX512VLBWINTRIN_H
|
||||
#define _mm_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, I) \
|
||||
(__m128i)__builtin_ia32_selectb_128((__mmask16)(U), \
|
||||
(__v16qi)_mm_gf2p8affineinv_epi64_epi8(A, B, I), \
|
||||
(__v16qi)(__m128i)(S))
|
||||
|
||||
#define _mm_maskz_gf2p8affineinv_epi64_epi8(U, A, B, I) \
|
||||
(__m128i)_mm_mask_gf2p8affineinv_epi64_epi8((__m128i)_mm_setzero_si128(), \
|
||||
U, A, B, I)
|
||||
|
||||
#define _mm256_mask_gf2p8affineinv_epi64_epi8(S, U, A, B, I) \
|
||||
(__m256i)__builtin_ia32_selectb_256((__mmask32)(U), \
|
||||
(__v32qi)_mm256_gf2p8affineinv_epi64_epi8(A, B, I), \
|
||||
(__v32qi)(__m256i)(S))
|
||||
|
||||
#define _mm256_maskz_gf2p8affineinv_epi64_epi8(U, A, B, I) \
|
||||
(__m256i)_mm256_mask_gf2p8affineinv_epi64_epi8((__m256i)_mm256_setzero_si256(), \
|
||||
U, A, B, I)
|
||||
|
||||
#define _mm_mask_gf2p8affine_epi64_epi8(S, U, A, B, I) \
|
||||
(__m128i)__builtin_ia32_selectb_128((__mmask16)(U), \
|
||||
(__v16qi)_mm_gf2p8affine_epi64_epi8(A, B, I), \
|
||||
(__v16qi)(__m128i)(S))
|
||||
|
||||
#define _mm_maskz_gf2p8affine_epi64_epi8(U, A, B, I) \
|
||||
(__m128i)_mm_mask_gf2p8affine_epi64_epi8((__m128i)_mm_setzero_si128(), \
|
||||
U, A, B, I)
|
||||
|
||||
#define _mm256_mask_gf2p8affine_epi64_epi8(S, U, A, B, I) \
|
||||
(__m256i)__builtin_ia32_selectb_256((__mmask32)(U), \
|
||||
(__v32qi)_mm256_gf2p8affine_epi64_epi8(A, B, I), \
|
||||
(__v32qi)(__m256i)(S))
|
||||
|
||||
#define _mm256_maskz_gf2p8affine_epi64_epi8(U, A, B, I) \
|
||||
(__m256i)_mm256_mask_gf2p8affine_epi64_epi8((__m256i)_mm256_setzero_si256(), \
|
||||
U, A, B, I)
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS_VL128
|
||||
_mm_mask_gf2p8mul_epi8(__m128i __S, __mmask16 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_selectb_128(__U,
|
||||
(__v16qi) _mm_gf2p8mul_epi8(__A, __B),
|
||||
(__v16qi) __S);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS_VL128
|
||||
_mm_maskz_gf2p8mul_epi8(__mmask16 __U, __m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_mask_gf2p8mul_epi8((__m128i)_mm_setzero_si128(),
|
||||
__U, __A, __B);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS_VL256
|
||||
_mm256_mask_gf2p8mul_epi8(__m256i __S, __mmask32 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_selectb_256(__U,
|
||||
(__v32qi) _mm256_gf2p8mul_epi8(__A, __B),
|
||||
(__v32qi) __S);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS_VL256
|
||||
_mm256_maskz_gf2p8mul_epi8(__mmask32 __U, __m256i __A, __m256i __B)
|
||||
{
|
||||
return _mm256_mask_gf2p8mul_epi8((__m256i)_mm256_setzero_si256(),
|
||||
__U, __A, __B);
|
||||
}
|
||||
#endif /* __AVX512VLBWINTRIN_H */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#undef __DEFAULT_FN_ATTRS_Y
|
||||
|
||||
49
lib/include/hresetintrin.h
vendored
Normal file
49
lib/include/hresetintrin.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*===---------------- hresetintrin.h - HRESET intrinsics -------------------===
|
||||
*
|
||||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
* See https://llvm.org/LICENSE.txt for license information.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __X86GPRINTRIN_H
|
||||
#error "Never use <hresetintrin.h> directly; include <x86gprintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __HRESETINTRIN_H
|
||||
#define __HRESETINTRIN_H
|
||||
|
||||
#if __has_extension(gnu_asm)
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("hreset")))
|
||||
|
||||
/// Provides a hint to the processor to selectively reset the prediction
|
||||
/// history of the current logical processor specified by a 32-bit integer
|
||||
/// value \a __eax.
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> HRESET </c> instruction.
|
||||
///
|
||||
/// \operation
|
||||
/// IF __eax == 0
|
||||
/// // nop
|
||||
/// ELSE
|
||||
/// FOR i := 0 to 31
|
||||
/// IF __eax[i]
|
||||
/// ResetPredictionFeature(i)
|
||||
/// FI
|
||||
/// ENDFOR
|
||||
/// FI
|
||||
/// \endoperation
|
||||
static __inline void __DEFAULT_FN_ATTRS
|
||||
_hreset(int __eax)
|
||||
{
|
||||
__asm__ ("hreset $0" :: "a"(__eax));
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __has_extension(gnu_asm) */
|
||||
|
||||
#endif /* __HRESETINTRIN_H */
|
||||
97
lib/include/ia32intrin.h
vendored
97
lib/include/ia32intrin.h
vendored
@@ -14,6 +14,18 @@
|
||||
#ifndef __IA32INTRIN_H
|
||||
#define __IA32INTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
|
||||
#define __DEFAULT_FN_ATTRS_SSE42 __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
#define __DEFAULT_FN_ATTRS_CAST __attribute__((__always_inline__)) constexpr
|
||||
#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
|
||||
#else
|
||||
#define __DEFAULT_FN_ATTRS_CAST __attribute__((__always_inline__))
|
||||
#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
|
||||
#endif
|
||||
|
||||
/** Find the first set bit starting from the lsb. Result is undefined if
|
||||
* input is 0.
|
||||
*
|
||||
@@ -26,7 +38,7 @@
|
||||
* A 32-bit integer operand.
|
||||
* \returns A 32-bit integer containing the bit number.
|
||||
*/
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__bsfd(int __A) {
|
||||
return __builtin_ctz(__A);
|
||||
}
|
||||
@@ -43,7 +55,7 @@ __bsfd(int __A) {
|
||||
* A 32-bit integer operand.
|
||||
* \returns A 32-bit integer containing the bit number.
|
||||
*/
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__bsrd(int __A) {
|
||||
return 31 - __builtin_clz(__A);
|
||||
}
|
||||
@@ -59,12 +71,12 @@ __bsrd(int __A) {
|
||||
* A 32-bit integer operand.
|
||||
* \returns A 32-bit integer containing the swapped bytes.
|
||||
*/
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__bswapd(int __A) {
|
||||
return __builtin_bswap32(__A);
|
||||
}
|
||||
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
_bswap(int __A) {
|
||||
return __builtin_bswap32(__A);
|
||||
}
|
||||
@@ -85,7 +97,7 @@ _bswap(int __A) {
|
||||
* A 64-bit integer operand.
|
||||
* \returns A 32-bit integer containing the bit number.
|
||||
*/
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__bsfq(long long __A) {
|
||||
return __builtin_ctzll(__A);
|
||||
}
|
||||
@@ -102,7 +114,7 @@ __bsfq(long long __A) {
|
||||
* A 64-bit integer operand.
|
||||
* \returns A 32-bit integer containing the bit number.
|
||||
*/
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__bsrq(long long __A) {
|
||||
return 63 - __builtin_clzll(__A);
|
||||
}
|
||||
@@ -118,7 +130,7 @@ __bsrq(long long __A) {
|
||||
* A 64-bit integer operand.
|
||||
* \returns A 64-bit integer containing the swapped bytes.
|
||||
*/
|
||||
static __inline__ long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__bswapq(long long __A) {
|
||||
return __builtin_bswap64(__A);
|
||||
}
|
||||
@@ -138,7 +150,7 @@ __bswapq(long long __A) {
|
||||
* \returns A 32-bit integer containing the number of bits with value 1 in the
|
||||
* source operand.
|
||||
*/
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__popcntd(unsigned int __A)
|
||||
{
|
||||
return __builtin_popcount(__A);
|
||||
@@ -159,7 +171,7 @@ __popcntd(unsigned int __A)
|
||||
* \returns A 64-bit integer containing the number of bits with value 1 in the
|
||||
* source operand.
|
||||
*/
|
||||
static __inline__ long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__popcntq(unsigned long long __A)
|
||||
{
|
||||
return __builtin_popcountll(__A);
|
||||
@@ -169,26 +181,26 @@ __popcntq(unsigned long long __A)
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__readeflags(void)
|
||||
{
|
||||
return __builtin_ia32_readeflags_u64();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__writeeflags(unsigned long long __f)
|
||||
{
|
||||
__builtin_ia32_writeeflags_u64(__f);
|
||||
}
|
||||
|
||||
#else /* !__x86_64__ */
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__readeflags(void)
|
||||
{
|
||||
return __builtin_ia32_readeflags_u32();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__writeeflags(unsigned int __f)
|
||||
{
|
||||
__builtin_ia32_writeeflags_u32(__f);
|
||||
@@ -205,11 +217,9 @@ __writeeflags(unsigned int __f)
|
||||
* A 32-bit float value.
|
||||
* \returns a 32-bit unsigned integer containing the converted value.
|
||||
*/
|
||||
static __inline__ unsigned int __attribute__((__always_inline__))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CAST
|
||||
_castf32_u32(float __A) {
|
||||
unsigned int D;
|
||||
__builtin_memcpy(&D, &__A, sizeof(__A));
|
||||
return D;
|
||||
return __builtin_bit_cast(unsigned int, __A);
|
||||
}
|
||||
|
||||
/** Cast a 64-bit float value to a 64-bit unsigned integer value
|
||||
@@ -222,11 +232,9 @@ _castf32_u32(float __A) {
|
||||
* A 64-bit float value.
|
||||
* \returns a 64-bit unsigned integer containing the converted value.
|
||||
*/
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CAST
|
||||
_castf64_u64(double __A) {
|
||||
unsigned long long D;
|
||||
__builtin_memcpy(&D, &__A, sizeof(__A));
|
||||
return D;
|
||||
return __builtin_bit_cast(unsigned long long, __A);
|
||||
}
|
||||
|
||||
/** Cast a 32-bit unsigned integer value to a 32-bit float value
|
||||
@@ -239,11 +247,9 @@ _castf64_u64(double __A) {
|
||||
* A 32-bit unsigned integer value.
|
||||
* \returns a 32-bit float value containing the converted value.
|
||||
*/
|
||||
static __inline__ float __attribute__((__always_inline__))
|
||||
static __inline__ float __DEFAULT_FN_ATTRS_CAST
|
||||
_castu32_f32(unsigned int __A) {
|
||||
float D;
|
||||
__builtin_memcpy(&D, &__A, sizeof(__A));
|
||||
return D;
|
||||
return __builtin_bit_cast(float, __A);
|
||||
}
|
||||
|
||||
/** Cast a 64-bit unsigned integer value to a 64-bit float value
|
||||
@@ -256,11 +262,9 @@ _castu32_f32(unsigned int __A) {
|
||||
* A 64-bit unsigned integer value.
|
||||
* \returns a 64-bit float value containing the converted value.
|
||||
*/
|
||||
static __inline__ double __attribute__((__always_inline__))
|
||||
static __inline__ double __DEFAULT_FN_ATTRS_CAST
|
||||
_castu64_f64(unsigned long long __A) {
|
||||
double D;
|
||||
__builtin_memcpy(&D, &__A, sizeof(__A));
|
||||
return D;
|
||||
return __builtin_bit_cast(double, __A);
|
||||
}
|
||||
|
||||
/** Adds the unsigned integer operand to the CRC-32C checksum of the
|
||||
@@ -278,7 +282,7 @@ _castu64_f64(unsigned long long __A) {
|
||||
* \returns The result of adding operand \a __C to the CRC-32C checksum of
|
||||
* operand \a __D.
|
||||
*/
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS_SSE42
|
||||
__crc32b(unsigned int __C, unsigned char __D)
|
||||
{
|
||||
return __builtin_ia32_crc32qi(__C, __D);
|
||||
@@ -299,7 +303,7 @@ __crc32b(unsigned int __C, unsigned char __D)
|
||||
* \returns The result of adding operand \a __C to the CRC-32C checksum of
|
||||
* operand \a __D.
|
||||
*/
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS_SSE42
|
||||
__crc32w(unsigned int __C, unsigned short __D)
|
||||
{
|
||||
return __builtin_ia32_crc32hi(__C, __D);
|
||||
@@ -320,7 +324,7 @@ __crc32w(unsigned int __C, unsigned short __D)
|
||||
* \returns The result of adding operand \a __C to the CRC-32C checksum of
|
||||
* operand \a __D.
|
||||
*/
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS_SSE42
|
||||
__crc32d(unsigned int __C, unsigned int __D)
|
||||
{
|
||||
return __builtin_ia32_crc32si(__C, __D);
|
||||
@@ -342,20 +346,20 @@ __crc32d(unsigned int __C, unsigned int __D)
|
||||
* \returns The result of adding operand \a __C to the CRC-32C checksum of
|
||||
* operand \a __D.
|
||||
*/
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_SSE42
|
||||
__crc32q(unsigned long long __C, unsigned long long __D)
|
||||
{
|
||||
return __builtin_ia32_crc32di(__C, __D);
|
||||
}
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__rdpmc(int __A) {
|
||||
return __builtin_ia32_rdpmc(__A);
|
||||
}
|
||||
|
||||
/* __rdtscp */
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__rdtscp(unsigned int *__A) {
|
||||
return __builtin_ia32_rdtscp(__A);
|
||||
}
|
||||
@@ -364,48 +368,48 @@ __rdtscp(unsigned int *__A) {
|
||||
|
||||
#define _rdpmc(A) __rdpmc(A)
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_wbinvd(void) {
|
||||
__builtin_ia32_wbinvd();
|
||||
}
|
||||
|
||||
static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rolb(unsigned char __X, int __C) {
|
||||
return __builtin_rotateleft8(__X, __C);
|
||||
}
|
||||
|
||||
static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rorb(unsigned char __X, int __C) {
|
||||
return __builtin_rotateright8(__X, __C);
|
||||
}
|
||||
|
||||
static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rolw(unsigned short __X, int __C) {
|
||||
return __builtin_rotateleft16(__X, __C);
|
||||
}
|
||||
|
||||
static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rorw(unsigned short __X, int __C) {
|
||||
return __builtin_rotateright16(__X, __C);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rold(unsigned int __X, int __C) {
|
||||
return __builtin_rotateleft32(__X, __C);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rord(unsigned int __X, int __C) {
|
||||
return __builtin_rotateright32(__X, __C);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rolq(unsigned long long __X, int __C) {
|
||||
return __builtin_rotateleft64(__X, __C);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
__rorq(unsigned long long __X, int __C) {
|
||||
return __builtin_rotateright64(__X, __C);
|
||||
}
|
||||
@@ -429,4 +433,9 @@ __rorq(unsigned long long __X, int __C) {
|
||||
#define _rotwl(a,b) __rolw((a), (b))
|
||||
#define _rotwr(a,b) __rorw((a), (b))
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#undef __DEFAULT_FN_ATTRS_CAST
|
||||
#undef __DEFAULT_FN_ATTRS_SSE42
|
||||
#undef __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
|
||||
#endif /* __IA32INTRIN_H */
|
||||
|
||||
12
lib/include/immintrin.h
vendored
12
lib/include/immintrin.h
vendored
@@ -10,6 +10,8 @@
|
||||
#ifndef __IMMINTRIN_H
|
||||
#define __IMMINTRIN_H
|
||||
|
||||
#include <x86gprintrin.h>
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__MMX__)
|
||||
#include <mmintrin.h>
|
||||
@@ -143,6 +145,11 @@
|
||||
#include <avx512vlvnniintrin.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__AVXVNNI__)
|
||||
#include <avxvnniintrin.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__AVX512DQ__)
|
||||
#include <avx512dqintrin.h>
|
||||
@@ -471,6 +478,11 @@ _storebe_i64(void * __P, long long __D) {
|
||||
#include <invpcidintrin.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__KL__) || defined(__WIDEKL__)
|
||||
#include <keylockerintrin.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__AMXTILE__) || defined(__AMXINT8__) || defined(__AMXBF16__)
|
||||
#include <amxintrin.h>
|
||||
|
||||
173
lib/include/intrin.h
vendored
173
lib/include/intrin.h
vendored
@@ -57,16 +57,11 @@ void __addfsbyte(unsigned long, unsigned char);
|
||||
void __addfsdword(unsigned long, unsigned long);
|
||||
void __addfsword(unsigned long, unsigned short);
|
||||
void __code_seg(const char *);
|
||||
static __inline__
|
||||
void __cpuid(int[4], int);
|
||||
static __inline__
|
||||
void __cpuidex(int[4], int, int);
|
||||
static __inline__
|
||||
__int64 __emul(int, int);
|
||||
static __inline__
|
||||
unsigned __int64 __emulu(unsigned int, unsigned int);
|
||||
unsigned int __getcallerseflags(void);
|
||||
static __inline__
|
||||
void __halt(void);
|
||||
unsigned char __inbyte(unsigned short);
|
||||
void __inbytestring(unsigned short, unsigned char *, unsigned long);
|
||||
@@ -82,13 +77,9 @@ void __inwordstring(unsigned short, unsigned short *, unsigned long);
|
||||
void __lidt(void *);
|
||||
unsigned __int64 __ll_lshift(unsigned __int64, int);
|
||||
__int64 __ll_rshift(__int64, int);
|
||||
static __inline__
|
||||
void __movsb(unsigned char *, unsigned char const *, size_t);
|
||||
static __inline__
|
||||
void __movsd(unsigned long *, unsigned long const *, size_t);
|
||||
static __inline__
|
||||
void __movsw(unsigned short *, unsigned short const *, size_t);
|
||||
static __inline__
|
||||
void __nop(void);
|
||||
void __nvreg_restore_fence(void);
|
||||
void __nvreg_save_fence(void);
|
||||
@@ -105,23 +96,16 @@ unsigned long __readcr4(void);
|
||||
unsigned long __readcr8(void);
|
||||
unsigned int __readdr(unsigned int);
|
||||
#ifdef __i386__
|
||||
static __inline__
|
||||
unsigned char __readfsbyte(unsigned long);
|
||||
static __inline__
|
||||
unsigned __int64 __readfsqword(unsigned long);
|
||||
static __inline__
|
||||
unsigned short __readfsword(unsigned long);
|
||||
#endif
|
||||
static __inline__
|
||||
unsigned __int64 __readmsr(unsigned long);
|
||||
unsigned __int64 __readpmc(unsigned long);
|
||||
unsigned long __segmentlimit(unsigned long);
|
||||
void __sidt(void *);
|
||||
static __inline__
|
||||
void __stosb(unsigned char *, unsigned char, size_t);
|
||||
static __inline__
|
||||
void __stosd(unsigned long *, unsigned long, size_t);
|
||||
static __inline__
|
||||
void __stosw(unsigned short *, unsigned short, size_t);
|
||||
void __svm_clgi(void);
|
||||
void __svm_invlpga(void *, int);
|
||||
@@ -136,7 +120,6 @@ void __vmx_off(void);
|
||||
void __vmx_vmptrst(unsigned __int64 *);
|
||||
void __wbinvd(void);
|
||||
void __writecr0(unsigned int);
|
||||
static __inline__
|
||||
void __writecr3(unsigned __INTPTR_TYPE__);
|
||||
void __writecr4(unsigned int);
|
||||
void __writecr8(unsigned int);
|
||||
@@ -146,11 +129,8 @@ void __writefsdword(unsigned long, unsigned long);
|
||||
void __writefsqword(unsigned long, unsigned __int64);
|
||||
void __writefsword(unsigned long, unsigned short);
|
||||
void __writemsr(unsigned long, unsigned __int64);
|
||||
static __inline__
|
||||
void *_AddressOfReturnAddress(void);
|
||||
static __inline__
|
||||
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask);
|
||||
static __inline__
|
||||
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask);
|
||||
unsigned char _bittest(long const *, long);
|
||||
unsigned char _bittestandcomplement(long *, long);
|
||||
@@ -169,12 +149,10 @@ long _InterlockedExchangeAdd_HLEAcquire(long volatile *, long);
|
||||
long _InterlockedExchangeAdd_HLERelease(long volatile *, long);
|
||||
__int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64);
|
||||
__int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64);
|
||||
static __inline__ void
|
||||
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
|
||||
_ReadBarrier(void);
|
||||
static __inline__ void
|
||||
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
|
||||
_ReadWriteBarrier(void);
|
||||
void __attribute__((__deprecated__(
|
||||
"use other intrinsics or C++11 atomics instead"))) _ReadBarrier(void);
|
||||
void __attribute__((__deprecated__(
|
||||
"use other intrinsics or C++11 atomics instead"))) _ReadWriteBarrier(void);
|
||||
unsigned int _rorx_u32(unsigned int, const unsigned int);
|
||||
int _sarx_i32(int, unsigned int);
|
||||
#if __STDC_HOSTED__
|
||||
@@ -185,9 +163,8 @@ unsigned int _shrx_u32(unsigned int, unsigned int);
|
||||
void _Store_HLERelease(long volatile *, long);
|
||||
void _Store64_HLERelease(__int64 volatile *, __int64);
|
||||
void _StorePointer_HLERelease(void *volatile *, void *);
|
||||
static __inline__ void
|
||||
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
|
||||
_WriteBarrier(void);
|
||||
void __attribute__((__deprecated__(
|
||||
"use other intrinsics or C++11 atomics instead"))) _WriteBarrier(void);
|
||||
unsigned __int32 xbegin(void);
|
||||
void _xend(void);
|
||||
|
||||
@@ -197,19 +174,14 @@ void __addgsbyte(unsigned long, unsigned char);
|
||||
void __addgsdword(unsigned long, unsigned long);
|
||||
void __addgsqword(unsigned long, unsigned __int64);
|
||||
void __addgsword(unsigned long, unsigned short);
|
||||
static __inline__
|
||||
void __faststorefence(void);
|
||||
void __incgsbyte(unsigned long);
|
||||
void __incgsdword(unsigned long);
|
||||
void __incgsqword(unsigned long);
|
||||
void __incgsword(unsigned long);
|
||||
static __inline__
|
||||
void __movsq(unsigned long long *, unsigned long long const *, size_t);
|
||||
static __inline__
|
||||
unsigned char __readgsbyte(unsigned long);
|
||||
static __inline__
|
||||
unsigned long __readgsdword(unsigned long);
|
||||
static __inline__
|
||||
unsigned __int64 __readgsqword(unsigned long);
|
||||
unsigned short __readgsword(unsigned long);
|
||||
unsigned __int64 __shiftleft128(unsigned __int64 _LowPart,
|
||||
@@ -218,7 +190,6 @@ unsigned __int64 __shiftleft128(unsigned __int64 _LowPart,
|
||||
unsigned __int64 __shiftright128(unsigned __int64 _LowPart,
|
||||
unsigned __int64 _HighPart,
|
||||
unsigned char _Shift);
|
||||
static __inline__
|
||||
void __stosq(unsigned __int64 *, unsigned __int64, size_t);
|
||||
unsigned char __vmx_on(unsigned __int64 *);
|
||||
unsigned char __vmx_vmclear(unsigned __int64 *);
|
||||
@@ -243,10 +214,6 @@ unsigned char _interlockedbittestandreset64(__int64 volatile *, __int64);
|
||||
unsigned char _interlockedbittestandset64(__int64 volatile *, __int64);
|
||||
long _InterlockedCompareExchange_np(long volatile *_Destination, long _Exchange,
|
||||
long _Comparand);
|
||||
unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_CompareandResult);
|
||||
unsigned char _InterlockedCompareExchange128_np(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
@@ -269,13 +236,9 @@ unsigned __int64 _rorx_u64(unsigned __int64, const unsigned int);
|
||||
__int64 _sarx_i64(__int64, unsigned int);
|
||||
unsigned __int64 _shlx_u64(unsigned __int64, unsigned int);
|
||||
unsigned __int64 _shrx_u64(unsigned __int64, unsigned int);
|
||||
static __inline__
|
||||
__int64 __mulh(__int64, __int64);
|
||||
static __inline__
|
||||
unsigned __int64 __umulh(unsigned __int64, unsigned __int64);
|
||||
static __inline__
|
||||
__int64 _mul128(__int64, __int64, __int64*);
|
||||
static __inline__
|
||||
unsigned __int64 _umul128(unsigned __int64,
|
||||
unsigned __int64,
|
||||
unsigned __int64*);
|
||||
@@ -284,29 +247,19 @@ unsigned __int64 _umul128(unsigned __int64,
|
||||
|
||||
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
static __inline__
|
||||
unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask);
|
||||
static __inline__
|
||||
unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
||||
static __inline__
|
||||
__int64 _InterlockedDecrement64(__int64 volatile *_Addend);
|
||||
static __inline__
|
||||
__int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value);
|
||||
static __inline__
|
||||
__int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value);
|
||||
static __inline__
|
||||
__int64 _InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value);
|
||||
static __inline__
|
||||
__int64 _InterlockedIncrement64(__int64 volatile *_Addend);
|
||||
static __inline__
|
||||
__int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask);
|
||||
static __inline__
|
||||
__int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask);
|
||||
static __inline__
|
||||
__int64 _InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask);
|
||||
|
||||
#endif
|
||||
@@ -470,45 +423,81 @@ __int64 _InterlockedCompareExchange64_nf(__int64 volatile *_Destination,
|
||||
__int64 _InterlockedCompareExchange64_rel(__int64 volatile *_Destination,
|
||||
__int64 _Exchange, __int64 _Comparand);
|
||||
#endif
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_ComparandResult);
|
||||
#endif
|
||||
#if defined(__aarch64__)
|
||||
unsigned char _InterlockedCompareExchange128_acq(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_ComparandResult);
|
||||
unsigned char _InterlockedCompareExchange128_nf(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_ComparandResult);
|
||||
unsigned char _InterlockedCompareExchange128_rel(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_ComparandResult);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* movs, stos
|
||||
\*----------------------------------------------------------------------------*/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsb(unsigned char *__dst, unsigned char const *__src, size_t __n) {
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __movsb(unsigned char *__dst,
|
||||
unsigned char const *__src,
|
||||
size_t __n) {
|
||||
__asm__ __volatile__("rep movsb" : "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
: : "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsd(unsigned long *__dst, unsigned long const *__src, size_t __n) {
|
||||
__asm__ __volatile__("rep movsl" : "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
: : "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsw(unsigned short *__dst, unsigned short const *__src, size_t __n) {
|
||||
__asm__ __volatile__("rep movsw" : "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
: : "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosd(unsigned long *__dst, unsigned long __x, size_t __n) {
|
||||
__asm__ __volatile__("rep stosl" : "+D"(__dst), "+c"(__n) : "a"(__x)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __movsd(unsigned long *__dst,
|
||||
unsigned long const *__src,
|
||||
size_t __n) {
|
||||
__asm__ __volatile__("rep movsl"
|
||||
: "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
:
|
||||
: "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosw(unsigned short *__dst, unsigned short __x, size_t __n) {
|
||||
__asm__ __volatile__("rep stosw" : "+D"(__dst), "+c"(__n) : "a"(__x)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __movsw(unsigned short *__dst,
|
||||
unsigned short const *__src,
|
||||
size_t __n) {
|
||||
__asm__ __volatile__("rep movsw"
|
||||
: "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
:
|
||||
: "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __stosd(unsigned long *__dst,
|
||||
unsigned long __x,
|
||||
size_t __n) {
|
||||
__asm__ __volatile__("rep stosl"
|
||||
: "+D"(__dst), "+c"(__n)
|
||||
: "a"(__x)
|
||||
: "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __stosw(unsigned short *__dst,
|
||||
unsigned short __x,
|
||||
size_t __n) {
|
||||
__asm__ __volatile__("rep stosw"
|
||||
: "+D"(__dst), "+c"(__n)
|
||||
: "a"(__x)
|
||||
: "memory");
|
||||
}
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsq(unsigned long long *__dst, unsigned long long const *__src, size_t __n) {
|
||||
__asm__ __volatile__("rep movsq" : "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
: : "memory");
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __movsq(
|
||||
unsigned long long *__dst, unsigned long long const *__src, size_t __n) {
|
||||
__asm__ __volatile__("rep movsq"
|
||||
: "+D"(__dst), "+S"(__src), "+c"(__n)
|
||||
:
|
||||
: "memory");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosq(unsigned __int64 *__dst, unsigned __int64 __x, size_t __n) {
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst,
|
||||
unsigned __int64 __x,
|
||||
size_t __n) {
|
||||
__asm__ __volatile__("rep stosq" : "+D"(__dst), "+c"(__n) : "a"(__x)
|
||||
: "memory");
|
||||
}
|
||||
@@ -518,26 +507,25 @@ __stosq(unsigned __int64 *__dst, unsigned __int64 __x, size_t __n) {
|
||||
|* Misc
|
||||
\*----------------------------------------------------------------------------*/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__cpuid(int __info[4], int __level) {
|
||||
__asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
|
||||
: "a"(__level), "c"(0));
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __cpuid(int __info[4], int __level) {
|
||||
__asm__("cpuid"
|
||||
: "=a"(__info[0]), "=b"(__info[1]), "=c"(__info[2]), "=d"(__info[3])
|
||||
: "a"(__level), "c"(0));
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__cpuidex(int __info[4], int __level, int __ecx) {
|
||||
__asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
|
||||
: "a"(__level), "c"(__ecx));
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __cpuidex(int __info[4], int __level,
|
||||
int __ecx) {
|
||||
__asm__("cpuid"
|
||||
: "=a"(__info[0]), "=b"(__info[1]), "=c"(__info[2]), "=d"(__info[3])
|
||||
: "a"(__level), "c"(__ecx));
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__halt(void) {
|
||||
__asm__ volatile ("hlt");
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __halt(void) {
|
||||
__asm__ volatile("hlt");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__nop(void) {
|
||||
__asm__ volatile ("nop");
|
||||
static __inline__ void __DEFAULT_FN_ATTRS __nop(void) {
|
||||
__asm__ volatile("nop");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -574,8 +562,7 @@ __readmsr(unsigned long __register) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline__ unsigned __LPTRINT_TYPE__ __DEFAULT_FN_ATTRS
|
||||
__readcr3(void) {
|
||||
static __inline__ unsigned __LPTRINT_TYPE__ __DEFAULT_FN_ATTRS __readcr3(void) {
|
||||
unsigned __LPTRINT_TYPE__ __cr3_val;
|
||||
__asm__ __volatile__ ("mov %%cr3, %0" : "=r"(__cr3_val) : : "memory");
|
||||
return __cr3_val;
|
||||
|
||||
506
lib/include/keylockerintrin.h
vendored
Normal file
506
lib/include/keylockerintrin.h
vendored
Normal file
@@ -0,0 +1,506 @@
|
||||
/*===----------------- keylockerintrin.h - KL Intrinsics -------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <keylockerintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef _KEYLOCKERINTRIN_H
|
||||
#define _KEYLOCKERINTRIN_H
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__KL__)
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("kl"),\
|
||||
__min_vector_width__(128)))
|
||||
|
||||
/// Load internal wrapping key from __intkey, __enkey_lo and __enkey_hi. __ctl
|
||||
/// will assigned to EAX, whch specifies the KeySource and whether backing up
|
||||
/// the key is permitted. The 256-bit encryption key is loaded from the two
|
||||
/// explicit operands (__enkey_lo and __enkey_hi). The 128-bit integrity key is
|
||||
/// loaded from the implicit operand XMM0 which assigned by __intkey.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> LOADIWKEY </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// IF CPL > 0 // LOADKWKEY only allowed at ring 0 (supervisor mode)
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// IF “LOADIWKEY exiting” VM execution control set
|
||||
/// VMexit
|
||||
/// FI
|
||||
/// IF __ctl[4:1] > 1 // Reserved KeySource encoding used
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// IF __ctl[31:5] != 0 // Reserved bit in __ctl is set
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// IF __ctl[0] AND (CPUID.19H.ECX[0] == 0) // NoBackup is not supported on this part
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// IF (__ctl[4:1] == 1) AND (CPUID.19H.ECX[1] == 0) // KeySource of 1 is not supported on this part
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// IF (__ctl[4:1] == 0) // KeySource of 0.
|
||||
/// IWKey.Encryption Key[127:0] := __enkey_hi[127:0]:
|
||||
/// IWKey.Encryption Key[255:128] := __enkey_lo[127:0]
|
||||
/// IWKey.IntegrityKey[127:0] := __intkey[127:0]
|
||||
/// IWKey.NoBackup := __ctl[0]
|
||||
/// IWKey.KeySource := __ctl[4:1]
|
||||
/// ZF := 0
|
||||
/// ELSE // KeySource of 1. See RDSEED definition for details of randomness
|
||||
/// IF HW_NRND_GEN.ready == 1 // Full-entropy random data from RDSEED was received
|
||||
/// IWKey.Encryption Key[127:0] := __enkey_hi[127:0] XOR HW_NRND_GEN.data[127:0]
|
||||
/// IWKey.Encryption Key[255:128] := __enkey_lo[127:0] XOR HW_NRND_GEN.data[255:128]
|
||||
/// IWKey.Encryption Key[255:0] := __enkey_hi[127:0]:__enkey_lo[127:0] XOR HW_NRND_GEN.data[255:0]
|
||||
/// IWKey.IntegrityKey[127:0] := __intkey[127:0] XOR HW_NRND_GEN.data[383:256]
|
||||
/// IWKey.NoBackup := __ctl[0]
|
||||
/// IWKey.KeySource := __ctl[4:1]
|
||||
/// ZF := 0
|
||||
/// ELSE // Random data was not returned from RDSEED. IWKey was not loaded
|
||||
/// ZF := 1
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_loadiwkey (unsigned int __ctl, __m128i __intkey,
|
||||
__m128i __enkey_lo, __m128i __enkey_hi) {
|
||||
__builtin_ia32_loadiwkey (__intkey, __enkey_lo, __enkey_hi, __ctl);
|
||||
}
|
||||
|
||||
/// Wrap a 128-bit AES key from __key into a key handle and output in
|
||||
/// ((__m128i*)__h) to ((__m128i*)__h) + 5 and a 32-bit value as return.
|
||||
/// The explicit source operand __htype specifies handle restrictions.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> ENCODEKEY128 </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// InputKey[127:0] := __key[127:0]
|
||||
/// KeyMetadata[2:0] := __htype[2:0]
|
||||
/// KeyMetadata[23:3] := 0 // Reserved for future usage
|
||||
/// KeyMetadata[27:24] := 0 // KeyType is AES-128 (value of 0)
|
||||
/// KeyMetadata[127:28] := 0 // Reserved for future usage
|
||||
/// Handle[383:0] := WrapKey128(InputKey[127:0], KeyMetadata[127:0],
|
||||
/// IWKey.Integrity Key[127:0], IWKey.Encryption Key[255:0])
|
||||
/// dst[0] := IWKey.NoBackup
|
||||
/// dst[4:1] := IWKey.KeySource[3:0]
|
||||
/// dst[31:5] := 0
|
||||
/// MEM[__h+127:__h] := Handle[127:0] // AAD
|
||||
/// MEM[__h+255:__h+128] := Handle[255:128] // Integrity Tag
|
||||
/// MEM[__h+383:__h+256] := Handle[383:256] // CipherText
|
||||
/// MEM[__h+511:__h+384] := 0 // Reserved for future usage
|
||||
/// MEM[__h+639:__h+512] := 0 // Reserved for future usage
|
||||
/// MEM[__h+767:__h+640] := 0 // Reserved for future usage
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// ZF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_mm_encodekey128_u32(unsigned int __htype, __m128i __key, void *__h) {
|
||||
return __builtin_ia32_encodekey128_u32(__htype, (__v2di)__key, __h);
|
||||
}
|
||||
|
||||
/// Wrap a 256-bit AES key from __key_hi:__key_lo into a key handle, then
|
||||
/// output handle in ((__m128i*)__h) to ((__m128i*)__h) + 6 and
|
||||
/// a 32-bit value as return.
|
||||
/// The explicit source operand __htype specifies handle restrictions.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> ENCODEKEY256 </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// InputKey[127:0] := __key_lo[127:0]
|
||||
/// InputKey[255:128] := __key_hi[255:128]
|
||||
/// KeyMetadata[2:0] := __htype[2:0]
|
||||
/// KeyMetadata[23:3] := 0 // Reserved for future usage
|
||||
/// KeyMetadata[27:24] := 1 // KeyType is AES-256 (value of 1)
|
||||
/// KeyMetadata[127:28] := 0 // Reserved for future usage
|
||||
/// Handle[511:0] := WrapKey256(InputKey[255:0], KeyMetadata[127:0],
|
||||
/// IWKey.Integrity Key[127:0], IWKey.Encryption Key[255:0])
|
||||
/// dst[0] := IWKey.NoBackup
|
||||
/// dst[4:1] := IWKey.KeySource[3:0]
|
||||
/// dst[31:5] := 0
|
||||
/// MEM[__h+127:__h] := Handle[127:0] // AAD
|
||||
/// MEM[__h+255:__h+128] := Handle[255:128] // Tag
|
||||
/// MEM[__h+383:__h+256] := Handle[383:256] // CipherText[127:0]
|
||||
/// MEM[__h+511:__h+384] := Handle[511:384] // CipherText[255:128]
|
||||
/// MEM[__h+639:__h+512] := 0 // Reserved for future usage
|
||||
/// MEM[__h+767:__h+640] := 0 // Reserved for future usage
|
||||
/// MEM[__h+895:__h+768] := 0 Integrity// Reserved for future usage
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// ZF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_mm_encodekey256_u32(unsigned int __htype, __m128i __key_lo, __m128i __key_hi,
|
||||
void *__h) {
|
||||
return __builtin_ia32_encodekey256_u32(__htype, (__v2di)__key_lo,
|
||||
(__v2di)__key_hi, __h);
|
||||
}
|
||||
|
||||
/// The AESENC128KL performs 10 rounds of AES to encrypt the __idata using
|
||||
/// the 128-bit key in the handle from the __h. It stores the result in the
|
||||
/// __odata. And return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESENC128KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[383:0] := MEM[__h+383:__h] // Load is not guaranteed to be atomic.
|
||||
/// IllegalHandle := ( HandleReservedBitSet (Handle[383:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[383:256] ||
|
||||
/// HandleKeyType (Handle[383:0]) != HANDLE_KEY_TYPE_AES128 )
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey)
|
||||
/// IF (Authentic == 0)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// MEM[__odata+127:__odata] := AES128Encrypt (__idata[127:0], UnwrappedKey)
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesenc128kl_u8(__m128i* __odata, __m128i __idata, const void *__h) {
|
||||
return __builtin_ia32_aesenc128kl_u8((__v2di *)__odata, (__v2di)__idata, __h);
|
||||
}
|
||||
|
||||
/// The AESENC256KL performs 14 rounds of AES to encrypt the __idata using
|
||||
/// the 256-bit key in the handle from the __h. It stores the result in the
|
||||
/// __odata. And return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESENC256KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[511:0] := MEM[__h+511:__h] // Load is not guaranteed to be atomic.
|
||||
/// IllegalHandle := ( HandleReservedBitSet (Handle[511:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[255:128] ||
|
||||
/// HandleKeyType (Handle[511:0]) != HANDLE_KEY_TYPE_AES256 )
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey)
|
||||
/// IF (Authentic == 0)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// MEM[__odata+127:__odata] := AES256Encrypt (__idata[127:0], UnwrappedKey)
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesenc256kl_u8(__m128i* __odata, __m128i __idata, const void *__h) {
|
||||
return __builtin_ia32_aesenc256kl_u8((__v2di *)__odata, (__v2di)__idata, __h);
|
||||
}
|
||||
|
||||
/// The AESDEC128KL performs 10 rounds of AES to decrypt the __idata using
|
||||
/// the 128-bit key in the handle from the __h. It stores the result in the
|
||||
/// __odata. And return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESDEC128KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[383:0] := MEM[__h+383:__h] // Load is not guaranteed to be atomic.
|
||||
/// IllegalHandle := (HandleReservedBitSet (Handle[383:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[383:256] ||
|
||||
/// HandleKeyType (Handle[383:0]) != HANDLE_KEY_TYPE_AES128)
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey)
|
||||
/// IF (Authentic == 0)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// MEM[__odata+127:__odata] := AES128Decrypt (__idata[127:0], UnwrappedKey)
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesdec128kl_u8(__m128i* __odata, __m128i __idata, const void *__h) {
|
||||
return __builtin_ia32_aesdec128kl_u8((__v2di *)__odata, (__v2di)__idata, __h);
|
||||
}
|
||||
|
||||
/// The AESDEC256KL performs 10 rounds of AES to decrypt the __idata using
|
||||
/// the 256-bit key in the handle from the __h. It stores the result in the
|
||||
/// __odata. And return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESDEC256KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[511:0] := MEM[__h+511:__h]
|
||||
/// IllegalHandle := (HandleReservedBitSet (Handle[511:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[383:256] ||
|
||||
/// HandleKeyType (Handle[511:0]) != HANDLE_KEY_TYPE_AES256)
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey)
|
||||
/// IF (Authentic == 0)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// MEM[__odata+127:__odata] := AES256Decrypt (__idata[127:0], UnwrappedKey)
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesdec256kl_u8(__m128i* __odata, __m128i __idata, const void *__h) {
|
||||
return __builtin_ia32_aesdec256kl_u8((__v2di *)__odata, (__v2di)__idata, __h);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) \
|
||||
|| defined(__KL__) */
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__WIDEKL__)
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("kl,widekl"),\
|
||||
__min_vector_width__(128)))
|
||||
|
||||
/// Encrypt __idata[0] to __idata[7] using 128-bit AES key indicated by handle
|
||||
/// at __h and store each resultant block back from __odata to __odata+7. And
|
||||
/// return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESENCWIDE128KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle := MEM[__h+383:__h]
|
||||
/// IllegalHandle := ( HandleReservedBitSet (Handle[383:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[255:128] ||
|
||||
/// HandleKeyType (Handle[383:0]) != HANDLE_KEY_TYPE_AES128 )
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey)
|
||||
/// IF Authentic == 0
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// FOR i := 0 to 7
|
||||
/// __odata[i] := AES128Encrypt (__idata[i], UnwrappedKey)
|
||||
/// ENDFOR
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesencwide128kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) {
|
||||
return __builtin_ia32_aesencwide128kl_u8((__v2di *)__odata,
|
||||
(const __v2di *)__idata, __h);
|
||||
}
|
||||
|
||||
/// Encrypt __idata[0] to __idata[7] using 256-bit AES key indicated by handle
|
||||
/// at __h and store each resultant block back from __odata to __odata+7. And
|
||||
/// return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESENCWIDE256KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[511:0] := MEM[__h+511:__h]
|
||||
/// IllegalHandle := ( HandleReservedBitSet (Handle[511:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[255:128] ||
|
||||
/// HandleKeyType (Handle[511:0]) != HANDLE_KEY_TYPE_AES512 )
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey)
|
||||
/// IF Authentic == 0
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// FOR i := 0 to 7
|
||||
/// __odata[i] := AES256Encrypt (__idata[i], UnwrappedKey)
|
||||
/// ENDFOR
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesencwide256kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) {
|
||||
return __builtin_ia32_aesencwide256kl_u8((__v2di *)__odata,
|
||||
(const __v2di *)__idata, __h);
|
||||
}
|
||||
|
||||
/// Decrypt __idata[0] to __idata[7] using 128-bit AES key indicated by handle
|
||||
/// at __h and store each resultant block back from __odata to __odata+7. And
|
||||
/// return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESDECWIDE128KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[383:0] := MEM[__h+383:__h]
|
||||
/// IllegalHandle := ( HandleReservedBitSet (Handle[383:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[255:128] ||
|
||||
/// HandleKeyType (Handle) != HANDLE_KEY_TYPE_AES128 )
|
||||
/// IF (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate384 (Handle[383:0], IWKey)
|
||||
/// IF Authentic == 0
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// FOR i := 0 to 7
|
||||
/// __odata[i] := AES128Decrypt (__idata[i], UnwrappedKey)
|
||||
/// ENDFOR
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesdecwide128kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) {
|
||||
return __builtin_ia32_aesdecwide128kl_u8((__v2di *)__odata,
|
||||
(const __v2di *)__idata, __h);
|
||||
}
|
||||
|
||||
/// Decrypt __idata[0] to __idata[7] using 256-bit AES key indicated by handle
|
||||
/// at __h and store each resultant block back from __odata to __odata+7. And
|
||||
/// return the affected ZF flag status.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> AESDECWIDE256KL </c> instructions.
|
||||
///
|
||||
/// \operation
|
||||
/// Handle[511:0] := MEM[__h+511:__h]
|
||||
/// IllegalHandle = ( HandleReservedBitSet (Handle[511:0]) ||
|
||||
/// (Handle[127:0] AND (CPL > 0)) ||
|
||||
/// Handle[255:128] ||
|
||||
/// HandleKeyType (Handle) != HANDLE_KEY_TYPE_AES512 )
|
||||
/// If (IllegalHandle)
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// (UnwrappedKey, Authentic) := UnwrapKeyAndAuthenticate512 (Handle[511:0], IWKey)
|
||||
/// IF Authentic == 0
|
||||
/// ZF := 1
|
||||
/// ELSE
|
||||
/// FOR i := 0 to 7
|
||||
/// __odata[i] := AES256Decrypt (__idata[i], UnwrappedKey)
|
||||
/// ENDFOR
|
||||
/// ZF := 0
|
||||
/// FI
|
||||
/// FI
|
||||
/// dst := ZF
|
||||
/// OF := 0
|
||||
/// SF := 0
|
||||
/// AF := 0
|
||||
/// PF := 0
|
||||
/// CF := 0
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_mm_aesdecwide256kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* __h) {
|
||||
return __builtin_ia32_aesdecwide256kl_u8((__v2di *)__odata,
|
||||
(const __v2di *)__idata, __h);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) \
|
||||
|| defined(__WIDEKL__) */
|
||||
|
||||
#endif /* _KEYLOCKERINTRIN_H */
|
||||
6
lib/include/mm_malloc.h
vendored
6
lib/include/mm_malloc.h
vendored
@@ -54,7 +54,13 @@ _mm_malloc(size_t __size, size_t __align)
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_mm_free(void *__p)
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
__mingw_aligned_free(__p);
|
||||
#elif defined(_WIN32)
|
||||
_aligned_free(__p);
|
||||
#else
|
||||
free(__p);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
18
lib/include/opencl-c-base.h
vendored
18
lib/include/opencl-c-base.h
vendored
@@ -9,6 +9,21 @@
|
||||
#ifndef _OPENCL_BASE_H_
|
||||
#define _OPENCL_BASE_H_
|
||||
|
||||
// Define extension macros
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
// For SPIR all extensions are supported.
|
||||
#if defined(__SPIR__)
|
||||
#define cl_khr_subgroup_extended_types 1
|
||||
#define cl_khr_subgroup_non_uniform_vote 1
|
||||
#define cl_khr_subgroup_ballot 1
|
||||
#define cl_khr_subgroup_non_uniform_arithmetic 1
|
||||
#define cl_khr_subgroup_shuffle 1
|
||||
#define cl_khr_subgroup_shuffle_relative 1
|
||||
#define cl_khr_subgroup_clustered_reduce 1
|
||||
#endif // defined(__SPIR__)
|
||||
#endif // (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
|
||||
// built-in scalar data types:
|
||||
|
||||
/**
|
||||
@@ -568,4 +583,7 @@ typedef struct {
|
||||
#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : end
|
||||
#endif // cl_intel_device_side_avc_motion_estimation
|
||||
|
||||
// Disable any extensions we may have enabled previously.
|
||||
#pragma OPENCL EXTENSION all : disable
|
||||
|
||||
#endif //_OPENCL_BASE_H_
|
||||
|
||||
2
lib/include/opencl-c.h
vendored
2
lib/include/opencl-c.h
vendored
@@ -4633,6 +4633,7 @@ float16 __ovld __cnfn convert_float16(float16);
|
||||
// Conversions with double data type parameters or return value.
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
char __ovld __cnfn convert_char(double);
|
||||
char __ovld __cnfn convert_char_rte(double);
|
||||
char __ovld __cnfn convert_char_rtn(double);
|
||||
@@ -5455,6 +5456,7 @@ double16 __ovld __cnfn convert_double16_rtz(ushort16);
|
||||
#endif //cl_khr_fp64
|
||||
|
||||
#ifdef cl_khr_fp16
|
||||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
||||
// Convert half types to non-double types.
|
||||
uchar __ovld __cnfn convert_uchar(half);
|
||||
uchar __ovld __cnfn convert_uchar_rte(half);
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
// which might live in cstdlib.
|
||||
#include <cstdlib>
|
||||
|
||||
// We need limits because __clang_cuda_cmath.h below uses `std::numeric_limit`.
|
||||
#include <limits>
|
||||
|
||||
#pragma omp begin declare variant match( \
|
||||
device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
|
||||
device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any, allow_templates)})
|
||||
|
||||
#define __CUDA__
|
||||
#define __OPENMP_NVPTX__
|
||||
|
||||
@@ -25,3 +25,28 @@
|
||||
|
||||
// Grab the host header too.
|
||||
#include_next <complex>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// If we are compiling against libc++, the macro _LIBCPP_STD_VER should be set
|
||||
// after including <cmath> above. Since the complex header we use is a
|
||||
// simplified version of the libc++, we don't need it in this case. If we
|
||||
// compile against libstdc++, or any other standard library, we will overload
|
||||
// the (hopefully template) functions in the <complex> header with the ones we
|
||||
// got from libc++ which decomposes math functions, like `std::sin`, into
|
||||
// arithmetic and calls to non-complex functions, all of which we can then
|
||||
// handle.
|
||||
#ifndef _LIBCPP_STD_VER
|
||||
|
||||
#pragma omp begin declare variant match( \
|
||||
device = {arch(nvptx, nvptx64)}, \
|
||||
implementation = {extension(match_any, allow_templates)})
|
||||
|
||||
#include <complex_cmath.h>
|
||||
|
||||
#pragma omp end declare variant
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
388
lib/include/openmp_wrappers/complex_cmath.h
Normal file
388
lib/include/openmp_wrappers/complex_cmath.h
Normal file
@@ -0,0 +1,388 @@
|
||||
//===------------------------- __complex_cmath.h --------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// std::complex header copied from the libcxx source and simplified for use in
|
||||
// OpenMP target offload regions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _OPENMP
|
||||
#error "This file is for OpenMP compilation only."
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error "This file is for C++ compilation only."
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_COMPLEX
|
||||
#define _LIBCPP_COMPLEX
|
||||
|
||||
#include <cmath>
|
||||
#include <type_traits>
|
||||
|
||||
#define __DEVICE__ static constexpr __attribute__((nothrow))
|
||||
|
||||
namespace std {
|
||||
|
||||
// abs
|
||||
|
||||
template <class _Tp> __DEVICE__ _Tp abs(const std::complex<_Tp> &__c) {
|
||||
return hypot(__c.real(), __c.imag());
|
||||
}
|
||||
|
||||
// arg
|
||||
|
||||
template <class _Tp> __DEVICE__ _Tp arg(const std::complex<_Tp> &__c) {
|
||||
return atan2(__c.imag(), __c.real());
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
typename enable_if<is_integral<_Tp>::value || is_same<_Tp, double>::value,
|
||||
double>::type
|
||||
arg(_Tp __re) {
|
||||
return atan2(0., __re);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
typename enable_if<is_same<_Tp, float>::value, float>::type arg(_Tp __re) {
|
||||
return atan2f(0.F, __re);
|
||||
}
|
||||
|
||||
// norm
|
||||
|
||||
template <class _Tp> __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) {
|
||||
if (std::isinf(__c.real()))
|
||||
return abs(__c.real());
|
||||
if (std::isinf(__c.imag()))
|
||||
return abs(__c.imag());
|
||||
return __c.real() * __c.real() + __c.imag() * __c.imag();
|
||||
}
|
||||
|
||||
// conj
|
||||
|
||||
template <class _Tp> std::complex<_Tp> conj(const std::complex<_Tp> &__c) {
|
||||
return std::complex<_Tp>(__c.real(), -__c.imag());
|
||||
}
|
||||
|
||||
// proj
|
||||
|
||||
template <class _Tp> std::complex<_Tp> proj(const std::complex<_Tp> &__c) {
|
||||
std::complex<_Tp> __r = __c;
|
||||
if (std::isinf(__c.real()) || std::isinf(__c.imag()))
|
||||
__r = std::complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
|
||||
return __r;
|
||||
}
|
||||
|
||||
// polar
|
||||
|
||||
template <class _Tp>
|
||||
complex<_Tp> polar(const _Tp &__rho, const _Tp &__theta = _Tp()) {
|
||||
if (std::isnan(__rho) || signbit(__rho))
|
||||
return std::complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
||||
if (std::isnan(__theta)) {
|
||||
if (std::isinf(__rho))
|
||||
return std::complex<_Tp>(__rho, __theta);
|
||||
return std::complex<_Tp>(__theta, __theta);
|
||||
}
|
||||
if (std::isinf(__theta)) {
|
||||
if (std::isinf(__rho))
|
||||
return std::complex<_Tp>(__rho, _Tp(NAN));
|
||||
return std::complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
||||
}
|
||||
_Tp __x = __rho * cos(__theta);
|
||||
if (std::isnan(__x))
|
||||
__x = 0;
|
||||
_Tp __y = __rho * sin(__theta);
|
||||
if (std::isnan(__y))
|
||||
__y = 0;
|
||||
return std::complex<_Tp>(__x, __y);
|
||||
}
|
||||
|
||||
// log
|
||||
|
||||
template <class _Tp> std::complex<_Tp> log(const std::complex<_Tp> &__x) {
|
||||
return std::complex<_Tp>(log(abs(__x)), arg(__x));
|
||||
}
|
||||
|
||||
// log10
|
||||
|
||||
template <class _Tp> std::complex<_Tp> log10(const std::complex<_Tp> &__x) {
|
||||
return log(__x) / log(_Tp(10));
|
||||
}
|
||||
|
||||
// sqrt
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> sqrt(const std::complex<_Tp> &__x) {
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(_Tp(INFINITY), __x.imag());
|
||||
if (std::isinf(__x.real())) {
|
||||
if (__x.real() > _Tp(0))
|
||||
return std::complex<_Tp>(__x.real(), std::isnan(__x.imag())
|
||||
? __x.imag()
|
||||
: copysign(_Tp(0), __x.imag()));
|
||||
return std::complex<_Tp>(std::isnan(__x.imag()) ? __x.imag() : _Tp(0),
|
||||
copysign(__x.real(), __x.imag()));
|
||||
}
|
||||
return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
|
||||
}
|
||||
|
||||
// exp
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> exp(const std::complex<_Tp> &__x) {
|
||||
_Tp __i = __x.imag();
|
||||
if (std::isinf(__x.real())) {
|
||||
if (__x.real() < _Tp(0)) {
|
||||
if (!std::isfinite(__i))
|
||||
__i = _Tp(1);
|
||||
} else if (__i == 0 || !std::isfinite(__i)) {
|
||||
if (std::isinf(__i))
|
||||
__i = _Tp(NAN);
|
||||
return std::complex<_Tp>(__x.real(), __i);
|
||||
}
|
||||
} else if (std::isnan(__x.real()) && __x.imag() == 0)
|
||||
return __x;
|
||||
_Tp __e = exp(__x.real());
|
||||
return std::complex<_Tp>(__e * cos(__i), __e * sin(__i));
|
||||
}
|
||||
|
||||
// pow
|
||||
|
||||
template <class _Tp>
|
||||
std::complex<_Tp> pow(const std::complex<_Tp> &__x,
|
||||
const std::complex<_Tp> &__y) {
|
||||
return exp(__y * log(__x));
|
||||
}
|
||||
|
||||
// __sqr, computes pow(x, 2)
|
||||
|
||||
template <class _Tp> std::complex<_Tp> __sqr(const std::complex<_Tp> &__x) {
|
||||
return std::complex<_Tp>((__x.real() - __x.imag()) *
|
||||
(__x.real() + __x.imag()),
|
||||
_Tp(2) * __x.real() * __x.imag());
|
||||
}
|
||||
|
||||
// asinh
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> asinh(const std::complex<_Tp> &__x) {
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (std::isinf(__x.real())) {
|
||||
if (std::isnan(__x.imag()))
|
||||
return __x;
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(__x.real(),
|
||||
copysign(__pi * _Tp(0.25), __x.imag()));
|
||||
return std::complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||
}
|
||||
if (std::isnan(__x.real())) {
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(__x.imag(), __x.real());
|
||||
if (__x.imag() == 0)
|
||||
return __x;
|
||||
return std::complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(copysign(__x.imag(), __x.real()),
|
||||
copysign(__pi / _Tp(2), __x.imag()));
|
||||
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1)));
|
||||
return std::complex<_Tp>(copysign(__z.real(), __x.real()),
|
||||
copysign(__z.imag(), __x.imag()));
|
||||
}
|
||||
|
||||
// acosh
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> acosh(const std::complex<_Tp> &__x) {
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (std::isinf(__x.real())) {
|
||||
if (std::isnan(__x.imag()))
|
||||
return std::complex<_Tp>(abs(__x.real()), __x.imag());
|
||||
if (std::isinf(__x.imag())) {
|
||||
if (__x.real() > 0)
|
||||
return std::complex<_Tp>(__x.real(),
|
||||
copysign(__pi * _Tp(0.25), __x.imag()));
|
||||
else
|
||||
return std::complex<_Tp>(-__x.real(),
|
||||
copysign(__pi * _Tp(0.75), __x.imag()));
|
||||
}
|
||||
if (__x.real() < 0)
|
||||
return std::complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
||||
return std::complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||
}
|
||||
if (std::isnan(__x.real())) {
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(abs(__x.imag()), __x.real());
|
||||
return std::complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(abs(__x.imag()),
|
||||
copysign(__pi / _Tp(2), __x.imag()));
|
||||
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
||||
return std::complex<_Tp>(copysign(__z.real(), _Tp(0)),
|
||||
copysign(__z.imag(), __x.imag()));
|
||||
}
|
||||
|
||||
// atanh
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> atanh(const std::complex<_Tp> &__x) {
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (std::isinf(__x.imag())) {
|
||||
return std::complex<_Tp>(copysign(_Tp(0), __x.real()),
|
||||
copysign(__pi / _Tp(2), __x.imag()));
|
||||
}
|
||||
if (std::isnan(__x.imag())) {
|
||||
if (std::isinf(__x.real()) || __x.real() == 0)
|
||||
return std::complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
|
||||
return std::complex<_Tp>(__x.imag(), __x.imag());
|
||||
}
|
||||
if (std::isnan(__x.real())) {
|
||||
return std::complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (std::isinf(__x.real())) {
|
||||
return std::complex<_Tp>(copysign(_Tp(0), __x.real()),
|
||||
copysign(__pi / _Tp(2), __x.imag()));
|
||||
}
|
||||
if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
|
||||
return std::complex<_Tp>(copysign(_Tp(INFINITY), __x.real()),
|
||||
copysign(_Tp(0), __x.imag()));
|
||||
}
|
||||
std::complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
|
||||
return std::complex<_Tp>(copysign(__z.real(), __x.real()),
|
||||
copysign(__z.imag(), __x.imag()));
|
||||
}
|
||||
|
||||
// sinh
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> sinh(const std::complex<_Tp> &__x) {
|
||||
if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
|
||||
return std::complex<_Tp>(__x.real(), _Tp(NAN));
|
||||
if (__x.real() == 0 && !std::isfinite(__x.imag()))
|
||||
return std::complex<_Tp>(__x.real(), _Tp(NAN));
|
||||
if (__x.imag() == 0 && !std::isfinite(__x.real()))
|
||||
return __x;
|
||||
return std::complex<_Tp>(sinh(__x.real()) * cos(__x.imag()),
|
||||
cosh(__x.real()) * sin(__x.imag()));
|
||||
}
|
||||
|
||||
// cosh
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> cosh(const std::complex<_Tp> &__x) {
|
||||
if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
|
||||
return std::complex<_Tp>(abs(__x.real()), _Tp(NAN));
|
||||
if (__x.real() == 0 && !std::isfinite(__x.imag()))
|
||||
return std::complex<_Tp>(_Tp(NAN), __x.real());
|
||||
if (__x.real() == 0 && __x.imag() == 0)
|
||||
return std::complex<_Tp>(_Tp(1), __x.imag());
|
||||
if (__x.imag() == 0 && !std::isfinite(__x.real()))
|
||||
return std::complex<_Tp>(abs(__x.real()), __x.imag());
|
||||
return std::complex<_Tp>(cosh(__x.real()) * cos(__x.imag()),
|
||||
sinh(__x.real()) * sin(__x.imag()));
|
||||
}
|
||||
|
||||
// tanh
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> tanh(const std::complex<_Tp> &__x) {
|
||||
if (std::isinf(__x.real())) {
|
||||
if (!std::isfinite(__x.imag()))
|
||||
return std::complex<_Tp>(_Tp(1), _Tp(0));
|
||||
return std::complex<_Tp>(_Tp(1),
|
||||
copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
|
||||
}
|
||||
if (std::isnan(__x.real()) && __x.imag() == 0)
|
||||
return __x;
|
||||
_Tp __2r(_Tp(2) * __x.real());
|
||||
_Tp __2i(_Tp(2) * __x.imag());
|
||||
_Tp __d(cosh(__2r) + cos(__2i));
|
||||
_Tp __2rsh(sinh(__2r));
|
||||
if (std::isinf(__2rsh) && std::isinf(__d))
|
||||
return std::complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
||||
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
||||
return std::complex<_Tp>(__2rsh / __d, sin(__2i) / __d);
|
||||
}
|
||||
|
||||
// asin
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> asin(const std::complex<_Tp> &__x) {
|
||||
std::complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
|
||||
return std::complex<_Tp>(__z.imag(), -__z.real());
|
||||
}
|
||||
|
||||
// acos
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> acos(const std::complex<_Tp> &__x) {
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (std::isinf(__x.real())) {
|
||||
if (std::isnan(__x.imag()))
|
||||
return std::complex<_Tp>(__x.imag(), __x.real());
|
||||
if (std::isinf(__x.imag())) {
|
||||
if (__x.real() < _Tp(0))
|
||||
return std::complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
|
||||
return std::complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
|
||||
}
|
||||
if (__x.real() < _Tp(0))
|
||||
return std::complex<_Tp>(__pi,
|
||||
signbit(__x.imag()) ? -__x.real() : __x.real());
|
||||
return std::complex<_Tp>(_Tp(0),
|
||||
signbit(__x.imag()) ? __x.real() : -__x.real());
|
||||
}
|
||||
if (std::isnan(__x.real())) {
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(__x.real(), -__x.imag());
|
||||
return std::complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (std::isinf(__x.imag()))
|
||||
return std::complex<_Tp>(__pi / _Tp(2), -__x.imag());
|
||||
if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
|
||||
return std::complex<_Tp>(__pi / _Tp(2), -__x.imag());
|
||||
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
||||
if (signbit(__x.imag()))
|
||||
return std::complex<_Tp>(abs(__z.imag()), abs(__z.real()));
|
||||
return std::complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
|
||||
}
|
||||
|
||||
// atan
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> atan(const std::complex<_Tp> &__x) {
|
||||
std::complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
|
||||
return std::complex<_Tp>(__z.imag(), -__z.real());
|
||||
}
|
||||
|
||||
// sin
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> sin(const std::complex<_Tp> &__x) {
|
||||
std::complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
|
||||
return std::complex<_Tp>(__z.imag(), -__z.real());
|
||||
}
|
||||
|
||||
// cos
|
||||
|
||||
template <class _Tp> std::complex<_Tp> cos(const std::complex<_Tp> &__x) {
|
||||
return cosh(complex<_Tp>(-__x.imag(), __x.real()));
|
||||
}
|
||||
|
||||
// tan
|
||||
|
||||
template <class _Tp>
|
||||
__DEVICE__ std::complex<_Tp> tan(const std::complex<_Tp> &__x) {
|
||||
std::complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
|
||||
return std::complex<_Tp>(__z.imag(), -__z.real());
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
11
lib/include/popcntintrin.h
vendored
11
lib/include/popcntintrin.h
vendored
@@ -13,6 +13,12 @@
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
|
||||
#else
|
||||
#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
|
||||
#endif
|
||||
|
||||
/// Counts the number of bits in the source operand having a value of 1.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
@@ -23,7 +29,7 @@
|
||||
/// An unsigned 32-bit integer operand.
|
||||
/// \returns A 32-bit integer containing the number of bits with value 1 in the
|
||||
/// source operand.
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
_mm_popcnt_u32(unsigned int __A)
|
||||
{
|
||||
return __builtin_popcount(__A);
|
||||
@@ -40,7 +46,7 @@ _mm_popcnt_u32(unsigned int __A)
|
||||
/// An unsigned 64-bit integer operand.
|
||||
/// \returns A 64-bit integer containing the number of bits with value 1 in the
|
||||
/// source operand.
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
_mm_popcnt_u64(unsigned long long __A)
|
||||
{
|
||||
return __builtin_popcountll(__A);
|
||||
@@ -48,5 +54,6 @@ _mm_popcnt_u64(unsigned long long __A)
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#undef __DEFAULT_FN_ATTRS_CONSTEXPR
|
||||
|
||||
#endif /* __POPCNTINTRIN_H */
|
||||
|
||||
@@ -78,6 +78,30 @@ extern __inline __m128i
|
||||
return (__m128i)vec_sel((__v16qu)__A, (__v16qu)__B, __lmask);
|
||||
}
|
||||
|
||||
extern __inline __m128i
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_mm_insert_epi8(__m128i const __A, int const __D, int const __N) {
|
||||
__v16qi result = (__v16qi)__A;
|
||||
result[__N & 0xf] = __D;
|
||||
return (__m128i)result;
|
||||
}
|
||||
|
||||
extern __inline __m128i
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_mm_insert_epi32(__m128i const __A, int const __D, int const __N) {
|
||||
__v4si result = (__v4si)__A;
|
||||
result[__N & 3] = __D;
|
||||
return (__m128i)result;
|
||||
}
|
||||
|
||||
extern __inline __m128i
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_mm_insert_epi64(__m128i const __A, long long const __D, int const __N) {
|
||||
__v2di result = (__v2di)__A;
|
||||
result[__N & 1] = __D;
|
||||
return (__m128i)result;
|
||||
}
|
||||
|
||||
#else
|
||||
#include_next <smmintrin.h>
|
||||
#endif /* defined(__linux__) && defined(__ppc64__) */
|
||||
|
||||
150
lib/include/uintrintrin.h
vendored
Normal file
150
lib/include/uintrintrin.h
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
/*===------------------ uintrintrin.h - UINTR intrinsics -------------------===
|
||||
*
|
||||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
* See https://llvm.org/LICENSE.txt for license information.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86GPRINTRIN_H
|
||||
#error "Never use <uintrintrin.h> directly; include <x86gprintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __UINTRINTRIN_H
|
||||
#define __UINTRINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file */
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("uintr")))
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
/// Clears the user interrupt flag (UIF). Its effect takes place immediately: a
|
||||
/// user interrupt cannot be delivered on the instruction boundary following
|
||||
/// CLUI. Can be executed only if CR4.UINT = 1, the logical processor is in
|
||||
/// 64-bit mode, and software is not executing inside an enclave; otherwise,
|
||||
/// each causes an invalid-opcode exception. Causes a transactional abort if
|
||||
/// executed inside a transactional region; the abort loads EAX as it would
|
||||
/// had it been due to an execution of CLI.
|
||||
///
|
||||
/// \headerfile <x86gprintrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> CLUI </c> instruction.
|
||||
///
|
||||
/// \operation
|
||||
/// UIF := 0
|
||||
/// \endoperation
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_clui (void)
|
||||
{
|
||||
__builtin_ia32_clui();
|
||||
}
|
||||
|
||||
/// Sets the user interrupt flag (UIF). Its effect takes place immediately; a
|
||||
/// user interrupt may be delivered on the instruction boundary following
|
||||
/// STUI. Can be executed only if CR4.UINT = 1, the logical processor is in
|
||||
/// 64-bit mode, and software is not executing inside an enclave; otherwise,
|
||||
/// each causes an invalid-opcode exception. Causes a transactional abort if
|
||||
/// executed inside a transactional region; the abort loads EAX as it would
|
||||
/// had it been due to an execution of STI.
|
||||
///
|
||||
/// \headerfile <x86gprintrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> STUI </c> instruction.
|
||||
///
|
||||
/// \operation
|
||||
/// UIF := 1
|
||||
/// \endoperation
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_stui (void)
|
||||
{
|
||||
__builtin_ia32_stui();
|
||||
}
|
||||
|
||||
/// Get the current value of the user interrupt flag (UIF). Can be executed
|
||||
/// regardless of CPL and inside a transactional region. Can be executed only
|
||||
/// if CR4.UINT = 1, the logical processor is in 64-bit mode, and software is
|
||||
/// not executing inside an enclave; otherwise, it causes an invalid-opcode
|
||||
/// exception.
|
||||
///
|
||||
/// \headerfile <x86gprintrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> TESTUI </c> instruction.
|
||||
///
|
||||
/// \returns The current value of the user interrupt flag (UIF).
|
||||
///
|
||||
/// \operation
|
||||
/// CF := UIF
|
||||
/// ZF := 0
|
||||
/// AF := 0
|
||||
/// OF := 0
|
||||
/// PF := 0
|
||||
/// SF := 0
|
||||
/// dst := CF
|
||||
/// \endoperation
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_testui (void)
|
||||
{
|
||||
return __builtin_ia32_testui();
|
||||
}
|
||||
|
||||
/// Send interprocessor user interrupt. Can be executed only if
|
||||
/// CR4.UINT = IA32_UINT_TT[0] = 1, the logical processor is in 64-bit mode,
|
||||
/// and software is not executing inside an enclave; otherwise, it causes an
|
||||
/// invalid-opcode exception. May be executed at any privilege level, all of
|
||||
/// its memory accesses are performed with supervisor privilege.
|
||||
///
|
||||
/// \headerfile <x86gprintrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the <c> SENDUIPI </c> instruction
|
||||
///
|
||||
/// \param __a
|
||||
/// Index of user-interrupt target table entry in user-interrupt target
|
||||
/// table.
|
||||
///
|
||||
/// \operation
|
||||
/// IF __a > UITTSZ
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// tempUITTE := MEM[UITTADDR + (a<<4)]
|
||||
/// // tempUITTE must be valid, and can't have any reserved bit set
|
||||
/// IF (tempUITTE.V == 0 OR tempUITTE[7:1] != 0)
|
||||
/// GP (0)
|
||||
/// FI
|
||||
/// tempUPID := MEM[tempUITTE.UPIDADDR] // under lock
|
||||
/// // tempUPID can't have any reserved bit set
|
||||
/// IF (tempUPID[15:2] != 0 OR tempUPID[31:24] != 0)
|
||||
/// GP (0) // release lock
|
||||
/// FI
|
||||
/// tempUPID.PIR[tempUITTE.UV] := 1;
|
||||
/// IF (tempUPID.SN == 0 AND tempUPID.ON == 0)
|
||||
/// tempUPID.ON := 1
|
||||
/// sendNotify := 1
|
||||
/// ELSE
|
||||
/// sendNotify := 0
|
||||
/// FI
|
||||
/// MEM[tempUITTE.UPIDADDR] := tempUPID // release lock
|
||||
/// IF sendNotify == 1
|
||||
/// IF IA32_APIC_BASE[10] == 1 // local APIC is in x2APIC mode
|
||||
/// // send ordinary IPI with vector tempUPID.NV to 32-bit physical APIC
|
||||
/// // ID tempUPID.NDST
|
||||
/// SendOrdinaryIPI(tempUPID.NV, tempUPID.NDST)
|
||||
/// ELSE
|
||||
/// // send ordinary IPI with vector tempUPID.NV to 8-bit physical APIC
|
||||
/// // ID tempUPID.NDST[15:8]
|
||||
/// SendOrdinaryIPI(tempUPID.NV, tempUPID.NDST[15:8])
|
||||
/// FI
|
||||
/// FI
|
||||
/// \endoperation
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_senduipi (unsigned long long __a)
|
||||
{
|
||||
__builtin_ia32_senduipi(__a);
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __UINTRINTRIN_H */
|
||||
112
lib/include/wasm_simd128.h
vendored
112
lib/include/wasm_simd128.h
vendored
@@ -18,8 +18,7 @@ typedef int32_t v128_t __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
|
||||
// Internal types determined by clang builtin definitions
|
||||
typedef int32_t __v128_u __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
typedef char __i8x16 __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
typedef signed char __s8x16
|
||||
typedef signed char __i8x16
|
||||
__attribute__((__vector_size__(16), __aligned__(16)));
|
||||
typedef unsigned char __u8x16
|
||||
__attribute__((__vector_size__(16), __aligned__(16)));
|
||||
@@ -35,6 +34,13 @@ typedef unsigned long long __u64x2
|
||||
typedef float __f32x4 __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
typedef double __f64x2 __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
|
||||
typedef signed char __i8x8 __attribute__((__vector_size__(8), __aligned__(8)));
|
||||
typedef unsigned char __u8x8
|
||||
__attribute__((__vector_size__(8), __aligned__(8)));
|
||||
typedef short __i16x4 __attribute__((__vector_size__(8), __aligned__(8)));
|
||||
typedef unsigned short __u16x4
|
||||
__attribute__((__vector_size__(8), __aligned__(8)));
|
||||
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("simd128"), \
|
||||
__min_vector_width__(128)))
|
||||
@@ -273,7 +279,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_splat(int8_t __a) {
|
||||
(__builtin_wasm_extract_lane_s_i8x16((__i8x16)(__a), __i))
|
||||
|
||||
#define wasm_u8x16_extract_lane(__a, __i) \
|
||||
(__builtin_wasm_extract_lane_u_i8x16((__i8x16)(__a), __i))
|
||||
(__builtin_wasm_extract_lane_u_i8x16((__u8x16)(__a), __i))
|
||||
|
||||
#define wasm_i8x16_replace_lane(__a, __i, __b) \
|
||||
((v128_t)__builtin_wasm_replace_lane_i8x16((__i8x16)(__a), __i, __b))
|
||||
@@ -286,7 +292,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_splat(int16_t __a) {
|
||||
(__builtin_wasm_extract_lane_s_i16x8((__i16x8)(__a), __i))
|
||||
|
||||
#define wasm_u16x8_extract_lane(__a, __i) \
|
||||
(__builtin_wasm_extract_lane_u_i16x8((__i16x8)(__a), __i))
|
||||
(__builtin_wasm_extract_lane_u_i16x8((__u16x8)(__a), __i))
|
||||
|
||||
#define wasm_i16x8_replace_lane(__a, __i, __b) \
|
||||
((v128_t)__builtin_wasm_replace_lane_i16x8((__i16x8)(__a), __i, __b))
|
||||
@@ -333,17 +339,17 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_splat(double __a) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_eq(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)((__s8x16)__a == (__s8x16)__b);
|
||||
return (v128_t)((__i8x16)__a == (__i8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_ne(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)((__s8x16)__a != (__s8x16)__b);
|
||||
return (v128_t)((__i8x16)__a != (__i8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_lt(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)((__s8x16)__a < (__s8x16)__b);
|
||||
return (v128_t)((__i8x16)__a < (__i8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_lt(v128_t __a,
|
||||
@@ -353,7 +359,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_lt(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_gt(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)((__s8x16)__a > (__s8x16)__b);
|
||||
return (v128_t)((__i8x16)__a > (__i8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_gt(v128_t __a,
|
||||
@@ -363,7 +369,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_gt(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_le(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)((__s8x16)__a <= (__s8x16)__b);
|
||||
return (v128_t)((__i8x16)__a <= (__i8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_le(v128_t __a,
|
||||
@@ -373,7 +379,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_le(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_ge(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)((__s8x16)__a >= (__s8x16)__b);
|
||||
return (v128_t)((__i8x16)__a >= (__i8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_ge(v128_t __a,
|
||||
@@ -595,7 +601,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_shl(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_shr(v128_t __a,
|
||||
int32_t __b) {
|
||||
return (v128_t)((__s8x16)__a >> __b);
|
||||
return (v128_t)((__i8x16)__a >> __b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_shr(v128_t __a,
|
||||
@@ -616,8 +622,8 @@ wasm_i8x16_add_saturate(v128_t __a, v128_t __b) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_u8x16_add_saturate(v128_t __a, v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_add_saturate_u_i8x16((__i8x16)__a,
|
||||
(__i8x16)__b);
|
||||
return (v128_t)__builtin_wasm_add_saturate_u_i8x16((__u8x16)__a,
|
||||
(__u8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_sub(v128_t __a,
|
||||
@@ -633,8 +639,8 @@ wasm_i8x16_sub_saturate(v128_t __a, v128_t __b) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_u8x16_sub_saturate(v128_t __a, v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_sub_saturate_u_i8x16((__i8x16)__a,
|
||||
(__i8x16)__b);
|
||||
return (v128_t)__builtin_wasm_sub_saturate_u_i8x16((__u8x16)__a,
|
||||
(__u8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_min(v128_t __a,
|
||||
@@ -644,7 +650,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_min(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_min(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_min_u_i8x16((__i8x16)__a, (__i8x16)__b);
|
||||
return (v128_t)__builtin_wasm_min_u_i8x16((__u8x16)__a, (__u8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_max(v128_t __a,
|
||||
@@ -654,12 +660,12 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_max(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_max(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_max_u_i8x16((__i8x16)__a, (__i8x16)__b);
|
||||
return (v128_t)__builtin_wasm_max_u_i8x16((__u8x16)__a, (__u8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_avgr(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_avgr_u_i8x16((__i8x16)__a, (__i8x16)__b);
|
||||
return (v128_t)__builtin_wasm_avgr_u_i8x16((__u8x16)__a, (__u8x16)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_abs(v128_t __a) {
|
||||
@@ -706,8 +712,8 @@ wasm_i16x8_add_saturate(v128_t __a, v128_t __b) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_u16x8_add_saturate(v128_t __a, v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_add_saturate_u_i16x8((__i16x8)__a,
|
||||
(__i16x8)__b);
|
||||
return (v128_t)__builtin_wasm_add_saturate_u_i16x8((__u16x8)__a,
|
||||
(__u16x8)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_sub(v128_t __a,
|
||||
@@ -723,8 +729,8 @@ wasm_i16x8_sub_saturate(v128_t __a, v128_t __b) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_u16x8_sub_saturate(v128_t __a, v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_sub_saturate_u_i16x8((__i16x8)__a,
|
||||
(__i16x8)__b);
|
||||
return (v128_t)__builtin_wasm_sub_saturate_u_i16x8((__u16x8)__a,
|
||||
(__u16x8)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_mul(v128_t __a,
|
||||
@@ -739,7 +745,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_min(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_min(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_min_u_i16x8((__i16x8)__a, (__i16x8)__b);
|
||||
return (v128_t)__builtin_wasm_min_u_i16x8((__u16x8)__a, (__u16x8)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_max(v128_t __a,
|
||||
@@ -749,12 +755,12 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_max(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_max(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_max_u_i16x8((__i16x8)__a, (__i16x8)__b);
|
||||
return (v128_t)__builtin_wasm_max_u_i16x8((__u16x8)__a, (__u16x8)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_avgr(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_avgr_u_i16x8((__i16x8)__a, (__i16x8)__b);
|
||||
return (v128_t)__builtin_wasm_avgr_u_i16x8((__u16x8)__a, (__u16x8)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_abs(v128_t __a) {
|
||||
@@ -810,7 +816,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_min(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_min(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_min_u_i32x4((__i32x4)__a, (__i32x4)__b);
|
||||
return (v128_t)__builtin_wasm_min_u_i32x4((__u32x4)__a, (__u32x4)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_max(v128_t __a,
|
||||
@@ -820,7 +826,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_max(v128_t __a,
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_max(v128_t __a,
|
||||
v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_max_u_i32x4((__i32x4)__a, (__i32x4)__b);
|
||||
return (v128_t)__builtin_wasm_max_u_i32x4((__u32x4)__a, (__u32x4)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_neg(v128_t __a) {
|
||||
@@ -1071,8 +1077,8 @@ wasm_i8x16_narrow_i16x8(v128_t __a, v128_t __b) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_u8x16_narrow_i16x8(v128_t __a, v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_narrow_u_i8x16_i16x8((__i16x8)__a,
|
||||
(__i16x8)__b);
|
||||
return (v128_t)__builtin_wasm_narrow_u_i8x16_i16x8((__u16x8)__a,
|
||||
(__u16x8)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
@@ -1083,48 +1089,76 @@ wasm_i16x8_narrow_i32x4(v128_t __a, v128_t __b) {
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_u16x8_narrow_i32x4(v128_t __a, v128_t __b) {
|
||||
return (v128_t)__builtin_wasm_narrow_u_i16x8_i32x4((__i32x4)__a,
|
||||
(__i32x4)__b);
|
||||
return (v128_t)__builtin_wasm_narrow_u_i16x8_i32x4((__u32x4)__a,
|
||||
(__u32x4)__b);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i16x8_widen_low_i8x16(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_low_s_i16x8_i8x16((__i8x16)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__i8x8){((__i8x16)__a)[0], ((__i8x16)__a)[1], ((__i8x16)__a)[2],
|
||||
((__i8x16)__a)[3], ((__i8x16)__a)[4], ((__i8x16)__a)[5],
|
||||
((__i8x16)__a)[6], ((__i8x16)__a)[7]},
|
||||
__i16x8);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i16x8_widen_high_i8x16(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_high_s_i16x8_i8x16((__i8x16)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__i8x8){((__i8x16)__a)[8], ((__i8x16)__a)[9], ((__i8x16)__a)[10],
|
||||
((__i8x16)__a)[11], ((__i8x16)__a)[12], ((__i8x16)__a)[13],
|
||||
((__i8x16)__a)[14], ((__i8x16)__a)[15]},
|
||||
__i16x8);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i16x8_widen_low_u8x16(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_low_u_i16x8_i8x16((__i8x16)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__u8x8){((__u8x16)__a)[0], ((__u8x16)__a)[1], ((__u8x16)__a)[2],
|
||||
((__u8x16)__a)[3], ((__u8x16)__a)[4], ((__u8x16)__a)[5],
|
||||
((__u8x16)__a)[6], ((__u8x16)__a)[7]},
|
||||
__u16x8);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i16x8_widen_high_u8x16(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_high_u_i16x8_i8x16((__i8x16)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__u8x8){((__u8x16)__a)[8], ((__u8x16)__a)[9], ((__u8x16)__a)[10],
|
||||
((__u8x16)__a)[11], ((__u8x16)__a)[12], ((__u8x16)__a)[13],
|
||||
((__u8x16)__a)[14], ((__u8x16)__a)[15]},
|
||||
__u16x8);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i32x4_widen_low_i16x8(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_low_s_i32x4_i16x8((__i16x8)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__i16x4){((__i16x8)__a)[0], ((__i16x8)__a)[1], ((__i16x8)__a)[2],
|
||||
((__i16x8)__a)[3]},
|
||||
__i32x4);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i32x4_widen_high_i16x8(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_high_s_i32x4_i16x8((__i16x8)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__i16x4){((__i16x8)__a)[4], ((__i16x8)__a)[5], ((__i16x8)__a)[6],
|
||||
((__i16x8)__a)[7]},
|
||||
__i32x4);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i32x4_widen_low_u16x8(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_low_u_i32x4_i16x8((__i16x8)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__u16x4){((__u16x8)__a)[0], ((__u16x8)__a)[1], ((__u16x8)__a)[2],
|
||||
((__u16x8)__a)[3]},
|
||||
__u32x4);
|
||||
}
|
||||
|
||||
static __inline__ v128_t __DEFAULT_FN_ATTRS
|
||||
wasm_i32x4_widen_high_u16x8(v128_t __a) {
|
||||
return (v128_t)__builtin_wasm_widen_high_u_i32x4_i16x8((__i16x8)__a);
|
||||
return (v128_t) __builtin_convertvector(
|
||||
(__u16x4){((__u16x8)__a)[4], ((__u16x8)__a)[5], ((__u16x8)__a)[6],
|
||||
((__u16x8)__a)[7]},
|
||||
__u32x4);
|
||||
}
|
||||
|
||||
// Undefine helper macros
|
||||
|
||||
23
lib/include/x86gprintrin.h
vendored
Normal file
23
lib/include/x86gprintrin.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*===--------------- x86gprintrin.h - X86 GPR intrinsics ------------------===
|
||||
*
|
||||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
* See https://llvm.org/LICENSE.txt for license information.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86GPRINTRIN_H
|
||||
#define __X86GPRINTRIN_H
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__HRESET__)
|
||||
#include <hresetintrin.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
|
||||
defined(__UINTR__)
|
||||
#include <uintrintrin.h>
|
||||
#endif
|
||||
|
||||
#endif /* __X86GPRINTRIN_H */
|
||||
206
lib/libcxx/include/__availability
Normal file
206
lib/libcxx/include/__availability
Normal file
@@ -0,0 +1,206 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___AVAILABILITY
|
||||
#define _LIBCPP___AVAILABILITY
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// Libc++ is shipped by various vendors. In particular, it is used as a system
|
||||
// library on macOS, iOS and other Apple platforms. In order for users to be
|
||||
// able to compile a binary that is intended to be deployed to an older version
|
||||
// of a platform, Clang provides availability attributes [1]. These attributes
|
||||
// can be placed on declarations and are used to describe the life cycle of a
|
||||
// symbol in the library.
|
||||
//
|
||||
// The main goal is to ensure a compile-time error if a symbol that hasn't been
|
||||
// introduced in a previously released library is used in a program that targets
|
||||
// that previously released library. Normally, this would be a load-time error
|
||||
// when one tries to launch the program against the older library.
|
||||
//
|
||||
// For example, the filesystem library was introduced in the dylib in macOS 10.15.
|
||||
// If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their
|
||||
// program, the compiler would normally not complain (because the required
|
||||
// declarations are in the headers), but the dynamic loader would fail to find
|
||||
// the symbols when actually trying to launch the program on macOS 10.13. To
|
||||
// turn this into a compile-time issue instead, declarations are annotated with
|
||||
// when they were introduced, and the compiler can produce a diagnostic if the
|
||||
// program references something that isn't available on the deployment target.
|
||||
//
|
||||
// This mechanism is general in nature, and any vendor can add their markup to
|
||||
// the library (see below). Whenever a new feature is added that requires support
|
||||
// in the shared library, a macro should be added below to mark this feature
|
||||
// as unavailable. When vendors decide to ship the feature as part of their
|
||||
// shared library, they can update the markup appropriately.
|
||||
//
|
||||
// Note that this mechanism is disabled by default in the "upstream" libc++.
|
||||
// Availability annotations are only meaningful when shipping libc++ inside
|
||||
// a platform (i.e. as a system library), and so vendors that want them should
|
||||
// turn those annotations on at CMake configuration time.
|
||||
//
|
||||
// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
|
||||
|
||||
|
||||
// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
|
||||
// for a while.
|
||||
#if defined(_LIBCPP_DISABLE_AVAILABILITY)
|
||||
# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Availability markup is disabled when building the library, or when the compiler
|
||||
// doesn't support the proper attributes.
|
||||
#if defined(_LIBCPP_BUILDING_LIBRARY) || \
|
||||
defined(_LIBCXXABI_BUILDING_LIBRARY) || \
|
||||
!__has_feature(attribute_availability_with_strict) || \
|
||||
!__has_feature(attribute_availability_in_templates) || \
|
||||
!__has_extension(pragma_clang_attribute_external_declaration)
|
||||
# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
|
||||
// This controls the availability of std::shared_mutex and std::shared_timed_mutex,
|
||||
// which were added to the dylib later.
|
||||
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
|
||||
|
||||
// These macros control the availability of std::bad_optional_access and
|
||||
// other exception types. These were put in the shared library to prevent
|
||||
// code bloat from every user program defining the vtable for these exception
|
||||
// types.
|
||||
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
|
||||
// This controls the availability of std::uncaught_exceptions().
|
||||
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
|
||||
|
||||
// This controls the availability of the sized version of ::operator delete,
|
||||
// which was added to the dylib later.
|
||||
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
|
||||
|
||||
// This controls the availability of the std::future_error exception.
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
|
||||
// This controls the availability of std::type_info's vtable.
|
||||
// I can't imagine how using std::type_info can work at all if
|
||||
// this isn't supported.
|
||||
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
|
||||
|
||||
// This controls the availability of std::locale::category members
|
||||
// (e.g. std::locale::collate), which are defined in the dylib.
|
||||
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
|
||||
|
||||
// This controls the availability of atomic operations on std::shared_ptr
|
||||
// (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared
|
||||
// lock table located in the dylib.
|
||||
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
|
||||
|
||||
// These macros control the availability of all parts of <filesystem> that
|
||||
// depend on something in the dylib.
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
// This controls the availability of std::to_chars.
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS
|
||||
|
||||
// This controls the availability of the C++20 synchronization library,
|
||||
// which requires shared library support for various operations
|
||||
// (see libcxx/src/atomic.cpp).
|
||||
# define _LIBCPP_AVAILABILITY_SYNC
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \
|
||||
__attribute__((availability(macosx,strict,introduced=10.13))) \
|
||||
__attribute__((availability(ios,strict,introduced=11.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=11.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=4.0)))
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
|
||||
__attribute__((availability(ios,strict,introduced=6.0)))
|
||||
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM \
|
||||
__attribute__((availability(macosx,strict,introduced=10.15))) \
|
||||
__attribute__((availability(ios,strict,introduced=13.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=13.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=6.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
|
||||
_Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop")
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS \
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_SYNC \
|
||||
__attribute__((unavailable))
|
||||
|
||||
#else
|
||||
|
||||
// ...New vendors can add availability markup here...
|
||||
|
||||
# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
|
||||
|
||||
#endif
|
||||
|
||||
// Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS.
|
||||
// Those are defined in terms of the availability attributes above, and
|
||||
// should not be vendor-specific.
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
|
||||
#else
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP___AVAILABILITY
|
||||
@@ -11,7 +11,7 @@
|
||||
#define _LIBCPP___BIT_REFERENCE
|
||||
|
||||
#include <__config>
|
||||
#include <bit>
|
||||
#include <__bits>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@@ -239,8 +239,8 @@ __bit_iterator<_Cp, _IsConst>
|
||||
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
||||
{
|
||||
if (static_cast<bool>(__value_))
|
||||
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return _VSTD::__find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return _VSTD::__find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
}
|
||||
|
||||
// count
|
||||
@@ -313,8 +313,8 @@ typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
||||
{
|
||||
if (static_cast<bool>(__value_))
|
||||
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return _VSTD::__count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return _VSTD::__count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
}
|
||||
|
||||
// fill_n
|
||||
@@ -387,9 +387,9 @@ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __v
|
||||
if (__n > 0)
|
||||
{
|
||||
if (__value_)
|
||||
__fill_n_true(__first, __n);
|
||||
_VSTD::__fill_n_true(__first, __n);
|
||||
else
|
||||
__fill_n_false(__first, __n);
|
||||
_VSTD::__fill_n_false(__first, __n);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,8 +538,8 @@ __bit_iterator<_Cp, false>
|
||||
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
if (__first.__ctz_ == __result.__ctz_)
|
||||
return __copy_aligned(__first, __last, __result);
|
||||
return __copy_unaligned(__first, __last, __result);
|
||||
return _VSTD::__copy_aligned(__first, __last, __result);
|
||||
return _VSTD::__copy_unaligned(__first, __last, __result);
|
||||
}
|
||||
|
||||
// copy_backward
|
||||
@@ -685,8 +685,8 @@ __bit_iterator<_Cp, false>
|
||||
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
if (__last.__ctz_ == __result.__ctz_)
|
||||
return __copy_backward_aligned(__first, __last, __result);
|
||||
return __copy_backward_unaligned(__first, __last, __result);
|
||||
return _VSTD::__copy_backward_aligned(__first, __last, __result);
|
||||
return _VSTD::__copy_backward_unaligned(__first, __last, __result);
|
||||
}
|
||||
|
||||
// move
|
||||
@@ -868,8 +868,8 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
|
||||
__bit_iterator<__C2, false> __first2)
|
||||
{
|
||||
if (__first1.__ctz_ == __first2.__ctz_)
|
||||
return __swap_ranges_aligned(__first1, __last1, __first2);
|
||||
return __swap_ranges_unaligned(__first1, __last1, __first2);
|
||||
return _VSTD::__swap_ranges_aligned(__first1, __last1, __first2);
|
||||
return _VSTD::__swap_ranges_unaligned(__first1, __last1, __first2);
|
||||
}
|
||||
|
||||
// rotate
|
||||
@@ -1083,8 +1083,8 @@ bool
|
||||
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
|
||||
{
|
||||
if (__first1.__ctz_ == __first2.__ctz_)
|
||||
return __equal_aligned(__first1, __last1, __first2);
|
||||
return __equal_unaligned(__first1, __last1, __first2);
|
||||
return _VSTD::__equal_aligned(__first1, __last1, __first2);
|
||||
return _VSTD::__equal_unaligned(__first1, __last1, __first2);
|
||||
}
|
||||
|
||||
template <class _Cp, bool _IsConst,
|
||||
|
||||
146
lib/libcxx/include/__bits
Normal file
146
lib/libcxx/include/__bits
Normal file
@@ -0,0 +1,146 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___BITS
|
||||
#define _LIBCPP___BITS
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
|
||||
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
|
||||
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
|
||||
|
||||
#else // _LIBCPP_COMPILER_MSVC
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_ctz(unsigned __x) {
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
unsigned long __where;
|
||||
if (_BitScanForward(&__where, __x))
|
||||
return static_cast<int>(__where);
|
||||
return 32;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_ctz(unsigned long __x) {
|
||||
static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
|
||||
return __ctz(static_cast<unsigned>(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_ctz(unsigned long long __x) {
|
||||
unsigned long __where;
|
||||
#if defined(_LIBCPP_HAS_BITSCAN64)
|
||||
(defined(_M_AMD64) || defined(__x86_64__))
|
||||
if (_BitScanForward64(&__where, __x))
|
||||
return static_cast<int>(__where);
|
||||
#else
|
||||
// Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
|
||||
if (_BitScanForward(&__where, static_cast<unsigned long>(__x)))
|
||||
return static_cast<int>(__where);
|
||||
if (_BitScanForward(&__where, static_cast<unsigned long>(__x >> 32)))
|
||||
return static_cast<int>(__where + 32);
|
||||
#endif
|
||||
return 64;
|
||||
}
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_clz(unsigned __x) {
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
unsigned long __where;
|
||||
if (_BitScanReverse(&__where, __x))
|
||||
return static_cast<int>(31 - __where);
|
||||
return 32; // Undefined Behavior.
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_clz(unsigned long __x) {
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
return __libcpp_clz(static_cast<unsigned>(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_clz(unsigned long long __x) {
|
||||
unsigned long __where;
|
||||
#if defined(_LIBCPP_HAS_BITSCAN64)
|
||||
if (_BitScanReverse64(&__where, __x))
|
||||
return static_cast<int>(63 - __where);
|
||||
#else
|
||||
// Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls.
|
||||
if (_BitScanReverse(&__where, static_cast<unsigned long>(__x >> 32)))
|
||||
return static_cast<int>(63 - (__where + 32));
|
||||
if (_BitScanReverse(&__where, static_cast<unsigned long>(__x)))
|
||||
return static_cast<int>(63 - __where);
|
||||
#endif
|
||||
return 64; // Undefined Behavior.
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) {
|
||||
static_assert(sizeof(unsigned) == 4, "");
|
||||
return __popcnt(__x);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) {
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
return __popcnt(__x);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) {
|
||||
static_assert(sizeof(unsigned long long) == 8, "");
|
||||
return __popcnt64(__x);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_COMPILER_MSVC
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP__BITS
|
||||
@@ -32,13 +32,13 @@
|
||||
# define _GNUC_VER_NEW 0
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 11000
|
||||
#define _LIBCPP_VERSION 12000
|
||||
|
||||
#ifndef _LIBCPP_ABI_VERSION
|
||||
# define _LIBCPP_ABI_VERSION 1
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_HOSTED__
|
||||
#if __STDC_HOSTED__ == 0
|
||||
# define _LIBCPP_FREESTANDING
|
||||
#endif
|
||||
|
||||
@@ -49,8 +49,10 @@
|
||||
# define _LIBCPP_STD_VER 14
|
||||
# elif __cplusplus <= 201703L
|
||||
# define _LIBCPP_STD_VER 17
|
||||
# elif __cplusplus <= 202002L
|
||||
# define _LIBCPP_STD_VER 20
|
||||
# else
|
||||
# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
|
||||
# define _LIBCPP_STD_VER 21 // current year, or date of c++2b ratification
|
||||
# endif
|
||||
#endif // _LIBCPP_STD_VER
|
||||
|
||||
@@ -63,7 +65,7 @@
|
||||
#elif defined(__wasm__)
|
||||
# define _LIBCPP_OBJECT_FORMAT_WASM 1
|
||||
#else
|
||||
# error Unknown object file format
|
||||
// ... add new file formats here ...
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
@@ -105,6 +107,10 @@
|
||||
// Re-worked external template instantiations for std::string with a focus on
|
||||
// performance and fast-path inlining.
|
||||
# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
|
||||
// Enable clang::trivial_abi on std::unique_ptr.
|
||||
# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
|
||||
// Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
|
||||
# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
|
||||
#elif _LIBCPP_ABI_VERSION == 1
|
||||
# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
// Enable compiling copies of now inline methods into the dylib to support
|
||||
@@ -121,9 +127,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
|
||||
use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
|
||||
#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
// Enable additional explicit instantiations of iostreams components. This
|
||||
// reduces the number of weak definitions generated in programs that use
|
||||
// iostreams by providing a single strong definition in the shared library.
|
||||
# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||
@@ -256,14 +264,14 @@
|
||||
# endif // __LONG_LONG_SUPPORTED
|
||||
#endif // __FreeBSD__
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_BIG_ENDIAN
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#endif // __NetBSD__
|
||||
#endif // defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define _LIBCPP_WIN32API
|
||||
@@ -304,7 +312,7 @@
|
||||
# endif
|
||||
#endif // __sun__
|
||||
|
||||
#if defined(__CloudABI__)
|
||||
#if defined(__OpenBSD__) || defined(__CloudABI__)
|
||||
// Certain architectures provide arc4random(). Prefer using
|
||||
// arc4random() over /dev/{u,}random to make it possible to obtain
|
||||
// random data even when using sandboxing mechanisms such as chroots,
|
||||
@@ -344,13 +352,11 @@
|
||||
# if defined(__FreeBSD__)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# if __FreeBSD_version >= 1300064 || \
|
||||
(__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000)
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# endif
|
||||
# elif defined(__BIONIC__)
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# if __ANDROID_API__ >= 21
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# endif
|
||||
@@ -364,7 +370,9 @@
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# elif defined(__OpenBSD__)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# elif defined(__linux__)
|
||||
# if !defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
|
||||
@@ -372,16 +380,24 @@
|
||||
# endif
|
||||
# if _LIBCPP_GLIBC_PREREQ(2, 17)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# endif
|
||||
# else // defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# endif
|
||||
# endif // __linux__
|
||||
# elif defined(__APPLE__)
|
||||
// timespec_get and aligned_alloc were introduced in macOS 10.15 and
|
||||
// aligned releases
|
||||
# if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 || \
|
||||
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
|
||||
__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
|
||||
__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# endif
|
||||
# endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@@ -389,9 +405,7 @@
|
||||
#elif defined(_LIBCPP_COMPILER_CLANG)
|
||||
# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
|
||||
#else
|
||||
// This definition is potentially buggy, but it's only taken with GCC in C++03,
|
||||
// which we barely support anyway. See llvm.org/PR39713
|
||||
# define _LIBCPP_ALIGNOF(_Tp) __alignof(_Tp)
|
||||
# error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang"
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
|
||||
@@ -433,10 +447,6 @@ typedef __char32_t char32_t;
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
|
||||
# define nullptr __nullptr
|
||||
@@ -445,18 +455,6 @@ typedef __char32_t char32_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
@@ -720,7 +718,7 @@ typedef __char32_t char32_t;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
@@ -754,16 +752,6 @@ typedef __char32_t char32_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
|
||||
# ifdef _LIBCPP_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos.
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
|
||||
# else
|
||||
// TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398
|
||||
// And we should consider defaulting to OFF.
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HIDE_FROM_ABI
|
||||
# if _LIBCPP_HIDE_FROM_ABI_PER_TU
|
||||
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
|
||||
@@ -838,6 +826,12 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
#ifndef __cpp_consteval
|
||||
# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR
|
||||
#else
|
||||
# define _LIBCPP_CONSTEVAL consteval
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
# define _LIBCPP_DEFAULT {}
|
||||
#else
|
||||
@@ -863,10 +857,6 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_EXPLICIT
|
||||
#endif
|
||||
|
||||
#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
|
||||
#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
@@ -880,34 +870,43 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# if _LIBCPP_DEBUG == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
# elif _LIBCPP_DEBUG == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
# endif
|
||||
# if !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
# endif
|
||||
// _LIBCPP_DEBUG potential values:
|
||||
// - undefined: No assertions. This is the default.
|
||||
// - 0: Basic assertions
|
||||
// - 1: Basic assertions + iterator validity checks.
|
||||
#if !defined(_LIBCPP_DEBUG)
|
||||
# define _LIBCPP_DEBUG_LEVEL 0
|
||||
#elif _LIBCPP_DEBUG == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
#elif _LIBCPP_DEBUG == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
#else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_DEBUG_LEVEL
|
||||
# define _LIBCPP_DEBUG_LEVEL 0
|
||||
// _LIBCPP_DEBUG_LEVEL is always defined to one of [0, 1, 2] at this point
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
|
||||
// When the Debug mode is enabled, we disable extern declarations because we
|
||||
// don't want to use the functions compiled in the library, which might not
|
||||
// have had the debug mode enabled when built. However, some extern declarations
|
||||
// need to be used, because code correctness depends on it (several instances
|
||||
// in the <locale>). Those special declarations are declared with
|
||||
// _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled even
|
||||
// when the debug mode is enabled.
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_DEFINE
|
||||
@@ -938,6 +937,8 @@ typedef unsigned int char32_t;
|
||||
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
|
||||
// have it unless the language feature test macro is defined.
|
||||
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
|
||||
#elif defined(__MVS__)
|
||||
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
@@ -999,6 +1000,18 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_DEPRECATED_IN_CXX17
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED
|
||||
#else
|
||||
# define _LIBCPP_DEPRECATED_IN_CXX20
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_NO_HAS_CHAR8_T)
|
||||
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
|
||||
#else
|
||||
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
#endif
|
||||
|
||||
// Macros to enter and leave a state where deprecation warnings are suppressed.
|
||||
#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
|
||||
(defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
|
||||
@@ -1037,14 +1050,6 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && \
|
||||
!defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \
|
||||
!defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
|
||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr
|
||||
#else
|
||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
#endif
|
||||
|
||||
// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
|
||||
// NODISCARD macros to the correct attribute.
|
||||
#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
|
||||
@@ -1079,12 +1084,6 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_INLINE_VAR
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
|
||||
#else
|
||||
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
|
||||
#define _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
@@ -1100,7 +1099,7 @@ typedef unsigned int char32_t;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_ASAN
|
||||
_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
|
||||
const void *, const void *, const void *, const void *);
|
||||
#endif
|
||||
|
||||
@@ -1125,11 +1124,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
# if defined(__FreeBSD__) || \
|
||||
defined(__wasi__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NuttX__) || \
|
||||
defined(__linux__) || \
|
||||
defined(__GNU__) || \
|
||||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
defined(__sun__) || \
|
||||
defined(__MVS__) || \
|
||||
(defined(__MINGW32__) && __has_include(<pthread.h>))
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(__Fuchsia__)
|
||||
@@ -1167,10 +1169,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
_LIBCPP_HAS_NO_THREADS is defined.
|
||||
#endif
|
||||
|
||||
#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
|
||||
#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
|
||||
#define __STDCPP_THREADS__ 1
|
||||
#endif
|
||||
@@ -1222,13 +1220,15 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
// Some systems do not provide gets() in their C library, for security reasons.
|
||||
#ifndef _LIBCPP_C_HAS_NO_GETS
|
||||
# if defined(_LIBCPP_MSVCRT) || \
|
||||
(defined(__FreeBSD_version) && __FreeBSD_version >= 1300043)
|
||||
(defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || \
|
||||
defined(__OpenBSD__)
|
||||
# define _LIBCPP_C_HAS_NO_GETS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || \
|
||||
defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \
|
||||
defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \
|
||||
defined(__MVS__) || defined(__OpenBSD__)
|
||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||
#endif
|
||||
|
||||
@@ -1337,6 +1337,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#endif
|
||||
#endif // !defined(_LIBCPP_NODEBUG_TYPE)
|
||||
|
||||
#if __has_attribute(__preferred_name__)
|
||||
#define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
|
||||
#else
|
||||
#define _LIBCPP_PREFERRED_NAME(x)
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT) && \
|
||||
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
|
||||
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
|
||||
@@ -1367,120 +1373,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
#endif
|
||||
|
||||
// Decide whether to use availability macros.
|
||||
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
|
||||
!defined(_LIBCXXABI_BUILDING_LIBRARY) && \
|
||||
!defined(_LIBCPP_DISABLE_AVAILABILITY) && \
|
||||
__has_feature(attribute_availability_with_strict) && \
|
||||
__has_feature(attribute_availability_in_templates) && \
|
||||
__has_extension(pragma_clang_attribute_external_declaration)
|
||||
# ifdef __APPLE__
|
||||
# define _LIBCPP_USE_AVAILABILITY_APPLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Define availability macros.
|
||||
#if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
|
||||
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \
|
||||
__attribute__((availability(macosx,strict,introduced=10.13))) \
|
||||
__attribute__((availability(ios,strict,introduced=11.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=11.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=4.0)))
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
|
||||
__attribute__((availability(ios,strict,introduced=6.0)))
|
||||
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM \
|
||||
__attribute__((availability(macosx,strict,introduced=10.15))) \
|
||||
__attribute__((availability(ios,strict,introduced=13.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=13.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=6.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
|
||||
_Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop")
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS \
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_SYNC \
|
||||
__attribute__((unavailable))
|
||||
#else
|
||||
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
|
||||
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
|
||||
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
|
||||
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS
|
||||
# define _LIBCPP_AVAILABILITY_SYNC
|
||||
#endif
|
||||
|
||||
// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
|
||||
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
|
||||
#else
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
#endif
|
||||
|
||||
// The stream API was dropped and re-added in the dylib shipped on macOS
|
||||
// and iOS. We can only assume the dylib to provide these definitions for
|
||||
// macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available
|
||||
// from the headers, but not from the dylib. Explicit instantiation
|
||||
// declarations for streams exist conditionally to this; if we provide
|
||||
// an explicit instantiation declaration and we try to deploy to a dylib
|
||||
// that does not provide those symbols, we'll get a load-time error.
|
||||
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
|
||||
((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
||||
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \
|
||||
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
|
||||
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
|
||||
# define _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_IBM)
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
|
||||
#endif
|
||||
@@ -1547,6 +1439,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
|
||||
#endif
|
||||
|
||||
#if __has_attribute(init_priority)
|
||||
# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
|
||||
#else
|
||||
# define _LIBCPP_INIT_PRIORITY_MAX
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
||||
@@ -26,12 +26,14 @@
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
|
||||
#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||
#cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
#cmakedefine _LIBCPP_NO_VCRUNTIME
|
||||
#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
|
||||
#cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@
|
||||
#endif
|
||||
#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
|
||||
#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
|
||||
#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS
|
||||
#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
|
||||
#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
|
||||
|
||||
@_LIBCPP_ABI_DEFINES@
|
||||
|
||||
|
||||
@@ -27,26 +27,21 @@
|
||||
# include <cstddef>
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : \
|
||||
_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#ifndef _LIBCPP_DEBUG_ASSERT
|
||||
#define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m)
|
||||
#endif
|
||||
#define _LIBCPP_DEBUG_MODE(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#ifndef _LIBCPP_DEBUG_ASSERT
|
||||
#if _LIBCPP_DEBUG_LEVEL == 0
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
|
||||
# define _LIBCPP_ASSERT_IMPL(x, m) ((void)0)
|
||||
#elif _LIBCPP_DEBUG_LEVEL == 1
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
|
||||
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
|
||||
#elif _LIBCPP_DEBUG_LEVEL == 2
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m)
|
||||
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
|
||||
#else
|
||||
# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2
|
||||
#endif
|
||||
#ifndef _LIBCPP_DEBUG_MODE
|
||||
#define _LIBCPP_DEBUG_MODE(...) ((void)0)
|
||||
|
||||
#if !defined(_LIBCPP_ASSERT)
|
||||
# define _LIBCPP_ASSERT(x, m) _LIBCPP_ASSERT_IMPL(x, m)
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@@ -59,7 +54,7 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
|
||||
__libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)
|
||||
: __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}
|
||||
|
||||
_LIBCPP_FUNC_VIS std::string what() const;
|
||||
_LIBCPP_FUNC_VIS string what() const;
|
||||
|
||||
const char* __file_;
|
||||
int __line_;
|
||||
@@ -83,7 +78,7 @@ void __libcpp_abort_debug_function(__libcpp_debug_info const&);
|
||||
_LIBCPP_FUNC_VIS
|
||||
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __c_node;
|
||||
|
||||
@@ -226,7 +221,7 @@ public:
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) {
|
||||
return ::new(__mem) _C_node<_Cont>(__c, __next);
|
||||
return ::new (__mem) _C_node<_Cont>(__c, __next);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
@@ -271,7 +266,7 @@ _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
|
||||
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ __func<_Fp, _Alloc, _Rp()>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ template<class _Fp, class _Alloc, class _Rp>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp>
|
||||
@@ -212,7 +212,7 @@ __func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
@@ -298,7 +298,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
@@ -384,7 +384,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
@@ -554,7 +554,7 @@ function<_Rp()>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -562,7 +562,7 @@ function<_Rp()>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -581,7 +581,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -589,7 +589,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -834,7 +834,7 @@ function<_Rp(_A0)>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -842,7 +842,7 @@ function<_Rp(_A0)>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -861,7 +861,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -869,7 +869,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1122,7 +1122,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1141,7 +1141,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1149,7 +1149,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1394,7 +1394,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1402,7 +1402,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1421,7 +1421,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1429,7 +1429,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
#else // defined(_LIBCPP_CXX03_LANG)
|
||||
@@ -308,64 +308,64 @@ struct __invoke_return
|
||||
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
|
||||
template <class _Ret>
|
||||
template <class _Ret, bool = is_void<_Ret>::value>
|
||||
struct __invoke_void_return_wrapper
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
static _Ret __call(_Args&&... __args) {
|
||||
return __invoke(_VSTD::forward<_Args>(__args)...);
|
||||
return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
#else
|
||||
template <class _Fn>
|
||||
static _Ret __call(_Fn __f) {
|
||||
return __invoke(__f);
|
||||
return _VSTD::__invoke(__f);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0>
|
||||
static _Ret __call(_Fn __f, _A0& __a0) {
|
||||
return __invoke(__f, __a0);
|
||||
return _VSTD::__invoke(__f, __a0);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1>
|
||||
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
||||
return __invoke(__f, __a0, __a1);
|
||||
return _VSTD::__invoke(__f, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1, class _A2>
|
||||
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
|
||||
return __invoke(__f, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f, __a0, __a1, __a2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __invoke_void_return_wrapper<void>
|
||||
template <class _Ret>
|
||||
struct __invoke_void_return_wrapper<_Ret, true>
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
static void __call(_Args&&... __args) {
|
||||
__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
_VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
#else
|
||||
template <class _Fn>
|
||||
static void __call(_Fn __f) {
|
||||
__invoke(__f);
|
||||
_VSTD::__invoke(__f);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0>
|
||||
static void __call(_Fn __f, _A0& __a0) {
|
||||
__invoke(__f, __a0);
|
||||
_VSTD::__invoke(__f, __a0);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1>
|
||||
static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
||||
__invoke(__f, __a0, __a1);
|
||||
_VSTD::__invoke(__f, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1, class _A2>
|
||||
static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
|
||||
__invoke(__f, __a0, __a1, __a2);
|
||||
_VSTD::__invoke(__f, __a0, __a1, __a2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@@ -382,135 +382,138 @@ private:
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
reference_wrapper(type& __f) _NOEXCEPT
|
||||
: __f_(_VSTD::addressof(__f)) {}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
operator type&() const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const {
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
#else
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return<type>::type
|
||||
operator() () const {
|
||||
return __invoke(get());
|
||||
return _VSTD::__invoke(get());
|
||||
}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type, _A0>::type
|
||||
operator() (_A0& __a0) const {
|
||||
return __invoke(get(), __a0);
|
||||
return _VSTD::__invoke(get(), __a0);
|
||||
}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type, _A0 const>::type
|
||||
operator() (_A0 const& __a0) const {
|
||||
return __invoke(get(), __a0);
|
||||
return _VSTD::__invoke(get(), __a0);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0, _A1>::type
|
||||
operator() (_A0& __a0, _A1& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0 const, _A1>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0, _A1 const>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0 const, _A1 const>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1, _A2>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
};
|
||||
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
@@ -518,7 +521,7 @@ ref(_Tp& __t) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
@@ -526,7 +529,7 @@ ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
@@ -534,7 +537,7 @@ cref(const _Tp& __t) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ struct __enable_invoke_imp<_Ret, _T1, false, true> {
|
||||
template <class _Ret, class _T1>
|
||||
struct __enable_invoke_imp<_Ret, _T1, false, false> {
|
||||
typedef typename add_lvalue_reference<
|
||||
typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Ret>::type
|
||||
typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type
|
||||
>::type _Bullet4;
|
||||
typedef _Bullet4 type;
|
||||
};
|
||||
@@ -142,7 +142,7 @@ __invoke(_Fn __f, _T1& __t1) {
|
||||
|
||||
template <class _Fp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()())
|
||||
decltype(declval<_Fp&>()())
|
||||
__invoke(_Fp& __f)
|
||||
{
|
||||
return __f();
|
||||
@@ -150,7 +150,7 @@ __invoke(_Fp& __f)
|
||||
|
||||
template <class _Fp, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
|
||||
decltype(declval<_Fp&>()(declval<_A0&>()))
|
||||
__invoke(_Fp& __f, _A0& __a0)
|
||||
{
|
||||
return __f(__a0);
|
||||
@@ -158,7 +158,7 @@ __invoke(_Fp& __f, _A0& __a0)
|
||||
|
||||
template <class _Fp, class _A0, class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
|
||||
decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>()))
|
||||
__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
|
||||
{
|
||||
return __f(__a0, __a1);
|
||||
@@ -166,7 +166,7 @@ __invoke(_Fp& __f, _A0& __a0, _A1& __a1)
|
||||
|
||||
template <class _Fp, class _A0, class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
|
||||
decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
|
||||
__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
|
||||
{
|
||||
return __f(__a0, __a1, __a2);
|
||||
@@ -181,13 +181,13 @@ struct __invoke_return
|
||||
template <class _Fp>
|
||||
struct __invoke_return<_Fp, false>
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _A0>
|
||||
struct __invoke_return0
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Tp, class _A0>
|
||||
@@ -199,8 +199,8 @@ struct __invoke_return0<_Rp _Tp::*, _A0>
|
||||
template <class _Tp, class _A0, class _A1>
|
||||
struct __invoke_return1
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
|
||||
_VSTD::declval<_A1&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(),
|
||||
declval<_A1&>())) type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Class, class _A0, class _A1>
|
||||
@@ -211,9 +211,9 @@ struct __invoke_return1<_Rp _Class::*, _A0, _A1> {
|
||||
template <class _Tp, class _A0, class _A1, class _A2>
|
||||
struct __invoke_return2
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
|
||||
_VSTD::declval<_A1&>(),
|
||||
_VSTD::declval<_A2&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(),
|
||||
declval<_A1&>(),
|
||||
declval<_A2&>())) type;
|
||||
};
|
||||
|
||||
template <class _Ret, class _Class, class _A0, class _A1, class _A2>
|
||||
|
||||
@@ -34,19 +34,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
template <class _Key, class _Tp>
|
||||
struct __hash_value_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct __is_hash_value_type_imp : false_type {};
|
||||
|
||||
template <class _Key, class _Value>
|
||||
struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value>> : true_type {};
|
||||
struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value> > : true_type {};
|
||||
|
||||
template <class ..._Args>
|
||||
struct __is_hash_value_type : false_type {};
|
||||
|
||||
template <class _One>
|
||||
struct __is_hash_value_type<_One> : __is_hash_value_type_imp<typename __uncvref<_One>::type> {};
|
||||
#endif
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
size_t __next_prime(size_t __n);
|
||||
@@ -122,7 +120,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__next_hash_pow2(size_t __n)
|
||||
{
|
||||
return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
|
||||
return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
|
||||
}
|
||||
|
||||
|
||||
@@ -155,12 +153,10 @@ struct __hash_key_value_types {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n);
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type&& __move(__node_value_type& __v) {
|
||||
return _VSTD::move(__v);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
@@ -197,13 +193,10 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n.__get_value());
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
|
||||
return __v.__move();
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>,
|
||||
@@ -295,10 +288,12 @@ public:
|
||||
typedef typename _NodeTypes::__node_value_type_pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator(const __hash_iterator& __i)
|
||||
: __node_(__i.__node_)
|
||||
@@ -322,7 +317,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@@ -364,7 +359,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
@@ -405,17 +400,21 @@ public:
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
|
||||
: __node_(__x.__node_)
|
||||
{
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__iterator_copy(this, &__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __hash_const_iterator& __i)
|
||||
: __node_(__i.__node_)
|
||||
@@ -439,7 +438,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@@ -480,7 +479,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
@@ -518,10 +517,12 @@ public:
|
||||
typedef typename _NodeTypes::__node_value_type_pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator(const __hash_local_iterator& __i)
|
||||
: __node_(__i.__node_),
|
||||
@@ -549,7 +550,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@@ -593,7 +594,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator(__next_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count, const void* __c) _NOEXCEPT
|
||||
@@ -650,7 +651,9 @@ public:
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -659,10 +662,12 @@ public:
|
||||
__bucket_(__x.__bucket_),
|
||||
__bucket_count_(__x.__bucket_count_)
|
||||
{
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__iterator_copy(this, &__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(const __hash_const_local_iterator& __i)
|
||||
: __node_(__i.__node_),
|
||||
@@ -690,7 +695,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@@ -734,7 +739,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(__next_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count, const void* __c) _NOEXCEPT
|
||||
@@ -783,7 +788,6 @@ public:
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
: __data_(__size, __a) {}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
@@ -791,7 +795,6 @@ public:
|
||||
{
|
||||
__x.size() = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __data_.first();}
|
||||
@@ -1007,7 +1010,6 @@ public:
|
||||
explicit __hash_table(const allocator_type& __a);
|
||||
__hash_table(const __hash_table& __u);
|
||||
__hash_table(const __hash_table& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__hash_table(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__bucket_list>::value &&
|
||||
@@ -1016,11 +1018,9 @@ public:
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value);
|
||||
__hash_table(__hash_table&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
~__hash_table();
|
||||
|
||||
__hash_table& operator=(const __hash_table& __u);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_table& operator=(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
@@ -1028,7 +1028,6 @@ public:
|
||||
is_nothrow_move_assignable<__node_allocator>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
#endif
|
||||
template <class _InputIterator>
|
||||
void __assign_unique(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
@@ -1037,7 +1036,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{
|
||||
return std::min<size_type>(
|
||||
return _VSTD::min<size_type>(
|
||||
__node_traits::max_size(__node_alloc()),
|
||||
numeric_limits<difference_type >::max()
|
||||
);
|
||||
@@ -1066,7 +1065,6 @@ public:
|
||||
iterator __node_insert_multi(const_iterator __p,
|
||||
__node_pointer __nd);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
|
||||
@@ -1151,15 +1149,6 @@ public:
|
||||
return __emplace_hint_multi(__p, _VSTD::forward<_Pp>(__x));
|
||||
}
|
||||
|
||||
#else // !defined(_LIBCPP_CXX03_LANG)
|
||||
template <class _Key, class _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args& __args);
|
||||
|
||||
iterator __insert_multi(const __container_value_type& __x);
|
||||
iterator __insert_multi(const_iterator __p, const __container_value_type& __x);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
|
||||
return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
|
||||
@@ -1295,7 +1284,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::begin(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
|
||||
#else
|
||||
return local_iterator(__bucket_list_[__n], __n, bucket_count());
|
||||
@@ -1308,7 +1297,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::end(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return local_iterator(nullptr, __n, bucket_count(), this);
|
||||
#else
|
||||
return local_iterator(nullptr, __n, bucket_count());
|
||||
@@ -1321,7 +1310,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::cbegin(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
|
||||
#else
|
||||
return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
|
||||
@@ -1334,35 +1323,30 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::cend(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_local_iterator(nullptr, __n, bucket_count(), this);
|
||||
#else
|
||||
return const_local_iterator(nullptr, __n, bucket_count());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
private:
|
||||
void __rehash(size_type __n);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
__node_holder __construct_node(_Args&& ...__args);
|
||||
|
||||
template <class _First, class ..._Rest>
|
||||
__node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
__node_holder __construct_node(const __container_value_type& __v);
|
||||
__node_holder __construct_node_hash(size_t __hash, const __container_value_type& __v);
|
||||
#endif
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1373,7 +1357,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __hash_table&, false_type) {}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void __move_assign(__hash_table& __u, false_type);
|
||||
void __move_assign(__hash_table& __u, true_type)
|
||||
_NOEXCEPT_(
|
||||
@@ -1400,7 +1383,6 @@ private:
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void __deallocate_node(__next_pointer __np) _NOEXCEPT;
|
||||
__next_pointer __detach() _NOEXCEPT;
|
||||
@@ -1477,8 +1459,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
@@ -1526,8 +1506,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
{
|
||||
@@ -1539,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
#endif
|
||||
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__erase_c(this);
|
||||
#endif
|
||||
}
|
||||
@@ -1583,7 +1561,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
|
||||
while (__np != nullptr)
|
||||
{
|
||||
__next_pointer __next = __np->__next_;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
@@ -1593,7 +1571,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@@ -1618,8 +1596,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
|
||||
return __cache;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
@@ -1646,7 +1622,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
}
|
||||
@@ -1714,8 +1690,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
void
|
||||
@@ -1800,7 +1774,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__p1_.first().__next_, this);
|
||||
#else
|
||||
return iterator(__p1_.first().__next_);
|
||||
@@ -1812,7 +1786,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(nullptr, this);
|
||||
#else
|
||||
return iterator(nullptr);
|
||||
@@ -1824,7 +1798,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(__p1_.first().__next_, this);
|
||||
#else
|
||||
return const_iterator(__p1_.first().__next_);
|
||||
@@ -1836,7 +1810,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(nullptr, this);
|
||||
#else
|
||||
return const_iterator(nullptr);
|
||||
@@ -1945,7 +1919,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
__existing_node = __nd->__ptr();
|
||||
__inserted = true;
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return pair<iterator, bool>(iterator(__existing_node, this), __inserted);
|
||||
#else
|
||||
return pair<iterator, bool>(iterator(__existing_node), __inserted);
|
||||
@@ -1955,7 +1929,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
// Prepare the container for an insertion of the value __cp_val with the hash
|
||||
// __cp_hash. This does a lookup into the container to see if __cp_value is
|
||||
// already present, and performs a rehash if necessary. Returns a pointer to the
|
||||
// last occurance of __cp_val in the map.
|
||||
// last occurrence of __cp_val in the map.
|
||||
//
|
||||
// Note that this function does forward exceptions if key_eq() throws, and never
|
||||
// mutates __value or actually inserts into the map.
|
||||
@@ -2043,7 +2017,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
__next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_);
|
||||
__node_insert_multi_perform(__cp, __pn);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__cp->__ptr(), this);
|
||||
#else
|
||||
return iterator(__cp->__ptr());
|
||||
@@ -2055,7 +2029,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
const_iterator __p, __node_pointer __cp)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
@@ -2078,7 +2052,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
__cp->__next_ = __np;
|
||||
__pp->__next_ = static_cast<__next_pointer>(__cp);
|
||||
++size();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(static_cast<__next_pointer>(__cp), this);
|
||||
#else
|
||||
return iterator(static_cast<__next_pointer>(__cp));
|
||||
@@ -2089,17 +2063,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _Key, class ..._Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
|
||||
#else
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _Key, class _Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args& __args)
|
||||
#endif
|
||||
{
|
||||
|
||||
size_t __hash = hash_function()(__k);
|
||||
@@ -2123,11 +2090,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
|
||||
}
|
||||
}
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__node_holder __h = __construct_node_hash(__hash, _VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
__node_holder __h = __construct_node_hash(__hash, __args);
|
||||
#endif
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
|
||||
@@ -2159,15 +2122,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
|
||||
__inserted = true;
|
||||
}
|
||||
__done:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return pair<iterator, bool>(iterator(__nd, this), __inserted);
|
||||
#else
|
||||
return pair<iterator, bool>(iterator(__nd), __inserted);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class... _Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
@@ -2197,7 +2158,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
@@ -2208,36 +2169,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
return __r;
|
||||
}
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const __container_value_type& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(__x);
|
||||
iterator __r = __node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
|
||||
const __container_value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container::insert(const_iterator, lvalue) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
#endif
|
||||
__node_holder __h = __construct_node(__x);
|
||||
iterator __r = __node_insert_multi(__p, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _NodeHandle, class _InsertReturnType>
|
||||
@@ -2399,9 +2330,9 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif
|
||||
__pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
|
||||
__bucket_list_.reset(__nbc > 0 ?
|
||||
__pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
|
||||
@@ -2470,7 +2401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
|
||||
{
|
||||
if ((__nd->__hash() == __hash)
|
||||
&& key_eq()(__nd->__upcast()->__value_, __k))
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__nd, this);
|
||||
#else
|
||||
return iterator(__nd);
|
||||
@@ -2501,7 +2432,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
|
||||
{
|
||||
if ((__nd->__hash() == __hash)
|
||||
&& key_eq()(__nd->__upcast()->__value_, __k))
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(__nd, this);
|
||||
#else
|
||||
return const_iterator(__nd);
|
||||
@@ -2513,8 +2444,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
|
||||
return end();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class ..._Args>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
@@ -2550,43 +2479,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(
|
||||
return __h;
|
||||
}
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const __container_value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = hash_function()(__h->__value_);
|
||||
__h->__next_ = nullptr;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash,
|
||||
const __container_value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = __hash;
|
||||
__h->__next_ = nullptr;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
|
||||
{
|
||||
__next_pointer __np = __p.__node_;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container erase(iterator) called with an iterator not"
|
||||
" referring to this container");
|
||||
@@ -2606,7 +2504,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
|
||||
const_iterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
|
||||
"unodered container::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this unodered container");
|
||||
@@ -2620,7 +2518,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
|
||||
erase(__p);
|
||||
}
|
||||
__next_pointer __np = __last.__node_;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator (__np, this);
|
||||
#else
|
||||
return iterator (__np);
|
||||
@@ -2691,7 +2589,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
__pn->__next_ = __cn->__next_;
|
||||
__cn->__next_ = nullptr;
|
||||
--size();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
|
||||
{
|
||||
@@ -2701,7 +2599,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
{
|
||||
(*__dp)->__c_ = nullptr;
|
||||
if (--__c->end_ != __dp)
|
||||
memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@@ -2830,9 +2728,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
__u.__bucket_list_.reset(__npp);
|
||||
}
|
||||
_VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
|
||||
__swap_allocator(__bucket_list_.get_deleter().__alloc(),
|
||||
_VSTD::__swap_allocator(__bucket_list_.get_deleter().__alloc(),
|
||||
__u.__bucket_list_.get_deleter().__alloc());
|
||||
__swap_allocator(__node_alloc(), __u.__node_alloc());
|
||||
_VSTD::__swap_allocator(__node_alloc(), __u.__node_alloc());
|
||||
_VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
|
||||
__p2_.swap(__u.__p2_);
|
||||
__p3_.swap(__u.__p3_);
|
||||
@@ -2842,7 +2740,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
if (__u.size() > 0)
|
||||
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
|
||||
__u.__p1_.first().__ptr();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
}
|
||||
@@ -2876,7 +2774,7 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
bool
|
||||
@@ -2906,7 +2804,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
11000
|
||||
12000
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define _LIBCPP___LOCALE
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@@ -20,26 +21,30 @@
|
||||
#include <locale.h>
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
# include <cstring>
|
||||
# include <support/win32/locale_win32.h>
|
||||
#elif defined(_AIX)
|
||||
# include <support/ibm/xlocale.h>
|
||||
# include <__support/win32/locale_win32.h>
|
||||
#elif defined(__NuttX__)
|
||||
# include <__support/nuttx/xlocale.h>
|
||||
#elif defined(_AIX) || defined(__MVS__)
|
||||
# include <__support/ibm/xlocale.h>
|
||||
#elif defined(__ANDROID__)
|
||||
# include <support/android/locale_bionic.h>
|
||||
# include <__support/android/locale_bionic.h>
|
||||
#elif defined(__sun__)
|
||||
# include <xlocale.h>
|
||||
# include <support/solaris/xlocale.h>
|
||||
# include <__support/solaris/xlocale.h>
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
# include <support/newlib/xlocale.h>
|
||||
# include <__support/newlib/xlocale.h>
|
||||
#elif defined(__OpenBSD__)
|
||||
# include <__support/openbsd/xlocale.h>
|
||||
#elif (defined(__APPLE__) || defined(__FreeBSD__) \
|
||||
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
|
||||
# include <xlocale.h>
|
||||
#elif defined(__Fuchsia__)
|
||||
# include <support/fuchsia/xlocale.h>
|
||||
# include <__support/fuchsia/xlocale.h>
|
||||
#elif defined(__wasi__)
|
||||
// WASI libc uses musl's locales support.
|
||||
# include <support/musl/xlocale.h>
|
||||
# include <__support/musl/xlocale.h>
|
||||
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# include <support/musl/xlocale.h>
|
||||
# include <__support/musl/xlocale.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@@ -76,7 +81,7 @@ struct __libcpp_locale_guard {
|
||||
// locale name, otherwise it will be a semicolon-separated string listing
|
||||
// each category. In the second case, we know at least one category won't
|
||||
// be what we want, so we only have to check the first case.
|
||||
if (strcmp(__l.__get_locale(), __lc) != 0) {
|
||||
if (_VSTD::strcmp(__l.__get_locale(), __lc) != 0) {
|
||||
__locale_all = _strdup(__lc);
|
||||
if (__locale_all == nullptr)
|
||||
__throw_bad_alloc();
|
||||
@@ -105,7 +110,6 @@ struct __libcpp_locale_guard {
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class _LIBCPP_TYPE_VIS locale;
|
||||
|
||||
template <class _Facet>
|
||||
@@ -335,8 +339,8 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
||||
return static_cast<long>(__h);
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
|
||||
|
||||
// template <class CharT> class collate_byname;
|
||||
|
||||
@@ -396,7 +400,26 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
class _LIBCPP_TYPE_VIS ctype_base
|
||||
{
|
||||
public:
|
||||
#if defined(__GLIBC__)
|
||||
#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
|
||||
typedef unsigned long mask;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
static const mask upper = 1<<3;
|
||||
static const mask lower = 1<<4;
|
||||
static const mask alpha = 1<<5;
|
||||
static const mask digit = 1<<6;
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#if defined(__BIONIC__)
|
||||
// Historically this was a part of regex_traits rather than ctype_base. The
|
||||
// historical value of the constant is preserved for ABI compatibility.
|
||||
static const mask __regex_word = 0x8000;
|
||||
#else
|
||||
static const mask __regex_word = 1<<10;
|
||||
#endif // defined(__BIONIC__)
|
||||
#elif defined(__GLIBC__)
|
||||
typedef unsigned short mask;
|
||||
static const mask space = _ISspace;
|
||||
static const mask print = _ISprint;
|
||||
@@ -485,24 +508,7 @@ public:
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
|
||||
#else
|
||||
typedef unsigned long mask;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
static const mask upper = 1<<3;
|
||||
static const mask lower = 1<<4;
|
||||
static const mask alpha = 1<<5;
|
||||
static const mask digit = 1<<6;
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#if defined(__BIONIC__)
|
||||
// Historically this was a part of regex_traits rather than ctype_base. The
|
||||
// historical value of the constant is preserved for ABI compatibility.
|
||||
static const mask __regex_word = 0x8000;
|
||||
#else
|
||||
static const mask __regex_word = 1<<10;
|
||||
#endif // defined(__BIONIC__)
|
||||
# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
|
||||
#endif
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
@@ -623,7 +629,7 @@ class _LIBCPP_TYPE_VIS ctype<char>
|
||||
public:
|
||||
typedef char char_type;
|
||||
|
||||
explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
|
||||
explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is(mask __m, char_type __c) const
|
||||
@@ -1069,10 +1075,10 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
||||
// template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
|
||||
class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -1155,10 +1161,100 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char16_t, char8_t, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char8_t extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_unshift(__st, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
|
||||
{
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
~codecvt();
|
||||
|
||||
virtual result do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t> // deprecated in C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -1241,6 +1337,96 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char32_t, char8_t, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char8_t extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_unshift(__st, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
|
||||
{
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
~codecvt();
|
||||
|
||||
virtual result do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
||||
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
@@ -1258,15 +1444,21 @@ protected:
|
||||
~codecvt_byname();
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
|
||||
{
|
||||
}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>) // C++20
|
||||
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>) // C++20
|
||||
#endif
|
||||
|
||||
template <size_t _Np>
|
||||
struct __narrow_to_utf8
|
||||
@@ -1290,12 +1482,14 @@ struct __narrow_to_utf8<8>
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
|
||||
|
||||
@@ -1324,12 +1518,14 @@ struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
|
||||
|
||||
@@ -1380,12 +1576,14 @@ struct __widen_from_utf8<8>
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
|
||||
|
||||
@@ -1407,19 +1605,21 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
|
||||
if (__r == codecvt_base::error || __nn == __nb)
|
||||
__throw_runtime_error("locale not supported");
|
||||
for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
|
||||
*__s = (wchar_t)*__p;
|
||||
*__s = *__p;
|
||||
__nb = __nn;
|
||||
}
|
||||
return __s;
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
|
||||
|
||||
@@ -1441,7 +1641,7 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
|
||||
if (__r == codecvt_base::error || __nn == __nb)
|
||||
__throw_runtime_error("locale not supported");
|
||||
for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
|
||||
*__s = (wchar_t)*__p;
|
||||
*__s = *__p;
|
||||
__nb = __nn;
|
||||
}
|
||||
return __s;
|
||||
|
||||
401
lib/libcxx/include/__memory/allocator_traits.h
Normal file
401
lib/libcxx/include/__memory/allocator_traits.h
Normal file
@@ -0,0 +1,401 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
|
||||
#define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
|
||||
|
||||
#include <__config>
|
||||
#include <__memory/base.h>
|
||||
#include <__memory/pointer_traits.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
|
||||
template <class _Tp, class = void> struct NAME : false_type { }; \
|
||||
template <class _Tp> struct NAME<_Tp, typename __void_t<typename _Tp:: PROPERTY >::type> : true_type { }
|
||||
|
||||
// __pointer
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
|
||||
template <class _Tp, class _Alloc,
|
||||
class _RawAlloc = typename remove_reference<_Alloc>::type,
|
||||
bool = __has_pointer<_RawAlloc>::value>
|
||||
struct __pointer {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _RawAlloc::pointer;
|
||||
};
|
||||
template <class _Tp, class _Alloc, class _RawAlloc>
|
||||
struct __pointer<_Tp, _Alloc, _RawAlloc, false> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = _Tp*;
|
||||
};
|
||||
|
||||
// __const_pointer
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer);
|
||||
template <class _Tp, class _Ptr, class _Alloc,
|
||||
bool = __has_const_pointer<_Alloc>::value>
|
||||
struct __const_pointer {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::const_pointer;
|
||||
};
|
||||
template <class _Tp, class _Ptr, class _Alloc>
|
||||
struct __const_pointer<_Tp, _Ptr, _Alloc, false> {
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
using type = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
|
||||
#else
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
|
||||
#endif
|
||||
};
|
||||
|
||||
// __void_pointer
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_void_pointer, void_pointer);
|
||||
template <class _Ptr, class _Alloc,
|
||||
bool = __has_void_pointer<_Alloc>::value>
|
||||
struct __void_pointer {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::void_pointer;
|
||||
};
|
||||
template <class _Ptr, class _Alloc>
|
||||
struct __void_pointer<_Ptr, _Alloc, false> {
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename pointer_traits<_Ptr>::template rebind<void>::other;
|
||||
#else
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename pointer_traits<_Ptr>::template rebind<void>;
|
||||
#endif
|
||||
};
|
||||
|
||||
// __const_void_pointer
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_void_pointer, const_void_pointer);
|
||||
template <class _Ptr, class _Alloc,
|
||||
bool = __has_const_void_pointer<_Alloc>::value>
|
||||
struct __const_void_pointer {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::const_void_pointer;
|
||||
};
|
||||
template <class _Ptr, class _Alloc>
|
||||
struct __const_void_pointer<_Ptr, _Alloc, false> {
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename pointer_traits<_Ptr>::template rebind<const void>::other;
|
||||
#else
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename pointer_traits<_Ptr>::template rebind<const void>;
|
||||
#endif
|
||||
};
|
||||
|
||||
// __size_type
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_size_type, size_type);
|
||||
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
|
||||
struct __size_type : make_unsigned<_DiffType> { };
|
||||
template <class _Alloc, class _DiffType>
|
||||
struct __size_type<_Alloc, _DiffType, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::size_type;
|
||||
};
|
||||
|
||||
// __alloc_traits_difference_type
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type);
|
||||
template <class _Alloc, class _Ptr, bool = __has_alloc_traits_difference_type<_Alloc>::value>
|
||||
struct __alloc_traits_difference_type {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename pointer_traits<_Ptr>::difference_type;
|
||||
};
|
||||
template <class _Alloc, class _Ptr>
|
||||
struct __alloc_traits_difference_type<_Alloc, _Ptr, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::difference_type;
|
||||
};
|
||||
|
||||
// __propagate_on_container_copy_assignment
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_copy_assignment, propagate_on_container_copy_assignment);
|
||||
template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
|
||||
struct __propagate_on_container_copy_assignment : false_type { };
|
||||
template <class _Alloc>
|
||||
struct __propagate_on_container_copy_assignment<_Alloc, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::propagate_on_container_copy_assignment;
|
||||
};
|
||||
|
||||
// __propagate_on_container_move_assignment
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_move_assignment, propagate_on_container_move_assignment);
|
||||
template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
|
||||
struct __propagate_on_container_move_assignment : false_type { };
|
||||
template <class _Alloc>
|
||||
struct __propagate_on_container_move_assignment<_Alloc, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::propagate_on_container_move_assignment;
|
||||
};
|
||||
|
||||
// __propagate_on_container_swap
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_swap, propagate_on_container_swap);
|
||||
template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
|
||||
struct __propagate_on_container_swap : false_type { };
|
||||
template <class _Alloc>
|
||||
struct __propagate_on_container_swap<_Alloc, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::propagate_on_container_swap;
|
||||
};
|
||||
|
||||
// __is_always_equal
|
||||
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_is_always_equal, is_always_equal);
|
||||
template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
|
||||
struct __is_always_equal : is_empty<_Alloc> { };
|
||||
template <class _Alloc>
|
||||
struct __is_always_equal<_Alloc, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc::is_always_equal;
|
||||
};
|
||||
|
||||
// __allocator_traits_rebind
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Tp, class _Up, class = void>
|
||||
struct __has_rebind_other : false_type { };
|
||||
template <class _Tp, class _Up>
|
||||
struct __has_rebind_other<_Tp, _Up, typename __void_t<
|
||||
typename _Tp::template rebind<_Up>::other
|
||||
>::type> : true_type { };
|
||||
|
||||
template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
|
||||
struct __allocator_traits_rebind {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Tp::template rebind<_Up>::other;
|
||||
};
|
||||
template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
|
||||
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other;
|
||||
};
|
||||
template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
|
||||
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> {
|
||||
using type _LIBCPP_NODEBUG_TYPE = _Alloc<_Up, _Args...>;
|
||||
};
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template<class _Alloc, class _Tp>
|
||||
using __allocator_traits_rebind_t = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
|
||||
// __has_allocate_hint
|
||||
template <class _Alloc, class _SizeType, class _ConstVoidPtr, class = void>
|
||||
struct __has_allocate_hint : false_type { };
|
||||
|
||||
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
|
||||
struct __has_allocate_hint<_Alloc, _SizeType, _ConstVoidPtr, decltype(
|
||||
(void)declval<_Alloc>().allocate(declval<_SizeType>(), declval<_ConstVoidPtr>())
|
||||
)> : true_type { };
|
||||
|
||||
// __has_construct
|
||||
template <class, class _Alloc, class ..._Args>
|
||||
struct __has_construct_impl : false_type { };
|
||||
|
||||
template <class _Alloc, class ..._Args>
|
||||
struct __has_construct_impl<decltype(
|
||||
(void)declval<_Alloc>().construct(declval<_Args>()...)
|
||||
), _Alloc, _Args...> : true_type { };
|
||||
|
||||
template <class _Alloc, class ..._Args>
|
||||
struct __has_construct : __has_construct_impl<void, _Alloc, _Args...> { };
|
||||
|
||||
// __has_destroy
|
||||
template <class _Alloc, class _Pointer, class = void>
|
||||
struct __has_destroy : false_type { };
|
||||
|
||||
template <class _Alloc, class _Pointer>
|
||||
struct __has_destroy<_Alloc, _Pointer, decltype(
|
||||
(void)declval<_Alloc>().destroy(declval<_Pointer>())
|
||||
)> : true_type { };
|
||||
|
||||
// __has_max_size
|
||||
template <class _Alloc, class = void>
|
||||
struct __has_max_size : false_type { };
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_max_size<_Alloc, decltype(
|
||||
(void)declval<_Alloc&>().max_size()
|
||||
)> : true_type { };
|
||||
|
||||
// __has_select_on_container_copy_construction
|
||||
template <class _Alloc, class = void>
|
||||
struct __has_select_on_container_copy_construction : false_type { };
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_select_on_container_copy_construction<_Alloc, decltype(
|
||||
(void)declval<_Alloc>().select_on_container_copy_construction()
|
||||
)> : true_type { };
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Alloc>
|
||||
struct _LIBCPP_TEMPLATE_VIS allocator_traits
|
||||
{
|
||||
using allocator_type = _Alloc;
|
||||
using value_type = typename allocator_type::value_type;
|
||||
using pointer = typename __pointer<value_type, allocator_type>::type;
|
||||
using const_pointer = typename __const_pointer<value_type, pointer, allocator_type>::type;
|
||||
using void_pointer = typename __void_pointer<pointer, allocator_type>::type;
|
||||
using const_void_pointer = typename __const_void_pointer<pointer, allocator_type>::type;
|
||||
using difference_type = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
|
||||
using size_type = typename __size_type<allocator_type, difference_type>::type;
|
||||
using propagate_on_container_copy_assignment = typename __propagate_on_container_copy_assignment<allocator_type>::type;
|
||||
using propagate_on_container_move_assignment = typename __propagate_on_container_move_assignment<allocator_type>::type;
|
||||
using propagate_on_container_swap = typename __propagate_on_container_swap<allocator_type>::type;
|
||||
using is_always_equal = typename __is_always_equal<allocator_type>::type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
using rebind_alloc = __allocator_traits_rebind_t<allocator_type, _Tp>;
|
||||
template <class _Tp>
|
||||
using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct rebind_alloc {
|
||||
using other = __allocator_traits_rebind_t<allocator_type, _Tp>;
|
||||
};
|
||||
template <class _Tp>
|
||||
struct rebind_traits {
|
||||
using other = allocator_traits<typename rebind_alloc<_Tp>::other>;
|
||||
};
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer allocate(allocator_type& __a, size_type __n) {
|
||||
return __a.allocate(__n);
|
||||
}
|
||||
|
||||
template <class _Ap = _Alloc, class =
|
||||
_EnableIf<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
return __a.allocate(__n, __hint);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
template <class _Ap = _Alloc, class = void, class =
|
||||
_EnableIf<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) {
|
||||
return __a.allocate(__n);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT {
|
||||
__a.deallocate(__p, __n);
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args, class =
|
||||
_EnableIf<__has_construct<allocator_type, _Tp*, _Args...>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
__a.construct(__p, _VSTD::forward<_Args>(__args)...);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
template <class _Tp, class... _Args, class = void, class =
|
||||
_EnableIf<!__has_construct<allocator_type, _Tp*, _Args...>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void construct(allocator_type&, _Tp* __p, _Args&&... __args) {
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class =
|
||||
_EnableIf<__has_destroy<allocator_type, _Tp*>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void destroy(allocator_type& __a, _Tp* __p) {
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
__a.destroy(__p);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
template <class _Tp, class = void, class =
|
||||
_EnableIf<!__has_destroy<allocator_type, _Tp*>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void destroy(allocator_type&, _Tp* __p) {
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_VSTD::destroy_at(__p);
|
||||
#else
|
||||
__p->~_Tp();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Ap = _Alloc, class =
|
||||
_EnableIf<__has_max_size<const _Ap>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static size_type max_size(const allocator_type& __a) _NOEXCEPT {
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
return __a.max_size();
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
template <class _Ap = _Alloc, class = void, class =
|
||||
_EnableIf<!__has_max_size<const _Ap>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static size_type max_size(const allocator_type&) _NOEXCEPT {
|
||||
return numeric_limits<size_type>::max() / sizeof(value_type);
|
||||
}
|
||||
|
||||
template <class _Ap = _Alloc, class =
|
||||
_EnableIf<__has_select_on_container_copy_construction<const _Ap>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static allocator_type select_on_container_copy_construction(const allocator_type& __a) {
|
||||
return __a.select_on_container_copy_construction();
|
||||
}
|
||||
template <class _Ap = _Alloc, class = void, class =
|
||||
_EnableIf<!__has_select_on_container_copy_construction<const _Ap>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static allocator_type select_on_container_copy_construction(const allocator_type& __a) {
|
||||
return __a;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Traits, class _Tp>
|
||||
struct __rebind_alloc_helper {
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
using type _LIBCPP_NODEBUG_TYPE = typename _Traits::template rebind_alloc<_Tp>;
|
||||
#else
|
||||
using type = typename _Traits::template rebind_alloc<_Tp>::other;
|
||||
#endif
|
||||
};
|
||||
|
||||
// __is_default_allocator
|
||||
template <class _Tp>
|
||||
struct __is_default_allocator : false_type { };
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type { };
|
||||
|
||||
// __is_cpp17_move_insertable
|
||||
template <class _Alloc, class = void>
|
||||
struct __is_cpp17_move_insertable
|
||||
: is_move_constructible<typename _Alloc::value_type>
|
||||
{ };
|
||||
|
||||
template <class _Alloc>
|
||||
struct __is_cpp17_move_insertable<_Alloc, _EnableIf<
|
||||
!__is_default_allocator<_Alloc>::value &&
|
||||
__has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value
|
||||
> > : true_type { };
|
||||
|
||||
// __is_cpp17_copy_insertable
|
||||
template <class _Alloc, class = void>
|
||||
struct __is_cpp17_copy_insertable
|
||||
: integral_constant<bool,
|
||||
is_copy_constructible<typename _Alloc::value_type>::value &&
|
||||
__is_cpp17_move_insertable<_Alloc>::value
|
||||
>
|
||||
{ };
|
||||
|
||||
template <class _Alloc>
|
||||
struct __is_cpp17_copy_insertable<_Alloc, _EnableIf<
|
||||
!__is_default_allocator<_Alloc>::value &&
|
||||
__has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value
|
||||
> >
|
||||
: __is_cpp17_move_insertable<_Alloc>
|
||||
{ };
|
||||
|
||||
#undef _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
|
||||
127
lib/libcxx/include/__memory/base.h
Normal file
127
lib/libcxx/include/__memory/base.h
Normal file
@@ -0,0 +1,127 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_BASE_H
|
||||
#define _LIBCPP___MEMORY_BASE_H
|
||||
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// addressof
|
||||
#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return __builtin_addressof(__x);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<_Tp *>(
|
||||
const_cast<char *>(&reinterpret_cast<const volatile char &>(__x)));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
|
||||
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
|
||||
// Objective-C++ Automatic Reference Counting uses qualified pointers
|
||||
// that require special addressof() signatures. When
|
||||
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
|
||||
// itself is providing these definitions. Otherwise, we provide them.
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__strong _Tp*
|
||||
addressof(__strong _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__weak _Tp*
|
||||
addressof(__weak _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__autoreleasing _Tp*
|
||||
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__unsafe_unretained _Tp*
|
||||
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_CXX03_LANG)
|
||||
template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
|
||||
#endif
|
||||
|
||||
// construct_at
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
template<class _Tp, class ..._Args, class = decltype(
|
||||
::new (_VSTD::declval<void*>()) _Tp(_VSTD::declval<_Args>()...)
|
||||
)>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) {
|
||||
_LIBCPP_ASSERT(__location, "null pointer given to construct_at");
|
||||
return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// destroy_at
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
void destroy_at(_Tp* __loc) {
|
||||
_LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
|
||||
__loc->~_Tp();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_BASE_H
|
||||
169
lib/libcxx/include/__memory/pointer_traits.h
Normal file
169
lib/libcxx/include/__memory/pointer_traits.h
Normal file
@@ -0,0 +1,169 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_POINTER_TRAITS_H
|
||||
#define _LIBCPP___MEMORY_POINTER_TRAITS_H
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_element_type : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_element_type<_Tp,
|
||||
typename __void_t<typename _Tp::element_type>::type> : true_type {};
|
||||
|
||||
template <class _Ptr, bool = __has_element_type<_Ptr>::value>
|
||||
struct __pointer_traits_element_type;
|
||||
|
||||
template <class _Ptr>
|
||||
struct __pointer_traits_element_type<_Ptr, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args>
|
||||
struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args>
|
||||
struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE _Tp type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_difference_type : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_difference_type<_Tp,
|
||||
typename __void_t<typename _Tp::difference_type>::type> : true_type {};
|
||||
|
||||
template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
|
||||
struct __pointer_traits_difference_type
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
|
||||
};
|
||||
|
||||
template <class _Ptr>
|
||||
struct __pointer_traits_difference_type<_Ptr, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __has_rebind
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Xp> static __two __test(...);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
|
||||
struct __pointer_traits_rebind
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
|
||||
#else
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
|
||||
struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
|
||||
#else
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
|
||||
struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
|
||||
{
|
||||
typedef _Sp<_Up, _Args...> type;
|
||||
};
|
||||
|
||||
template <class _Ptr>
|
||||
struct _LIBCPP_TEMPLATE_VIS pointer_traits
|
||||
{
|
||||
typedef _Ptr pointer;
|
||||
typedef typename __pointer_traits_element_type<pointer>::type element_type;
|
||||
typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
|
||||
#else
|
||||
template <class _Up> struct rebind
|
||||
{typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
private:
|
||||
struct __nat {};
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static pointer pointer_to(typename conditional<is_void<element_type>::value,
|
||||
__nat, element_type>::type& __r)
|
||||
{return pointer::pointer_to(__r);}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
|
||||
{
|
||||
typedef _Tp* pointer;
|
||||
typedef _Tp element_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Up> using rebind = _Up*;
|
||||
#else
|
||||
template <class _Up> struct rebind {typedef _Up* other;};
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct __nat {};
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer pointer_to(typename conditional<is_void<element_type>::value,
|
||||
__nat, element_type>::type& __r) _NOEXCEPT
|
||||
{return _VSTD::addressof(__r);}
|
||||
};
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __rebind_pointer {
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef typename pointer_traits<_From>::template rebind<_To> type;
|
||||
#else
|
||||
typedef typename pointer_traits<_From>::template rebind<_To>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_POINTER_TRAITS_H
|
||||
88
lib/libcxx/include/__memory/utilities.h
Normal file
88
lib/libcxx/include/__memory/utilities.h
Normal file
@@ -0,0 +1,88 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_UTILITIES_H
|
||||
#define _LIBCPP___MEMORY_UTILITIES_H
|
||||
|
||||
#include <__config>
|
||||
#include <__memory/allocator_traits.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// Helper class to allocate memory using an Allocator in an exception safe
|
||||
// manner.
|
||||
//
|
||||
// The intended usage of this class is as follows:
|
||||
//
|
||||
// 0
|
||||
// 1 __allocation_guard<SomeAllocator> guard(alloc, 10);
|
||||
// 2 do_some_initialization_that_may_throw(guard.__get());
|
||||
// 3 save_allocated_pointer_in_a_noexcept_operation(guard.__release_ptr());
|
||||
// 4
|
||||
//
|
||||
// If line (2) throws an exception during initialization of the memory, the
|
||||
// guard's destructor will be called, and the memory will be released using
|
||||
// Allocator deallocation. Otherwise, we release the memory from the guard on
|
||||
// line (3) in an operation that can't throw -- after that, the guard is not
|
||||
// responsible for the memory anymore.
|
||||
//
|
||||
// This is similar to a unique_ptr, except it's easier to use with a
|
||||
// custom allocator.
|
||||
template<class _Alloc>
|
||||
struct __allocation_guard {
|
||||
using _Pointer = typename allocator_traits<_Alloc>::pointer;
|
||||
using _Size = typename allocator_traits<_Alloc>::size_type;
|
||||
|
||||
template<class _AllocT> // we perform the allocator conversion inside the constructor
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
explicit __allocation_guard(_AllocT __alloc, _Size __n)
|
||||
: __alloc_(_VSTD::move(__alloc))
|
||||
, __n_(__n)
|
||||
, __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
|
||||
{ }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
~__allocation_guard() _NOEXCEPT {
|
||||
if (__ptr_ != nullptr) {
|
||||
allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_Pointer __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++
|
||||
_Pointer __tmp = __ptr_;
|
||||
__ptr_ = nullptr;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_Pointer __get() const _NOEXCEPT {
|
||||
return __ptr_;
|
||||
}
|
||||
|
||||
private:
|
||||
_Alloc __alloc_;
|
||||
_Size __n_;
|
||||
_Pointer __ptr_;
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_UTILITIES_H
|
||||
@@ -146,7 +146,6 @@ private:
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
@@ -163,8 +162,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
@@ -382,12 +379,12 @@ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
|
||||
|
||||
using __ratio = ratio_divide<_Period, nano>;
|
||||
using __ns_rep = nanoseconds::rep;
|
||||
__ns_rep __result_max = std::numeric_limits<__ns_rep>::max();
|
||||
__ns_rep __result_max = numeric_limits<__ns_rep>::max();
|
||||
if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
|
||||
return nanoseconds::max();
|
||||
}
|
||||
|
||||
__ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
|
||||
__ns_rep __result_min = numeric_limits<__ns_rep>::min();
|
||||
if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
|
||||
return nanoseconds::min();
|
||||
}
|
||||
@@ -421,7 +418,7 @@ condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
if (__t <= __now)
|
||||
return cv_status::timeout;
|
||||
|
||||
__clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch()));
|
||||
__clock_tp_ns __t_ns = __clock_tp_ns(_VSTD::__safe_nanosecond_cast(__t.time_since_epoch()));
|
||||
|
||||
__do_timed_wait(__lk, __t_ns);
|
||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||
@@ -454,13 +451,13 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
|
||||
#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
|
||||
using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
|
||||
__ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count();
|
||||
__ns_rep __now_count_ns = _VSTD::__safe_nanosecond_cast(__c_now.time_since_epoch()).count();
|
||||
#else
|
||||
using __clock_tp_ns = time_point<system_clock, nanoseconds>;
|
||||
__ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
|
||||
__ns_rep __now_count_ns = _VSTD::__safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
|
||||
#endif
|
||||
|
||||
__ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count();
|
||||
__ns_rep __d_ns_count = _VSTD::__safe_nanosecond_cast(__d).count();
|
||||
|
||||
if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) {
|
||||
__do_timed_wait(__lk, __clock_tp_ns::max());
|
||||
|
||||
@@ -68,7 +68,6 @@ public:
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
@@ -76,7 +75,6 @@ public:
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
@@ -101,12 +99,10 @@ public:
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
@@ -270,7 +266,7 @@ typename enable_if
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
_ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
|
||||
_ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last));
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
_VSTD::__to_address(__tx.__pos_), *__first);
|
||||
@@ -283,7 +279,7 @@ void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ != __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __to_address(__begin_++));
|
||||
__alloc_traits::destroy(__alloc(), _VSTD::__to_address(__begin_++));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -300,7 +296,7 @@ void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last != __end_)
|
||||
__alloc_traits::destroy(__alloc(), __to_address(--__end_));
|
||||
__alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__end_));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -350,8 +346,6 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
@@ -412,8 +406,6 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
@@ -424,7 +416,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_allocator(__alloc(), __x.__alloc());
|
||||
_VSTD::__swap_allocator(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -499,8 +491,6 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
@@ -531,8 +521,6 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@@ -563,8 +551,6 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
@@ -626,8 +612,6 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
#define _LIBCPP___SSO_ALLOCATOR
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@@ -47,21 +48,21 @@ public:
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = nullptr)
|
||||
{
|
||||
if (!__allocated_ && __n <= _Np)
|
||||
{
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
|
||||
return allocator<_Tp>().allocate(__n);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
_VSTD::__libcpp_deallocate(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
|
||||
allocator<_Tp>().deallocate(__p, __n);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ template <> struct char_traits<char8_t>; // c++20
|
||||
|
||||
#include <__config>
|
||||
#include <algorithm> // for search and min
|
||||
#include <cstdio> // For EOF.
|
||||
#include <cstdio> // for EOF
|
||||
#include <cstring> // for memcpy
|
||||
#include <cwchar> // for wmemcpy
|
||||
#include <memory> // for __murmur2_or_cityhash
|
||||
|
||||
#include <__debug>
|
||||
@@ -92,7 +94,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, std::allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \
|
||||
@@ -108,7 +110,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, std::allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \
|
||||
@@ -158,7 +160,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, std::allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \
|
||||
@@ -268,7 +270,7 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@@ -318,7 +320,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
|
||||
// constexpr versions of move/copy/assign.
|
||||
|
||||
template <class _CharT>
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
if (__n == 0) return __s1;
|
||||
@@ -331,7 +333,7 @@ _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_VSTD::copy_n(__s2, __n, __s1);
|
||||
@@ -339,7 +341,7 @@ _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT
|
||||
{
|
||||
_VSTD::fill_n(__s, __n, __a);
|
||||
@@ -370,27 +372,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
|
||||
length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
|
||||
? _VSTD::__move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
|
||||
? _VSTD::__copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
|
||||
? _VSTD::__assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n);
|
||||
}
|
||||
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
@@ -414,7 +416,7 @@ char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_memcmp(__s1, __s2, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return memcmp(__s1, __s2, __n);
|
||||
return _VSTD::memcmp(__s1, __s2, __n);
|
||||
#else
|
||||
for (; __n; --__n, ++__s1, ++__s2)
|
||||
{
|
||||
@@ -436,7 +438,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_char_memchr(__s, to_int_type(__a), __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return (const char_type*) memchr(__s, to_int_type(__a), __n);
|
||||
return (const char_type*) _VSTD::memchr(__s, to_int_type(__a), __n);
|
||||
#else
|
||||
for (; __n; --__n)
|
||||
{
|
||||
@@ -473,27 +475,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
|
||||
size_t length(const char_type* __s) _NOEXCEPT;
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : wmemmove(__s1, __s2, __n);
|
||||
? _VSTD::__move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : _VSTD::wmemmove(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n);
|
||||
? _VSTD::__copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : _VSTD::wmemcpy(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : wmemset(__s, __a, __n);
|
||||
? _VSTD::__assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : _VSTD::wmemset(__s, __a, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
@@ -516,7 +518,7 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemcmp(__s1, __s2, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wmemcmp(__s1, __s2, __n);
|
||||
return _VSTD::wmemcmp(__s1, __s2, __n);
|
||||
#else
|
||||
for (; __n; --__n, ++__s1, ++__s2)
|
||||
{
|
||||
@@ -548,7 +550,7 @@ char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wcslen(__s);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wcslen(__s);
|
||||
return _VSTD::wcslen(__s);
|
||||
#else
|
||||
size_t __len = 0;
|
||||
for (; !eq(*__s, char_type(0)); ++__s)
|
||||
@@ -566,7 +568,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemchr(__s, __a, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wmemchr(__s, __a, __n);
|
||||
return _VSTD::wmemchr(__s, __a, __n);
|
||||
#else
|
||||
for (; __n; --__n)
|
||||
{
|
||||
@@ -606,29 +608,29 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
|
||||
_LIBCPP_INLINE_VISIBILITY static constexpr
|
||||
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
|
||||
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
|
||||
? _VSTD::__move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n);
|
||||
}
|
||||
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
|
||||
? _VSTD::__copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n);
|
||||
}
|
||||
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
|
||||
? _VSTD::__assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n);
|
||||
}
|
||||
|
||||
static inline constexpr int_type not_eof(int_type __c) noexcept
|
||||
@@ -683,7 +685,7 @@ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif // #_LIBCPP_NO_HAS_CHAR8_T
|
||||
@@ -765,7 +767,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
@@ -885,7 +887,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
@@ -943,7 +945,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
|
||||
if (__pos >= __sz)
|
||||
return __npos;
|
||||
const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
|
||||
if (__r == 0)
|
||||
if (__r == nullptr)
|
||||
return __npos;
|
||||
return static_cast<_SizeT>(__r - __p);
|
||||
}
|
||||
@@ -972,7 +974,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
|
||||
|
||||
// Find __f2 the first byte matching in __first1.
|
||||
__first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2);
|
||||
if (__first1 == 0)
|
||||
if (__first1 == nullptr)
|
||||
return __last1;
|
||||
|
||||
// It is faster to compare from the first byte of __first1 even if we
|
||||
@@ -1095,7 +1097,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
{
|
||||
const _CharT* __pe = __p + __sz;
|
||||
for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
|
||||
if (_Traits::find(__s, __n, *__ps) == 0)
|
||||
if (_Traits::find(__s, __n, *__ps) == nullptr)
|
||||
return static_cast<_SizeT>(__ps - __p);
|
||||
}
|
||||
return __npos;
|
||||
@@ -1129,7 +1131,7 @@ __str_find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
else
|
||||
__pos = __sz;
|
||||
for (const _CharT* __ps = __p + __pos; __ps != __p;)
|
||||
if (_Traits::find(__s, __n, *--__ps) == 0)
|
||||
if (_Traits::find(__s, __n, *--__ps) == nullptr)
|
||||
return static_cast<_SizeT>(__ps - __p);
|
||||
return __npos;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/android/locale_bionic.h ------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -28,13 +28,13 @@ extern "C" {
|
||||
#include <android/api-level.h>
|
||||
#include <android/ndk-version.h>
|
||||
#if __ANDROID_API__ < 21
|
||||
#include <support/xlocale/__posix_l_fallback.h>
|
||||
#include <__support/xlocale/__posix_l_fallback.h>
|
||||
#endif
|
||||
// In NDK versions later than 16, locale-aware functions are provided by
|
||||
// legacy_stdlib_inlines.h
|
||||
#if __NDK_MAJOR__ <= 16
|
||||
#if __ANDROID_API__ < 21
|
||||
#include <support/xlocale/__strtonum_fallback.h>
|
||||
#include <__support/xlocale/__strtonum_fallback.h>
|
||||
#elif __ANDROID_API__ < 26
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/fuchsia/xlocale.h ------------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cwchar>
|
||||
#include <support/xlocale/__posix_l_fallback.h>
|
||||
#include <support/xlocale/__strtonum_fallback.h>
|
||||
#include <__support/xlocale/__posix_l_fallback.h>
|
||||
#include <__support/xlocale/__strtonum_fallback.h>
|
||||
|
||||
#endif // defined(__Fuchsia__)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/ibm/limits.h ---------------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/ibm/locale_mgmt_aix.h --------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
38
lib/libcxx/include/__support/ibm/nanosleep.h
Normal file
38
lib/libcxx/include/__support/ibm/nanosleep.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
||||
#define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
inline int nanosleep(const struct timespec* req, struct timespec* rem)
|
||||
{
|
||||
// The nanosleep() function is not available on z/OS. Therefore, we will call
|
||||
// sleep() to sleep for whole seconds and usleep() to sleep for any remaining
|
||||
// fraction of a second. Any remaining nanoseconds will round up to the next
|
||||
// microsecond.
|
||||
|
||||
useconds_t __micro_sec = (rem->tv_nsec + 999) / 1000;
|
||||
if (__micro_sec > 999999)
|
||||
{
|
||||
++rem->tv_sec;
|
||||
__micro_sec -= 1000000;
|
||||
}
|
||||
while (rem->tv_sec)
|
||||
rem->tv_sec = sleep(rem->tv_sec);
|
||||
if (__micro_sec) {
|
||||
rem->tv_nsec = __micro_sec * 1000;
|
||||
return usleep(__micro_sec);
|
||||
}
|
||||
rem->tv_nsec = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------- support/ibm/support.h ----------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/ibm/xlocale.h -------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -9,15 +9,16 @@
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
#include <support/ibm/locale_mgmt_aix.h>
|
||||
|
||||
#if defined(_AIX)
|
||||
#include <__support/ibm/locale_mgmt_aix.h>
|
||||
|
||||
#include "cstdlib"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_AIX)
|
||||
#if !defined(_AIX71)
|
||||
// AIX 7.1 and higher has these definitions. Definitions and stubs
|
||||
// are provied here as a temporary workaround on AIX 6.1.
|
||||
@@ -207,14 +208,20 @@ size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
|
||||
}
|
||||
#endif // !defined(_AIX71)
|
||||
|
||||
// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
|
||||
// implemented yet.
|
||||
// strftime_l() is defined by POSIX. However, AIX 7.1 and z/OS do not have it
|
||||
// implemented yet. z/OS retrieves it from the POSIX fallbacks.
|
||||
static inline
|
||||
size_t strftime_l(char *__s, size_t __size, const char *__fmt,
|
||||
const struct tm *__tm, locale_t locale) {
|
||||
return __xstrftime(locale, __s, __size, __fmt, __tm);
|
||||
}
|
||||
|
||||
#elif defined(__MVS__)
|
||||
#include <wctype.h>
|
||||
// POSIX routines
|
||||
#include <__support/xlocale/__posix_l_fallback.h>
|
||||
#endif // defined(__MVS__)
|
||||
|
||||
// The following are not POSIX routines. These are quick-and-dirty hacks
|
||||
// to make things pretend to work
|
||||
static inline
|
||||
@@ -266,5 +273,4 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // defined(_AIX)
|
||||
#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/musl/xlocale.h ------------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -17,9 +17,9 @@
|
||||
#include <ctype.h>
|
||||
#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
|
||||
__NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
|
||||
#include <support/xlocale/__nop_locale_mgmt.h>
|
||||
#include <support/xlocale/__posix_l_fallback.h>
|
||||
#include <support/xlocale/__strtonum_fallback.h>
|
||||
#include <__support/xlocale/__nop_locale_mgmt.h>
|
||||
#include <__support/xlocale/__posix_l_fallback.h>
|
||||
#include <__support/xlocale/__strtonum_fallback.h>
|
||||
#endif
|
||||
|
||||
#endif // _NEWLIB_VERSION
|
||||
18
lib/libcxx/include/__support/nuttx/xlocale.h
Normal file
18
lib/libcxx/include/__support/nuttx/xlocale.h
Normal file
@@ -0,0 +1,18 @@
|
||||
// -*- C++ -*-
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_NUTTX_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H
|
||||
|
||||
#if defined(__NuttX__)
|
||||
#include <__support/xlocale/__posix_l_fallback.h>
|
||||
#include <__support/xlocale/__strtonum_fallback.h>
|
||||
#endif // __NuttX__
|
||||
|
||||
#endif
|
||||
19
lib/libcxx/include/__support/openbsd/xlocale.h
Normal file
19
lib/libcxx/include/__support/openbsd/xlocale.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// -*- C++ -*-
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H
|
||||
|
||||
#include <cstdlib>
|
||||
#include <clocale>
|
||||
#include <cwctype>
|
||||
#include <ctype.h>
|
||||
#include <__support/xlocale/__strtonum_fallback.h>
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------ support/win32/limits_msvc_win32.h -----------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/win32/locale_win32.h -------------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -201,8 +201,8 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
|
||||
#define strtof_l _strtof_l
|
||||
#define strtold_l _strtold_l
|
||||
#else
|
||||
float strtof_l(const char*, char**, locale_t);
|
||||
long double strtold_l(const char*, char**, locale_t);
|
||||
_LIBCPP_FUNC_VIS float strtof_l(const char*, char**, locale_t);
|
||||
_LIBCPP_FUNC_VIS long double strtold_l(const char*, char**, locale_t);
|
||||
#endif
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===------------ support/xlocale/__nop_locale_mgmt.h -----------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------- support/xlocale/__posix_l_fallback.h -----------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -1,5 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------- support/xlocale/__strtonum_fallback.h -----------------===//
|
||||
//===-----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@@ -11,10 +11,15 @@
|
||||
#define _LIBCPP_THREADING_SUPPORT
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <chrono>
|
||||
#include <iosfwd>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __MVS__
|
||||
# include <__support/ibm/nanosleep.h>
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@@ -26,7 +31,7 @@
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
# ifdef __APPLE__
|
||||
# if defined(__APPLE__) || defined(__MVS__)
|
||||
# define _LIBCPP_NO_NATIVE_SEMAPHORES
|
||||
# endif
|
||||
# ifndef _LIBCPP_NO_NATIVE_SEMAPHORES
|
||||
@@ -82,11 +87,14 @@ typedef pthread_once_t __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
|
||||
|
||||
// Thread id
|
||||
typedef pthread_t __libcpp_thread_id;
|
||||
#if defined(__MVS__)
|
||||
typedef unsigned long long __libcpp_thread_id;
|
||||
#else
|
||||
typedef pthread_t __libcpp_thread_id;
|
||||
#endif
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
|
||||
typedef pthread_t __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
@@ -278,24 +286,21 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
|
||||
#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
|
||||
struct __libcpp_timed_backoff_policy {
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool operator()(chrono::nanoseconds __elapsed) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(chrono::nanoseconds __elapsed) const
|
||||
{
|
||||
if(__elapsed > chrono::milliseconds(128))
|
||||
__libcpp_thread_sleep_for(chrono::milliseconds(8));
|
||||
else if(__elapsed > chrono::microseconds(64))
|
||||
__libcpp_thread_sleep_for(__elapsed / 2);
|
||||
else if(__elapsed > chrono::microseconds(4))
|
||||
__libcpp_thread_yield();
|
||||
else
|
||||
{} // poll
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) const
|
||||
{
|
||||
if(__elapsed > chrono::milliseconds(128))
|
||||
__libcpp_thread_sleep_for(chrono::milliseconds(8));
|
||||
else if(__elapsed > chrono::microseconds(64))
|
||||
__libcpp_thread_sleep_for(__elapsed / 2);
|
||||
else if(__elapsed > chrono::microseconds(4))
|
||||
__libcpp_thread_yield();
|
||||
else
|
||||
; // poll
|
||||
return false;
|
||||
}
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
|
||||
|
||||
template<class _Fn, class _BFn>
|
||||
@@ -484,7 +489,7 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
||||
// Returns non-zero if the thread ids are equal, otherwise 0
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
{
|
||||
return pthread_equal(t1, t2) != 0;
|
||||
return t1 == t2;
|
||||
}
|
||||
|
||||
// Returns non-zero if t1 < t2, otherwise 0
|
||||
@@ -495,28 +500,33 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
|
||||
// Thread
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
|
||||
return *__t == 0;
|
||||
return *__t == __libcpp_thread_t();
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
return pthread_create(__t, 0, __func, __arg);
|
||||
return pthread_create(__t, nullptr, __func, __arg);
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_current_id()
|
||||
{
|
||||
return pthread_self();
|
||||
const __libcpp_thread_t thread = pthread_self();
|
||||
return __libcpp_thread_get_id(&thread);
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
|
||||
{
|
||||
#if defined(__MVS__)
|
||||
return __t->__;
|
||||
#else
|
||||
return *__t;
|
||||
#endif
|
||||
}
|
||||
|
||||
int __libcpp_thread_join(__libcpp_thread_t *__t)
|
||||
{
|
||||
return pthread_join(*__t, 0);
|
||||
return pthread_join(*__t, nullptr);
|
||||
}
|
||||
|
||||
int __libcpp_thread_detach(__libcpp_thread_t *__t)
|
||||
@@ -651,7 +661,7 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
|
||||
// Thread
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
|
||||
return *__t == 0;
|
||||
return __libcpp_thread_get_id(__t) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
|
||||
@@ -108,10 +108,10 @@ __tree_sub_invariant(_NodePtr __x)
|
||||
if (__x->__right_ && !__x->__right_->__is_black_)
|
||||
return 0;
|
||||
}
|
||||
unsigned __h = __tree_sub_invariant(__x->__left_);
|
||||
unsigned __h = _VSTD::__tree_sub_invariant(__x->__left_);
|
||||
if (__h == 0)
|
||||
return 0; // invalid left subtree
|
||||
if (__h != __tree_sub_invariant(__x->__right_))
|
||||
if (__h != _VSTD::__tree_sub_invariant(__x->__right_))
|
||||
return 0; // invalid or different height right subtree
|
||||
return __h + __x->__is_black_; // return black height of this node
|
||||
}
|
||||
@@ -128,13 +128,13 @@ __tree_invariant(_NodePtr __root)
|
||||
// check __x->__parent_ consistency
|
||||
if (__root->__parent_ == nullptr)
|
||||
return false;
|
||||
if (!__tree_is_left_child(__root))
|
||||
if (!_VSTD::__tree_is_left_child(__root))
|
||||
return false;
|
||||
// root must be black
|
||||
if (!__root->__is_black_)
|
||||
return false;
|
||||
// do normal node checks
|
||||
return __tree_sub_invariant(__root) != 0;
|
||||
return _VSTD::__tree_sub_invariant(__root) != 0;
|
||||
}
|
||||
|
||||
// Returns: pointer to the left-most node under __x.
|
||||
@@ -168,8 +168,8 @@ _NodePtr
|
||||
__tree_next(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
if (__x->__right_ != nullptr)
|
||||
return __tree_min(__x->__right_);
|
||||
while (!__tree_is_left_child(__x))
|
||||
return _VSTD::__tree_min(__x->__right_);
|
||||
while (!_VSTD::__tree_is_left_child(__x))
|
||||
__x = __x->__parent_unsafe();
|
||||
return __x->__parent_unsafe();
|
||||
}
|
||||
@@ -180,8 +180,8 @@ _EndNodePtr
|
||||
__tree_next_iter(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
if (__x->__right_ != nullptr)
|
||||
return static_cast<_EndNodePtr>(__tree_min(__x->__right_));
|
||||
while (!__tree_is_left_child(__x))
|
||||
return static_cast<_EndNodePtr>(_VSTD::__tree_min(__x->__right_));
|
||||
while (!_VSTD::__tree_is_left_child(__x))
|
||||
__x = __x->__parent_unsafe();
|
||||
return static_cast<_EndNodePtr>(__x->__parent_);
|
||||
}
|
||||
@@ -195,9 +195,9 @@ _NodePtr
|
||||
__tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
|
||||
{
|
||||
if (__x->__left_ != nullptr)
|
||||
return __tree_max(__x->__left_);
|
||||
return _VSTD::__tree_max(__x->__left_);
|
||||
_NodePtr __xx = static_cast<_NodePtr>(__x);
|
||||
while (__tree_is_left_child(__xx))
|
||||
while (_VSTD::__tree_is_left_child(__xx))
|
||||
__xx = __xx->__parent_unsafe();
|
||||
return __xx->__parent_unsafe();
|
||||
}
|
||||
@@ -237,7 +237,7 @@ __tree_left_rotate(_NodePtr __x) _NOEXCEPT
|
||||
if (__x->__right_ != nullptr)
|
||||
__x->__right_->__set_parent(__x);
|
||||
__y->__parent_ = __x->__parent_;
|
||||
if (__tree_is_left_child(__x))
|
||||
if (_VSTD::__tree_is_left_child(__x))
|
||||
__x->__parent_->__left_ = __y;
|
||||
else
|
||||
__x->__parent_unsafe()->__right_ = __y;
|
||||
@@ -257,7 +257,7 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT
|
||||
if (__x->__left_ != nullptr)
|
||||
__x->__left_->__set_parent(__x);
|
||||
__y->__parent_ = __x->__parent_;
|
||||
if (__tree_is_left_child(__x))
|
||||
if (_VSTD::__tree_is_left_child(__x))
|
||||
__x->__parent_->__left_ = __y;
|
||||
else
|
||||
__x->__parent_unsafe()->__right_ = __y;
|
||||
@@ -281,7 +281,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
|
||||
while (__x != __root && !__x->__parent_unsafe()->__is_black_)
|
||||
{
|
||||
// __x->__parent_ != __root because __x->__parent_->__is_black == false
|
||||
if (__tree_is_left_child(__x->__parent_unsafe()))
|
||||
if (_VSTD::__tree_is_left_child(__x->__parent_unsafe()))
|
||||
{
|
||||
_NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_;
|
||||
if (__y != nullptr && !__y->__is_black_)
|
||||
@@ -294,16 +294,16 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!__tree_is_left_child(__x))
|
||||
if (!_VSTD::__tree_is_left_child(__x))
|
||||
{
|
||||
__x = __x->__parent_unsafe();
|
||||
__tree_left_rotate(__x);
|
||||
_VSTD::__tree_left_rotate(__x);
|
||||
}
|
||||
__x = __x->__parent_unsafe();
|
||||
__x->__is_black_ = true;
|
||||
__x = __x->__parent_unsafe();
|
||||
__x->__is_black_ = false;
|
||||
__tree_right_rotate(__x);
|
||||
_VSTD::__tree_right_rotate(__x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -320,16 +320,16 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__tree_is_left_child(__x))
|
||||
if (_VSTD::__tree_is_left_child(__x))
|
||||
{
|
||||
__x = __x->__parent_unsafe();
|
||||
__tree_right_rotate(__x);
|
||||
_VSTD::__tree_right_rotate(__x);
|
||||
}
|
||||
__x = __x->__parent_unsafe();
|
||||
__x->__is_black_ = true;
|
||||
__x = __x->__parent_unsafe();
|
||||
__x->__is_black_ = false;
|
||||
__tree_left_rotate(__x);
|
||||
_VSTD::__tree_left_rotate(__x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// __y will have at most one child.
|
||||
// __y will be the initial hole in the tree (make the hole at a leaf)
|
||||
_NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ?
|
||||
__z : __tree_next(__z);
|
||||
__z : _VSTD::__tree_next(__z);
|
||||
// __x is __y's possibly null single child
|
||||
_NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_;
|
||||
// __w is __x's possibly null uncle (will become __x's sibling)
|
||||
@@ -360,7 +360,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// link __x to __y's parent, and find __w
|
||||
if (__x != nullptr)
|
||||
__x->__parent_ = __y->__parent_;
|
||||
if (__tree_is_left_child(__y))
|
||||
if (_VSTD::__tree_is_left_child(__y))
|
||||
{
|
||||
__y->__parent_->__left_ = __x;
|
||||
if (__y != __root)
|
||||
@@ -381,7 +381,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
{
|
||||
// __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
|
||||
__y->__parent_ = __z->__parent_;
|
||||
if (__tree_is_left_child(__z))
|
||||
if (_VSTD::__tree_is_left_child(__z))
|
||||
__y->__parent_->__left_ = __y;
|
||||
else
|
||||
__y->__parent_unsafe()->__right_ = __y;
|
||||
@@ -421,13 +421,13 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// with a non-null black child).
|
||||
while (true)
|
||||
{
|
||||
if (!__tree_is_left_child(__w)) // if x is left child
|
||||
if (!_VSTD::__tree_is_left_child(__w)) // if x is left child
|
||||
{
|
||||
if (!__w->__is_black_)
|
||||
{
|
||||
__w->__is_black_ = true;
|
||||
__w->__parent_unsafe()->__is_black_ = false;
|
||||
__tree_left_rotate(__w->__parent_unsafe());
|
||||
_VSTD::__tree_left_rotate(__w->__parent_unsafe());
|
||||
// __x is still valid
|
||||
// reset __root only if necessary
|
||||
if (__root == __w->__left_)
|
||||
@@ -448,7 +448,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
break;
|
||||
}
|
||||
// reset sibling, and it still can't be null
|
||||
__w = __tree_is_left_child(__x) ?
|
||||
__w = _VSTD::__tree_is_left_child(__x) ?
|
||||
__x->__parent_unsafe()->__right_ :
|
||||
__x->__parent_->__left_;
|
||||
// continue;
|
||||
@@ -460,7 +460,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// __w left child is non-null and red
|
||||
__w->__left_->__is_black_ = true;
|
||||
__w->__is_black_ = false;
|
||||
__tree_right_rotate(__w);
|
||||
_VSTD::__tree_right_rotate(__w);
|
||||
// __w is known not to be root, so root hasn't changed
|
||||
// reset sibling, and it still can't be null
|
||||
__w = __w->__parent_unsafe();
|
||||
@@ -469,7 +469,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
__w->__is_black_ = __w->__parent_unsafe()->__is_black_;
|
||||
__w->__parent_unsafe()->__is_black_ = true;
|
||||
__w->__right_->__is_black_ = true;
|
||||
__tree_left_rotate(__w->__parent_unsafe());
|
||||
_VSTD::__tree_left_rotate(__w->__parent_unsafe());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -479,7 +479,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
{
|
||||
__w->__is_black_ = true;
|
||||
__w->__parent_unsafe()->__is_black_ = false;
|
||||
__tree_right_rotate(__w->__parent_unsafe());
|
||||
_VSTD::__tree_right_rotate(__w->__parent_unsafe());
|
||||
// __x is still valid
|
||||
// reset __root only if necessary
|
||||
if (__root == __w->__right_)
|
||||
@@ -500,7 +500,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
break;
|
||||
}
|
||||
// reset sibling, and it still can't be null
|
||||
__w = __tree_is_left_child(__x) ?
|
||||
__w = _VSTD::__tree_is_left_child(__x) ?
|
||||
__x->__parent_unsafe()->__right_ :
|
||||
__x->__parent_->__left_;
|
||||
// continue;
|
||||
@@ -512,7 +512,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// __w right child is non-null and red
|
||||
__w->__right_->__is_black_ = true;
|
||||
__w->__is_black_ = false;
|
||||
__tree_left_rotate(__w);
|
||||
_VSTD::__tree_left_rotate(__w);
|
||||
// __w is known not to be root, so root hasn't changed
|
||||
// reset sibling, and it still can't be null
|
||||
__w = __w->__parent_unsafe();
|
||||
@@ -521,7 +521,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
__w->__is_black_ = __w->__parent_unsafe()->__is_black_;
|
||||
__w->__parent_unsafe()->__is_black_ = true;
|
||||
__w->__left_->__is_black_ = true;
|
||||
__tree_right_rotate(__w->__parent_unsafe());
|
||||
_VSTD::__tree_right_rotate(__w->__parent_unsafe());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -533,19 +533,17 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// node traits
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct __is_tree_value_type_imp : false_type {};
|
||||
|
||||
template <class _Key, class _Value>
|
||||
struct __is_tree_value_type_imp<__value_type<_Key, _Value>> : true_type {};
|
||||
struct __is_tree_value_type_imp<__value_type<_Key, _Value> > : true_type {};
|
||||
|
||||
template <class ..._Args>
|
||||
struct __is_tree_value_type : false_type {};
|
||||
|
||||
template <class _One>
|
||||
struct __is_tree_value_type<_One> : __is_tree_value_type_imp<typename __uncvref<_One>::type> {};
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
struct __tree_key_value_types {
|
||||
@@ -566,12 +564,10 @@ struct __tree_key_value_types {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n);
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type&& __move(__node_value_type& __v) {
|
||||
return _VSTD::move(__v);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
@@ -616,12 +612,10 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
|
||||
return _VSTD::addressof(__n.__get_value());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
|
||||
return __v.__move();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _VoidPtr>
|
||||
@@ -845,7 +839,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator& operator++() {
|
||||
__ptr_ = static_cast<__iter_pointer>(
|
||||
__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
|
||||
_VSTD::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -854,7 +848,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator& operator--() {
|
||||
__ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>(
|
||||
__ptr_ = static_cast<__iter_pointer>(_VSTD::__tree_prev_iter<__node_base_pointer>(
|
||||
static_cast<__end_node_pointer>(__ptr_)));
|
||||
return *this;
|
||||
}
|
||||
@@ -926,7 +920,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator& operator++() {
|
||||
__ptr_ = static_cast<__iter_pointer>(
|
||||
__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
|
||||
_VSTD::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -936,7 +930,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator& operator--() {
|
||||
__ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>(
|
||||
__ptr_ = static_cast<__iter_pointer>(_VSTD::__tree_prev_iter<__node_base_pointer>(
|
||||
static_cast<__end_node_pointer>(__ptr_)));
|
||||
return *this;
|
||||
}
|
||||
@@ -973,7 +967,7 @@ private:
|
||||
|
||||
template<class _Tp, class _Compare>
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
|
||||
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
|
||||
"the specified comparator type does not provide a viable const call operator")
|
||||
#endif
|
||||
int __diagnose_non_const_comparator();
|
||||
@@ -1103,7 +1097,6 @@ public:
|
||||
void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
|
||||
template <class _InputIterator>
|
||||
void __assign_multi(_InputIterator __first, _InputIterator __last);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
@@ -1114,8 +1107,6 @@ public:
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
~__tree();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1129,7 +1120,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return std::min<size_type>(
|
||||
{return _VSTD::min<size_type>(
|
||||
__node_traits::max_size(__node_alloc()),
|
||||
numeric_limits<difference_type >::max());}
|
||||
|
||||
@@ -1146,12 +1137,11 @@ public:
|
||||
_NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class ..._Args>
|
||||
pair<iterator, bool>
|
||||
__emplace_unique_key_args(_Key const&, _Args&&... __args);
|
||||
template <class _Key, class ..._Args>
|
||||
iterator
|
||||
pair<iterator, bool>
|
||||
__emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
|
||||
|
||||
template <class... _Args>
|
||||
@@ -1225,7 +1215,7 @@ public:
|
||||
>::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
|
||||
return __emplace_hint_unique_key_args(__p, __f,
|
||||
_VSTD::forward<_First>(__f),
|
||||
_VSTD::forward<_Second>(__s));
|
||||
_VSTD::forward<_Second>(__s)).first;
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
@@ -1245,25 +1235,16 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
__emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
|
||||
return __emplace_hint_unique_key_args(__p, __x, _VSTD::forward<_Pp>(__x));
|
||||
return __emplace_hint_unique_key_args(__p, __x, _VSTD::forward<_Pp>(__x)).first;
|
||||
}
|
||||
|
||||
template <class _Pp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
__emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
|
||||
return __emplace_hint_unique_key_args(__p, __x.first, _VSTD::forward<_Pp>(__x));
|
||||
return __emplace_hint_unique_key_args(__p, __x.first, _VSTD::forward<_Pp>(__x)).first;
|
||||
}
|
||||
|
||||
#else
|
||||
template <class _Key, class _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args& __args);
|
||||
template <class _Key, class _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
|
||||
return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
|
||||
@@ -1271,15 +1252,9 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_unique(const_iterator __p, const __container_value_type& __v) {
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v);
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_multi(const __container_value_type& __v);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_multi(const_iterator __p, const __container_value_type& __v);
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
|
||||
return __emplace_unique_key_args(_NodeTypes::__get_key(__v), _VSTD::move(__v));
|
||||
@@ -1287,7 +1262,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_unique(const_iterator __p, __container_value_type&& __v) {
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v));
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v)).first;
|
||||
}
|
||||
|
||||
template <class _Vp, class = typename enable_if<
|
||||
@@ -1332,8 +1307,6 @@ public:
|
||||
return __emplace_hint_multi(__p, _VSTD::forward<_Vp>(__v));
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
|
||||
|
||||
@@ -1455,7 +1428,7 @@ private:
|
||||
__node_base_pointer&
|
||||
__find_leaf(const_iterator __hint,
|
||||
__parent_pointer& __parent, const key_type& __v);
|
||||
// FIXME: Make this function const qualified. Unfortunetly doing so
|
||||
// FIXME: Make this function const qualified. Unfortunately doing so
|
||||
// breaks existing code which uses non-const callable comparators.
|
||||
template <class _Key>
|
||||
__node_base_pointer&
|
||||
@@ -1471,12 +1444,8 @@ private:
|
||||
__node_base_pointer& __dummy,
|
||||
const _Key& __v);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
__node_holder __construct_node(_Args&& ...__args);
|
||||
#else
|
||||
__node_holder __construct_node(const __container_value_type& __v);
|
||||
#endif
|
||||
|
||||
void destroy(__node_pointer __nd) _NOEXCEPT;
|
||||
|
||||
@@ -1621,20 +1590,20 @@ __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_poin
|
||||
{
|
||||
if (__cache->__parent_ == nullptr)
|
||||
return nullptr;
|
||||
if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
|
||||
if (_VSTD::__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
|
||||
{
|
||||
__cache->__parent_->__left_ = nullptr;
|
||||
__cache = static_cast<__node_pointer>(__cache->__parent_);
|
||||
if (__cache->__right_ == nullptr)
|
||||
return __cache;
|
||||
return static_cast<__node_pointer>(__tree_leaf(__cache->__right_));
|
||||
return static_cast<__node_pointer>(_VSTD::__tree_leaf(__cache->__right_));
|
||||
}
|
||||
// __cache is right child
|
||||
__cache->__parent_unsafe()->__right_ = nullptr;
|
||||
__cache = static_cast<__node_pointer>(__cache->__parent_);
|
||||
if (__cache->__left_ == nullptr)
|
||||
return __cache;
|
||||
return static_cast<__node_pointer>(__tree_leaf(__cache->__left_));
|
||||
return static_cast<__node_pointer>(_VSTD::__tree_leaf(__cache->__left_));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1706,8 +1675,6 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
__begin_node() = __end_node();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
@@ -1814,8 +1781,6 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::~__tree()
|
||||
{
|
||||
@@ -1854,7 +1819,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||
using _VSTD::swap;
|
||||
swap(__begin_node_, __t.__begin_node_);
|
||||
swap(__pair1_.first(), __t.__pair1_.first());
|
||||
__swap_allocator(__node_alloc(), __t.__node_alloc());
|
||||
_VSTD::__swap_allocator(__node_alloc(), __t.__node_alloc());
|
||||
__pair3_.swap(__t.__pair3_);
|
||||
if (size() == 0)
|
||||
__begin_node() = __end_node();
|
||||
@@ -2113,21 +2078,14 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
|
||||
__child = __new_node;
|
||||
if (__begin_node()->__left_ != nullptr)
|
||||
__begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_);
|
||||
__tree_balance_after_insert(__end_node()->__left_, __child);
|
||||
_VSTD::__tree_balance_after_insert(__end_node()->__left_, __child);
|
||||
++size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class... _Args>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
|
||||
#else
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class _Args>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args& __args)
|
||||
#endif
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__parent, __k);
|
||||
@@ -2135,11 +2093,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A
|
||||
bool __inserted = false;
|
||||
if (__child == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
__node_holder __h = __construct_node(__args);
|
||||
#endif
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
__r = __h.release();
|
||||
__inserted = true;
|
||||
@@ -2147,41 +2101,27 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A
|
||||
return pair<iterator, bool>(iterator(__r), __inserted);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class... _Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
|
||||
const_iterator __p, _Key const& __k, _Args&&... __args)
|
||||
#else
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class _Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
|
||||
const_iterator __p, _Key const& __k, _Args& __args)
|
||||
#endif
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer __dummy;
|
||||
__node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
bool __inserted = false;
|
||||
if (__child == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
__node_holder __h = __construct_node(__args);
|
||||
#endif
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
__r = __h.release();
|
||||
__inserted = true;
|
||||
}
|
||||
return iterator(__r);
|
||||
return pair<iterator, bool>(iterator(__r), __inserted);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class ..._Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
@@ -2259,46 +2199,6 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||
}
|
||||
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(const __container_value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const __container_value_type& __v)
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__v));
|
||||
__node_holder __h = __construct_node(__v);
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
return iterator(__h.release());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const __container_value_type& __v)
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__v));
|
||||
__node_holder __h = __construct_node(__v);
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
return iterator(__h.release());
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd)
|
||||
@@ -2348,8 +2248,8 @@ __tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _
|
||||
if (__begin_node() == __ptr)
|
||||
__begin_node() = __r.__ptr_;
|
||||
--size();
|
||||
__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__ptr));
|
||||
_VSTD::__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__ptr));
|
||||
return __r;
|
||||
}
|
||||
|
||||
@@ -2727,7 +2627,7 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
||||
return _Pp(iterator(__rt),
|
||||
iterator(
|
||||
__rt->__right_ != nullptr ?
|
||||
static_cast<__iter_pointer>(__tree_min(__rt->__right_))
|
||||
static_cast<__iter_pointer>(_VSTD::__tree_min(__rt->__right_))
|
||||
: __result));
|
||||
}
|
||||
return _Pp(iterator(__result), iterator(__result));
|
||||
@@ -2755,7 +2655,7 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
||||
return _Pp(const_iterator(__rt),
|
||||
const_iterator(
|
||||
__rt->__right_ != nullptr ?
|
||||
static_cast<__iter_pointer>(__tree_min(__rt->__right_))
|
||||
static_cast<__iter_pointer>(_VSTD::__tree_min(__rt->__right_))
|
||||
: __result));
|
||||
}
|
||||
return _Pp(const_iterator(__result), const_iterator(__result));
|
||||
@@ -2824,8 +2724,8 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
||||
__begin_node() = static_cast<__iter_pointer>(__np->__parent_);
|
||||
}
|
||||
--size();
|
||||
__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__np));
|
||||
_VSTD::__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__np));
|
||||
return __node_holder(__np, _Dp(__node_alloc(), true));
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,8 +81,8 @@ namespace std {
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <__availability>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
#include <cstdlib>
|
||||
@@ -157,7 +157,7 @@ namespace __any_imp
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr const void* __get_fallback_typeid() {
|
||||
return &__unique_typeinfo<decay_t<_Tp>>::__id;
|
||||
return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@@ -368,7 +368,11 @@ namespace __any_imp
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
_Tp* __ret = ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
_Alloc __a;
|
||||
_Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s.__buf));
|
||||
_ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...);
|
||||
__dest.__h = &_SmallHandler::__handle;
|
||||
return *__ret;
|
||||
}
|
||||
@@ -376,8 +380,11 @@ namespace __any_imp
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __destroy(any & __this) {
|
||||
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
||||
__value.~_Tp();
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
_Alloc __a;
|
||||
_Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
||||
_ATraits::destroy(__a, __p);
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
@@ -445,10 +452,12 @@ namespace __any_imp
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
typedef __allocator_destructor<_Alloc> _Dp;
|
||||
_Alloc __a;
|
||||
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
_Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
|
||||
_Tp * __ret = __hold.get();
|
||||
_ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...);
|
||||
__dest.__s.__ptr = __hold.release();
|
||||
__dest.__h = &_LargeHandler::__handle;
|
||||
return *__ret;
|
||||
@@ -458,7 +467,12 @@ namespace __any_imp
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __destroy(any & __this){
|
||||
delete static_cast<_Tp*>(__this.__s.__ptr);
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
_Alloc __a;
|
||||
_Tp * __p = static_cast<_Tp *>(__this.__s.__ptr);
|
||||
_ATraits::destroy(__a, __p);
|
||||
_ATraits::deallocate(__a, __p, 1);
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +142,8 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_Tp __elems_[_Size];
|
||||
|
||||
@@ -155,7 +155,7 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
|
||||
std::swap_ranges(data(), data() + _Size, __a.data());
|
||||
_VSTD::swap_ranges(data(), data() + _Size, __a.data());
|
||||
}
|
||||
|
||||
// iterators:
|
||||
@@ -245,8 +245,8 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename conditional<is_const<_Tp>::value, const char,
|
||||
char>::type _CharType;
|
||||
@@ -459,8 +459,6 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
return __a.__elems_[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
@@ -479,8 +477,6 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
return _VSTD::move(__a.__elems_[_Ip]);
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
template <typename _Tp, size_t _Size, size_t... _Index>
|
||||
@@ -504,7 +500,7 @@ to_array(_Tp (&__arr)[_Size]) noexcept(is_nothrow_constructible_v<_Tp, _Tp&>) {
|
||||
static_assert(
|
||||
is_constructible_v<_Tp, _Tp&>,
|
||||
"[array.creation]/1: to_array requires copy constructible elements.");
|
||||
return __to_array_lvalue_impl(__arr, make_index_sequence<_Size>());
|
||||
return _VSTD::__to_array_lvalue_impl(__arr, make_index_sequence<_Size>());
|
||||
}
|
||||
|
||||
template <typename _Tp, size_t _Size>
|
||||
@@ -516,8 +512,8 @@ to_array(_Tp(&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
|
||||
static_assert(
|
||||
is_move_constructible_v<_Tp>,
|
||||
"[array.creation]/4: to_array requires move constructible elements.");
|
||||
return __to_array_rvalue_impl(_VSTD::move(__arr),
|
||||
make_index_sequence<_Size>());
|
||||
return _VSTD::__to_array_rvalue_impl(_VSTD::move(__arr),
|
||||
make_index_sequence<_Size>());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
namespace std
|
||||
{
|
||||
|
||||
// feature test macro
|
||||
// feature test macro [version.syn]
|
||||
|
||||
#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10
|
||||
#define __cpp_lib_atomic_is_always_lock_free
|
||||
#define __cpp_lib_atomic_flag_test
|
||||
#define __cpp_lib_atomic_lock_free_type_aliases
|
||||
#define __cpp_lib_atomic_wait
|
||||
|
||||
// order and consistency
|
||||
|
||||
@@ -45,6 +48,7 @@ template <class T> T kill_dependency(T y) noexcept;
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE unspecified
|
||||
#define ATOMIC_CHAR_LOCK_FREE unspecified
|
||||
#define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE unspecified
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE unspecified
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE unspecified
|
||||
@@ -108,6 +112,7 @@ template <>
|
||||
struct atomic<integral>
|
||||
{
|
||||
using value_type = integral;
|
||||
using difference_type = value_type;
|
||||
|
||||
static constexpr bool is_always_lock_free;
|
||||
bool is_lock_free() const volatile noexcept;
|
||||
@@ -190,6 +195,7 @@ template <class T>
|
||||
struct atomic<T*>
|
||||
{
|
||||
using value_type = T*;
|
||||
using difference_type = ptrdiff_t;
|
||||
|
||||
static constexpr bool is_always_lock_free;
|
||||
bool is_lock_free() const volatile noexcept;
|
||||
@@ -460,6 +466,7 @@ typedef atomic<long> atomic_long;
|
||||
typedef atomic<unsigned long> atomic_ulong;
|
||||
typedef atomic<long long> atomic_llong;
|
||||
typedef atomic<unsigned long long> atomic_ullong;
|
||||
typedef atomic<char8_t> atomic_char8_t; // C++20
|
||||
typedef atomic<char16_t> atomic_char16_t;
|
||||
typedef atomic<char32_t> atomic_char32_t;
|
||||
typedef atomic<wchar_t> atomic_wchar_t;
|
||||
@@ -477,7 +484,7 @@ typedef atomic<int_fast8_t> atomic_int_fast8_t;
|
||||
typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
|
||||
typedef atomic<int_fast16_t> atomic_int_fast16_t;
|
||||
typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
|
||||
typedef atomic<int_fast32_t> atomic_int_fast32_t;
|
||||
typedef atomic<int_fast32_t> atomic_int_fast32_t;
|
||||
typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
|
||||
typedef atomic<int_fast64_t> atomic_int_fast64_t;
|
||||
typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
|
||||
@@ -568,6 +575,7 @@ template <class T>
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__threading_support>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -654,7 +662,7 @@ typedef enum memory_order {
|
||||
|
||||
template <typename _Tp> _LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
|
||||
return memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0;
|
||||
return _VSTD::memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0;
|
||||
}
|
||||
|
||||
static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
|
||||
@@ -1119,6 +1127,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
|
||||
#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
|
||||
# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
|
||||
# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
|
||||
#endif
|
||||
# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
@@ -1130,6 +1141,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
|
||||
#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
|
||||
# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
|
||||
#endif
|
||||
# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
@@ -1245,10 +1259,10 @@ template <typename _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
_Tp __temp;
|
||||
__a->__lock();
|
||||
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
|
||||
bool __ret = __temp == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__cxx_atomic_assign_volatile(__a->__a_value, __value);
|
||||
else
|
||||
@@ -1261,11 +1275,11 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
bool __ret = __a->__a_value == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__a->__a_value = __value;
|
||||
_VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
|
||||
else
|
||||
*__expected = __a->__a_value;
|
||||
_VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
|
||||
__a->__unlock();
|
||||
return __ret;
|
||||
}
|
||||
@@ -1274,10 +1288,10 @@ template <typename _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
_Tp __temp;
|
||||
__a->__lock();
|
||||
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
|
||||
bool __ret = __temp == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__cxx_atomic_assign_volatile(__a->__a_value, __value);
|
||||
else
|
||||
@@ -1290,11 +1304,11 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
bool __ret = __a->__a_value == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__a->__a_value = __value;
|
||||
_VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
|
||||
else
|
||||
*__expected = __a->__a_value;
|
||||
_VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
|
||||
__a->__unlock();
|
||||
return __ret;
|
||||
}
|
||||
@@ -1444,6 +1458,9 @@ template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC
|
||||
template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
template<> struct __cxx_is_always_lock_free<char8_t> { enum { __value = 2 == ATOMIC_CHAR8_T_LOCK_FREE }; };
|
||||
#endif
|
||||
template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
|
||||
@@ -1486,8 +1503,6 @@ struct __cxx_atomic_impl : public _Base {
|
||||
using __cxx_contention_t = int64_t;
|
||||
#endif //__linux__
|
||||
|
||||
#if _LIBCPP_STD_VER >= 11
|
||||
|
||||
using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PLATFORM_WAIT
|
||||
@@ -1519,7 +1534,7 @@ struct __libcpp_atomic_wait_backoff_impl {
|
||||
else if(__elapsed > chrono::microseconds(4))
|
||||
__libcpp_thread_yield();
|
||||
else
|
||||
; // poll
|
||||
{} // poll
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -1565,8 +1580,6 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, mem
|
||||
return __cxx_atomic_wait(__a, __test_fn);
|
||||
}
|
||||
|
||||
#endif //_LIBCPP_STD_VER >= 11
|
||||
|
||||
// general atomic<T>
|
||||
|
||||
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
|
||||
@@ -1775,6 +1788,7 @@ struct atomic
|
||||
{
|
||||
typedef __atomic_base<_Tp> __base;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type difference_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic() _NOEXCEPT _LIBCPP_DEFAULT
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1796,6 +1810,7 @@ struct atomic<_Tp*>
|
||||
{
|
||||
typedef __atomic_base<_Tp*> __base;
|
||||
typedef _Tp* value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic() _NOEXCEPT _LIBCPP_DEFAULT
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1872,7 +1887,7 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__cxx_atomic_init(&__o->__a_, __d);
|
||||
}
|
||||
@@ -1880,7 +1895,7 @@ atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__cxx_atomic_init(&__o->__a_, __d);
|
||||
}
|
||||
@@ -1890,7 +1905,7 @@ atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__o->store(__d);
|
||||
}
|
||||
@@ -1898,7 +1913,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__o->store(__d);
|
||||
}
|
||||
@@ -1908,7 +1923,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
@@ -1917,7 +1932,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
@@ -1966,7 +1981,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d);
|
||||
}
|
||||
@@ -1974,7 +1989,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d);
|
||||
}
|
||||
@@ -1984,7 +1999,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d, __m);
|
||||
}
|
||||
@@ -1992,7 +2007,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d, __m);
|
||||
}
|
||||
@@ -2002,7 +2017,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d);
|
||||
}
|
||||
@@ -2010,7 +2025,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d);
|
||||
}
|
||||
@@ -2020,7 +2035,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d);
|
||||
}
|
||||
@@ -2028,7 +2043,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d);
|
||||
}
|
||||
@@ -2038,8 +2053,8 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
|
||||
typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@@ -2049,7 +2064,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
|
||||
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@@ -2062,7 +2077,7 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
||||
_Tp* __e, _Tp __d,
|
||||
typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@@ -2072,8 +2087,8 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
|
||||
typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@@ -2156,10 +2171,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@@ -2168,10 +2183,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@@ -2179,7 +2194,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_add(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@@ -2187,7 +2202,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_add(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@@ -2198,10 +2213,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@@ -2210,10 +2225,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@@ -2221,8 +2236,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@@ -2230,7 +2244,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@@ -2241,10 +2255,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@@ -2253,10 +2267,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@@ -2264,7 +2278,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_sub(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@@ -2272,7 +2286,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_sub(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@@ -2283,10 +2297,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@@ -2295,10 +2309,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@@ -2306,8 +2320,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@@ -2315,7 +2328,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@@ -2329,7 +2342,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op);
|
||||
}
|
||||
@@ -2341,7 +2354,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op);
|
||||
}
|
||||
@@ -2355,7 +2368,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op, __m);
|
||||
}
|
||||
@@ -2367,7 +2380,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op, __m);
|
||||
}
|
||||
@@ -2381,7 +2394,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op);
|
||||
}
|
||||
@@ -2393,7 +2406,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op);
|
||||
}
|
||||
@@ -2407,7 +2420,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op, __m);
|
||||
}
|
||||
@@ -2419,7 +2432,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op, __m);
|
||||
}
|
||||
@@ -2433,7 +2446,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op);
|
||||
}
|
||||
@@ -2445,7 +2458,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op);
|
||||
}
|
||||
@@ -2459,7 +2472,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op, __m);
|
||||
}
|
||||
@@ -2471,7 +2484,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op, __m);
|
||||
}
|
||||
@@ -2715,6 +2728,9 @@ typedef atomic<long> atomic_long;
|
||||
typedef atomic<unsigned long> atomic_ulong;
|
||||
typedef atomic<long long> atomic_llong;
|
||||
typedef atomic<unsigned long long> atomic_ullong;
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
typedef atomic<char8_t> atomic_char8_t;
|
||||
#endif
|
||||
typedef atomic<char16_t> atomic_char16_t;
|
||||
typedef atomic<char32_t> atomic_char32_t;
|
||||
typedef atomic<wchar_t> atomic_wchar_t;
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace std
|
||||
public:
|
||||
using arrival_token = see below;
|
||||
|
||||
static constexpr ptrdiff_t max() noexcept;
|
||||
|
||||
constexpr explicit barrier(ptrdiff_t phase_count,
|
||||
CompletionFunction f = CompletionFunction());
|
||||
~barrier();
|
||||
@@ -44,6 +46,7 @@ namespace std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <atomic>
|
||||
#ifndef _LIBCPP_HAS_NO_TREE_BARRIER
|
||||
# include <memory>
|
||||
@@ -57,6 +60,9 @@ namespace std
|
||||
# error <barrier> is not supported on this single threaded system
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@@ -287,7 +293,7 @@ public:
|
||||
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
|
||||
barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
|
||||
: __b(__count, std::move(__completion)) {
|
||||
: __b(__count, _VSTD::move(__completion)) {
|
||||
}
|
||||
|
||||
barrier(barrier const&) = delete;
|
||||
@@ -301,7 +307,7 @@ public:
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
|
||||
void wait(arrival_token&& __phase) const
|
||||
{
|
||||
__b.wait(std::move(__phase));
|
||||
__b.wait(_VSTD::move(__phase));
|
||||
}
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
|
||||
void arrive_and_wait()
|
||||
@@ -319,4 +325,6 @@ _LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif //_LIBCPP_BARRIER
|
||||
|
||||
@@ -17,13 +17,13 @@ namespace std {
|
||||
|
||||
// [bit.pow.two], integral powers of 2
|
||||
template <class T>
|
||||
constexpr bool ispow2(T x) noexcept; // C++20
|
||||
constexpr bool has_single_bit(T x) noexcept; // C++20
|
||||
template <class T>
|
||||
constexpr T ceil2(T x); // C++20
|
||||
constexpr T bit_ceil(T x); // C++20
|
||||
template <class T>
|
||||
constexpr T floor2(T x) noexcept; // C++20
|
||||
constexpr T bit_floor(T x) noexcept; // C++20
|
||||
template <class T>
|
||||
constexpr T log2p1(T x) noexcept; // C++20
|
||||
constexpr T bit_width(T x) noexcept; // C++20
|
||||
|
||||
// [bit.rotate], rotating
|
||||
template<class T>
|
||||
@@ -55,13 +55,14 @@ namespace std {
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__bits>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <version>
|
||||
#include <__debug>
|
||||
|
||||
#if defined(__IBMCPP__)
|
||||
#include "support/ibm/support.h"
|
||||
#include "__support/ibm/support.h"
|
||||
#endif
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
#include <intrin.h>
|
||||
@@ -76,122 +77,6 @@ _LIBCPP_PUSH_MACROS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
|
||||
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
|
||||
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
|
||||
|
||||
#else // _LIBCPP_COMPILER_MSVC
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_ctz(unsigned __x) {
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
unsigned long __where;
|
||||
if (_BitScanForward(&__where, __x))
|
||||
return static_cast<int>(__where);
|
||||
return 32;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_ctz(unsigned long __x) {
|
||||
static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
|
||||
return __ctz(static_cast<unsigned>(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_ctz(unsigned long long __x) {
|
||||
unsigned long __where;
|
||||
#if defined(_LIBCPP_HAS_BITSCAN64)
|
||||
(defined(_M_AMD64) || defined(__x86_64__))
|
||||
if (_BitScanForward64(&__where, __x))
|
||||
return static_cast<int>(__where);
|
||||
#else
|
||||
// Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
|
||||
if (_BitScanForward(&__where, static_cast<unsigned long>(__x)))
|
||||
return static_cast<int>(__where);
|
||||
if (_BitScanForward(&__where, static_cast<unsigned long>(__x >> 32)))
|
||||
return static_cast<int>(__where + 32);
|
||||
#endif
|
||||
return 64;
|
||||
}
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_clz(unsigned __x) {
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
unsigned long __where;
|
||||
if (_BitScanReverse(&__where, __x))
|
||||
return static_cast<int>(31 - __where);
|
||||
return 32; // Undefined Behavior.
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_clz(unsigned long __x) {
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
return __libcpp_clz(static_cast<unsigned>(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_clz(unsigned long long __x) {
|
||||
unsigned long __where;
|
||||
#if defined(_LIBCPP_HAS_BITSCAN64)
|
||||
if (_BitScanReverse64(&__where, __x))
|
||||
return static_cast<int>(63 - __where);
|
||||
#else
|
||||
// Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls.
|
||||
if (_BitScanReverse(&__where, static_cast<unsigned long>(__x >> 32)))
|
||||
return static_cast<int>(63 - (__where + 32));
|
||||
if (_BitScanReverse(&__where, static_cast<unsigned long>(__x)))
|
||||
return static_cast<int>(63 - __where);
|
||||
#endif
|
||||
return 64; // Undefined Behavior.
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) {
|
||||
static_assert(sizeof(unsigned) == 4, "");
|
||||
return __popcnt(__x);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) {
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
return __popcnt(__x);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) {
|
||||
static_assert(sizeof(unsigned long long) == 8, "");
|
||||
return __popcnt64(__x);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_COMPILER_MSVC
|
||||
|
||||
template <class _Tp>
|
||||
using __bitop_unsigned_integer _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
|
||||
@@ -343,14 +228,14 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
unsigned __bit_log2(_Tp __t) _NOEXCEPT
|
||||
{
|
||||
static_assert(__bitop_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned");
|
||||
return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
|
||||
return numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool __ispow2(_Tp __t) _NOEXCEPT
|
||||
bool __has_single_bit(_Tp __t) _NOEXCEPT
|
||||
{
|
||||
static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
|
||||
static_assert(__bitop_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned");
|
||||
return __t != 0 && (((__t & (__t - 1)) == 0));
|
||||
}
|
||||
|
||||
@@ -399,7 +284,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
|
||||
countr_zero(_Tp __t) noexcept
|
||||
{
|
||||
return __countr_zero(__t);
|
||||
return __countr_zero(__t);
|
||||
}
|
||||
|
||||
|
||||
@@ -424,15 +309,15 @@ popcount(_Tp __t) noexcept
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool>
|
||||
ispow2(_Tp __t) noexcept
|
||||
has_single_bit(_Tp __t) noexcept
|
||||
{
|
||||
return __ispow2(__t);
|
||||
return __has_single_bit(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
|
||||
floor2(_Tp __t) noexcept
|
||||
bit_floor(_Tp __t) noexcept
|
||||
{
|
||||
return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t);
|
||||
}
|
||||
@@ -440,11 +325,11 @@ floor2(_Tp __t) noexcept
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
|
||||
ceil2(_Tp __t) noexcept
|
||||
bit_ceil(_Tp __t) noexcept
|
||||
{
|
||||
if (__t < 2) return 1;
|
||||
const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u));
|
||||
_LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2");
|
||||
_LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil");
|
||||
|
||||
if constexpr (sizeof(_Tp) >= sizeof(unsigned))
|
||||
return _Tp{1} << __n;
|
||||
@@ -459,12 +344,11 @@ ceil2(_Tp __t) noexcept
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
|
||||
log2p1(_Tp __t) noexcept
|
||||
bit_width(_Tp __t) noexcept
|
||||
{
|
||||
return __t == 0 ? 0 : __bit_log2(__t) + 1;
|
||||
}
|
||||
|
||||
|
||||
enum class endian
|
||||
{
|
||||
little = 0xDEAD,
|
||||
|
||||
@@ -380,7 +380,7 @@ unsigned long long
|
||||
__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
|
||||
{
|
||||
unsigned long long __r = __first_[0];
|
||||
for (std::size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
|
||||
for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
|
||||
__r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
|
||||
return __r;
|
||||
}
|
||||
@@ -625,13 +625,13 @@ protected:
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||
{return reference(0, 1);}
|
||||
{return reference(nullptr, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
|
||||
{return const_reference(0, 1);}
|
||||
{return const_reference(nullptr, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
|
||||
{return iterator(0, 0);}
|
||||
{return iterator(nullptr, 0);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
|
||||
{return const_iterator(0, 0);}
|
||||
{return const_iterator(nullptr, 0);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
|
||||
@@ -990,7 +990,7 @@ inline
|
||||
size_t
|
||||
bitset<_Size>::count() const _NOEXCEPT
|
||||
{
|
||||
return static_cast<size_t>(__count_bool_true(base::__make_iter(0), _Size));
|
||||
return static_cast<size_t>(_VSTD::__count_bool_true(base::__make_iter(0), _Size));
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
|
||||
@@ -74,12 +74,13 @@ namespace std {
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__errc>
|
||||
#include <type_traits>
|
||||
#include <cmath> // for log2f
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
@@ -206,7 +207,7 @@ __mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r)
|
||||
{
|
||||
auto __c = __a * __b;
|
||||
__r = __c;
|
||||
return __c > (numeric_limits<unsigned char>::max)();
|
||||
return __c > numeric_limits<unsigned char>::max();
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@@ -215,7 +216,7 @@ __mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r)
|
||||
{
|
||||
auto __c = __a * __b;
|
||||
__r = __c;
|
||||
return __c > (numeric_limits<unsigned short>::max)();
|
||||
return __c > numeric_limits<unsigned short>::max();
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@@ -226,7 +227,7 @@ __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r)
|
||||
#if !defined(_LIBCPP_COMPILER_MSVC)
|
||||
return __builtin_mul_overflow(__a, __b, &__r);
|
||||
#else
|
||||
bool __did = __b && ((numeric_limits<_Tp>::max)() / __b) < __a;
|
||||
bool __did = __b && (numeric_limits<_Tp>::max() / __b) < __a;
|
||||
__r = __a * __b;
|
||||
return __did;
|
||||
#endif
|
||||
@@ -332,7 +333,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
|
||||
auto __len = __p - __buf;
|
||||
if (__len <= __diff)
|
||||
{
|
||||
memcpy(__first, __buf, __len);
|
||||
_VSTD::memcpy(__first, __buf, __len);
|
||||
return {__first + __len, {}};
|
||||
}
|
||||
else
|
||||
@@ -381,7 +382,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
|
||||
return {__last, errc::value_too_large};
|
||||
else
|
||||
{
|
||||
memmove(__first, __p, __len);
|
||||
_VSTD::memmove(__first, __p, __len);
|
||||
return {__first + __len, {}};
|
||||
}
|
||||
}
|
||||
@@ -428,13 +429,13 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
|
||||
if (__x <= __complement(__to_unsigned(__tl::min())))
|
||||
{
|
||||
__x = __complement(__x);
|
||||
memcpy(&__value, &__x, sizeof(__x));
|
||||
_VSTD::memcpy(&__value, &__x, sizeof(__x));
|
||||
return __r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__x <= (__tl::max)())
|
||||
if (__x <= __tl::max())
|
||||
{
|
||||
__value = __x;
|
||||
return __r;
|
||||
@@ -525,7 +526,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
|
||||
auto __p = __tx::__read(__first, __last, __a, __b);
|
||||
if (__p == __last || !__in_pattern(*__p))
|
||||
{
|
||||
__output_type __m = (numeric_limits<_Tp>::max)();
|
||||
__output_type __m = numeric_limits<_Tp>::max();
|
||||
if (__m >= __a && __m - __a >= __b)
|
||||
{
|
||||
__value = __a + __b;
|
||||
@@ -580,7 +581,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
|
||||
|
||||
if (__p == __last || !__in_pattern(*__p, __base))
|
||||
{
|
||||
if ((__tl::max)() - __a >= __b)
|
||||
if (__tl::max() - __a >= __b)
|
||||
{
|
||||
__value = __a + __b;
|
||||
return {__p, {}};
|
||||
|
||||
@@ -824,6 +824,7 @@ constexpr chrono::year operator ""y(unsigned lo
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <ctime>
|
||||
#include <type_traits>
|
||||
#include <ratio>
|
||||
@@ -1076,7 +1077,7 @@ public:
|
||||
is_convertible<_Rep2, rep>::value &&
|
||||
(treat_as_floating_point<rep>::value ||
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
>::type* = nullptr)
|
||||
: __rep_(__r) {}
|
||||
|
||||
// conversions
|
||||
@@ -1089,7 +1090,7 @@ public:
|
||||
treat_as_floating_point<rep>::value ||
|
||||
(__no_overflow<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value))
|
||||
>::type* = 0)
|
||||
>::type* = nullptr)
|
||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
|
||||
// observer
|
||||
@@ -1375,7 +1376,7 @@ public:
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Duration2, duration>::value
|
||||
>::type* = 0)
|
||||
>::type* = nullptr)
|
||||
: __d_(t.time_since_epoch()) {}
|
||||
|
||||
// observer
|
||||
|
||||
@@ -660,8 +660,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
|
||||
template <class _IntT, class _RealT>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
|
||||
using _Lim = std::numeric_limits<_IntT>;
|
||||
const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>();
|
||||
using _Lim = numeric_limits<_IntT>;
|
||||
const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>();
|
||||
if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) {
|
||||
return _Lim::max();
|
||||
} else if (__r <= _Lim::lowest()) {
|
||||
|
||||
@@ -109,6 +109,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@@ -125,6 +126,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -144,6 +147,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@@ -160,6 +164,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -267,6 +273,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@@ -283,6 +290,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -302,6 +311,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@@ -318,6 +328,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -337,6 +349,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@@ -353,6 +366,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -372,6 +387,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@@ -388,6 +404,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -460,6 +478,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@@ -476,6 +495,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@@ -495,6 +516,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@@ -511,6 +533,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
|
||||
@@ -154,8 +154,13 @@ enum class _LIBCPP_ENUM_VIS _NCmpResult : signed char {
|
||||
__unordered = -127
|
||||
};
|
||||
|
||||
struct _CmpUnspecifiedType;
|
||||
using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)();
|
||||
struct _CmpUnspecifiedParam {
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEVAL
|
||||
_CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
|
||||
|
||||
template<typename _Tp, typename = _VSTD::enable_if_t<!_VSTD::is_same_v<_Tp, int>>>
|
||||
_CmpUnspecifiedParam(_Tp) = delete;
|
||||
};
|
||||
|
||||
class weak_equality {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -696,8 +701,8 @@ constexpr _ClassifyCompCategory __type_to_enum() noexcept {
|
||||
|
||||
template <size_t _Size>
|
||||
constexpr _ClassifyCompCategory
|
||||
__compute_comp_type(std::array<_ClassifyCompCategory, _Size> __types) {
|
||||
std::array<int, _CCC_Size> __seen = {};
|
||||
__compute_comp_type(array<_ClassifyCompCategory, _Size> __types) {
|
||||
array<int, _CCC_Size> __seen = {};
|
||||
for (auto __type : __types)
|
||||
++__seen[__type];
|
||||
if (__seen[_None])
|
||||
|
||||
@@ -227,14 +227,6 @@ template<class T> complex<T> sqrt (const complex<T>&);
|
||||
template<class T> complex<T> tan (const complex<T>&);
|
||||
template<class T> complex<T> tanh (const complex<T>&);
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_istream<charT, traits>&
|
||||
operator>>(basic_istream<charT, traits>& is, complex<T>& x);
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
@@ -244,9 +236,12 @@ template<class T, class charT, class traits>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
#include <iosfwd>
|
||||
#include <sstream>
|
||||
#include <version>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
# include <sstream> // for std::basic_ostringstream
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@@ -955,7 +950,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
complex<_Tp>
|
||||
proj(const complex<_Tp>& __c)
|
||||
{
|
||||
std::complex<_Tp> __r = __c;
|
||||
complex<_Tp> __r = __c;
|
||||
if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
|
||||
__r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
|
||||
return __r;
|
||||
@@ -1438,6 +1433,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
|
||||
return __is;
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
template<class _Tp, class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
||||
@@ -1449,6 +1445,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
||||
__s << '(' << __x.real() << ',' << __x.imag() << ')';
|
||||
return __os << __s.str();
|
||||
}
|
||||
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
// Literal suffix for complex number literals [complex.literals]
|
||||
|
||||
@@ -157,6 +157,11 @@ concept __same_as_impl = _VSTD::_IsSame<_Tp, _Up>::value;
|
||||
template<class _Tp, class _Up>
|
||||
concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
|
||||
|
||||
// [concept.destructible]
|
||||
|
||||
template<class _Tp>
|
||||
concept destructible = _VSTD::is_nothrow_destructible_v<_Tp>;
|
||||
|
||||
#endif //_LIBCPP_STD_VER > 17 && defined(__cpp_concepts) && __cpp_concepts >= 201811L
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -52,6 +52,20 @@ int timespec_get( struct timespec *ts, int base); // C++17
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// FIXME:
|
||||
// Apple SDKs don't define ::timespec_get unconditionally in C++ mode. This
|
||||
// should be fixed in future SDKs, but for the time being we need to avoid
|
||||
// trying to use that declaration when the SDK doesn't provide it. Note that
|
||||
// we're detecting this here instead of in <__config> because we can't include
|
||||
// system headers from <__config>, since it leads to circular module dependencies.
|
||||
// This is also meant to be a very temporary workaround until the SDKs are fixed.
|
||||
#if defined(__APPLE__)
|
||||
# include <sys/cdefs.h>
|
||||
# if defined(_LIBCPP_HAS_TIMESPEC_GET) && (__DARWIN_C_LEVEL < __DARWIN_C_FULL)
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::clock_t;
|
||||
@@ -72,7 +86,7 @@ using ::gmtime;
|
||||
using ::localtime;
|
||||
#endif
|
||||
using ::strftime;
|
||||
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
|
||||
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) && !defined(_LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED)
|
||||
using ::timespec_get;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1237,7 +1237,7 @@ __deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
||||
__map_.swap(__c.__map_);
|
||||
_VSTD::swap(__start_, __c.__start_);
|
||||
_VSTD::swap(size(), __c.size());
|
||||
__swap_allocator(__alloc(), __c.__alloc());
|
||||
_VSTD::__swap_allocator(__alloc(), __c.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1393,7 +1393,7 @@ public:
|
||||
size_type size() const _NOEXCEPT {return __base::size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return std::min<size_type>(
|
||||
{return _VSTD::min<size_type>(
|
||||
__alloc_traits::max_size(__base::__alloc()),
|
||||
numeric_limits<difference_type>::max());}
|
||||
void resize(size_type __n);
|
||||
@@ -1586,7 +1586,7 @@ public:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
deque(_InputIterator, _InputIterator)
|
||||
@@ -2376,7 +2376,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
|
||||
for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
|
||||
_ConstructTransaction __tx(this, __br);
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
|
||||
__alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), *__f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2393,7 +2393,7 @@ deque<_Tp, _Allocator>::__append(size_type __n)
|
||||
for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
|
||||
_ConstructTransaction __tx(this, __br);
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
|
||||
__alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
|
||||
__alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2410,7 +2410,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
|
||||
for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
|
||||
_ConstructTransaction __tx(this, __br);
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
|
||||
__alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), __v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2708,7 +2708,7 @@ void
|
||||
deque<_Tp, _Allocator>::pop_front()
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
__alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() +
|
||||
__alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() +
|
||||
__base::__start_ / __base::__block_size) +
|
||||
__base::__start_ % __base::__block_size));
|
||||
--__base::size();
|
||||
@@ -2723,7 +2723,7 @@ deque<_Tp, _Allocator>::pop_back()
|
||||
_LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");
|
||||
allocator_type& __a = __base::__alloc();
|
||||
size_type __p = __base::size() + __base::__start_ - 1;
|
||||
__alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() +
|
||||
__alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() +
|
||||
__p / __base::__block_size) +
|
||||
__p % __base::__block_size));
|
||||
--__base::size();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user