initial attempt for fat binary on Aarch64

This commit is contained in:
Konstantinos Margaritis
2023-08-23 09:42:00 +00:00
committed by Konstantinos Margaritis
parent 6b2a42019b
commit 394d09fe45
6 changed files with 355 additions and 166 deletions

View File

@@ -32,7 +32,6 @@
#include "ue2common.h"
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
#include "util/arch/x86/cpuid_inline.h"
#endif
#include "util/join.h"
#if defined(DISABLE_AVX512_DISPATCH)
@@ -83,6 +82,41 @@
HS_PUBLIC_API \
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,
unsigned length, unsigned flags, hs_scratch_t *scratch,
match_event_handler onEvent, void *userCtx);