public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111449] New: memcmp (p,q,16) == 0 can be optimized better on ppc64 with vector comparison instructions
@ 2023-09-18  2:37 guihaoc at gcc dot gnu.org
  2023-10-23  1:17 ` [Bug target/111449] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2023-09-18  2:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111449
           Summary: memcmp (p,q,16) == 0 can be optimized better on ppc64
                    with vector comparison instructions
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guihaoc at gcc dot gnu.org
  Target Milestone: ---

int compare (const char* s1, const char* s2)
{
  return __builtin_memcmp (s1, s2, 16) == 0;
}


trunk outputs
        ld 10,0(3)
        ld 9,0(4)
        cmpd 0,10,9
        beq 0,.L6
.L2:
        li 3,1
        cntlzw 3,3
        srwi 3,3,5
        blr
        .p2align 4,,15
.L6:
        ld 10,8(3)
        ld 9,8(4)
        li 3,0
        cmpd 0,10,9
        bne 0,.L2
        cntlzw 3,3
        srwi 3,3,5
        blr

Expect to use vector comparison to eliminate branches.
        lxv 32,0(3)
        lxv 33,0(4)
        vcmpequb. 0,0,1
        mfcr 3,2
        rlwinm 3,3,25,1
        blr

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

end of thread, other threads:[~2023-11-17  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18  2:37 [Bug target/111449] New: memcmp (p,q,16) == 0 can be optimized better on ppc64 with vector comparison instructions guihaoc at gcc dot gnu.org
2023-10-23  1:17 ` [Bug target/111449] " cvs-commit at gcc dot gnu.org
2023-10-30  3:03 ` cvs-commit at gcc dot gnu.org
2023-11-17  9:20 ` cvs-commit at gcc dot gnu.org
2023-11-17  9:25 ` guihaoc 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).