public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110452] Bad vectorization of invariant masks
Date: Thu, 29 Jun 2023 08:34:58 +0000	[thread overview]
Message-ID: <bug-110452-4-JclK788HMx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110452-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:6d2eddf456f2d6494cac490c4aa3e7d089926098

commit r14-2183-g6d2eddf456f2d6494cac490c4aa3e7d089926098
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 28 14:05:55 2023 +0200

    middle-end/110452 - bad code generation with AVX512 mask splat

    The following adds an alternate way of expanding a uniform
    mask vector constructor like

      _55 = _2 ? -1 : 0;
      vect_cst__56 = {_55, _55, _55, _55, _55, _55, _55, _55};

    when the mask mode is a scalar int mode like for AVX512 or GCN.
    Instead of piecewise building the result via shifts and ors
    we can take advantage of uniformity and signedness of the
    component and simply sign-extend to the result.

    Instead of

            cmpl    $3, %edi
            sete    %cl
            movl    %ecx, %esi
            leal    (%rsi,%rsi), %eax
            leal    0(,%rsi,4), %r9d
            leal    0(,%rsi,8), %r8d
            orl     %esi, %eax
            orl     %r9d, %eax
            movl    %ecx, %r9d
            orl     %r8d, %eax
            movl    %ecx, %r8d
            sall    $4, %r9d
            sall    $5, %r8d
            sall    $6, %esi
            orl     %r9d, %eax
            orl     %r8d, %eax
            movl    %ecx, %r8d
            orl     %esi, %eax
            sall    $7, %r8d
            orl     %r8d, %eax
            kmovb   %eax, %k1

    we then get

            cmpl    $3, %edi
            sete    %cl
            negl    %ecx
            kmovb   %ecx, %k1

    Code generation for non-uniform masks remains bad, but at least
    I see no easy way out for the most general case here.

            PR middle-end/110452
            * expr.cc (store_constructor): Handle uniform boolean
            vectors with integer mode specially.

  parent reply	other threads:[~2023-06-29  8:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 11:11 [Bug tree-optimization/110452] New: " rguenth at gcc dot gnu.org
2023-06-28 11:12 ` [Bug tree-optimization/110452] " rguenth at gcc dot gnu.org
2023-06-29  8:34 ` cvs-commit at gcc dot gnu.org [this message]
2023-06-29  8:35 ` 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-110452-4-JclK788HMx@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).