public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101187] New: enhancement for vector shift with constant bigger than element precision
@ 2021-06-24  4:58 crazylht at gmail dot com
  2021-06-24  6:52 ` [Bug tree-optimization/101187] enhancement for vector logic right " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: crazylht at gmail dot com @ 2021-06-24  4:58 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-05 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  4:58 [Bug tree-optimization/101187] New: enhancement for vector shift with constant bigger than element precision crazylht at gmail dot com
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

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).