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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |13.2.0

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The memcpy is gone eventually, with a string length of 4 even on GIMPLE.

clang produces

_Z3fooB5cxx11v:                         # @_Z3fooB5cxx11v
        .cfi_startproc
# %bb.0:
        movq    %rdi, %rax
        leaq    16(%rdi), %rcx
        movq    %rcx, (%rdi)
        movl    $6513249, 16(%rdi)              # imm = 0x636261
        movq    $3, 8(%rdi)
        retq

for me and

_Z3foov:                                # @_Z3foov
        .cfi_startproc
# %bb.0:
        movq    %rdi, %rax
        movb    $6, -32(%rsp)
        movl    $6513249, -31(%rsp)             # imm = 0x636261
        movq    -16(%rsp), %rcx
        movq    %rcx, 16(%rdi)
        movzbl  -32(%rsp), %ecx
        movb    %cl, (%rdi)
        movl    -31(%rsp), %ecx
        movl    %ecx, 1(%rdi)
        movq    -27(%rsp), %rcx
        movq    %rcx, 5(%rdi)
        movzwl  -19(%rsp), %ecx
        movw    %cx, 13(%rdi)
        movzbl  -17(%rsp), %ecx
        movb    %cl, 15(%rdi)
        retq

with -stdlib=libc++

Reply via email to