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: [email protected]
          Reporter: [email protected]
                CC: [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to