public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/101187] New: enhancement for vector shift with constant bigger than element precision
Date: Thu, 24 Jun 2021 04:58:41 +0000	[thread overview]
Message-ID: <bug-101187-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101187
           Summary: enhancement for vector shift with constant bigger than
                    element precision
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
                CC: jakub at redhat dot com, rguenth at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

using T = unsigned char; // or ushort, or uint
using V [[gnu::vector_size(8)]] = T;
V f(V x) { return x >> 8 * sizeof(T); }

r12-1764 regresses pr91838.C with extra options: -march=cascadelake

cat pr91838.C

/* { dg-do compile { target c++11 } } */
/* { dg-additional-options "-O2 -Wno-psabi -w" } */
/* { dg-additional-options "-masm=att" { target i?86-*-* x86_64-*-* } } */

using T = unsigned char; // or ushort
using V [[gnu::vector_size(8)]] = T;
V f(V x) {
  return x >> 8 * sizeof(T);
}

/* { dg-final { scan-assembler {pxor\s+%xmm0,\s+%xmm0} { target { { i?86-*-*
x86_64-*-* } && lp64 } } } } */


w/o vlshr_optab,  vector operation will be lowered to scalar and be optimized
by pass_ccp4 in gimple. But w/ vlshr_optab, it's not optimized and left to the
backend, in the backend we don't optimize(just like what we did in
ix86_expand_vec_shift_qihi_constant).

As suggested by Richi, we may need to add a gimple simplification pattern to
handle this.

             reply	other threads:[~2021-06-24  4:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24  4:58 crazylht at gmail dot com [this message]
2021-06-24  6:52 ` [Bug tree-optimization/101187] enhancement for vector logic right " rguenth at gcc dot gnu.org
2021-06-24  8:31 ` jakub at gcc dot gnu.org
2021-06-24  9:40 ` rguenther at suse dot de
2021-06-24  9:44 ` jakub at gcc dot gnu.org
2021-07-05 17:00 ` hjl.tools at gmail dot com

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-101187-4@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).