public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/100738] New: Gimple failed to simplify ((v4si) ~a) < 0 ? c : d to ((v4si)a) >= 0 ? c : d
@ 2021-05-24  8:21 crazylht at gmail dot com
  2021-05-24  8:59 ` [Bug middle-end/100738] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2021-05-24  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

end of thread, other threads:[~2021-12-17  5:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  8:21 [Bug middle-end/100738] New: Gimple failed to simplify ((v4si) ~a) < 0 ? c : d to ((v4si)a) >= 0 ? c : d crazylht at gmail dot com
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

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