aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-02-18 17:16:04 -0800
committerGuy Harris <guy@alum.mit.edu>2015-02-19 02:42:11 +0000
commit493ab6bcf368de4cb795cbf023dce9a0d71ab655 (patch)
treef86468c0ae7a7e5b2ac52eeaba732eae8b1013f1 /wsutil
parente29dca79f2faccfab156871dff8b200c6768d841 (diff)
Check whether emmintrin.h can be used *without* -msse4.2.
If not, we can't use SSE 4.2, as we need to be able to include it in files that use tvb_pbrk_compile()/tvb_pbrk_exec() even if they're not compiled with -msse4.2 (most files aren't, as we need to isolate SSE 4.2 instructions to a small bit of code that uses them only if running on hardware that supports them). Change-Id: I62262a3c45fa14e200967916ac0ffc283f8e322c Reviewed-on: https://code.wireshark.org/review/7246 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/CMakeLists.txt40
1 files changed, 26 insertions, 14 deletions
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt
index fe2d662eac..6741ce4c8c 100644
--- a/wsutil/CMakeLists.txt
+++ b/wsutil/CMakeLists.txt
@@ -104,24 +104,36 @@ else()
endif()
if(COMPILER_CAN_HANDLE_SSE4_2)
#
- # Make sure we have the necessary header for the SSE4.2 intrinsics
- # and that we can use it.
+ # Make sure we have the necessary headers for the SSE4.2 intrinsics
+ # and that we can use them.
#
-
+ # First, check whether we have emmintrin.h and can use it
+ # *without* the SSE 4.2 flag.
#
- # Does this add the SSE4.2 flags to the beginning of CFLAGS?
+ check_include_file("emmintrin.h" EMMINTRIN_H_WORKS)
+
#
- # Note that if there's a mix of "enable SSE 4.2" and"disable
- # SSE 4.2" flags, this may not indicate that we can use the
- # header. That's not a bug, that's a feature; the other flags
- # may have been forced by the build process, e.g. in Gentoo
- # Linux, and we want to check this with whatever flags will
- # actually be used when building (see bug 10792).
+ # OK, if that works, see whether we have nmmintrin.h and
+ # can use it *with* the SSE 4.2 flag.
#
- cmake_push_check_state()
- set(CMAKE_REQUIRED_FLAGS "${SSE4_2_FLAG}")
- check_include_file("nmmintrin.h" HAVE_SSE4_2)
- cmake_pop_check_state()
+ if(EMMINTRIN_H_WORKS)
+ #
+ # Does this add the SSE4.2 flags to the beginning of
+ # CFLAGS?
+ #
+ # Note that if there's a mix of "enable SSE 4.2" and
+ # "disable SSE 4.2" flags, this may not indicate that
+ # we can use the header. That's not a bug, that's a
+ # feature; the other flags may have been forced by
+ # the build process, e.g. in Gentoo Linux, and we want
+ # to check this with whatever flags will actually be
+ # used when building (see bug 10792).
+ #
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_FLAGS "${SSE4_2_FLAG}")
+ check_include_file("nmmintrin.h" HAVE_SSE4_2)
+ cmake_pop_check_state()
+ endif()
endif()
if(HAVE_SSE4_2)
set(WSUTIL_FILES ${WSUTIL_FILES} ws_mempbrk_sse42.c)