public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "zhongyunde at huawei dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106323] New: [Suboptimal] memcmp(s1, s2, n) == 0 expansion on AArch64 compare to llvm Date: Sat, 16 Jul 2022 09:55:02 +0000 [thread overview] Message-ID: <bug-106323-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106323 Bug ID: 106323 Summary: [Suboptimal] memcmp(s1, s2, n) == 0 expansion on AArch64 compare to llvm Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zhongyunde at huawei dot com Target Milestone: --- test case, see detail https://gcc.godbolt.org/z/PM3jxEM9M ``` #include <string.h> int src(char* s1, char* s2) { return memcmp(s1, s2, 3) == 0; } ``` * llvm doesn't emit branch with instruction cset ``` src: // @src ldrh w8, [x0] ldrh w9, [x1] ldrb w10, [x0, #2] ldrb w11, [x1, #2] eor w8, w8, w9 eor w9, w10, w11 orr w8, w8, w9 cmp w8, #0 cset w0, eq ret ``` * gcc ``` src: ldrh w3, [x0] ldrh w2, [x1] cmp w3, w2 beq .L5 .L2: mov w0, 1 eor w0, w0, 1 ret .L5: ldrb w2, [x0, 2] ldrb w0, [x1, 2] cmp w2, w0 bne .L2 mov w0, 0 eor w0, w0, 1 ret ```
next reply other threads:[~2022-07-16 9:55 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-16 9:55 zhongyunde at huawei dot com [this message] 2022-07-17 20:23 ` [Bug middle-end/106323] " pinskia at gcc dot gnu.org 2022-07-17 20:37 ` pinskia at gcc dot gnu.org 2022-07-18 7:31 ` wilco at gcc dot gnu.org 2022-12-06 13:03 ` zhongyunde at huawei dot com
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-106323-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: linkBe 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).