Change HAVE_SSE42 to HAVE_SSE4_2 add $(SIMD_FLAGS)

Add autotools macros to distribution
Call AX_EXT to define HAVE_SSE4_2

Change-Id: I9ff085d923dfafb32510cdd14290e74a2aaea302
Reviewed-on: https://code.wireshark.org/review/2110
Tested-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
AndersBroman 2014-06-10 14:47:09 +02:00 committed by Anders Broman
parent 94dcbfd9ac
commit fcb019acb8
7 changed files with 18 additions and 8 deletions

View File

@ -709,6 +709,10 @@ EXTRA_DIST = \
aclocal-fallback/glib-2.0.m4 \
aclocal-fallback/gtk-2.0.m4 \
aclocal-fallback/gtk-3.0.m4 \
aclocal-fallback/ax_check_compile_flag.m4 \
aclocal-fallback/ax_gcc_x86_cpuid.m4 \
aclocal-fallback/ax_ext.m4 \
aclocal-fallback/ax_gcc_x86_avx_xgetbv.m4 \
aclocal-flags \
adns_dll.dep \
adns_dll.rc \

View File

@ -283,4 +283,4 @@ typedef int ssize_t;
#endif
/* to use define _ws_mempbrk_sse42 if available (checked with cpuinfo) */
#define HAVE_SSE42 1
#define HAVE_SSE4_2 1

View File

@ -60,6 +60,12 @@ AC_PROG_CPP
AC_PROG_MKDIR_P
AC_WIRESHARK_CLANG_CHECK
# Find supported SIMD extensions by requesting cpuid. When an SIMD
# extension is found, the -m"simdextensionname" is added to SIMD_FLAGS
# (only if compilator support it) (ie : if "sse2" is available "-msse2" is
# added to SIMD_FLAGS)
AX_EXT
dnl Work around libtool bug (fixed in the version 1.5a?)
AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
AC_LIBTOOL_DLOPEN

View File

@ -83,7 +83,7 @@ libwsutil_la_SOURCES = \
libwsutil_sse42_la_SOURCES = \
ws_mempbrk_sse42.c
libwsutil_sse42_la_CFLAGS = $(AM_CFLAGS) -msse4.2
libwsutil_sse42_la_CFLAGS = $(AM_CFLAGS) $(SIMD_FLAGS)
EXTRA_libwsutil_la_SOURCES= \
inet_aton.c \

View File

@ -23,7 +23,7 @@
#include <glib.h>
#include "ws_symbol_export.h"
#ifdef HAVE_SSE42
#ifdef HAVE_SSE4_2
#include "ws_cpuid.h"
#endif
#include "ws_mempbrk.h"
@ -50,13 +50,13 @@ _ws_mempbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles)
WS_DLL_PUBLIC const guint8 *
ws_mempbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles)
{
#ifdef HAVE_SSE42
#ifdef HAVE_SSE4_2
static int have_sse42 = -1;
#endif
if (*needles == 0)
return NULL;
#ifdef HAVE_SSE42
#ifdef HAVE_SSE4_2
if G_UNLIKELY(have_sse42 < 0)
have_sse42 = ws_cpuid_sse42();

View File

@ -26,7 +26,7 @@
WS_DLL_PUBLIC const guint8 *ws_mempbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles);
#ifdef HAVE_SSE42
#ifdef HAVE_SSE4_2
const char *_ws_mempbrk_sse42(const char* haystack, size_t haystacklen, const char *needles);
#endif

View File

@ -20,7 +20,7 @@
#include "config.h"
#ifdef HAVE_SSE42
#ifdef HAVE_SSE4_2
#include <glib.h>
@ -191,7 +191,7 @@ _ws_mempbrk_sse42(const char *s, size_t slen, const char *a)
return _ws_mempbrk(aligned, slen, a);
}
#endif /* HAVE_SSE42 */
#endif /* HAVE_SSE4_2 */
/*
* Editor modelines
*