public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96481] New: SLP fail to vectorize VEC_COND_EXPR pattern.
@ 2020-08-05  9:26 crazylht at gmail dot com
  2020-08-05 11:26 ` [Bug tree-optimization/96481] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2020-08-05  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96481
           Summary: SLP fail to vectorize VEC_COND_EXPR pattern.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

testcase not vectorized:
-----
#include <x86intrin.h>

inline unsigned opt(unsigned a, unsigned b, unsigned c, unsigned d) {
    return a > b ? c : d;
}

void opt( unsigned * __restrict dst, const unsigned *pa, const unsigned *pb,
        const unsigned *pc, const unsigned  *pd )
{

     *dst++ = opt(*pa++, *pb++, *pc++, *pd++);
     *dst++ = opt(*pa++, *pb++, *pc++, *pd++);
     *dst++ = opt(*pa++, *pb++, *pc++, *pd++);
     *dst++ = opt(*pa++, *pb++, *pc++, *pd++);
}
----


testcase successfully vectorized:

----
inline unsigned opt(unsigned a, unsigned b, unsigned c, unsigned d) {
    return a > b ? c : d;
}

void opt( unsigned * __restrict dst, const unsigned *pa, const unsigned *pb,
        const unsigned *pc, const unsigned  *pd )
{
    for (int i = 0; i != 4; i++)
     *dst++ = opt(*pa++, *pb++, *pc++, *pd++);
}
----

llvm can handle both case
refer to https://godbolt.org/z/jYoPxT

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

end of thread, other threads:[~2021-08-20 10:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05  9:26 [Bug tree-optimization/96481] New: SLP fail to vectorize VEC_COND_EXPR pattern crazylht at gmail dot com
2020-08-05 11:26 ` [Bug tree-optimization/96481] " rguenth at gcc dot gnu.org
2020-08-05 11:28 ` rguenth at gcc dot gnu.org
2020-08-05 11:30 ` rguenth at gcc dot gnu.org
2020-08-10  3:20 ` marxin at gcc dot gnu.org
2021-08-19 23:13 ` pinskia at gcc dot gnu.org
2021-08-20  9:18 ` rguenth at gcc dot gnu.org
2021-08-20 10:46 ` rguenth 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).