[llvm-bugs] [Bug 50985] New: mov + mul + dup instructions are used for memset instead of just dup

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 5 02:28:01 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50985

            Bug ID: 50985
           Summary: mov + mul + dup instructions are used for memset
                    instead of just dup
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: kutdanila at yandex.ru
                CC: arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

https://gcc.godbolt.org/z/GfYWG5xer

#include <cstring>

void StdMemset(char* a, int b) {
    memset(a, b, 64);
}




StdMemset(char*, int):                        // @StdMemset(char*, int)
        and     x8, x1, #0xff
        mov     x9, #72340172838076673
        mul     x8, x8, x9
        dup     v0.2d, x8
        stp     q0, q0, [x0, #32]
        stp     q0, q0, [x0]
        ret


Ideally it should be

StdMemset(char*, int)
        dup     v0.16b, w1
        stp     q0, q0, [x0]
        stp     q0, q0, [x0, 32]
        ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210705/437f9d62/attachment.html>


More information about the llvm-bugs mailing list