public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/92080] Missed CSE of _mm512_set1_epi8(c) with _mm256_set1_epi8(c)
Date: Thu, 21 Mar 2024 07:51:30 +0000	[thread overview]
Message-ID: <bug-92080-4-EWZTYp9rhI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92080-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 21 Mar 2024, liuhongt at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92080
> 
> Hongtao Liu <liuhongt at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |liuhongt at gcc dot gnu.org
> 
> --- Comment #7 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
> Another simple case is 
> 
> typedef int v4si __attribute__((vector_size(16)));
> typedef short v8hi __attribute__((vector_size(16)));
> 
> v8hi a;
> v4si b;
> void
> foo ()
> {
>    b = __extension__(v4si){0, 0, 0, 0};
>    a = __extension__(v8hi){0, 0, 0, 0, 0, 0, 0, 0};
> }
> 
> GCC generates 2 pxor
> 
> foo():
>         vpxor   xmm0, xmm0, xmm0
>         vmovdqa XMMWORD PTR b[rip], xmm0
>         vpxor   xmm0, xmm0, xmm0
>         vmovdqa XMMWORD PTR a[rip], xmm0
>         ret

If we were to expose that vpxor before postreload we'd likely CSE but
we have

    5: xmm0:V4SI=const_vector
      REG_EQUIV const_vector
    6: [`b']=xmm0:V4SI
    7: xmm0:V8HI=const_vector
      REG_EQUIV const_vector
    8: [`a']=xmm0:V8HI

until the very end.  But since we have the same mode size on the xmm0
sets CSE could easily handle (integral) constants by hashing/comparing
on their byte representation rather than by using the RTX structure.
OTOH as we mostly have special constants allowed in the IL like this
treating all-zeros and all-ones specially might be good enough ...

  parent reply	other threads:[~2024-03-21  7:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-92080-4@http.gcc.gnu.org/bugzilla/>
2021-09-04 22:17 ` [Bug middle-end/92080] " pinskia at gcc dot gnu.org
2023-06-13  7:43 ` [Bug rtl-optimization/92080] " rguenth at gcc dot gnu.org
2024-03-21  7:13 ` liuhongt at gcc dot gnu.org
2024-03-21  7:51 ` rguenther at suse dot de [this message]
2024-03-21  8:03 ` liuhongt at gcc dot gnu.org
2024-03-21  8:31 ` rguenth at gcc dot gnu.org
2024-03-21  8:43 ` pinskia 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-92080-4-EWZTYp9rhI@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).