public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hao Liu OS <hliu@os.amperecomputing.com>
To: Richard Biener <rguenther@suse.de>,
	"GCC-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] testsuite: add the case to cover vectorization of A[(i+x)*stride] [PR114322]
Date: Wed, 20 Mar 2024 07:55:19 +0000	[thread overview]
Message-ID: <CYYPR01MB830975D3D960F112E00AB5D5E1332@CYYPR01MB8309.prod.exchangelabs.com> (raw)

Hi Richard,

As mentioned in the comments of PR114322 (which has been fixed by PR114151
r14-9540-ge0e9499a), this patch is to cover the case.

Bootstrapped and regression tested on aarch64-linux-gnu, OK for trunk?

gcc/testsuite/ChangeLog:

	PR tree-optimization/114322
	* gcc.dg/vect/pr114322.c: New testcase.

diff --git a/gcc/testsuite/gcc.dg/vect/pr114322.c b/gcc/testsuite/gcc.dg/vect/pr114322.c
new file mode 100644
index 00000000000..7c3a4ffe260
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr114322.c
@@ -0,0 +1,18 @@
+/* PR tree-optimization/114322 */
+/* { dg-do compile } */
+
+int
+foo (short *A, int x, int stride)
+{
+  int sum = 0;
+
+  if (stride > 1)
+    {
+      for (int i = 0; i < 1024; ++i)
+        sum += A[(i + x) * stride];
+    }
+
+  return sum;
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target aarch64*-*-* } } } */
-- 
2.34.1


             reply	other threads:[~2024-03-20  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20  7:55 Hao Liu OS [this message]
2024-03-20  8:21 ` Richard Biener
2024-03-20  9:43   ` Hao Liu OS

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=CYYPR01MB830975D3D960F112E00AB5D5E1332@CYYPR01MB8309.prod.exchangelabs.com \
    --to=hliu@os.amperecomputing.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).