Make the SSE2 feature optional.

This commit is contained in:
Juan Jose Garcia Ripoll 2010-08-20 21:07:01 +02:00
parent 8ed8a8e807
commit dc2ce379ec
7 changed files with 207 additions and 5 deletions

View file

@ -35,7 +35,10 @@ ECL_THREADS = 1
ECL_UNICODE =
# Set it to non-empty to enable Win32 debug support
#ECL_DEBUG = 1
#ECL_DEBUG = 1
# Set it to non-empty to support SSE2 intrinsics
ECL_SSE =
# Add the extensions to include in the build process. Comment any
# of the following lines to remove a feature from the build process
@ -75,18 +78,22 @@ MKNSI = makensis.exe
# ==================== Flags ====================
!if "$(ECL_SSE)" != ""
CFLAGS_SSE=/arch:SSE2
!endif
#
# Configuration-specific (Debug/Release) options
#
!if "$(ECL_DEBUG)" != ""
CFLAGS_OPTIMIZE = /Od
CFLAGS_CONFIG = /Zi /D_DEBUG /MDd $(CFLAGS_OPTIMIZE)
CFLAGS_CONFIG = /Zi /D_DEBUG /MDd $(CFLAGS_OPTIMIZE) $(CFLAGS_SSE)
LDFLAGS_CONFIG = /debug /nodefaultlib:msvcrt.lib
SHARED_LDFLAGS = /LDd
GCFLAGS =
!else
CFLAGS_OPTIMIZE = /O2
CFLAGS_CONFIG = /DNDEBUG /MD $(CFLAGS_OPTIMIZE)
CFLAGS_CONFIG = /DNDEBUG /MD $(CFLAGS_OPTIMIZE) $(CFLAGS_SSE)
LDFLAGS_CONFIG = /nodefaultlib:msvcrtd.lib
SHARED_LDFLAGS = /LD
GCFLAGS = nodebug=1
@ -312,7 +319,7 @@ eclmin.lib: eclgmp.lib eclgc.lib lsp/config.lsp
cd c
$(MAKE) ECL_VERSION_NUMBER=$(ECL_VERSION_NUMBER) \
ECL_THREADS=$(ECL_THREADS) ECL_UNICODE=$(ECL_UNICODE) \
"ECL_CFLAGS=$(CFLAGS) -DGC_BUILD"
ECL_SSE=$(ECL_SSE) "ECL_CFLAGS=$(CFLAGS) -DGC_BUILD"
cd ..
eclgc.lib:
cd gc

View file

@ -18,6 +18,12 @@ ECL_UNICODE_FLAG=1
ECL_UNICODE_FLAG=0
!endif
!if "$(ECL_SSE)" != ""
ECL_SSE_FLAG=1
!else
ECL_SSE_FLAG=0
!endif
# Programs used by "make":
#
TRUE_CC = cl
@ -107,6 +113,7 @@ $(DPP): $(srcdir)/dpp.c $(srcdir)/symbols_list2.h ../ecl/config.h
"@ECL_VERSION_NUMBER@" "$(ECL_VERSION_NUMBER)" \
"@ECL_THREADS@" "$(ECL_THREADS_FLAG)" \
"@ECL_UNICODE@" "$(ECL_UNICODE_FLAG)" \
"@ECL_SSE@" "$(ECL_SSE_FLAG)" \
< ..\ecl\config.h.msvc6 > $@
#

View file

@ -223,6 +223,14 @@ typedef unsigned int uint32_t;
#define ecl_unlikely(form) (form)
#define ecl_attr_noreturn
#if defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
#define ECL_SSE2 @ECL_SSE2@
#if !ECL_SSE2
#undef ECL_SSE2
#endif
#endif
/* -CUT-: Everything below this mark will not be installed */
/* -------------------------------------------------------------------- *
* BUILD OPTIONS WHICH NEED NOT BE EXPORTED *

33
src/aclocal.m4 vendored
View file

@ -770,6 +770,39 @@ esac
AC_SUBST(ECL_FPE_CODE)
])
dnl ----------------------------------------------------------------------
dnl Decide whether ECL should export SSE intrinsics
dnl
AC_DEFUN([ECL_SSE],[
if test "x$with_sse" = xyes; then
AC_MSG_CHECKING([for SSE intrinsics])
AC_TRY_LINK([
#include <xmmintrin.h>
#include <emmintrin.h>
],[__m128 value;
_mm_getcsr();],[sse_included=yes],[sse_included=no])
if test "$sse_included" = "no"; then
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -msse2"
AC_TRY_LINK([
#include <xmmintrin.h>
#include <emmintrin.h>
],[__m128 value;
_mm_getcsr();],[sse_included=yes],[sse_included=no])
if test "$sse_included" = "no"; then
CFLAGS="$OLD_CFLAGS"
with_sse=no
fi
fi
if test "x$with_sse" = xyes; then
AC_DEFINE(ECL_SSE2)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
])
dnl ----------------------------------------------------------------------
dnl Check whether we have unnamed POSIX semaphores available
AC_DEFUN([ECL_POSIX_SEMAPHORES],[

140
src/configure vendored
View file

@ -797,6 +797,7 @@ with_dffi
with_fpe
with_signed_zero
with_ieee_fp
with_sse
enable_unicode
enable_longdouble
enable_c99complex
@ -1520,6 +1521,9 @@ Optional Packages:
allow for IEEE signed zeros (default=YES).
--with-ieee-fp={yes|no} full IEEE floating point system, including denormals
(default=YES). Implies signed-zero and fpe
--with-sse={yes|no|auto}
implement SSE intrinsics in ECL (default=NO). Only
works when supported by the compiler
--with-debug-cflags add debug flags to the compiler invocation
(yes,no,actual flags,default=YES)
--with-profile-cflags add profiling flags to the compiler invocation
@ -2303,6 +2307,15 @@ else
fi
# Check whether --with-sse was given.
if test "${with_sse+set}" = set; then
withval=$with_sse;
else
with_sse="no"
fi
# Check whether --enable-unicode was given.
if test "${enable_unicode+set}" = set; then
enableval=$enable_unicode;
@ -10434,6 +10447,133 @@ esac
if test "x$with_sse" = xyes; then
{ $as_echo "$as_me:$LINENO: checking for SSE intrinsics" >&5
$as_echo_n "checking for SSE intrinsics... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <xmmintrin.h>
#include <emmintrin.h>
int
main ()
{
__m128 value;
_mm_getcsr();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
sse_included=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
sse_included=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
if test "$sse_included" = "no"; then
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -msse2"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <xmmintrin.h>
#include <emmintrin.h>
int
main ()
{
__m128 value;
_mm_getcsr();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
sse_included=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
sse_included=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
if test "$sse_included" = "no"; then
CFLAGS="$OLD_CFLAGS"
with_sse=no
fi
fi
if test "x$with_sse" = xyes; then
cat >>confdefs.h <<\_ACEOF
#define ECL_SSE2 1
_ACEOF
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test "$enable_longdouble" != "no" ; then
{ $as_echo "$as_me:$LINENO: checking for long double" >&5
$as_echo_n "checking for long double... " >&6; }

View file

@ -199,6 +199,12 @@ AC_ARG_WITH(ieee-fp,
[Implies signed-zero and fpe]),
[], [with_ieee_fp="yes"])
AC_ARG_WITH(sse,
AS_HELP_STRING( [--with-sse={yes|no|auto}],
[implement SSE intrinsics in ECL (default=NO).]
[Only works when supported by the compiler]),
[], [with_sse="no"])
AC_ARG_ENABLE(unicode,
AS_HELP_STRING( [--enable-unicode],
[enable support for unicode (default=NO)]),
@ -658,6 +664,7 @@ if test "x$with_dffi" != "xno"; then
ECL_FFI
fi
ECL_FPE_MODEL
ECL_SSE
if test "$enable_longdouble" != "no" ; then
AC_CHECK_TYPES([long double])

View file

@ -254,7 +254,7 @@ typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey;
#endif
#if defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
#define ECL_SSE2
#undef ECL_SSE2
#endif
/* -CUT-: Everything below this mark will not be installed */