Also support -xarch=sse_42 in the Sun C compiler for x86(-64).

Change-Id: Ib6d0ae9c237b96568e2522d2077b311b3ac5af2e
Reviewed-on: https://code.wireshark.org/review/6706
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-01-20 23:27:08 -08:00
parent db6f7339f7
commit bc86257750
2 changed files with 37 additions and 9 deletions

View File

@ -1080,6 +1080,8 @@ CFLAGS_before_simd="$CFLAGS"
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C)
if test "x$CFLAGS" != "x$CFLAGS_before_simd"
then
#
# The compiler supports -msse4.2; use that to enable SSE 4.2.
#
# Restore CFLAGS. We only want to apply -msse4.2 to
# wsutil/ws_mempbrk_sse42.c, as the SSE4.2 code there
@ -1087,7 +1089,28 @@ then
# code would do no such checks.
#
CFLAGS="$CFLAGS_before_simd"
ac_sse4_2_flag=-msse4.2
else
#
# Try -xarch=sse4_2; that's the flag for Sun's compiler.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xarch=sse4_2, C)
if test "x$CFLAGS" != "x$CFLAGS_before_simd"
then
#
# The compiler supports -xarch=sse4_2; use that to
# enable SSE 4.2.
#
# Restore CFLAGS; see above.
#
CFLAGS="$CFLAGS_before_simd"
ac_sse4_2_flag=-xarch=sse4_2
fi
fi
if test "x$ac_sse4_2_flag" != x; then
#
# OK, we have a compiler flag to enable SSE 4.2.
#
# Make sure we have the necessary header for the SSE4.2 intrinsics
# and that we can use it.
@ -1103,14 +1126,14 @@ then
# in the environment will come later and override it.
#
saved_CFLAGS="$CFLAGS"
CFLAGS="-msse4.2 $CFLAGS"
CFLAGS="$ac_sse4_2_flag $CFLAGS"
AC_TRY_COMPILE(
[#include <nmmintrin.h>],
[return 0;],
[
have_sse42=yes
AC_DEFINE(HAVE_SSE4_2, 1, [Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions])
CFLAGS_SSE42="-msse4.2"
CFLAGS_SSE42="$ac_sse4_2_flag"
AC_MSG_RESULT([yes])
],
[

View File

@ -77,14 +77,13 @@ set(WSUTIL_FILES
)
#
# XXX - we're assuming MSVC supports the SSE 4.2 intrinsics and
# that other C compilers support them iff they support the
# -msse4.2 flag.
# XXX - we're assuming MSVC doesn't require a flag to enable SSE 4.2
# support, and that, if the compiler supports a flag for SSE 4.2
# support, the intrinsics are supported iff we can include the
# <nmmintrin.h> flag.
#
# Perhaps we should check whether we can compile something
# that uses them, instead, and do something else to figure
# out what compiler flag, if any, we need to pass to the
# compiler to compile code that uses them.
# We only check for the GCC-style -msse4.2 flag and the Sun C
# -xarch=sse4_2 flag.
#
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(HAVE_SSE4_2 TRUE)
@ -94,6 +93,12 @@ else()
check_c_compiler_flag(-msse4.2 HAVE_SSE4_2)
if(HAVE_SSE4_2)
set(SSE4_2_FLAG "-msse4.2")
else()
message(STATUS "Checking for c-compiler flag: -xarch=sse4_2")
check_c_compiler_flag(-xarch=sse4_2 HAVE_SSE4_2)
if(HAVE_SSE4_2)
set(SSE4_2_FLAG "-xarch=sse4_2")
endif()
endif()
endif()
if(HAVE_SSE4_2)