[llvm-bugs] [Bug 26903] New: llvm/clang doesn't inline __builtin_mempcpy

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 10 11:45:20 PST 2016


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: unassignedbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: david.l.kreitzer at intel.com, llvm-bugs at lists.llvm.org,
                    zia.ansari at intel.com
    Classification: Unclassified

[hjl at 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 at gnu-6 pr70155a]$
/export/build/gnu/llvm-clang-bootstrap/stage1/build-x86_64-linux/bin/clang -S
-O2 m.i
[hjl at gnu-6 pr70155a]$ cat m.s
    .text
    .file    "m.i"
    .globl    foo1
    .p2align    4, 0x90
    .type    foo1, at 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, at 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","", at progbits
[hjl at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160310/670d4915/attachment.html>


More information about the llvm-bugs mailing list