diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-05-25 21:51:27 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-05-25 21:51:27 +0000 |
commit | 1d5cf7fcf28c0b7d44fab10d26fc450e9d962f03 (patch) | |
tree | 3cd241e469094809d6ceb3aa1a14f6841627e681 /libgfortran/acinclude.m4 | |
parent | 87e1e6036ef93b18b1450357488ee907db880f37 (diff) | |
download | gcc-1d5cf7fcf28c0b7d44fab10d26fc450e9d962f03.zip gcc-1d5cf7fcf28c0b7d44fab10d26fc450e9d962f03.tar.gz gcc-1d5cf7fcf28c0b7d44fab10d26fc450e9d962f03.tar.bz2 |
re PR libfortran/78379 (Processor-specific versions for matmul)
2017-05-25 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/78379
* Makefile.am: Add generated/matmulavx128_*.c files.
Handle them for compiling and setting the right flags.
* acinclude.m4: Add tests for FMA3, FMA4 and AVX128.
* configure.ac: Call them.
* Makefile.in: Regenerated.
* config.h.in: Regenerated.
* configure: Regenerated.
* m4/matmul.m4: Handle AMD chips by calling 128-bit AVX
versions which use FMA3 or FMA4.
* m4/matmulavx128.m4: New file.
* generated/matmul_c10.c: Regenerated.
* generated/matmul_c16.c: Regenerated.
* generated/matmul_c4.c: Regenerated.
* generated/matmul_c8.c: Regenerated.
* generated/matmul_i1.c: Regenerated.
* generated/matmul_i16.c: Regenerated.
* generated/matmul_i2.c: Regenerated.
* generated/matmul_i4.c: Regenerated.
* generated/matmul_i8.c: Regenerated.
* generated/matmul_r10.c: Regenerated.
* generated/matmul_r16.c: Regenerated.
* generated/matmul_r4.c: Regenerated.
* generated/matmul_r8.c: Regenerated.
* generated/matmulavx128_c10.c: New file.
* generated/matmulavx128_c16.c: New file.
* generated/matmulavx128_c4.c: New file.
* generated/matmulavx128_c8.c: New file.
* generated/matmulavx128_i1.c: New file.
* generated/matmulavx128_i16.c: New file.
* generated/matmulavx128_i2.c: New file.
* generated/matmulavx128_i4.c: New file.
* generated/matmulavx128_i8.c: New file.
* generated/matmulavx128_r10.c: New file.
* generated/matmulavx128_r16.c: New file.
* generated/matmulavx128_r4.c: New file.
* generated/matmulavx128_r8.c: New file.
From-SVN: r248472
Diffstat (limited to 'libgfortran/acinclude.m4')
-rw-r--r-- | libgfortran/acinclude.m4 | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index ceb80a1..cd8dfab 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -452,3 +452,53 @@ AC_DEFUN([LIBGFOR_CHECK_AVX512F], [ []) 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" +]) |