build: Use __builtin_popcount() if available.

This commit is contained in:
Józef Kucia
2017-09-08 15:04:30 +02:00
parent d9bc635d1a
commit 09658e3b9b
3 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
dnl VKD3D_CHECK_SYNC_ADD_AND_FETCH_FUNC
AC_DEFUN([VKD3D_CHECK_SYNC_ADD_AND_FETCH_FUNC],
[AC_MSG_CHECKING([for __sync_add_and_fetch])
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __sync_add_and_fetch((int *)0, 0); }])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SYNC_ADD_AND_FETCH],
[1],
[Define to 1 if you have __sync_add_and_fetch.])],
[AC_MSG_RESULT([no])])])
dnl VKD3D_CHECK_SYNC_SUB_AND_FETCH_FUNC
AC_DEFUN([VKD3D_CHECK_SYNC_SUB_AND_FETCH_FUNC],
[AC_MSG_CHECKING([for __sync_sub_and_fetch])
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __sync_sub_and_fetch((int *)0, 0); }])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SYNC_SUB_AND_FETCH],
[1],
[Define to 1 if you have __sync_sub_and_fetch.])],
[AC_MSG_RESULT([no])])])
dnl VKD3D_CHECK_BUILTIN_POPCOUNT
AC_DEFUN([VKD3D_CHECK_BUILTIN_POPCOUNT],
[AC_MSG_CHECKING([for __builtin_popcount])
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_popcount(0); }])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BUILTIN_POPCOUNT],
[1],
[Define to 1 if you have __builtin_popcount.])],
[AC_MSG_RESULT([no])])])