]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorRichard Biener <rguenther@suse.de>
Wed, 20 Jun 2018 13:10:21 +0000 (13:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 20 Jun 2018 13:10:21 +0000 (13:10 +0000)
2018-06-20  Richard Biener  <rguenther@suse.de>

Backport from mainline
2018-03-16  Richard Biener  <rguenther@suse.de>

PR c/84873
* c-gimplify.c (c_gimplify_expr): Revert previous change.  Instead
unshare the possibly folded expression.

2018-03-15  Richard Biener  <rguenther@suse.de>

PR c/84873
* c-gimplify.c (c_gimplify_expr): Do not fold expressions.

* c-c++-common/pr84873.c: New testcase.

2018-05-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/85597
* tree-vect-stmts.c (vectorizable_operation): For ternary SLP
do not use split vect_get_vec_defs call but call vect_get_slp_defs
directly.

* gcc.dg/vect/pr85597.c: New testcase.

From-SVN: r261800

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr84873.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr85597.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index d450f790bd04b13a8c815dc3eef1528c7542b407..14bcf30b2029ebfba81a239b206742764f7d1556 100644 (file)
@@ -1,3 +1,13 @@
+2018-06-20  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2018-05-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/85597
+       * tree-vect-stmts.c (vectorizable_operation): For ternary SLP
+       do not use split vect_get_vec_defs call but call vect_get_slp_defs
+       directly.
+
 2018-06-20  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index 8abb86aa56b616f784739223f04739a072f352e1..39314b27ef0225ccf0b868c420e06c8aab3f40a7 100644 (file)
@@ -1,3 +1,17 @@
+2018-06-20  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2018-03-16  Richard Biener  <rguenther@suse.de>
+
+       PR c/84873
+       * c-gimplify.c (c_gimplify_expr): Revert previous change.  Instead
+       unshare the possibly folded expression.
+       2018-03-15  Richard Biener  <rguenther@suse.de>
+
+       PR c/84873
+       * c-gimplify.c (c_gimplify_expr): Do not fold expressions.
+
 2017-09-15  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index c18b057727cf33afd5b4617f3cd584e0d41cb623..6ecf379a1e76489d20d2e1be54ecb039b87c2111 100644 (file)
@@ -240,7 +240,9 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
                                    unsigned_type_node)
            && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
                                    integer_type_node))
-         *op1_p = convert (unsigned_type_node, *op1_p);
+         /* Make sure to unshare the result, tree sharing is invalid
+            during gimplification.  */
+         *op1_p = unshare_expr (convert (unsigned_type_node, *op1_p));
        break;
       }
 
index 3fb5f41454ad0cdfbebdb99a9b6fc4eeb55dea74..67095b8a5146e49bdb9658fb6fcc9555a18be10c 100644 (file)
@@ -1,3 +1,16 @@
+2018-06-20  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2018-03-15  Richard Biener  <rguenther@suse.de>
+
+       PR c/84873
+       * c-c++-common/pr84873.c: New testcase.
+
+       2018-05-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/85597
+       * gcc.dg/vect/pr85597.c: New testcase.
+
 2018-06-20  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/c-c++-common/pr84873.c b/gcc/testsuite/c-c++-common/pr84873.c
new file mode 100644 (file)
index 0000000..5eb8a8d
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-frounding-math" } */
+
+int
+i1 (int w3, int n9)
+{
+  return w3 >> ((long int)(1 + 0.1) + -!n9);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr85597.c b/gcc/testsuite/gcc.dg/vect/pr85597.c
new file mode 100644 (file)
index 0000000..cf615f9
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-mfma" { target { x86_64-*-* i?86-*-* } } } */
+
+extern double fma (double, double, double);
+
+static inline void
+bar (int i, double *D, double *S)
+{
+  while (i-- > 0)
+    {
+      D[0] = fma (1, S[0], D[0]);
+      D[1] = fma (1, S[1], D[1]);
+      D[2] = fma (1, S[2], D[2]);
+      D[3] = fma (1, S[3], D[3]);
+      D += 4;
+      S += 4;
+    }
+}
+
+void
+foo (double *d, double *s)
+{
+  bar (10, d, s);
+}
+
index 5fbaadc523f258262fbaceb484c3ff89a67de866..9ac7cf3a2ec09dea46b5e7e377d1f1af0d969148 100644 (file)
@@ -5078,15 +5078,34 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi,
       /* Handle uses.  */
       if (j == 0)
        {
-         if (op_type == binary_op || op_type == ternary_op)
+         if (op_type == binary_op)
            vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
                               slp_node, -1);
+         else if (op_type == ternary_op)
+           {
+             if (slp_node)
+               {
+                 auto_vec<tree> ops(3);
+                 ops.quick_push (op0);
+                 ops.quick_push (op1);
+                 ops.quick_push (op2);
+                 auto_vec<vec<tree> > vec_defs(3);
+                 vect_get_slp_defs (ops, slp_node, &vec_defs, -1);
+                 vec_oprnds0 = vec_defs[0];
+                 vec_oprnds1 = vec_defs[1];
+                 vec_oprnds2 = vec_defs[2];
+               }
+             else
+               { 
+                 vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
+                                    NULL, -1);
+                 vect_get_vec_defs (op2, NULL_TREE, stmt, &vec_oprnds2, NULL,
+                                    NULL, -1);
+               }
+           }
          else
            vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
                               slp_node, -1);
-         if (op_type == ternary_op)
-           vect_get_vec_defs (op2, NULL_TREE, stmt, &vec_oprnds2, NULL,
-                              slp_node, -1);
        }
       else
        {