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/107617] SCC-VN with len_store and big endian
Date: Mon, 28 Nov 2022 11:38:10 +0000	[thread overview]
Message-ID: <bug-107617-4-XEOLHfx3dH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107617-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I suppose it's the

+  MEM <vector(4) integer(kind=4)> [(integer(kind=4) *)_13] = { -1, 1, -1, 1 };
...
+  .LEN_STORE (vectp.75_247, 64B, 11, { 255, 255, 255, 255, 0, 0, 0, 1, 255,
255, 255, 255, 0, 0, 0, 1 }, -1);
..
+  MEM <vector(2) integer(kind=8)> [(integer(kind=8) *)&a] = { -1, 1 };
+  MEM <vector(2) integer(kind=8)> [(integer(kind=8) *)&a + 16B] = { -1, 1 };
+  a[4] = 1;
+  a[5] = -1;
+  a[6] = 1;

you are talking about where we elide the scalar loads from _13 stored into
a[].

A gimple testcase would be something like

typedef unsigned char v16qi __attribute__((vector_size(16)));

int a[4];

void __GIMPLE (ssa)
foo (void *p)
{
  int v;

  __BB(2):
  .LEN_STORE (p_1(D), _Literal (int *) 64, 11, _Literal (v16qi) { _Literal
(unsigned char) 255, _Literal (unsigned char) 255, _Literal (unsigned char)
255, _Literal (unsigned char) 255, _Literal (unsigned char) 0, _Literal
(unsigned char) 0, _Literal (unsigned char) 0, _Literal (unsigned char) 1,
_Literal (unsigned char) 255, _Literal (unsigned char) 255, _Literal (unsigned
char) 255, _Literal (unsigned char) 255, _Literal (unsigned char) 0, _Literal
(unsigned char) 0, _Literal (unsigned char) 0, _Literal (unsigned char) 1 },
_Literal (signed char) -1);
  v_2 = __MEM <int> ((int *)p_1(D));
  v_3 = __MEM <int> ((int *)p_1(D) + 4);
  v_4 = __MEM <int> ((int *)p_1(D) + 8);
  v_5 = __MEM <int> ((int *)p_1(D) + 12);
  a[0] = v_2;
  a[1] = v_3;
  a[2] = v_4;
  a[3] = v_5;
  return;
}

which produces

  a[0] = 1;
  a[1] = _Literal (int) -1;
  a[2] = 1;
  a[3] = v_5;

changing the len to 15 and thus folding the .LEN_STORE to a full store changes
that to

  a[0] = _Literal (int) -1;
  a[1] = 1;
  a[2] = _Literal (int) -1;
  a[3] = 1;

which I assume is correct?  I think we'd need to feed a negative pd.rhs_off
into native_encode_expr but that's not supported there (and it treats -1
special).

Still .LEN_STORE covers bytes p + [0..11] here, correct?  But the stored
value is interpreted wrongly here and the new rhs_off assumes little-endian
adjustment.

  parent reply	other threads:[~2022-11-28 11:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 14:56 [Bug middle-end/107617] New: " rdapp at gcc dot gnu.org
2022-11-10 14:57 ` [Bug middle-end/107617] " rdapp at gcc dot gnu.org
2022-11-10 15:01 ` rdapp at gcc dot gnu.org
2022-11-11  7:42 ` [Bug tree-optimization/107617] " rguenth at gcc dot gnu.org
2022-11-28 11:38 ` rguenth at gcc dot gnu.org [this message]
2022-11-28 11:41 ` rguenth at gcc dot gnu.org
2022-12-11 13:36 ` rguenth at gcc dot gnu.org
2022-12-13  6:25 ` rdapp at linux dot ibm.com
2022-12-13 14:48 ` rdapp at linux dot ibm.com
2022-12-14  7:48 ` cvs-commit at gcc dot gnu.org
2022-12-14  7:49 ` 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-107617-4-XEOLHfx3dH@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).