1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
#
# Automatic simd compiler feature check by Burkhard Plaum (2006-05-16)
#
dnl GAVL_CHECK_SIMD_INTERNAL (cpumodel)
dnl Check for specific compiler simd features. These include inline
dnl assembly as well as intrinsics. If a feature is detected, have
dnl variable HAVE_feature is set to "true". The following features are
dnl Supported:
dnl MMX: Compiler can compile inline MMX assembly
dnl SSE: Compiler can compile inline SSE assembly
AC_DEFUN([GAVL_CHECK_SIMD_INTERNAL],[
AC_MSG_CHECKING([Architecture])
case $1 in
i[[3-7]]86)
AC_MSG_RESULT(IA32)
ARCH_X86=true
;;
x86_64*)
AC_MSG_RESULT(x86_64)
ARCH_X86=true
ARCH_X86_64=true
;;
powerpc | powerpc64)
AC_MSG_RESULT(PowerPC)
ARCH_PPC=true
;;
*)
AC_MSG_RESULT(unknown)
;;
esac
OLD_CFLAGS=$CFLAGS
CFLAGS=$2
if test x$ARCH_X86 = xtrue; then
dnl
dnl Check for MMX assembly
dnl
AC_MSG_CHECKING([if C compiler accepts MMX assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("movq" " %" "mm0" ", %" "mm1");],
HAVE_MMX=true)
if test $HAVE_MMX = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for 3Dnow assembly
dnl
AC_MSG_CHECKING([if C compiler accepts 3Dnow assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("pmulhrw" " %" "mm0" ", %" "mm1");],
HAVE_3DNOW=true)
if test "$HAVE_3DNOW" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for 3Dnowext assembly
dnl
AC_MSG_CHECKING([if C compiler accepts 3Dnowext assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("pswapd" " %" "mm0" ", %" "mm0");],
HAVE_3DNOWEXT=true)
if test "$HAVE_3DNOWEXT" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for SSE assembly
dnl
AC_MSG_CHECKING([if C compiler accepts SSE assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("movaps" " %" "xmm0" ", %" "xmm1");],
HAVE_SSE=true)
if test $HAVE_SSE = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for SSE2 assembly
dnl
AC_MSG_CHECKING([if C compiler accepts SSE2 assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("movdqa" " %" "xmm0" ", %" "xmm1");],
HAVE_SSE2=true)
if test $HAVE_SSE2 = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for SSE3 assembly
dnl
AC_MSG_CHECKING([if C compiler accepts SSE3 assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("addsubpd" " %" "xmm0" ", %" "xmm1");],
HAVE_SSE3=true)
if test $HAVE_SSE3 = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for SSSE3 assembly
dnl
AC_MSG_CHECKING([if C compiler accepts SSSE3 assembly])
AC_TRY_COMPILE([],[ __asm__ __volatile__ ("psignw" " %" "xmm0" ", %" "xmm1");],
HAVE_SSSE3=true)
if test $HAVE_SSSE3 = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for MMX intrinsics
dnl
AC_MSG_CHECKING([if C compiler accepts MMX intrinsics])
AC_TRY_LINK([#include <mmintrin.h>],[__m64 m1, m2; _m_paddb(m1, m2)],HAVE_MMX_INT=true)
if test "$HAVE_MMX_INT" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for 3Dnow intrinsics
dnl
AC_MSG_CHECKING([if C compiler accepts 3Dnow intrinsics])
AC_TRY_LINK([#include <mm3dnow.h>],[_m_femms();],HAVE_3DNOW_INT=true)
if test "$HAVE_3DNOW_INT" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for 3Dnowext intrinsics
dnl
AC_MSG_CHECKING([if C compiler accepts 3Dnowext intrinsics])
AC_TRY_LINK([#include <mm3dnow.h>],[__m64 b1;b1 = _m_pswapd(b1);_m_femms();],HAVE_3DNOWEXT_INT=true)
if test "$HAVE_3DNOWEXT_INT" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for SSE intrinsics
dnl
AC_MSG_CHECKING([if C compiler accepts SSE intrinsics])
AC_TRY_LINK([#include <xmmintrin.h>],[__m128 m1, m2; _mm_add_ss(m1, m2)],HAVE_SSE_INT=true)
if test "$HAVE_SSE_INT" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl
dnl Check for SSE2 intrinsics
dnl
AC_MSG_CHECKING([if C compiler accepts SSE2 intrinsics])
AC_TRY_LINK([#include <emmintrin.h>],[__m128d m1; m1 = _mm_set1_pd(1.0)],HAVE_SSE2_INT=true)
if test "$HAVE_SSE2_INT" = true; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
CFLAGS=$OLD_CFLAGS
])
dnl GAVL_CHECK_SIMD (cpumodel)
dnl Check for specific compiler simd features. These include inline
dnl assembly as well as intrinsics. If a feature is detected, have
dnl variable HAVE_feature is set to "true". The following features are
dnl Supported:
dnl MMX: Compiler can compile inline MMX assembly
dnl SSE: Compiler can compile inline SSE assembly
AC_DEFUN([GAVL_CHECK_SIMD],[
dnl
dnl Check for SIMD
dnl
AH_TEMPLATE([ARCH_X86], [Intel Architecture (32/64)])
AH_TEMPLATE([ARCH_X86_64], [Intel Architecture (64)])
AH_TEMPLATE([ARCH_PPC], [PowerPC Architecture])
AH_TEMPLATE([HAVE_MMX], [MMX Supported])
AH_TEMPLATE([HAVE_3DNOW], [3Dnow Supported])
AH_TEMPLATE([HAVE_SSE], [SSE Supported])
AH_TEMPLATE([HAVE_SSE2], [SSE2 Supported])
AH_TEMPLATE([HAVE_SSE3], [SSE3 Supported])
AH_TEMPLATE([HAVE_SSSE3], [SSSE3 Supported])
GAVL_CHECK_SIMD_INTERNAL($1, $2)
if test x"$HAVE_MMX" = "xtrue"; then
AC_DEFINE(HAVE_MMX)
fi
AM_CONDITIONAL(HAVE_MMX, test "x$HAVE_MMX" = "xtrue")
if test x"$HAVE_3DNOW" = "xtrue"; then
AC_DEFINE(HAVE_3DNOW)
fi
AM_CONDITIONAL(HAVE_3DNOW, test "x$HAVE_3DNOW" = "xtrue")
if test x"$HAVE_SSE" = "xtrue"; then
AC_DEFINE(HAVE_SSE)
fi
AM_CONDITIONAL(HAVE_SSE, test "x$HAVE_SSE" = "xtrue")
if test x"$HAVE_SSE2" = "xtrue"; then
AC_DEFINE(HAVE_SSE2)
fi
AM_CONDITIONAL(HAVE_SSE2, test "x$HAVE_SSE2" = "xtrue")
if test x"$HAVE_SSE3" = "xtrue"; then
AC_DEFINE(HAVE_SSE3)
fi
AM_CONDITIONAL(HAVE_SSE3, test "x$HAVE_SSE3" = "xtrue")
if test x"$HAVE_SSSE3" = "xtrue"; then
AC_DEFINE(HAVE_SSSE3)
fi
AM_CONDITIONAL(HAVE_SSSE3, test "x$HAVE_SSSE3" = "xtrue")
if test x"$ARCH_X86" = "xtrue"; then
AC_DEFINE(ARCH_X86)
fi
if test x"$ARCH_X86_64" = "xtrue"; then
AC_DEFINE(ARCH_X86_64)
fi
if test x"$ARCH_PPC" = "xtrue"; then
AC_DEFINE(ARCH_PPC)
fi
])
|