public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] tree-optimization/95487 - use a truth type for scatter masks
@ 2020-08-22 21:56 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:584436db8cffb154bbb8e02c51da58eb240533e1

commit 584436db8cffb154bbb8e02c51da58eb240533e1
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 3 15:51:29 2020 +0200

    tree-optimization/95487 - use a truth type for scatter masks
    
    This makes sure to get a truth type for scatter masks even when they
    are invariant.
    
    2020-06-03  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/95487
            * tree-vect-stmts.c (vectorizable_store): Use a truth type
            for the scatter mask.
    
            * g++.dg/vect/pr95487.cc: New testcase.

Diff:
---
 gcc/testsuite/g++.dg/vect/pr95487.cc | 20 ++++++++++++++++++++
 gcc/tree-vect-stmts.c                |  8 ++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/g++.dg/vect/pr95487.cc b/gcc/testsuite/g++.dg/vect/pr95487.cc
new file mode 100644
index 00000000000..34023d25572
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr95487.cc
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-additional-options "-O3" }
+// { dg-additional-options "-march=skylake-avx512" { target x86_64-*-* i?86-*-* } }
+
+int a;
+bool d;
+char e;
+extern short f[];
+extern int g[];
+short j;
+void h() {
+  for (short b = j; b < 0; b += 2) {
+    f[b] = 0;
+    if (d) {
+      for (char c = 0; c < a; c += 3)
+        e = 0;
+      g[b] = 0;
+    }
+  }
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index a6c7f333fc7..5548f0d987f 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -7676,8 +7676,12 @@ vectorizable_store (vec_info *vinfo,
 							      gs_info.offset,
 							      stmt_info);
 	      if (mask)
-		mask_op = vec_mask = vect_get_vec_def_for_operand (vinfo, mask,
-								   stmt_info);
+		{
+		  tree mask_vectype = truth_type_for (vectype);
+		  mask_op = vec_mask
+		    = vect_get_vec_def_for_operand (vinfo, mask,
+						    stmt_info, mask_vectype);
+		}
 	    }
 	  else if (modifier != NONE && (j & 1))
 	    {


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

only message in thread, other threads:[~2020-08-22 21:56 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:56 [gcc/devel/autopar_devel] tree-optimization/95487 - use a truth type for scatter masks 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).