public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/109973] [13/14 Regression] Wrong code for AVX2 since 13.1 by combining VPAND and VPTEST since r13-2006-ga56c1641e9d25e
Date: Fri, 26 May 2023 06:56:50 +0000	[thread overview]
Message-ID: <bug-109973-4-XwZRuVPDWX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109973-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Guess the optimization is perfectly valid when it is just the ZF flag that is
tested, i.e. in bar:

#include <immintrin.h>

int
foo (__m256i x, __m256i y)
{
  __m256i a = _mm256_and_si256 (x, y);
  return _mm256_testc_si256 (a, a);
}

int
bar (__m256i x, __m256i y)
{
  __m256i a = _mm256_and_si256 (x, y);
  return _mm256_testz_si256 (a, a);
}

_mm256_testc_si256 (a, a) is dumb (always returns non-zero because a & ~a is
0), perhaps we could fold it in gimple folding to 1.  Still I'm afraid at RTL
we can't rely on that folding.  One option could be to use CCZmode instead of
CCmode for the _mm*_testz* cases and perform this optimization solely for
CCZmode and not for CCmode that would be used
for _mm*_testc*.  It has a disadvantage that we'd likely not be able to merge
_mm256_testc_si256 (a, b) + _mm256_testz_si256 (a, b) (or vice versa).

  parent reply	other threads:[~2023-05-26  6:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  0:38 [Bug rtl-optimization/109973] New: Wrong code for AVX2 since 13.1 by combining VPAND and VPTEST benjsith at gmail dot com
2023-05-26  0:42 ` [Bug rtl-optimization/109973] " benjsith at gmail dot com
2023-05-26  0:47 ` [Bug target/109973] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-05-26  6:31 ` [Bug target/109973] [13/14 Regression] Wrong code for AVX2 since 13.1 by combining VPAND and VPTEST since r13-2006-ga56c1641e9d25e rguenth at gcc dot gnu.org
2023-05-26  6:56 ` jakub at gcc dot gnu.org [this message]
2023-05-26 12:06 ` benjsith at gmail dot com
2023-05-29 18:24 ` roger at nextmovesoftware dot com
2023-05-30 13:44 ` cvs-commit at gcc dot gnu.org
2023-06-01 14:12 ` cvs-commit at gcc dot gnu.org
2023-06-03 18:01 ` benjsith at gmail dot com
2023-06-04 11:01 ` cvs-commit at gcc dot gnu.org
2023-06-22  6:44 ` cvs-commit at gcc dot gnu.org
2023-07-03 13:28 ` [Bug target/109973] [13 " roger at nextmovesoftware dot com
2023-07-03 13:43 ` jakub at gcc dot gnu.org
2023-07-20  7:28 ` 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-109973-4-XwZRuVPDWX@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).