public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robin Dapp <rdapp@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Biener <richard.guenther@gmail.com>,
	jakub@redhat.com
Subject: VN, len_store and endianness
Date: Mon, 26 Sep 2022 16:21:08 +0200	[thread overview]
Message-ID: <0a9b9375-6587-5a7d-2ec9-18e7501fe179@linux.ibm.com> (raw)

Hi,

I'm locally testing a branch that enables vll/vstl for partial vector
usage i.e. len_load and len_store on s390.  I see a FAIL in
testsuite/gfortran.dg/power_3.f90.
Since r13-1777-gbd9837bc3ca134 we also performe VN for masked/len stores
and things go wrong there.  The problem seems to be that we evaluate a
vector constant {-1, 1, -1, 1} loaded with length 11 + 1(bias) = 12 as
{1, -1, 1} instead of {-1, 1, -1}.

I found it a bit difficult to navigate through the logic due to several
sizes, offsets, lengths and "amounts" :)  From what I can tell the
culprit code is (guarded by BYTES_BIG_ENDIAN)

   if (TREE_CODE (pd.rhs) != CONSTRUCTOR)
     {
         q = (this_buffer + len
              - (ROUND_UP (size - amnt, BITS_PER_UNIT)
                 / BITS_PER_UNIT));
     }

where, with pd.rhs = { 255, 255, 255, 255, 0, 0, 0, 1, 255, 255, 255,
255, 0, 0, 0, 1 }, len = 16 bytes, size = 96 bits, we read after the
first 32 bits.  What is supposed to happen here?  It looks like going
backwards (when size grows), but actually size shrinks for my example
with each successive element via pd.offset 0, -32 and -64.

When skipping the block with && TREE_CODE (pd.rhs) != VECTOR_CST the
test and various others succeed but I didn't pursue testing further and
figured I'd rather ask here for more insight.

Regards
 Robin

             reply	other threads:[~2022-09-26 14:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 14:21 Robin Dapp [this message]
2022-09-27  8:39 ` Richard Biener
2022-09-27 13:19   ` Robin Dapp
2022-09-27 13:49     ` Richard Biener
2022-09-27 13:59       ` Robin Dapp
2022-09-29  7:32         ` Richard Biener

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=0a9b9375-6587-5a7d-2ec9-18e7501fe179@linux.ibm.com \
    --to=rdapp@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=richard.guenther@gmail.com \
    /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).