public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4350] tree-optimization/102572 - fix gathers with invariant mask Date: Tue, 12 Oct 2021 12:50:12 +0000 (GMT) [thread overview] Message-ID: <20211012125012.108A23858430@sourceware.org> (raw) https://gcc.gnu.org/g:9f12a45ef147e563f099c24c293830727e8204cc commit r12-4350-g9f12a45ef147e563f099c24c293830727e8204cc Author: Richard Biener <rguenther@suse.de> Date: Tue Oct 12 13:42:08 2021 +0200 tree-optimization/102572 - fix gathers with invariant mask This fixes the vector def gathering for invariant masks which failed to pass in the desired vector type resulting in a non-mask type to be generate. 2021-10-12 Richard Biener <rguenther@suse.de> PR tree-optimization/102572 * tree-vect-stmts.c (vect_build_gather_load_calls): When gathering the vectorized defs for the mask pass in the desired mask vector type so invariants will be handled correctly. * g++.dg/vect/pr102572.cc: New testcase. Diff: --- gcc/testsuite/g++.dg/vect/pr102572.cc | 14 ++++++++++++++ gcc/tree-vect-stmts.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/vect/pr102572.cc b/gcc/testsuite/g++.dg/vect/pr102572.cc new file mode 100644 index 00000000000..0a713081537 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr102572.cc @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-additional-options "-O3" } +// { dg-additional-options "-march=skylake-avx512" { target x86_64-*-* i?86-*-* } } + +int a, b, c, f; +void g(bool h, int d[][5]) +{ + for (short i = f; i; i += 1) + { + a = h && d[0][i]; + for (int j = 0; j < 4; j += c) + b = 0; + } +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index a9c9e3d7c37..f5e1941f8ad 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -2791,7 +2791,7 @@ vect_build_gather_load_calls (vec_info *vinfo, stmt_vec_info stmt_info, if (mask) vect_get_vec_defs_for_operand (vinfo, stmt_info, modifier == NARROW ? ncopies / 2 : ncopies, - mask, &vec_masks); + mask, &vec_masks, masktype); for (int j = 0; j < ncopies; ++j) { tree op, var;
reply other threads:[~2021-10-12 12:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211012125012.108A23858430@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).