public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Philipp Tomsich <ptomsich@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/vrull/heads/slp-improvements)] Add testcase for #346
Date: Wed, 17 Jan 2024 19:14:51 +0000 (GMT)	[thread overview]
Message-ID: <20240117191451.A54A33858C2A@sourceware.org> (raw)

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

commit f963e37f4fc86f3683a586eec6ddb4b624ef42a4
Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
Date:   Thu Nov 30 10:25:07 2023 +0100

    Add testcase for #346

Diff:
---
 gcc/testsuite/gcc.dg/fold-perm-3.c | 44 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/fold-perm-3.c b/gcc/testsuite/gcc.dg/fold-perm-3.c
new file mode 100644
index 00000000000..925bb5fcc60
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-perm-3.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+typedef int veci __attribute__ ((vector_size (4 * sizeof (int))));
+
+void sink(veci, veci);
+
+void fun1 (veci *a)
+{
+  veci c1 = __builtin_shufflevector (a[0], a[0], 0, 0, 1, 1);
+  veci c2 = __builtin_shufflevector (a[1], a[1], 2, 2, 3, 3);
+  veci c3 = __builtin_shufflevector (a[2], a[2], 0, 0, 1, 1);
+  veci c4 = __builtin_shufflevector (a[3], a[3], 2, 2, 3, 3);
+  veci d1 = c1 + c2;
+  veci d2 = c1 - c2;
+  veci d3 = c3 + c4;
+  veci d4 = c3 - c4;
+  veci e1 = __builtin_shufflevector (d1, d2, 0, 4, 2, 6);
+  veci e2 = __builtin_shufflevector (d3, d4, 0, 4, 2, 6);
+
+  sink(e1, e2);
+}
+
+void fun2 (veci *a)
+{
+  veci c1 = __builtin_shufflevector (a[0], a[0], 0, 1, 0, 1);
+  veci c2 = __builtin_shufflevector (a[1], a[1], 2, 3, 2, 3);
+  veci c3 = __builtin_shufflevector (a[2], a[2], 0, 1, 0, 1);
+  veci c4 = __builtin_shufflevector (a[3], a[3], 2, 3, 2, 3);
+  veci d1 = c1 + c2;
+  veci d2 = c1 - c2;
+  veci d3 = c3 + c4;
+  veci d4 = c3 - c4;
+  veci e1 = __builtin_shufflevector (d1, d2, 0, 1, 4, 5);
+  veci e2 = __builtin_shufflevector (d3, d4, 0, 1, 4, 5);
+
+  sink(e1, e2);
+}
+
+/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 0, 4, 2, 6 }" "optimized" } } */
+/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 1, 5, 3, 7 }" "optimized" } } */
+/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 0, 1, 4, 5 }" "optimized" } } */
+/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 2, 3, 6, 7 }" "optimized" } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 8 "optimized" } } */

             reply	other threads:[~2024-01-17 19:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 19:14 Philipp Tomsich [this message]
2024-01-23 20:58 Philipp Tomsich

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=20240117191451.A54A33858C2A@sourceware.org \
    --to=ptomsich@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).