public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104610] New: memcmp () == 0 can be optimized better for avx512f
@ 2022-02-21 11:00 pinskia at gcc dot gnu.org
  2022-02-21 11:01 ` [Bug target/104610] " pinskia at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-21 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104610
           Summary: memcmp () == 0 can be optimized better for avx512f
           Product: gcc
           Version: 12.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:
bool f(char *a)
{
    char t[] = "0123456789012345678901234567890";
    return __builtin_memcmp(a, &t[0], sizeof(t)) == 0;
}

----- CUT ----
GCC does this via branches and compares but clang/LLVM does:

        vmovdqu (%rdi), %ymm0
        vpxor   .LCPI0_0(%rip), %ymm0, %ymm0
        vptest  %ymm0, %ymm0
        sete    %al
        vzeroupper

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

end of thread, other threads:[~2023-10-30  3:10 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 11:00 [Bug target/104610] New: memcmp () == 0 can be optimized better for avx512f pinskia at gcc dot gnu.org
2022-02-21 11:01 ` [Bug target/104610] " pinskia at gcc dot gnu.org
2022-02-22  4:03 ` crazylht at gmail dot com
2022-02-22  5:54 ` crazylht at gmail dot com
2022-02-22  5:55 ` crazylht at gmail dot com
2022-02-22  6:18 ` crazylht at gmail dot com
2022-02-22  6:32 ` crazylht at gmail dot com
2022-02-23  2:15 ` crazylht at gmail dot com
2022-02-23  6:18 ` crazylht at gmail dot com
2022-02-23 21:04 ` hjl.tools at gmail dot com
2022-02-24  5:33 ` crazylht at gmail dot com
2022-02-24  6:00 ` hjl.tools at gmail dot com
2022-02-26 20:26 ` hjl.tools at gmail dot com
2022-02-27 19:02 ` hjl.tools at gmail dot com
2022-02-27 19:29 ` hjl.tools at gmail dot com
2022-03-04  3:03 ` hjl.tools at gmail dot com
2022-03-28  5:05 ` crazylht at gmail dot com
2022-03-28  5:27 ` crazylht at gmail dot com
2022-05-18  2:47 ` cvs-commit at gcc dot gnu.org
2022-05-18  2:49 ` crazylht at gmail dot com
2022-06-16  7:41 ` crazylht at gmail dot com
2023-06-28 10:12 ` cvs-commit at gcc dot gnu.org
2023-06-28 11:05 ` ubizjak at gmail dot com
2023-10-10  7:37 ` crazylht at gmail dot com
2023-10-30  3:10 ` 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).