aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-03-04 10:59:30 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2021-03-04 10:59:30 +0000
commit8634da04f3f6214cc36ebfeba38c4f3fca4473be (patch)
tree2cd9e50414108b319aa96aba4dc1dc0acfdd2332
parent9.3.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS (diff)
downloadgcc-patches-8634da04f3f6214cc36ebfeba38c4f3fca4473be.tar.gz
gcc-patches-8634da04f3f6214cc36ebfeba38c4f3fca4473be.tar.bz2
gcc-patches-8634da04f3f6214cc36ebfeba38c4f3fca4473be.zip
10.2.0: backport PR97236: fix bad use of VMAT_CONTIGUOUS
Bug: https://gcc.gnu.org/PR97236 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rw-r--r--10.2.0/gentoo/42_all_vmat-PR97236.patch116
-rw-r--r--10.2.0/gentoo/README.history3
2 files changed, 119 insertions, 0 deletions
diff --git a/10.2.0/gentoo/42_all_vmat-PR97236.patch b/10.2.0/gentoo/42_all_vmat-PR97236.patch
new file mode 100644
index 0000000..5a7643c
--- /dev/null
+++ b/10.2.0/gentoo/42_all_vmat-PR97236.patch
@@ -0,0 +1,116 @@
+https://gcc.gnu.org/PR97236
+
+From 1ab88985631dd2c5a5e3b5c0dce47cf8b6ed2f82 Mon Sep 17 00:00:00 2001
+From: Matthias Klose <doko@ubuntu.com>
+Date: Tue, 6 Oct 2020 13:41:37 +0200
+Subject: [PATCH] Backport fix for PR/tree-optimization/97236 - fix bad use of
+ VMAT_CONTIGUOUS
+
+This avoids using VMAT_CONTIGUOUS with single-element interleaving
+when using V1mode vectors. Instead keep VMAT_ELEMENTWISE but
+continue to avoid load-lanes and gathers.
+
+2020-10-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97236
+ * tree-vect-stmts.c (get_group_load_store_type): Keep
+ VMAT_ELEMENTWISE for single-element vectors.
+
+ * gcc.dg/vect/pr97236.c: New testcase.
+---
+ gcc/testsuite/gcc.dg/vect/pr97236.c | 43 +++++++++++++++++++++++++++++
+ gcc/tree-vect-stmts.c | 20 ++++++--------
+ 2 files changed, 52 insertions(+), 11 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/vect/pr97236.c
+
+diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c
+new file mode 100644
+index 00000000000..9d3dc20d953
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/pr97236.c
+@@ -0,0 +1,43 @@
++typedef unsigned char __uint8_t;
++typedef __uint8_t uint8_t;
++typedef struct plane_t {
++ uint8_t *p_pixels;
++ int i_lines;
++ int i_pitch;
++} plane_t;
++
++typedef struct {
++ plane_t p[5];
++} picture_t;
++
++#define N 4
++
++void __attribute__((noipa))
++picture_Clone(picture_t *picture, picture_t *res)
++{
++ for (int i = 0; i < N; i++) {
++ res->p[i].p_pixels = picture->p[i].p_pixels;
++ res->p[i].i_lines = picture->p[i].i_lines;
++ res->p[i].i_pitch = picture->p[i].i_pitch;
++ }
++}
++
++int
++main()
++{
++ picture_t aaa, bbb;
++ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1};
++
++ for (unsigned i = 0; i < N; i++)
++ aaa.p[i].p_pixels = pixels;
++
++ picture_Clone (&aaa, &bbb);
++
++ uint8_t c = 0;
++ for (unsigned i = 0; i < N; i++)
++ c += bbb.p[i].p_pixels[0];
++
++ if (c != N)
++ __builtin_abort ();
++ return 0;
++}
+diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
+index 9ace345fc5e..d8b2ff3d6ee 100644
+--- a/gcc/tree-vect-stmts.c
++++ b/gcc/tree-vect-stmts.c
+@@ -2413,25 +2413,23 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp,
+ /* First cope with the degenerate case of a single-element
+ vector. */
+ if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U))
+- *memory_access_type = VMAT_CONTIGUOUS;
++ ;
+
+ /* Otherwise try using LOAD/STORE_LANES. */
+- if (*memory_access_type == VMAT_ELEMENTWISE
+- && (vls_type == VLS_LOAD
+- ? vect_load_lanes_supported (vectype, group_size, masked_p)
+- : vect_store_lanes_supported (vectype, group_size,
+- masked_p)))
++ else if (vls_type == VLS_LOAD
++ ? vect_load_lanes_supported (vectype, group_size, masked_p)
++ : vect_store_lanes_supported (vectype, group_size,
++ masked_p))
+ {
+ *memory_access_type = VMAT_LOAD_STORE_LANES;
+ overrun_p = would_overrun_p;
+ }
+
+ /* If that fails, try using permuting loads. */
+- if (*memory_access_type == VMAT_ELEMENTWISE
+- && (vls_type == VLS_LOAD
+- ? vect_grouped_load_supported (vectype, single_element_p,
+- group_size)
+- : vect_grouped_store_supported (vectype, group_size)))
++ else if (vls_type == VLS_LOAD
++ ? vect_grouped_load_supported (vectype, single_element_p,
++ group_size)
++ : vect_grouped_store_supported (vectype, group_size))
+ {
+ *memory_access_type = VMAT_CONTIGUOUS_PERMUTE;
+ overrun_p = would_overrun_p;
+--
+2.30.1
+
diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history
index 48587e1..4ca261a 100644
--- a/10.2.0/gentoo/README.history
+++ b/10.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+7 TODO
+ + 42_all_vmat-PR97236.patch
+
6 29 Dec 2020
- 34_all_fundecl-ICE-PR95820.patch