This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/19759] New: mempcpy shouldn't be inlined
- From: "hjl.tools at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 03 Mar 2016 20:52:12 +0000
- Subject: [Bug libc/19759] New: mempcpy shouldn't be inlined
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19759
Bug ID: 19759
Summary: mempcpy shouldn't be inlined
Product: glibc
Version: 2.23
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
commit 05a910f7b420c2b831f35ba90e61c80f001c0606
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date: Wed Aug 5 15:58:15 2015 +0100
Improve performance of mempcpy by inlining and using memcpy. Enable
this for all targets except sparc which has an optimized mempcpy
implementation.
inlines mempcpy. But inlining mempcpy uses a callee-saved register:
[hjl@gnu-6 tmp]$ cat m.c
extern char *src, *dst;
char *
foo (unsigned long i)
{
return __builtin_mempcpy (dst, src, i);
}
char *
bar (unsigned long i)
{
return __builtin_memcpy (dst, src, i) + i;
}
[hjl@gnu-6 tmp]$ gcc -S -O2 m.c
[hjl@gnu-6 tmp]$ cat m.s
.file "m.c"
.section .text.unlikely,"ax",@progbits
.LCOLDB0:
.text
.LHOTB0:
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movq %rdi, %rdx
movq src(%rip), %rsi
movq dst(%rip), %rdi
jmp mempcpy
.cfi_endproc
.LFE0:
.size foo, .-foo
.section .text.unlikely
.LCOLDE0:
.text
.LHOTE0:
.section .text.unlikely
.LCOLDB1:
.text
.LHOTB1:
.p2align 4,,15
.globl bar
.type bar, @function
bar:
.LFB1:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movq %rdi, %rdx
movq %rdi, %rbx
movq src(%rip), %rsi
movq dst(%rip), %rdi
call memcpy
addq %rbx, %rax
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE1:
.size bar, .-bar
.section .text.unlikely
.LCOLDE1:
.text
.LHOTE1:
.ident "GCC: (GNU) 5.3.1 20160212 (Red Hat 5.3.1-4)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 tmp]$
Not inlining mempcpy is preferred.
--
You are receiving this mail because:
You are on the CC list for the bug.