should fix it for fat binaries

This commit is contained in:
G.E. 2024-07-10 03:30:14 +03:00
parent 317f882cda
commit 5a34d8140b
3 changed files with 20 additions and 13 deletions

View File

@ -951,6 +951,11 @@ else ()
if (NOT BUILD_AVX512VBMI)
set (DISPATCHER_DEFINE "${DISPATCHER_DEFINE} -DDISABLE_AVX512VBMI_DISPATCH")
endif (NOT BUILD_AVX512VBMI)
if(BUILD_SSE2_SIMDE)
set (DISPATCHER_DEFINE "${DISPATCHER_DEFINE} -DVS_SIMDE_BACKEND -DVS_SIMDE_NATIVE -march=core2 -msse2")
set_source_files_properties(src/hs.cpp PROPERTIES
COMPILE_FLAGS "-DVS_SIMDE_BACKEND -DVS_SIMDE_NATIVE -march=core2 -msse2")
endif(BUILD_SSE2_SIMDE)
set_source_files_properties(src/dispatcher.c PROPERTIES
COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-function ${DISPATCHER_DEFINE}")

View File

@ -78,14 +78,10 @@
#define check_avx512vbmi() (0)
#endif
#if defined(BUILD_SSE2_SIMDE)
#if defined(HAVE_SSE2)
#define CHECK_SSE_LAST (1)
#if defined(VS_SIMDE_BACKEND)
#define CHECK_SSE_LAST() (1)
#else
#define CHECK_SSE_LAST (0)
#endif
#else
#define CHECK_SSE_LAST check_ssse3
#define CHECK_SSE_LAST() check_ssse3()
#endif
#define CREATE_DISPATCH(RTYPE, NAME, ...) \

View File

@ -198,15 +198,21 @@ hs_compile_multi_int(const char *const *expressions, const unsigned *flags,
return HS_COMPILER_ERROR;
}
#if defined(VS_SIMDE_NATIVE) && (defined(ARCH_IA32) || defined(ARCH_X86_64))
#define CHECK_SSE_FUNC() (1)
#else
#define CHECK_SSE_FUNC() check_ssse3()
#endif
#if defined(FAT_RUNTIME)
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
if (!check_ssse3()) {
if (!CHECK_SSE_FUNC()) {
*db = nullptr;
*comp_error = generateCompileError("Unsupported architecture", -1);
return HS_ARCH_ERROR;
}
#endif
#endif
#endif // arch
#endif // FAT_RUNTIME
if (!checkMode(mode, comp_error)) {
*db = nullptr;
@ -324,7 +330,7 @@ hs_compile_lit_multi_int(const char *const *expressions, const unsigned *flags,
}
#if defined(FAT_RUNTIME)
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
if (!check_ssse3()) {
if (!CHECK_SSE_FUNC()) {
*db = nullptr;
*comp_error = generateCompileError("Unsupported architecture", -1);
return HS_ARCH_ERROR;
@ -504,7 +510,7 @@ hs_error_t hs_expression_info_int(const char *expression, unsigned int flags,
#if defined(FAT_RUNTIME)
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
if (!check_ssse3()) {
if (!CHECK_SSE_FUNC()) {
*error = generateCompileError("Unsupported architecture", -1);
return HS_ARCH_ERROR;
}
@ -637,7 +643,7 @@ extern "C" HS_PUBLIC_API
hs_error_t HS_CDECL hs_free_compile_error(hs_compile_error_t *error) {
#if defined(FAT_RUNTIME)
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
if (!check_ssse3()) {
if (!CHECK_SSE_FUNC()) {
return HS_ARCH_ERROR;
}
#endif