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

            Bug ID: 26903
           Summary: llvm/clang doesn't inline __builtin_mempcpy
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: hjl.to...@gmail.com
                CC: david.l.kreit...@intel.com, llvm-bugs@lists.llvm.org,
                    zia.ans...@intel.com
    Classification: Unclassified

[hjl@gnu-6 pr70155a]$ cat m.i 
extern char *src, *dst;

char *
foo1 (void)
{
  return __builtin_memcpy (dst, src, 16);
}

char *
foo2 (void)
{
  return __builtin_mempcpy (dst, src, 16);
}
[hjl@gnu-6 pr70155a]$
/export/build/gnu/llvm-clang-bootstrap/stage1/build-x86_64-linux/bin/clang -S
-O2 m.i
[hjl@gnu-6 pr70155a]$ cat m.s
    .text
    .file    "m.i"
    .globl    foo1
    .p2align    4, 0x90
    .type    foo1,@function
foo1:                                   # @foo1
    .cfi_startproc
# BB#0:
    movq    dst(%rip), %rax
    movq    src(%rip), %rcx
    movups    (%rcx), %xmm0
    movups    %xmm0, (%rax)
    retq
.Lfunc_end0:
    .size    foo1, .Lfunc_end0-foo1
    .cfi_endproc

    .globl    foo2
    .p2align    4, 0x90
    .type    foo2,@function
foo2:                                   # @foo2
    .cfi_startproc
# BB#0:
    movq    dst(%rip), %rdi
    movq    src(%rip), %rsi
    movl    $16, %edx
    jmp    mempcpy                 # TAILCALL
.Lfunc_end1:
    .size    foo2, .Lfunc_end1-foo2
    .cfi_endproc


    .ident    "clang version 3.9.0 (http://llvm.org/git/clang.git
fdef93f7bb7594c6a2a623835f9d5330184bf37c) (http://llvm.org/git/llvm.git
ffadaf5667befa7f105aa48fca597d26d8c7ee49)"
    .section    ".note.GNU-stack","",@progbits
[hjl@gnu-6 pr70155a]$ 

I was expecting something like

foo2:
    movq    dst(%rip), %rax
    movq    src(%rip), %rcx
    movups    (%rcx), %xmm0
    movups    %xmm0, (%rax)
        addq    $16, %rax
    retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to