This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31016] Use __buildin_memcpy and __memcpy for array assignment
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Apr 2007 16:25:13 -0000
- Subject: [Bug fortran/31016] Use __buildin_memcpy and __memcpy for array assignment
- References: <bug-31016-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from pinskia at gcc dot gnu dot org 2007-04-30 17:25 -------
> AFAIK the libc memset/cpy choose the algorithm depending the the size etc., so
> you have to do a big block to make up for all the overhead. But what could be
> done for small multidimensional arrays would be to "flatten" the nested loops
> into the equivalent 1D loop? Perhaps this is something better done in the
> middle end?
Well libc's memcpy/memset does optimize by size but the compiler also optimizes
memcpy/memset if the size is constant and also based on the alignment so it
could optimize it down to two instructions instead of a couple (and on PPC,
with -maltivec, GCC can optimize using VMX also which makes the instruction
count go down even more).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31016