middle-end: Exclude TOP permute from blend considerations
authorTamar Christina <tamar.christina@arm.com>
Mon, 14 Dec 2020 15:20:05 +0000 (15:20 +0000)
committerTamar Christina <tamar.christina@arm.com>
Mon, 14 Dec 2020 15:20:11 +0000 (15:20 +0000)
Similarly to UNKNOWN permutes, TOP needs to be excluded from being considered
for blends because it produces no permute to check.

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

PR middle-end/98264
* gcc.target/i386/pr98264.c: New test.

gcc/testsuite/gcc.target/i386/pr98264.c [new file with mode: 0644]
gcc/tree-vect-slp-patterns.c

diff --git a/gcc/testsuite/gcc.target/i386/pr98264.c b/gcc/testsuite/gcc.target/i386/pr98264.c
new file mode 100644 (file)
index 0000000..ea23527
--- /dev/null
@@ -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;
+  }
+}
index bb2830d1d35d1607d1566868ffbcead97e4790d7..fede88923af8521ee4954c8ae27b0e589f975610 100644 (file)
@@ -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);
     }