]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/91723 (builtin fma is not optimized or vectorized...
authorJakub Jelinek <jakub@redhat.com>
Mon, 21 Oct 2019 11:41:40 +0000 (13:41 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 21 Oct 2019 11:41:40 +0000 (13:41 +0200)
Backported from mainline
2019-09-11  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/91723
* tree-vect-stmts.c (vectorizable_call): Use types_compatible_p check
instead of pointer equality when checking if argument vectypes are
the same.

* gcc.dg/vect/vect-fma-3.c: New test.

From-SVN: r277250

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-fma-3.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index c98ac09f6fa2f4a77a7bb4d9229c4de270cb5f2f..fc6fbfd3e2a99656491d846366b7cf89c64c9e99 100644 (file)
@@ -1,6 +1,13 @@
 2019-10-21  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-09-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91723
+       * tree-vect-stmts.c (vectorizable_call): Use types_compatible_p check
+       instead of pointer equality when checking if argument vectypes are
+       the same.
+
        2019-09-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/91665
index c6a1ad795a18e7baf90680507850da3125b0dd6d..c72e2983701b285faa82401a0bcb73d3304d0308 100644 (file)
@@ -1,6 +1,11 @@
 2019-10-21  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-09-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91723
+       * gcc.dg/vect/vect-fma-3.c: New test.
+
        2019-09-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/91665
diff --git a/gcc/testsuite/gcc.dg/vect/vect-fma-3.c b/gcc/testsuite/gcc.dg/vect/vect-fma-3.c
new file mode 100644 (file)
index 0000000..b231a32
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR tree-optimization/91723 */
+/* { dg-do compile { target { scalar_all_fma || { i?86-*-* x86_64-*-* } } } } */
+/* { dg-additional-options "-mfma" { target { i?86-*-* x86_64-*-* } } } */
+
+void
+foo (double *restrict r, const double *restrict a,
+     const double *restrict b, const double *restrict c)
+{
+  for (int i = 0; i < 1024; i++)
+    {
+      double x = __builtin_fma (a[i], b[i], c[i]);
+      x = __builtin_fma (a[i], b[i], x);
+      r[i] = x;
+    }
+}
+
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" { target vect_double } } } */
index ad998aa5770e62bf01c8fadcc666fcea712a1bd9..8263889cbe415adbdcb9b3baf998b1744f6a0e54 100644 (file)
@@ -3279,7 +3279,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
       if (!vectype_in)
        vectype_in = vectypes[i];
       else if (vectypes[i]
-              && vectypes[i] != vectype_in)
+              && !types_compatible_p (vectypes[i], vectype_in))
        {
          if (dump_enabled_p ())
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,