From 9698e1bb336c3d623231d7bb017681c2b82523dc Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Sun, 28 May 2017 19:12:45 +0000 Subject: [PATCH] Fix libgfortran FMA3/FMA4 tests * acinclude.m4 (LIBGFOR_CHECK_FMA3): Use test from check_effective_target_fma in gcc.target/i386/i386.exp. (LIBGFOR_CHECK_FMA4): Use test from check_effective_target_fma4. * configure: Regenerate. From-SVN: r248547 --- libgfortran/ChangeLog | 7 +++++++ libgfortran/acinclude.m4 | 18 ++++++++++++------ libgfortran/configure | 18 ++++++++++++------ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 720b1ce2265..eaeac6ad0b7 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2017-05-28 Rainer Orth + + * acinclude.m4 (LIBGFOR_CHECK_FMA3): Use test from + check_effective_target_fma in gcc.target/i386/i386.exp. + (LIBGFOR_CHECK_FMA4): Use test from check_effective_target_fma4. + * configure: Regenerate. + 2017-05-26 Thomas Koenig PR boostrap/80889 diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index b501a5e4ef9..90df4eea7b7 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -459,10 +459,13 @@ 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) + typedef float __m128 __attribute__ ((__vector_size__ (16))); + typedef float __v4sf __attribute__ ((__vector_size__ (16))); + __m128 _mm_macc_ps(__m128 __A, __m128 __B, __m128 __C) { - return __builtin_fmaf (a, b, c); + return (__m128) __builtin_ia32_vfmaddps ((__v4sf)__A, + (__v4sf)__B, + (__v4sf)__C); }]], [[]])], AC_DEFINE(HAVE_FMA3, 1, [Define if FMA3 instructions can be compiled.]), @@ -476,10 +479,13 @@ 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) + typedef float __m128 __attribute__ ((__vector_size__ (16))); + typedef float __v4sf __attribute__ ((__vector_size__ (16))); + __m128 _mm_macc_ps(__m128 __A, __m128 __B, __m128 __C) { - return __builtin_fmaf (a, b, c); + return (__m128) __builtin_ia32_vfmaddps ((__v4sf)__A, + (__v4sf)__B, + (__v4sf)__C); }]], [[]])], AC_DEFINE(HAVE_FMA4, 1, [Define if FMA4 instructions can be compiled.]), diff --git a/libgfortran/configure b/libgfortran/configure index 28f10d57474..87c83cab73a 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -26372,10 +26372,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - float - flt_mul_add (float a, float b, float c) + typedef float __m128 __attribute__ ((__vector_size__ (16))); + typedef float __v4sf __attribute__ ((__vector_size__ (16))); + __m128 _mm_macc_ps(__m128 __A, __m128 __B, __m128 __C) { - return __builtin_fmaf (a, b, c); + return (__m128) __builtin_ia32_vfmaddps ((__v4sf)__A, + (__v4sf)__B, + (__v4sf)__C); } int main () @@ -26401,10 +26404,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - float - flt_mul_add (float a, float b, float c) + typedef float __m128 __attribute__ ((__vector_size__ (16))); + typedef float __v4sf __attribute__ ((__vector_size__ (16))); + __m128 _mm_macc_ps(__m128 __A, __m128 __B, __m128 __C) { - return __builtin_fmaf (a, b, c); + return (__m128) __builtin_ia32_vfmaddps ((__v4sf)__A, + (__v4sf)__B, + (__v4sf)__C); } int main () -- 2.30.2