public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/111970] [14 regression] SLP for non-IFN gathers result in RISC-V test failure on gather since r14-4745-gbeab5b95c58145
Date: Mon, 20 Nov 2023 14:20:02 +0000	[thread overview]
Message-ID: <bug-111970-4-rAR8WoFAzw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111970-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111970

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so for RISC-V with the testcase from the description there's the
following issue:

  _179 = &MEM <vector(64) unsigned char> [(uint8_t *)_618];
  _225 = BIT_FIELD_REF <MEM <vector(64) unsigned char> [(uint8_t *)_179], 8,
16>;
...
  vect__8.9_405 = {_218, _224, _230, _236, _242, _248, _254, _260, _266, _272,
_278, _284, _290, _296, _302, _308, _314, _320, _326, _332, _338, _344, _350,
_356, _362, _368, _374, _380, _386, _392, _398, _404};
  vect__11.11_599 = vect__8.9_405 + { 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0,
2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0,
2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0,
2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0 };
  _609 = (void *) ivtmp.31_622;
  MEM <vector(32) float> [(float *)_609] = vect__11.11_599;
  _1 = _609 + 128;
  MEM <vector(32) float> [(float *)_1] = vect__11.11_599;

I think the following fixes it:

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 96e4a6cffad..bf8c99779ae 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -9188,7 +9188,8 @@ vectorizable_store (vec_info *vinfo,
                  unsigned HOST_WIDE_INT factor
                    = const_offset_nunits / const_nunits;
                  vec_offset = vec_offsets[(vec_num * j + i) / factor];
-                 unsigned elt_offset = (j % factor) * const_nunits;
+                 unsigned elt_offset
+                   = ((vec_num * j + i) % factor) * const_nunits;
                  tree idx_type = TREE_TYPE (TREE_TYPE (vec_offset));
                  tree scale = size_int (gs_info.scale);
                  align = get_object_alignment (DR_REF (first_dr_info->dr));
@@ -11150,7 +11151,8 @@ vectorizable_load (vec_info *vinfo,
                  unsigned HOST_WIDE_INT factor
                    = const_offset_nunits / const_nunits;
                  vec_offset = vec_offsets[(vec_num * j + i) / factor];
-                 unsigned elt_offset = (j % factor) * const_nunits;
+                 unsigned elt_offset
+                   = ((vec_num * j + i) % factor) * const_nunits;
                  tree idx_type = TREE_TYPE (TREE_TYPE (vec_offset));
                  tree scale = size_int (gs_info.scale);
                  align = get_object_alignment (DR_REF (first_dr_info->dr));

  parent reply	other threads:[~2023-11-20 14:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  2:02 [Bug c/111970] New: [tree-optimization] SLP for non-IFN gathers result in RISC-V test failure on gather pan2.li at intel dot com
2023-10-25  2:03 ` [Bug c/111970] " pan2.li at intel dot com
2023-10-25  2:53 ` [Bug tree-optimization/111970] [14 regression] SLP for non-IFN gathers result in RISC-V test failure on gather since r14-4745-gbeab5b95c58145 pan2.li at intel dot com
2023-10-25  8:05 ` pan2.li at intel dot com
2023-10-27 12:29 ` rguenth at gcc dot gnu.org
2023-10-27 13:03 ` pan2.li at intel dot com
2023-10-31 12:49 ` rguenth at gcc dot gnu.org
2023-10-31 14:07 ` pan2.li at intel dot com
2023-10-31 14:16 ` pan2.li at intel dot com
2023-11-13 12:42 ` rguenth at gcc dot gnu.org
2023-11-13 22:07 ` juzhe.zhong at rivai dot ai
2023-11-20  6:49 ` juzhe.zhong at rivai dot ai
2023-11-20  6:51 ` juzhe.zhong at rivai dot ai
2023-11-20  6:52 ` juzhe.zhong at rivai dot ai
2023-11-20  8:10 ` juzhe.zhong at rivai dot ai
2023-11-20  8:22 ` rguenther at suse dot de
2023-11-20  8:30 ` rguenth at gcc dot gnu.org
2023-11-20 14:20 ` rguenth at gcc dot gnu.org [this message]
2023-11-20 14:58 ` rdapp at gcc dot gnu.org
2023-11-20 22:24 ` tnfchris at gcc dot gnu.org
2023-11-20 22:30 ` pinskia at gcc dot gnu.org
2023-11-20 23:56 ` pan2.li at intel dot com
2023-11-21  7:20 ` cvs-commit at gcc dot gnu.org
2023-11-21  7:24 ` rguenth at gcc dot gnu.org

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=bug-111970-4-rAR8WoFAzw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).