summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-07-23 10:43:53 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-07-23 10:44:23 +0100
commit80e8a76a31943ee23cec774888b575a69a1360f1 (patch)
tree054e4c4cc2791360082b81018bed4a1b85935b33 /contrib
parent1e224376b74993b3ffc1c2ee388c6c7e9ff2747e (diff)
downloadrspamd-80e8a76a31943ee23cec774888b575a69a1360f1.tar.gz
rspamd-80e8a76a31943ee23cec774888b575a69a1360f1.zip
[Minor] Limit sse41 code to sse41 and x86_64
Diffstat (limited to 'contrib')
-rw-r--r--contrib/fastutf8/CMakeLists.txt6
-rw-r--r--contrib/fastutf8/fastutf8.c10
-rw-r--r--contrib/fastutf8/platform_config.h.in13
3 files changed, 7 insertions, 22 deletions
diff --git a/contrib/fastutf8/CMakeLists.txt b/contrib/fastutf8/CMakeLists.txt
index f2570bc50..2a98ed815 100644
--- a/contrib/fastutf8/CMakeLists.txt
+++ b/contrib/fastutf8/CMakeLists.txt
@@ -1,13 +1,11 @@
SET(UTFSRC ${CMAKE_CURRENT_SOURCE_DIR}/fastutf8.c)
-IF(HAVE_AVX2)
+IF(HAVE_AVX2 AND "${ARCH}" STREQUAL "x86_64")
SET(UTFSRC ${UTFSRC} ${CMAKE_CURRENT_SOURCE_DIR}/avx2.c)
MESSAGE(STATUS "UTF8: AVX2 support is added")
ENDIF()
-IF(HAVE_SSE41)
+IF(HAVE_SSE41 AND "${ARCH}" STREQUAL "x86_64")
SET(UTFSRC ${UTFSRC} ${CMAKE_CURRENT_SOURCE_DIR}/sse41.c)
MESSAGE(STATUS "UTF8: SSE41 support is added")
ENDIF()
-CONFIGURE_FILE(platform_config.h.in platform_config.h)
-
ADD_LIBRARY(rspamd-fastutf8 STATIC ${UTFSRC}) \ No newline at end of file
diff --git a/contrib/fastutf8/fastutf8.c b/contrib/fastutf8/fastutf8.c
index 2a5a9983c..89becaf0a 100644
--- a/contrib/fastutf8/fastutf8.c
+++ b/contrib/fastutf8/fastutf8.c
@@ -23,7 +23,7 @@
*/
#include "fastutf8.h"
-#include "platform_config.h"
+#include "libcryptobox/platform_config.h"
/*
@@ -125,10 +125,10 @@ rspamd_fast_utf8_validate_ref (const unsigned char *data, size_t len)
}
/* Prototypes */
-#ifdef HAVE_SSSE3
+#if defined(HAVE_SSE41) && defined(__x86_64__)
extern off_t rspamd_fast_utf8_validate_sse41 (const unsigned char *data, size_t len);
#endif
-#ifdef HAVE_AVX2
+#if defined(HAVE_AVX2) && defined(__x86_64__)
extern off_t rspamd_fast_utf8_validate_avx2 (const unsigned char *data, size_t len);
#endif
@@ -139,12 +139,12 @@ static off_t (*validate_func) (const unsigned char *data, size_t len) =
void
rspamd_fast_utf8_library_init (unsigned flags)
{
-#ifdef HAVE_SSSE3
+#if defined(HAVE_SSE41) && defined(__x86_64__)
if (flags & RSPAMD_FAST_UTF8_FLAG_SSE41) {
validate_func = rspamd_fast_utf8_validate_sse41;
}
#endif
-#ifdef HAVE_AVX2
+#if defined(HAVE_AVX2) && defined(__x86_64__)
if (flags & RSPAMD_FAST_UTF8_FLAG_AVX2) {
validate_func = rspamd_fast_utf8_validate_avx2;
}
diff --git a/contrib/fastutf8/platform_config.h.in b/contrib/fastutf8/platform_config.h.in
deleted file mode 100644
index 621d99e2c..000000000
--- a/contrib/fastutf8/platform_config.h.in
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef PLATFORM_H_CONFIG
-#define PLATFORM_H_CONFIG
-
-#define ARCH "${ARCH}"
-#define CMAKE_ARCH_${ARCH} 1
-
-#ifdef __x86_64__
-#cmakedefine HAVE_AVX2 1
-#cmakedefine HAVE_SSE41 1
-#cmakedefine HAVE_SSSE3 1
-#endif
-
-#endif