public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61473] New: register sized memmove not inlined
@ 2014-06-11 12:23 jtaylor.debian at googlemail dot com
2014-06-11 12:24 ` [Bug c/61473] " jtaylor.debian at googlemail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-06-11 12:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61473
Bug ID: 61473
Summary: register sized memmove not inlined
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jtaylor.debian at googlemail dot com
in this example file compiled with gcc-4.10 -O3 inlines the memcpy, but not the
memmove:
#include <string.h>
void a(int *a, int *b)
{
memcpy(a, b, sizeof(*a));
}
void b(int *a, int *b)
{
memmove(a, b, sizeof(*a));
}
at least on x86 the integer can be stored in fully in a register and saved back
to arbitrary aligned memory, so it should not matter if the two address overlap
and gcc should be able to replace it with a much faster inline memcpy.
Currently gcc only inlines the memmove for 1 byte types.
I am using a recent svn copy of gcc:
$ gcc-4.10 --version
gcc (GCC) 4.10.0 20140605 (experimental)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/61473] register sized memmove not inlined
2014-06-11 12:23 [Bug c/61473] New: register sized memmove not inlined jtaylor.debian at googlemail dot com
@ 2014-06-11 12:24 ` jtaylor.debian at googlemail dot com
2014-06-12 9:26 ` [Bug middle-end/61473] " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-06-11 12:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61473
--- Comment #1 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
I am using glibc 2.19-0ubuntu6 from the ubuntu 14.04 trusty repository
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61473] register sized memmove not inlined
2014-06-11 12:23 [Bug c/61473] New: register sized memmove not inlined jtaylor.debian at googlemail dot com
2014-06-11 12:24 ` [Bug c/61473] " jtaylor.debian at googlemail dot com
@ 2014-06-12 9:26 ` rguenth at gcc dot gnu.org
2014-07-11 13:43 ` rguenth at gcc dot gnu.org
2014-07-11 13:44 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 9:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61473
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-06-12
Component|c |middle-end
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The transform is simply not implemented for memmove but simplification always
goes through memmove -> memcpy and then applies this optimization to memcpy.
But of course here the memmove -> memcpy transform is not valid.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61473] register sized memmove not inlined
2014-06-11 12:23 [Bug c/61473] New: register sized memmove not inlined jtaylor.debian at googlemail dot com
2014-06-11 12:24 ` [Bug c/61473] " jtaylor.debian at googlemail dot com
2014-06-12 9:26 ` [Bug middle-end/61473] " rguenth at gcc dot gnu.org
@ 2014-07-11 13:43 ` rguenth at gcc dot gnu.org
2014-07-11 13:44 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-11 13:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61473
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Jul 11 13:42:55 2014
New Revision: 212452
URL: https://gcc.gnu.org/viewcvs?rev=212452&root=gcc&view=rev
Log:
2014-07-11 Richard Biener <rguenther@suse.de>
PR middle-end/61473
* builtins.c (fold_builtin_memory_op): Inline memory moves
that can be implemented with a single load followed by a
single store.
(c_strlen): Only warn when only_value is not 2.
* gcc.dg/memmove-4.c: New testcase.
* gcc.dg/strlenopt-8.c: XFAIL.
* gfortran.dg/coarray_lib_realloc_1.f90: Adjust.
Added:
trunk/gcc/testsuite/gcc.dg/memmove-4.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/strlenopt-8.c
trunk/gcc/testsuite/gfortran.dg/coarray_lib_realloc_1.f90
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61473] register sized memmove not inlined
2014-06-11 12:23 [Bug c/61473] New: register sized memmove not inlined jtaylor.debian at googlemail dot com
` (2 preceding siblings ...)
2014-07-11 13:43 ` rguenth at gcc dot gnu.org
@ 2014-07-11 13:44 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-11 13:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61473
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-11 13:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 12:23 [Bug c/61473] New: register sized memmove not inlined jtaylor.debian at googlemail dot com
2014-06-11 12:24 ` [Bug c/61473] " jtaylor.debian at googlemail dot com
2014-06-12 9:26 ` [Bug middle-end/61473] " rguenth at gcc dot gnu.org
2014-07-11 13:43 ` rguenth at gcc dot gnu.org
2014-07-11 13:44 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).