From 7667d814899d8e67cb8e45d5d04adf22e388e4d8 Mon Sep 17 00:00:00 2001 From: eschnett Date: Sun, 7 Jul 2013 14:29:13 +0000 Subject: Add CCTK_BUILTIN_ASSUME_ALIGNED This checks whether the GCC extension __builtin_assume_aligned is available, which can generate more efficient code when accessing data via pointers. git-svn-id: http://svn.cactuscode.org/flesh/trunk@5033 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/aclocal.m4 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lib/make/aclocal.m4') diff --git a/lib/make/aclocal.m4 b/lib/make/aclocal.m4 index 2851bf0f..e96e7a46 100644 --- a/lib/make/aclocal.m4 +++ b/lib/make/aclocal.m4 @@ -1111,6 +1111,37 @@ fi +AC_DEFUN(CCTK_C_BUILTIN_ASSUME_ALIGNED, +[AC_CACHE_CHECK([for C __builtin_assume_aligned], cctk_cv_have_c_builtin_assume_aligned, +[cctk_cv_have_c_builtin_assume_aligned=no +AC_TRY_LINK(, +__builtin_assume_aligned((void*)1000, 10); +__builtin_assume_aligned((void*)1001, 10, 1); +, cctk_cv_have_c_builtin_assume_aligned=yes, cctk_cv_have_c_builtin_assume_aligned=no) +]) +if test "$cctk_cv_have_c_builtin_assume_aligned" = "yes" ; then + AC_DEFINE(HAVE_CCTK_C_BUILTIN_ASSUME_ALIGNED) +fi +]) + +AC_DEFUN(CCTK_CXX_BUILTIN_ASSUME_ALIGNED, +[AC_CACHE_CHECK([for CXX __builtin_assume_aligned], cctk_cv_have_cxx_builtin_assume_aligned, +[cctk_cv_have_cxx_builtin_assume_aligned=no +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_LINK(, +__builtin_assume_aligned((void*)1000, 10); +__builtin_assume_aligned((void*)1001, 10, 1); +, cctk_cv_have_cxx_builtin_assume_aligned=yes, cctk_cv_have_cxx_builtin_assume_aligned=no) +AC_LANG_RESTORE +]) +if test "$cctk_cv_have_cxx_builtin_assume_aligned" = "yes" ; then + AC_DEFINE(HAVE_CCTK_CXX_BUILTIN_ASSUME_ALIGNED) +fi +]) + + + AC_DEFUN(CCTK_CXX_STATIC_ASSERT, [AC_CACHE_CHECK([for CXX static_assert], cctk_cv_have_cxx_static_assert, [cctk_cv_have_cxx_static_assert=no -- cgit v1.2.3