mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
initial attempt for fat binary on Aarch64
This commit is contained in:
parent
38431d1117
commit
68db36f4c4
123
CMakeLists.txt
123
CMakeLists.txt
@ -249,6 +249,7 @@ if (ARCH_IA32 OR ARCH_X86_64)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ARCH_AARCH64)
|
if (ARCH_AARCH64)
|
||||||
|
if (NOT FAT_RUNTIME)
|
||||||
if (BUILD_SVE2_BITPERM AND NOT SVE2_BITPERM_FOUND)
|
if (BUILD_SVE2_BITPERM AND NOT SVE2_BITPERM_FOUND)
|
||||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2-bitperm")
|
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2-bitperm")
|
||||||
elseif (BUILD_SVE2 AND NOT SVE2_FOUND)
|
elseif (BUILD_SVE2 AND NOT SVE2_FOUND)
|
||||||
@ -256,6 +257,10 @@ if (ARCH_AARCH64)
|
|||||||
elseif (BUILD_SVE AND NOT SVE_FOUND)
|
elseif (BUILD_SVE AND NOT SVE_FOUND)
|
||||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve")
|
set(GNUCC_ARCH "${GNUCC_ARCH}+sve")
|
||||||
endif ()
|
endif ()
|
||||||
|
else()
|
||||||
|
set(ARCH_C_FLAGS "")
|
||||||
|
set(ARCH_CXX_FLAGS "")
|
||||||
|
endif()
|
||||||
endif(ARCH_AARCH64)
|
endif(ARCH_AARCH64)
|
||||||
|
|
||||||
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
|
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
|
||||||
@ -271,24 +276,6 @@ if (NOT FAT_RUNTIME)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#if (ARCH_IA32 OR ARCH_X86_64 OR ARCH_ARM32 OR ARCH_AARCH64)
|
|
||||||
# if (NOT CMAKE_C_FLAGS MATCHES .*march.* AND NOT CMAKE_C_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_C_FLAGS "-march=${GNUCC_ARCH} -mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
# if (NOT CMAKE_CXX_FLAGS MATCHES .*march.* AND NOT CMAKE_CXX_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_CXX_FLAGS "-march=${GNUCC_ARCH} -mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
#if(ARCH_PPC64EL)
|
|
||||||
# if (NOT CMAKE_C_FLAGS MATCHES .*march.* AND NOT CMAKE_C_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_C_FLAGS "-mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
# if (NOT CMAKE_CXX_FLAGS MATCHES .*march.* AND NOT CMAKE_CXX_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_CXX_FLAGS "-mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
# compiler version checks TODO: test more compilers
|
# compiler version checks TODO: test more compilers
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(GNUCXX_MINVER "9")
|
set(GNUCXX_MINVER "9")
|
||||||
@ -396,6 +383,7 @@ endif()
|
|||||||
|
|
||||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
|
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND FAT_RUNTIME MATCHES "ON")
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND FAT_RUNTIME MATCHES "ON")
|
||||||
|
message("Fat Runtime for ${GNUCC_ARCH}")
|
||||||
# This is a Linux-only feature for now - requires platform support
|
# This is a Linux-only feature for now - requires platform support
|
||||||
# elsewhere
|
# elsewhere
|
||||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||||
@ -529,8 +517,8 @@ endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|||||||
|
|
||||||
|
|
||||||
if (FAT_RUNTIME)
|
if (FAT_RUNTIME)
|
||||||
if (NOT (ARCH_IA32 OR ARCH_X86_64))
|
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||||
message(FATAL_ERROR "Fat runtime is not supported on non-Intel architectures")
|
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building runtime for multiple microarchitectures")
|
message(STATUS "Building runtime for multiple microarchitectures")
|
||||||
endif()
|
endif()
|
||||||
@ -790,7 +778,7 @@ set (hs_exec_SRCS
|
|||||||
endif ()
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT BUILD_SVE2)
|
if (FAT_RUNTIME OR (NOT FAT_RUNTIME AND NOT BUILD_SVE2))
|
||||||
set (hs_exec_SRCS
|
set (hs_exec_SRCS
|
||||||
${hs_exec_SRCS}
|
${hs_exec_SRCS}
|
||||||
src/nfa/vermicelli_simd.cpp)
|
src/nfa/vermicelli_simd.cpp)
|
||||||
@ -1273,9 +1261,8 @@ if (NOT FAT_RUNTIME)
|
|||||||
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||||
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
else ()
|
||||||
else (FAT_RUNTIME)
|
if (ARCH_IA32 OR ARCH_X86_64)
|
||||||
|
|
||||||
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
||||||
if (NOT BUILD_AVX512)
|
if (NOT BUILD_AVX512)
|
||||||
set (DISPATCHER_DEFINE "-DDISABLE_AVX512_DISPATCH")
|
set (DISPATCHER_DEFINE "-DDISABLE_AVX512_DISPATCH")
|
||||||
@ -1345,7 +1332,6 @@ else (FAT_RUNTIME)
|
|||||||
$<TARGET_OBJECTS:hs_compile>
|
$<TARGET_OBJECTS:hs_compile>
|
||||||
$<TARGET_OBJECTS:hs_exec_common>
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
${RUNTIME_LIBS})
|
${RUNTIME_LIBS})
|
||||||
|
|
||||||
endif (BUILD_STATIC_LIBS)
|
endif (BUILD_STATIC_LIBS)
|
||||||
|
|
||||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||||
@ -1401,9 +1387,96 @@ else (FAT_RUNTIME)
|
|||||||
set_target_properties(hs_exec_common_shared PROPERTIES
|
set_target_properties(hs_exec_common_shared PROPERTIES
|
||||||
OUTPUT_NAME hs_exec_common
|
OUTPUT_NAME hs_exec_common
|
||||||
POSITION_INDEPENDENT_CODE TRUE)
|
POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
|
||||||
endif() # SHARED
|
endif() # SHARED
|
||||||
|
endif (ARCH_IA32 OR ARCH_X86_64)
|
||||||
|
if (ARCH_AARCH64)
|
||||||
|
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
||||||
|
if (BUILD_STATIC_LIBS)
|
||||||
|
add_library(hs_exec_neon OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_neon>)
|
||||||
|
set_target_properties(hs_exec_neon PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (BUILD_SVE)
|
||||||
|
add_library(hs_exec_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve>)
|
||||||
|
set_target_properties(hs_exec_sve PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE)
|
||||||
|
if (BUILD_SVE2)
|
||||||
|
add_library(hs_exec_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve2>)
|
||||||
|
set_target_properties(hs_exec_sve2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve2"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE2)
|
||||||
|
|
||||||
|
add_library(hs_exec_common OBJECT
|
||||||
|
${hs_exec_common_SRCS}
|
||||||
|
src/dispatcher.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# hs_version.c is added explicitly to avoid some build systems that refuse to
|
||||||
|
# create a lib without any src (I'm looking at you Xcode)
|
||||||
|
|
||||||
|
add_library(hs_runtime STATIC src/hs_version.c
|
||||||
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
|
${RUNTIME_LIBS})
|
||||||
|
set_target_properties(hs_runtime PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
add_library(hs_compile OBJECT ${hs_compile_SRCS})
|
||||||
|
|
||||||
|
# we want the static lib for testing
|
||||||
|
add_library(hs STATIC src/hs_version.c src/hs_valid_platform.c
|
||||||
|
$<TARGET_OBJECTS:hs_compile>
|
||||||
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
|
${RUNTIME_LIBS})
|
||||||
|
endif (BUILD_STATIC_LIBS)
|
||||||
|
|
||||||
|
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||||
|
# build shared libs
|
||||||
|
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||||
|
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
add_library(hs_exec_shared_neon OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_neon>)
|
||||||
|
set_target_properties(hs_exec_shared_neon PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (BUILD_SVE)
|
||||||
|
add_library(hs_exec_shared_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve>)
|
||||||
|
set_target_properties(hs_exec_shared_sve PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE)
|
||||||
|
if (BUILD_SVE2)
|
||||||
|
add_library(hs_exec_shared_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve2>)
|
||||||
|
set_target_properties(hs_exec_shared_sve2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve2"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE2)
|
||||||
|
add_library(hs_exec_common_shared OBJECT
|
||||||
|
${hs_exec_common_SRCS}
|
||||||
|
src/dispatcher.c
|
||||||
|
)
|
||||||
|
set_target_properties(hs_exec_common_shared PROPERTIES
|
||||||
|
OUTPUT_NAME hs_exec_common
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
endif() # SHARED
|
||||||
|
endif (ARCH_AARCH64)
|
||||||
endif (NOT FAT_RUNTIME)
|
endif (NOT FAT_RUNTIME)
|
||||||
|
|
||||||
if (NOT BUILD_SHARED_LIBS)
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
|
@ -8,7 +8,6 @@ elseif (HAVE_C_INTRIN_H)
|
|||||||
set (INTRIN_INC_H "intrin.h")
|
set (INTRIN_INC_H "intrin.h")
|
||||||
elseif (HAVE_C_ARM_NEON_H)
|
elseif (HAVE_C_ARM_NEON_H)
|
||||||
set (INTRIN_INC_H "arm_neon.h")
|
set (INTRIN_INC_H "arm_neon.h")
|
||||||
set (FAT_RUNTIME OFF)
|
|
||||||
elseif (HAVE_C_PPC64EL_ALTIVEC_H)
|
elseif (HAVE_C_PPC64EL_ALTIVEC_H)
|
||||||
set (INTRIN_INC_H "altivec.h")
|
set (INTRIN_INC_H "altivec.h")
|
||||||
set (FAT_RUNTIME OFF)
|
set (FAT_RUNTIME OFF)
|
||||||
@ -77,6 +76,7 @@ if (BUILD_AVX512VBMI)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (FAT_RUNTIME)
|
if (FAT_RUNTIME)
|
||||||
|
if (ARCH_IA32 OR ARCH_X86_64)
|
||||||
if (NOT DEFINED(BUILD_AVX2))
|
if (NOT DEFINED(BUILD_AVX2))
|
||||||
set(BUILD_AVX2 TRUE)
|
set(BUILD_AVX2 TRUE)
|
||||||
endif ()
|
endif ()
|
||||||
@ -92,6 +92,14 @@ if (FAT_RUNTIME)
|
|||||||
elseif ()
|
elseif ()
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7 -mssse3")
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7 -mssse3")
|
||||||
endif ()
|
endif ()
|
||||||
|
elseif(ARCH_AARCH64)
|
||||||
|
if (NOT DEFINED(BUILD_SVE))
|
||||||
|
set(BUILD_SVE TRUE)
|
||||||
|
endif ()
|
||||||
|
if (NOT DEFINED(BUILD_SVE2))
|
||||||
|
set(BUILD_SVE2 TRUE)
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
else (NOT FAT_RUNTIME)
|
else (NOT FAT_RUNTIME)
|
||||||
# if not fat runtime, then test given cflags
|
# if not fat runtime, then test given cflags
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
#include "util/arch/x86/cpuid_inline.h"
|
#include "util/arch/x86/cpuid_inline.h"
|
||||||
#endif
|
|
||||||
#include "util/join.h"
|
#include "util/join.h"
|
||||||
|
|
||||||
#if defined(DISABLE_AVX512_DISPATCH)
|
#if defined(DISABLE_AVX512_DISPATCH)
|
||||||
@ -83,6 +82,41 @@
|
|||||||
HS_PUBLIC_API \
|
HS_PUBLIC_API \
|
||||||
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
||||||
|
|
||||||
|
#elif defined(ARCH_AARCH64)
|
||||||
|
#include "util/arch/arm/cpuid_inline.h"
|
||||||
|
#include "util/join.h"
|
||||||
|
|
||||||
|
#define CREATE_DISPATCH(RTYPE, NAME, ...) \
|
||||||
|
/* create defns */ \
|
||||||
|
RTYPE JOIN(sve2_, NAME)(__VA_ARGS__); \
|
||||||
|
RTYPE JOIN(sve_, NAME)(__VA_ARGS__); \
|
||||||
|
RTYPE JOIN(neon_, NAME)(__VA_ARGS__); \
|
||||||
|
\
|
||||||
|
/* error func */ \
|
||||||
|
static inline RTYPE JOIN(error_, NAME)(__VA_ARGS__) { \
|
||||||
|
return (RTYPE)HS_ARCH_ERROR; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
/* resolver */ \
|
||||||
|
static RTYPE (*JOIN(resolve_, NAME)(void))(__VA_ARGS__) { \
|
||||||
|
if (check_sve2()) { \
|
||||||
|
return JOIN(sve2_, NAME); \
|
||||||
|
} \
|
||||||
|
if (check_sve()) { \
|
||||||
|
return JOIN(sve_, NAME); \
|
||||||
|
} \
|
||||||
|
if (check_neon()) { \
|
||||||
|
return JOIN(neon_, NAME); \
|
||||||
|
} \
|
||||||
|
/* anything else is fail */ \
|
||||||
|
return JOIN(error_, NAME); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
/* function */ \
|
||||||
|
HS_PUBLIC_API \
|
||||||
|
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
||||||
|
|
||||||
|
#endif
|
||||||
CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data,
|
CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data,
|
||||||
unsigned length, unsigned flags, hs_scratch_t *scratch,
|
unsigned length, unsigned flags, hs_scratch_t *scratch,
|
||||||
match_event_handler onEvent, void *userCtx);
|
match_event_handler onEvent, void *userCtx);
|
||||||
|
@ -199,11 +199,13 @@ hs_compile_multi_int(const char *const *expressions, const unsigned *flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
*db = nullptr;
|
*db = nullptr;
|
||||||
*comp_error = generateCompileError("Unsupported architecture", -1);
|
*comp_error = generateCompileError("Unsupported architecture", -1);
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkMode(mode, comp_error)) {
|
if (!checkMode(mode, comp_error)) {
|
||||||
@ -320,13 +322,14 @@ hs_compile_lit_multi_int(const char *const *expressions, const unsigned *flags,
|
|||||||
*comp_error = generateCompileError("Invalid parameter: elements is zero", -1);
|
*comp_error = generateCompileError("Invalid parameter: elements is zero", -1);
|
||||||
return HS_COMPILER_ERROR;
|
return HS_COMPILER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
*db = nullptr;
|
*db = nullptr;
|
||||||
*comp_error = generateCompileError("Unsupported architecture", -1);
|
*comp_error = generateCompileError("Unsupported architecture", -1);
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkMode(mode, comp_error)) {
|
if (!checkMode(mode, comp_error)) {
|
||||||
@ -500,10 +503,12 @@ hs_error_t hs_expression_info_int(const char *expression, unsigned int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
*error = generateCompileError("Unsupported architecture", -1);
|
*error = generateCompileError("Unsupported architecture", -1);
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@ -631,9 +636,11 @@ hs_error_t HS_CDECL hs_populate_platform(hs_platform_info_t *platform) {
|
|||||||
extern "C" HS_PUBLIC_API
|
extern "C" HS_PUBLIC_API
|
||||||
hs_error_t HS_CDECL hs_free_compile_error(hs_compile_error_t *error) {
|
hs_error_t HS_CDECL hs_free_compile_error(hs_compile_error_t *error) {
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
freeCompileError(error);
|
freeCompileError(error);
|
||||||
return HS_SUCCESS;
|
return HS_SUCCESS;
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
#include "util/arch/x86/cpuid_inline.h"
|
#include "util/arch/x86/cpuid_inline.h"
|
||||||
|
#elif defined(ARCH_AARCH64)
|
||||||
|
#include "util/arch/arm/cpuid_inline.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HS_PUBLIC_API
|
HS_PUBLIC_API
|
||||||
@ -43,7 +45,11 @@ hs_error_t HS_CDECL hs_valid_platform(void) {
|
|||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
#elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
|
#elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
|
||||||
|
if (check_neon()) {
|
||||||
return HS_SUCCESS;
|
return HS_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return HS_ARCH_ERROR;
|
||||||
|
}
|
||||||
#elif defined(ARCH_PPC64EL)
|
#elif defined(ARCH_PPC64EL)
|
||||||
return HS_SUCCESS;
|
return HS_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
|
61
src/util/arch/arm/cpuid_inline.h
Normal file
61
src/util/arch/arm/cpuid_inline.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017-2020, Intel Corporation
|
||||||
|
* Copyright (c) 2023, VectorCamp PC
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AARCH64_CPUID_INLINE_H_
|
||||||
|
#define AARCH64_CPUID_INLINE_H_
|
||||||
|
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
|
||||||
|
#include "ue2common.h"
|
||||||
|
#include "util/arch/common/cpuid_flags.h"
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int check_neon(void) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int check_sve(void) {
|
||||||
|
unsigned long hwcap = getauxval(AT_HWCAP);
|
||||||
|
if (hwcap & HWCAP_SVE) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int check_sve2(void) {
|
||||||
|
unsigned long hwcap2 = getauxval(AT_HWCAP2);
|
||||||
|
if (hwcap2 & HWCAP2_SVE2) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // AARCH64_CPUID_INLINE_H_
|
Loading…
x
Reference in New Issue
Block a user