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 middle-end/100738] New: Gimple failed to simplify ((v4si) ~a) < 0 ? c : d to ((v4si)a) >= 0 ? c : d
Date: Mon, 24 May 2021 08:21:42 +0000	[thread overview]
Message-ID: <bug-100738-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 100738
           Summary: Gimple failed to simplify ((v4si) ~a) < 0 ? c : d to
                    ((v4si)a) >= 0 ? c : d
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
                CC: hjl.tools at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-*-* i?86-*-*

cat test.c



typedef int v4si __attribute__((vector_size (16)));
typedef char v16qi __attribute__((vector_size (16)));
v4si
foo (v16qi a, v4si b, v4si c, v4si d)
{
    return ((v4si)~a) < 0 ? c : d;
}

gcc -Ofast -mavx2

foo(char __vector(16), int __vector(4), int __vector(4), int __vector(4)):
        vpcmpeqd        %xmm1, %xmm1, %xmm1
        vpxor   %xmm1, %xmm0, %xmm0
        vblendvps       %xmm0, %xmm2, %xmm3, %xmm0
        ret

it can be better with 

        vblendvps       xmm0, xmm3, xmm2, xmm0

gimple failed to simplify  ((v4si)~a) < 0 ? c : d to ((v4si)a) >= 0 ? c : d

With https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571056.html, i observe
rtl also won't simplify things like (vec_merge op1 op2 (lt (subreg (not op3) 0)
const0_rtx)) to (vec_merge op2 op1 (lt (subreg op3 0) const0_rtx))

             reply	other threads:[~2021-05-24  8:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24  8:21 crazylht at gmail dot com [this message]
2021-05-24  8:59 ` [Bug middle-end/100738] " pinskia at gcc dot gnu.org
2021-05-25  7:39 ` rguenth at gcc dot gnu.org
2021-05-26 10:48 ` crazylht at gmail dot com
2021-05-27  6:22 ` crazylht at gmail dot com
2021-12-08  6:13 ` cvs-commit at gcc dot gnu.org
2021-12-08  6:15 ` crazylht at gmail dot com
2021-12-17  5:56 ` cvs-commit 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-100738-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).