public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] tree-optimization/95297 - handle scalar shift arg for SLP invariant vectype
@ 2020-08-22 21:33 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:691d738863e56201c756488824d51c11cc9ac8f6

commit 691d738863e56201c756488824d51c11cc9ac8f6
Author: Richard Biener <rguenther@suse.de>
Date:   Mon May 25 11:14:03 2020 +0200

    tree-optimization/95297 - handle scalar shift arg for SLP invariant vectype
    
    This skips invariant vector type setting for a scalar shift argument.
    
    2020-05-25  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/95297
            * tree-vect-stmts.c (vectorizable_shift): For scalar_shift_arg
            skip updating operand 1 vector type.
    
            * g++.dg/vect/pr95297.cc: New testcase.
            * g++.dg/vect/pr95290.cc: Likewise.

Diff:
---
 gcc/ChangeLog                        |  6 ++++++
 gcc/testsuite/ChangeLog              |  6 ++++++
 gcc/testsuite/g++.dg/vect/pr95290.cc | 25 +++++++++++++++++++++++++
 gcc/testsuite/g++.dg/vect/pr95297.cc | 22 ++++++++++++++++++++++
 gcc/tree-vect-stmts.c                |  3 ++-
 5 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8a089279e1b..38ca3ef863b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-25  Richard Biener  <rguenther@suse.de>
+
+	PR tree-optimization/95297
+	* tree-vect-stmts.c (vectorizable_shift): For scalar_shift_arg
+	skip updating operand 1 vector type.
+
 2020-05-25  Richard Biener  <rguenther@suse.de>
 
 	PR tree-optimization/95284
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index db94bd05bc3..2ac873c4291 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-25  Richard Biener  <rguenther@suse.de>
+
+	PR tree-optimization/95297
+	* g++.dg/vect/pr95297.cc: New testcase.
+	* g++.dg/vect/pr95290.cc: Likewise.
+
 2020-05-25  Richard Biener  <rguenther@suse.de>
 
 	PR tree-optimization/95284
diff --git a/gcc/testsuite/g++.dg/vect/pr95290.cc b/gcc/testsuite/g++.dg/vect/pr95290.cc
new file mode 100644
index 00000000000..150bbf72103
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr95290.cc
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+typedef short a;
+enum b {};
+typedef struct {
+      a c;
+} d;
+typedef struct {
+      a e, f;
+} g;
+typedef struct {
+      g h;
+} i;
+typedef struct {
+      d j;
+        int k;
+} l;
+class m
+{
+  i imgdata;
+  void n();
+  l o;
+};
+void m::n() try { imgdata.h.e = imgdata.h.f = o.j.c >> o.j.c; } catch (b) {
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr95297.cc b/gcc/testsuite/g++.dg/vect/pr95297.cc
new file mode 100644
index 00000000000..6ffc92e5fd0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr95297.cc
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-additional-options "-O3 -fvect-cost-model=dynamic" }
+
+extern bool var_10;
+extern int var_16;
+extern short var_17;
+extern long var_18;
+extern int arr_3[][13];
+
+int min(const int &a, const int &b)
+{
+  return a < b ? a : b;
+}
+
+void test() {
+    for (short a = 0; a < 010; a++)
+      for (char b = 0; b < 012; b++)
+	arr_3[a][b] = min(-var_10, 0) + 2147483647 >> var_10;
+    var_16 = (bool)4;
+    var_17 = 0;
+    var_18 = -1594153176;
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index e7822c44951..c3254926e22 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5774,7 +5774,8 @@ vectorizable_shift (vec_info *vinfo,
     {
       if (slp_node
 	  && (!vect_maybe_update_slp_op_vectype (slp_op0, vectype)
-	      || !vect_maybe_update_slp_op_vectype (slp_op1, op1_vectype)))
+	      || (!scalar_shift_arg
+		  && !vect_maybe_update_slp_op_vectype (slp_op1, op1_vectype))))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-22 21:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:33 [gcc/devel/autopar_devel] tree-optimization/95297 - handle scalar shift arg for SLP invariant vectype Giuliano Belinassi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).