]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/78379 (Processor-specific versions for matmul)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 2 Mar 2017 11:04:01 +0000 (11:04 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 2 Mar 2017 11:04:01 +0000 (11:04 +0000)
2017-03-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/78379
* m4/matmul.m4: (matmul_'rtype_code`_avx2): Also generate for
reals.  Add fma to target options.
(matmul_'rtype_code`):  Call AVX2 only if FMA is available.
        * 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.

From-SVN: r245836

15 files changed:
libgfortran/ChangeLog
libgfortran/generated/matmul_c10.c
libgfortran/generated/matmul_c16.c
libgfortran/generated/matmul_c4.c
libgfortran/generated/matmul_c8.c
libgfortran/generated/matmul_i1.c
libgfortran/generated/matmul_i16.c
libgfortran/generated/matmul_i2.c
libgfortran/generated/matmul_i4.c
libgfortran/generated/matmul_i8.c
libgfortran/generated/matmul_r10.c
libgfortran/generated/matmul_r16.c
libgfortran/generated/matmul_r4.c
libgfortran/generated/matmul_r8.c
libgfortran/m4/matmul.m4

index 0485e6f698bee1a4a2f872fdb7ac4c464f895b94..ec72c6daa84bac6c63591b4ec432dde2473d2acd 100644 (file)
@@ -1,3 +1,23 @@
+2017-03-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/78379
+       * m4/matmul.m4: (matmul_'rtype_code`_avx2): Also generate for
+       reals.  Add fma to target options.
+       (matmul_'rtype_code`):  Call AVX2 only if FMA is available.
+        * 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.
+
 2017-02-27  Janne Blomqvist  <jb@gcc.gnu.org>
 
        * intrinsics/random.c (getosrandom): Don't try to use rand_s on
index 2892c50693f0e46c7c2dd9aaa0d1f26ec2f371e1..b333a844ea555c641692f19bd8f6fcf7ba7a3391 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_c10 (gfc_array_c10 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_c10);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray,
 static void
 matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, 
        gfc_array_c10 * const restrict a, gfc_array_c10 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, 
        gfc_array_c10 * const restrict a, gfc_array_c10 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_c10 (gfc_array_c10 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_c10_avx2;
              goto tailcall;
index d67ec15a5f2726b49cb445a49560e4cdb2b035b7..0ef66c0f4a2c167b45ad9d4e4fe01a7841d9afdc 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_c16 (gfc_array_c16 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_c16);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray,
 static void
 matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, 
        gfc_array_c16 * const restrict a, gfc_array_c16 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, 
        gfc_array_c16 * const restrict a, gfc_array_c16 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_c16 (gfc_array_c16 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_c16_avx2;
              goto tailcall;
index b20539d6e0bf4d203810d8a01dc14b3d7e938b41..b30320b37ae15a684c58aa11e29c9a84ba9c57ca 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_c4 (gfc_array_c4 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_c4);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray,
 static void
 matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, 
        gfc_array_c4 * const restrict a, gfc_array_c4 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, 
        gfc_array_c4 * const restrict a, gfc_array_c4 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_c4 (gfc_array_c4 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_c4_avx2;
              goto tailcall;
index 954dd5ee0640d2cab5d4c016025376e8c785844d..75b4680c3a0a77a07e54769545f1e59b12f43304 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_c8 (gfc_array_c8 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_c8);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray,
 static void
 matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, 
        gfc_array_c8 * const restrict a, gfc_array_c8 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, 
        gfc_array_c8 * const restrict a, gfc_array_c8 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_c8 (gfc_array_c8 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_c8_avx2;
              goto tailcall;
index 621183671ee67eef2e2fd2a9f671e8d287b84a18..924826338d8d909b125f4e0f4c0da1a6ce95f3e0 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_i1 (gfc_array_i1 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_i1);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray,
 static void
 matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, 
        gfc_array_i1 * const restrict a, gfc_array_i1 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, 
        gfc_array_i1 * const restrict a, gfc_array_i1 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_i1 (gfc_array_i1 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_i1_avx2;
              goto tailcall;
index 51e92fb84c61e07299593fd0034447779aa74616..f10540ed48a1daca20d61bf8869bb464bf9527a4 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_i16 (gfc_array_i16 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_i16);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray,
 static void
 matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict a, gfc_array_i16 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict a, gfc_array_i16 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_i16 (gfc_array_i16 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_i16_avx2;
              goto tailcall;
index 2077db3ed26bf60cf39bfc3605700355ed2c5f72..55ad5c614e66eee2825f1be0212a9b1b30f6cbe9 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_i2 (gfc_array_i2 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_i2);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray,
 static void
 matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, 
        gfc_array_i2 * const restrict a, gfc_array_i2 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, 
        gfc_array_i2 * const restrict a, gfc_array_i2 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_i2 (gfc_array_i2 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_i2_avx2;
              goto tailcall;
index 053f4a5263c29b3b30e788e531d2e556b0867449..97b4a5b6aa0889383561aa0547d5aa8cb2432538 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_i4 (gfc_array_i4 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_i4);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray,
 static void
 matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict a, gfc_array_i4 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict a, gfc_array_i4 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_i4 (gfc_array_i4 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_i4_avx2;
              goto tailcall;
index a3418d8a6a39c117bceb42c8418567c43facc21b..ae78ecfccb68af32deaab2aa38915d3b33d10c49 100644 (file)
@@ -74,9 +74,6 @@ extern void matmul_i8 (gfc_array_i8 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_i8);
 
-
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -628,7 +625,7 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray,
 static void
 matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict a, gfc_array_i8 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict a, gfc_array_i8 * const restrict b, int try_blas,
@@ -2277,7 +2274,8 @@ void matmul_i8 (gfc_array_i8 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_i8_avx2;
              goto tailcall;
index 24a331a948ce6e849d7a59e0a6615302b7e397bf..11d059198c92b0f1dfb0483145d040f5567bf2b9 100644 (file)
@@ -74,13 +74,6 @@ extern void matmul_r10 (gfc_array_r10 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_r10);
 
-#if defined(HAVE_AVX) && defined(HAVE_AVX2)
-/* REAL types generate identical code for AVX and AVX2.  Only generate
-   an AVX2 function if we are dealing with integer.  */
-#undef HAVE_AVX2
-#endif
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -632,7 +625,7 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray,
 static void
 matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, 
        gfc_array_r10 * const restrict a, gfc_array_r10 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, 
        gfc_array_r10 * const restrict a, gfc_array_r10 * const restrict b, int try_blas,
@@ -2281,7 +2274,8 @@ void matmul_r10 (gfc_array_r10 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_r10_avx2;
              goto tailcall;
index be3e8fd217f88cd8578e3406a0d1d2a1909a2a1b..73e7c9877adf09c4ff13f593aa44e0c478266f49 100644 (file)
@@ -74,13 +74,6 @@ extern void matmul_r16 (gfc_array_r16 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_r16);
 
-#if defined(HAVE_AVX) && defined(HAVE_AVX2)
-/* REAL types generate identical code for AVX and AVX2.  Only generate
-   an AVX2 function if we are dealing with integer.  */
-#undef HAVE_AVX2
-#endif
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -632,7 +625,7 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray,
 static void
 matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, 
        gfc_array_r16 * const restrict a, gfc_array_r16 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, 
        gfc_array_r16 * const restrict a, gfc_array_r16 * const restrict b, int try_blas,
@@ -2281,7 +2274,8 @@ void matmul_r16 (gfc_array_r16 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_r16_avx2;
              goto tailcall;
index b7a40d30b5d11e5df64da5b81adc3da06d64161d..ac7306fe035f8830c4475b85aba2e00355c8c443 100644 (file)
@@ -74,13 +74,6 @@ extern void matmul_r4 (gfc_array_r4 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_r4);
 
-#if defined(HAVE_AVX) && defined(HAVE_AVX2)
-/* REAL types generate identical code for AVX and AVX2.  Only generate
-   an AVX2 function if we are dealing with integer.  */
-#undef HAVE_AVX2
-#endif
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -632,7 +625,7 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray,
 static void
 matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, 
        gfc_array_r4 * const restrict a, gfc_array_r4 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, 
        gfc_array_r4 * const restrict a, gfc_array_r4 * const restrict b, int try_blas,
@@ -2281,7 +2274,8 @@ void matmul_r4 (gfc_array_r4 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_r4_avx2;
              goto tailcall;
index cffa4ecce903b495942acd70b998c03259671605..8d2e784de60753f209e94c4c7c34211c5e56d1d4 100644 (file)
@@ -74,13 +74,6 @@ extern void matmul_r8 (gfc_array_r8 * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_r8);
 
-#if defined(HAVE_AVX) && defined(HAVE_AVX2)
-/* REAL types generate identical code for AVX and AVX2.  Only generate
-   an AVX2 function if we are dealing with integer.  */
-#undef HAVE_AVX2
-#endif
-
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -632,7 +625,7 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray,
 static void
 matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, 
        gfc_array_r8 * const restrict a, gfc_array_r8 * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static void
 matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, 
        gfc_array_r8 * const restrict a, gfc_array_r8 * const restrict b, int try_blas,
@@ -2281,7 +2274,8 @@ void matmul_r8 (gfc_array_r8 * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_r8_avx2;
              goto tailcall;
index 27381293dba32d1c1d589ce4e582594f91b58687..812a7e7e5714f2c741d051d1dfd486f61baa5327 100644 (file)
@@ -75,14 +75,6 @@ extern void matmul_'rtype_code` ('rtype` * const restrict retarray,
        int blas_limit, blas_call gemm);
 export_proto(matmul_'rtype_code`);
 
-'ifelse(rtype_letter,`r',dnl
-`#if defined(HAVE_AVX) && defined(HAVE_AVX2)
-/* REAL types generate identical code for AVX and AVX2.  Only generate
-   an AVX2 function if we are dealing with integer.  */
-#undef HAVE_AVX2
-#endif')
-`
-
 /* Put exhaustive list of possible architectures here here, ORed together.  */
 
 #if defined(HAVE_AVX) || defined(HAVE_AVX2) || defined(HAVE_AVX512F)
@@ -101,7 +93,7 @@ static' include(matmul_internal.m4)dnl
 `static void
 'matmul_name` ('rtype` * const restrict retarray, 
        'rtype` * const restrict a, 'rtype` * const restrict b, int try_blas,
-       int blas_limit, blas_call gemm) __attribute__((__target__("avx2")));
+       int blas_limit, blas_call gemm) __attribute__((__target__("avx2,fma")));
 static' include(matmul_internal.m4)dnl
 `#endif /* HAVE_AVX2 */
 
@@ -147,7 +139,8 @@ void matmul_'rtype_code` ('rtype` * const restrict retarray,
 #endif  /* HAVE_AVX512F */
 
 #ifdef HAVE_AVX2
-         if (__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+         if ((__cpu_model.__cpu_features[0] & (1 << FEATURE_AVX2))
+            && (__cpu_model.__cpu_features[0] & (1 << FEATURE_FMA)))
            {
              matmul_p = matmul_'rtype_code`_avx2;
              goto tailcall;