[])
CFLAGS="$ac_save_CFLAGS"
])
+
+dnl Check for FMA3
+dnl
+AC_DEFUN([LIBGFOR_CHECK_FMA3], [
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-O2 -mfma -mno-fma4"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ float
+ flt_mul_add (float a, float b, float c)
+ {
+ return __builtin_fmaf (a, b, c);
+ }]], [[]])],
+ AC_DEFINE(HAVE_FMA3, 1,
+ [Define if FMA3 instructions can be compiled.]),
+ [])
+ CFLAGS="$ac_save_CFLAGS"
+])
+
+dnl Check for FMA4
+dnl
+AC_DEFUN([LIBGFOR_CHECK_FMA4], [
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-O2 -mfma4 -mno-fma"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ float
+ flt_mul_add (float a, float b, float c)
+ {
+ return __builtin_fmaf (a, b, c);
+ }]], [[]])],
+ AC_DEFINE(HAVE_FMA4, 1,
+ [Define if FMA4 instructions can be compiled.]),
+ [])
+ CFLAGS="$ac_save_CFLAGS"
+])
+
+dnl Check for -mprefer-avx128
+dnl This also defines an automake conditional.
+AC_DEFUN([LIBGFOR_CHECK_AVX128], [
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-O2 -mavx -mprefer-avx128"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ void foo()
+ {
+ }]], [[]])],
+ AC_DEFINE(HAVE_AVX128, 1,
+ [Define if -mprefer-avx128 is supported.])
+ AM_CONDITIONAL([HAVE_AVX128],true),
+ [])
+ CFLAGS="$ac_save_CFLAGS"
+])