public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level
Date: Wed, 17 May 2023 23:20:40 +0000	[thread overview]
Message-ID: <bug-109900-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 109900
           Summary: _mm256_abs_epi8 is not expanded on gimple level
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-linux-gnu

Take (at -O3 -march=x86-64-v3):
```
#include <immintrin.h>
__m256i
should_be_cmpeq_abs0 ()
{
  return _mm256_set1_epi8 (1);
}
__m256i
should_be_cmpeq_abs1 ()
{
  return _mm256_abs_epi8(_mm256_set1_epi8 (-1));
}
```
I would have expected these two produce the same code generation.
In the end, we still have a builtin function in the IR rather than ABS_EXPR.
The RTL level uses abs.
In fact combine tries to combine the two instructions:
Trying 5 -> 6:
    5: r85:V32QI=const_vector
    6: r84:V32QI=abs(r85:V32QI)
      REG_DEAD r85:V32QI
      REG_EQUAL const_vector
Failed to match this instruction:
(set (reg:V32QI 84)
    (const_vector:V32QI [
            (const_int 1 [0x1]) repeated x32
        ]))

             reply	other threads:[~2023-05-17 23:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 23:20 pinskia at gcc dot gnu.org [this message]
2023-05-19  5:51 ` [Bug target/109900] " crazylht at gmail dot com
2023-05-24  1:13 ` cvs-commit at gcc dot gnu.org
2023-05-24  1:14 ` crazylht at gmail dot com
2023-05-24  2:09 ` 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-109900-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).