mirror of https://github.com/libAthena/athena.git
Apply things learned from making hsh to atdna
This commit is contained in:
parent
aa07559839
commit
0a81594056
|
@ -142,8 +142,11 @@ endif()
|
||||||
# ATDNA target
|
# ATDNA target
|
||||||
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
||||||
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
||||||
set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS
|
target_compile_definitions(atdna PRIVATE
|
||||||
"INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR};__STDC_LIMIT_MACROS=1;__STDC_CONSTANT_MACROS=1")
|
INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR}
|
||||||
|
__STDC_LIMIT_MACROS=1
|
||||||
|
__STDC_CONSTANT_MACROS=1
|
||||||
|
ATDNA_ARGV0=${LLVM_ROOT_DIR}/bin/clang-tool)
|
||||||
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
|
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||||
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
|
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
@ -170,10 +173,8 @@ export(PACKAGE atdna)
|
||||||
|
|
||||||
# Create the atdnaConfig.cmake
|
# Create the atdnaConfig.cmake
|
||||||
# ... for the build tree
|
# ... for the build tree
|
||||||
set(CONF_CLANG_INCLUDE_DIR "${CLANG_INCLUDE_DIR}")
|
|
||||||
configure_file(atdnaConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/atdnaConfig.cmake" @ONLY)
|
configure_file(atdnaConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/atdnaConfig.cmake" @ONLY)
|
||||||
# ... for the install tree
|
# ... for the install tree
|
||||||
set(CONF_CLANG_INCLUDE_DIR "\${ATHENA_INCLUDE_DIR}/clang")
|
|
||||||
configure_file(atdnaConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atdnaConfig.cmake" @ONLY)
|
configure_file(atdnaConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atdnaConfig.cmake" @ONLY)
|
||||||
# ... for both
|
# ... for both
|
||||||
configure_file(atdnaConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/atdnaConfigVersion.cmake" @ONLY)
|
configure_file(atdnaConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/atdnaConfigVersion.cmake" @ONLY)
|
||||||
|
@ -193,8 +194,7 @@ install(EXPORT atdnaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
|
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
|
||||||
"-I${ATHENA_INCLUDE_DIR}" -isystem "${CLANG_INCLUDE_DIR}"
|
"-I${ATHENA_INCLUDE_DIR}" ${CMAKE_SOURCE_DIR}/test.hpp)
|
||||||
${CMAKE_SOURCE_DIR}/test.hpp)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ function(atdna out)
|
||||||
# Use Ninja's DEPFILE parser in cooperation with atdna
|
# Use Ninja's DEPFILE parser in cooperation with atdna
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d ${cdefcli} ${inccli}
|
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d ${cdefcli} ${inccli}
|
||||||
"-I${ATHENA_INCLUDE_DIR}" -isystem "@CONF_CLANG_INCLUDE_DIR@" ${ins}
|
"-I${ATHENA_INCLUDE_DIR}" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
@ -75,7 +75,7 @@ function(atdna out)
|
||||||
# Use CMake's built-in dependency scanner for makefile targets
|
# Use CMake's built-in dependency scanner for makefile targets
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out_rel} ${cdefcli} ${inccli}
|
ARGS ${extraargs} -o ${out_rel} ${cdefcli} ${inccli}
|
||||||
"-I${ATHENA_INCLUDE_DIR}" -isystem "@CONF_CLANG_INCLUDE_DIR@" ${ins}
|
"-I${ATHENA_INCLUDE_DIR}" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
COMMENT "Generating DNA ${out_rel}")
|
COMMENT "Generating DNA ${out_rel}")
|
||||||
|
|
|
@ -119,7 +119,7 @@ function(atdna out incdirs cdefs)
|
||||||
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
||||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
||||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
||||||
"-I${athena_SOURCE_DIR}/include" -isystem "${CLANG_INCLUDE_DIR}" ${ins}
|
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
@ -131,7 +131,7 @@ function(atdna out incdirs cdefs)
|
||||||
ARGS ${extraargs} -o ${out_rel}
|
ARGS ${extraargs} -o ${out_rel}
|
||||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
||||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
||||||
"-I${athena_SOURCE_DIR}/include" -isystem "${CLANG_INCLUDE_DIR}" ${ins}
|
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
COMMENT "Generating DNA ${out_rel}"
|
COMMENT "Generating DNA ${out_rel}"
|
||||||
|
|
|
@ -1243,17 +1243,13 @@ int main(int argc, const char** argv) {
|
||||||
llvm::cl::PrintHelpMessage();
|
llvm::cl::PrintHelpMessage();
|
||||||
|
|
||||||
std::vector<std::string> args = {
|
std::vector<std::string> args = {
|
||||||
"clang-tool",
|
XSTR(ATDNA_ARGV0),
|
||||||
#ifdef __linux__
|
|
||||||
"--gcc-toolchain=/usr",
|
|
||||||
#endif
|
|
||||||
"-fsyntax-only",
|
"-fsyntax-only",
|
||||||
"-std=c++1z",
|
"-std=c++2a",
|
||||||
"-D__atdna__=1",
|
"-D__atdna__=1",
|
||||||
"-Wno-expansion-to-defined",
|
"-Wno-expansion-to-defined",
|
||||||
"-Wno-nullability-completeness",
|
"-Wno-nullability-completeness",
|
||||||
"-Werror=shadow-field",
|
"-Werror=shadow-field",
|
||||||
"-I" XSTR(INSTALL_PREFIX) "/lib/clang/" CLANG_VERSION_STRING "/include",
|
|
||||||
"-I" XSTR(INSTALL_PREFIX) "/include/Athena",
|
"-I" XSTR(INSTALL_PREFIX) "/include/Athena",
|
||||||
};
|
};
|
||||||
for (int a = 1; a < argc; ++a) {
|
for (int a = 1; a < argc; ++a) {
|
||||||
|
|
|
@ -718,54 +718,78 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
__simd_reference operator++() && { return std::move(*this) = __ptr_->__get(__index_) + 1; }
|
__simd_reference operator++() && { return std::move(*this) = _Vp(*this) + 1; }
|
||||||
|
|
||||||
_Vp operator++(int) && {
|
_Vp operator++(int) && {
|
||||||
auto __val = __ptr_->__get(__index_);
|
auto __val = _Vp(*this);
|
||||||
__ptr_->__set(__index_, __val + 1);
|
__ptr_->__set(__index_, __val + 1);
|
||||||
return __val;
|
return __val;
|
||||||
}
|
}
|
||||||
|
|
||||||
__simd_reference operator--() && { return std::move(*this) = __ptr_->__get(__index_) - 1; }
|
__simd_reference operator--() && { return std::move(*this) = _Vp(*this) - 1; }
|
||||||
|
|
||||||
_Vp operator--(int) && {
|
_Vp operator--(int) && {
|
||||||
auto __val = __ptr_->__get(__index_);
|
auto __val = _Vp(*this);
|
||||||
__ptr_->__set(__index_, __val - 1);
|
__ptr_->__set(__index_, __val - 1);
|
||||||
return __val;
|
return __val;
|
||||||
}
|
}
|
||||||
|
|
||||||
__simd_reference operator+=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) + __value; }
|
__simd_reference operator+=(_Vp __value) && { return std::move(*this) = _Vp(*this) + __value; }
|
||||||
|
|
||||||
__simd_reference operator-=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) - __value; }
|
__simd_reference operator-=(_Vp __value) && { return std::move(*this) = _Vp(*this) - __value; }
|
||||||
|
|
||||||
__simd_reference operator*=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) * __value; }
|
__simd_reference operator*=(_Vp __value) && { return std::move(*this) = _Vp(*this) * __value; }
|
||||||
|
|
||||||
__simd_reference operator/=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) / __value; }
|
__simd_reference operator/=(_Vp __value) && { return std::move(*this) = _Vp(*this) / __value; }
|
||||||
|
|
||||||
__simd_reference operator%=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) % __value; }
|
__simd_reference operator%=(_Vp __value) && { return std::move(*this) = _Vp(*this) % __value; }
|
||||||
|
|
||||||
__simd_reference operator>>=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) >> __value; }
|
__simd_reference operator>>=(_Vp __value) && { return std::move(*this) = _Vp(*this) >> __value; }
|
||||||
|
|
||||||
__simd_reference operator<<=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) << __value; }
|
__simd_reference operator<<=(_Vp __value) && { return std::move(*this) = _Vp(*this) << __value; }
|
||||||
|
|
||||||
__simd_reference operator&=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) & __value; }
|
__simd_reference operator&=(_Vp __value) && { return std::move(*this) = _Vp(*this) & __value; }
|
||||||
|
|
||||||
__simd_reference operator|=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) | __value; }
|
__simd_reference operator|=(_Vp __value) && { return std::move(*this) = _Vp(*this) | __value; }
|
||||||
|
|
||||||
__simd_reference operator^=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) ^ __value; }
|
__simd_reference operator^=(_Vp __value) && { return std::move(*this) = _Vp(*this) ^ __value; }
|
||||||
|
|
||||||
bool operator<(_Vp __value) const { return __ptr_->__get(__index_) < __value; }
|
bool operator<(const __simd_reference& __value) const { return _Vp(*this) < _Vp(__value); }
|
||||||
|
|
||||||
bool operator<=(_Vp __value) const { return __ptr_->__get(__index_) <= __value; }
|
bool operator<=(const __simd_reference& __value) const { return _Vp(*this) <= _Vp(__value); }
|
||||||
|
|
||||||
bool operator>(_Vp __value) const { return __ptr_->__get(__index_) > __value; }
|
bool operator>(const __simd_reference& __value) const { return _Vp(*this) > _Vp(__value); }
|
||||||
|
|
||||||
bool operator>=(_Vp __value) const { return __ptr_->__get(__index_) >= __value; }
|
bool operator>=(const __simd_reference& __value) const { return _Vp(*this) >= _Vp(__value); }
|
||||||
|
|
||||||
bool operator==(_Vp __value) const { return __ptr_->__get(__index_) == __value; }
|
bool operator==(const __simd_reference& __value) const { return _Vp(*this) == _Vp(__value); }
|
||||||
|
|
||||||
bool operator!=(_Vp __value) const { return __ptr_->__get(__index_) != __value; }
|
bool operator!=(const __simd_reference& __value) const { return _Vp(*this) != _Vp(__value); }
|
||||||
|
|
||||||
|
bool operator<(_Vp __value) const { return _Vp(*this) < __value; }
|
||||||
|
|
||||||
|
bool operator<=(_Vp __value) const { return _Vp(*this) <= __value; }
|
||||||
|
|
||||||
|
bool operator>(_Vp __value) const { return _Vp(*this) > __value; }
|
||||||
|
|
||||||
|
bool operator>=(_Vp __value) const { return _Vp(*this) >= __value; }
|
||||||
|
|
||||||
|
bool operator==(_Vp __value) const { return _Vp(*this) == __value; }
|
||||||
|
|
||||||
|
bool operator!=(_Vp __value) const { return _Vp(*this) != __value; }
|
||||||
};
|
};
|
||||||
|
template <class _Vp, class _Tp, class _Abi>
|
||||||
|
inline bool operator<(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a < _Vp(b); }
|
||||||
|
template <class _Vp, class _Tp, class _Abi>
|
||||||
|
inline bool operator<=(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a <= _Vp(b); }
|
||||||
|
template <class _Vp, class _Tp, class _Abi>
|
||||||
|
inline bool operator>(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a > _Vp(b); }
|
||||||
|
template <class _Vp, class _Tp, class _Abi>
|
||||||
|
inline bool operator>=(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a >= _Vp(b); }
|
||||||
|
template <class _Vp, class _Tp, class _Abi>
|
||||||
|
inline bool operator==(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a == _Vp(b); }
|
||||||
|
template <class _Vp, class _Tp, class _Abi>
|
||||||
|
inline bool operator!=(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a != _Vp(b); }
|
||||||
|
|
||||||
template <class _Tp, class _Abi>
|
template <class _Tp, class _Abi>
|
||||||
class __simd_mask_reference {
|
class __simd_mask_reference {
|
||||||
|
|
Loading…
Reference in New Issue