public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1606] vect: Restore optab_vector argument [PR106250]
Date: Mon, 11 Jul 2022 14:59:16 +0000 (GMT)	[thread overview]
Message-ID: <20220711145916.433D1385DC03@sourceware.org> (raw)

https://gcc.gnu.org/g:e7a7fed818d238d45b18dfd927cde93b4711052d

commit r13-1606-ge7a7fed818d238d45b18dfd927cde93b4711052d
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Jul 11 15:59:00 2022 +0100

    vect: Restore optab_vector argument [PR106250]
    
    In g:76c3041b856cb0 I'd removed a "C ? optab_vector : optab_mixed_sign"
    argument from a call to directly_supported_p, thinking that the argument
    only existed because of the condition (which I was removing).  But the
    difference between the scalar and vector forms matters for shifts,
    so we do still need the argument.
    
    gcc/
            PR tree-optimization/106250
            * tree-vect-loop.cc (vectorizable_reduction): Reinstate final
            argument to directly_supported_p.

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr106250.c | 17 +++++++++++++++++
 gcc/tree-vect-loop.cc                |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/vect/pr106250.c b/gcc/testsuite/gcc.dg/vect/pr106250.c
new file mode 100644
index 00000000000..7f25f551869
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr106250.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+int
+foo (unsigned long int x, int y, int z)
+{
+  int ret = 0;
+
+  while (y < 1)
+    {
+      x *= 2;
+      ret = x == z;
+      z = y;
+      ++y;
+    }
+
+  return ret;
+}
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 3a70c15b593..2257b29a652 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7369,7 +7369,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
 	 dot-products.  */
       machine_mode vec_mode = TYPE_MODE (vectype_in);
       if (!lane_reduc_code_p
-	  && !directly_supported_p (op.code, vectype_in))
+	  && !directly_supported_p (op.code, vectype_in, optab_vector))
         {
           if (dump_enabled_p ())
             dump_printf (MSG_NOTE, "op not supported by target.\n");


                 reply	other threads:[~2022-07-11 14:59 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=20220711145916.433D1385DC03@sourceware.org \
    --to=rsandifo@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: link
Be 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).