public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tamar Christina <tamar.christina@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: nd@arm.com, rguenther@suse.de, ook@ucw.cz
Subject: [PATCH]middle-end vect: Exclude TOP permute from blend considerations
Date: Mon, 14 Dec 2020 15:17:13 +0000	[thread overview]
Message-ID: <patch-13912-tamar@arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

Hi All,

Similarly to UNKNOWN permutes, TOP needs to be excluded from being considered
for blends because it produces no permute to check.

Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
and no issues.

Committed under the GCC obvious rules.

Thanks,
Tamar

gcc/ChangeLog:

	PR middle-end/98264
	* tree-vect-slp-patterns.c (linear_loads_p): Exclude TOP permute.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr98264.c: New test.

--- inline copy of patch --

diff --git a/gcc/testsuite/gcc.target/i386/pr98264.c b/gcc/testsuite/gcc.target/i386/pr98264.c
new file mode 100644
index 0000000000000000000000000000000000000000..ea235277911f2a48b4b6f2ccd75a4f9000918599
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98264.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 -w" } */
+
+a[], g[], h[];
+double b, c;
+double j[];
+i;
+l() {
+  int e = 0;
+  for (; e < 80; e += 4) {
+    a[0] = h[e];
+    a[1] = h[e + 1];
+    j[0] = a[0] - c;
+    j[1] = a[1] + b;
+    __attribute__(()) k = *(double *)a, e, f = e = 0;
+    *g = k;
+    double *d = j;
+    for (; e < 2; e++)
+      if (d[e])
+        i = f;
+  }
+}
diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
index bb2830d1d35d1607d1566868ffbcead97e4790d7..fede88923af8521ee4954c8ae27b0e589f975610 100644
--- a/gcc/tree-vect-slp-patterns.c
+++ b/gcc/tree-vect-slp-patterns.c
@@ -240,7 +240,8 @@ linear_loads_p (slp_tree_to_load_perm_map_t *perm_cache, slp_tree root)
     {
       complex_load_perm_t res = linear_loads_p (perm_cache, child);
       kind = vect_merge_perms (kind, res.first);
-      if (kind == PERM_UNKNOWN)
+      /* Unknown and Top are not valid on blends as they produce no permute.  */
+      if (kind == PERM_UNKNOWN || kind == PERM_TOP)
 	return retval;
       all_loads.safe_push (res.second);
     }


-- 

[-- Attachment #2: rb13912.patch --]
[-- Type: text/x-diff, Size: 1375 bytes --]

diff --git a/gcc/testsuite/gcc.target/i386/pr98264.c b/gcc/testsuite/gcc.target/i386/pr98264.c
new file mode 100644
index 0000000000000000000000000000000000000000..ea235277911f2a48b4b6f2ccd75a4f9000918599
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr98264.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 -w" } */
+
+a[], g[], h[];
+double b, c;
+double j[];
+i;
+l() {
+  int e = 0;
+  for (; e < 80; e += 4) {
+    a[0] = h[e];
+    a[1] = h[e + 1];
+    j[0] = a[0] - c;
+    j[1] = a[1] + b;
+    __attribute__(()) k = *(double *)a, e, f = e = 0;
+    *g = k;
+    double *d = j;
+    for (; e < 2; e++)
+      if (d[e])
+        i = f;
+  }
+}
diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
index bb2830d1d35d1607d1566868ffbcead97e4790d7..fede88923af8521ee4954c8ae27b0e589f975610 100644
--- a/gcc/tree-vect-slp-patterns.c
+++ b/gcc/tree-vect-slp-patterns.c
@@ -240,7 +240,8 @@ linear_loads_p (slp_tree_to_load_perm_map_t *perm_cache, slp_tree root)
     {
       complex_load_perm_t res = linear_loads_p (perm_cache, child);
       kind = vect_merge_perms (kind, res.first);
-      if (kind == PERM_UNKNOWN)
+      /* Unknown and Top are not valid on blends as they produce no permute.  */
+      if (kind == PERM_UNKNOWN || kind == PERM_TOP)
 	return retval;
       all_loads.safe_push (res.second);
     }


                 reply	other threads:[~2020-12-14 15:18 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=patch-13912-tamar@arm.com \
    --to=tamar.christina@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.com \
    --cc=ook@ucw.cz \
    --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).