commit 80e8a76: [Minor] Limit sse41 code to sse41 and x86_64
Vsevolod Stakhov
vsevolod at rspamd.com
Sun Jul 23 09:49:03 UTC 2023
Author: Vsevolod Stakhov
Date: 2023-07-23 10:43:53 +0100
URL: https://github.com/rspamd/rspamd/commit/80e8a76a31943ee23cec774888b575a69a1360f1 (HEAD -> master)
[Minor] Limit sse41 code to sse41 and x86_64
---
contrib/fastutf8/CMakeLists.txt | 6 ++----
contrib/fastutf8/fastutf8.c | 10 +++++-----
contrib/fastutf8/platform_config.h.in | 13 -------------
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
More information about the Commits
mailing list