This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jun 2006 12:25:52 -0000
- Subject: [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Currently, string assignments are done via calls to _gfortran_copy_string,
which is a simple wrapper around memmove/memset:
void
copy_string (GFC_INTEGER_4 destlen, char * dest,
GFC_INTEGER_4 srclen, const char * src)
{
if (srclen >= destlen)
{
/* This will truncate if too long. */
memmove (dest, src, destlen);
}
else
{
memmove (dest, src, srclen);
/* Pad with spaces. */
memset (&dest[srclen], ' ', destlen - srclen);
}
}
With this implementation, AERMOD (from polyhedron benchmark) spends most of its
time in calls to memmove/memset. If the above code is directly emitted by the
front-end, I measure on i686-linux a 27% improvement in execution time with the
following options:
gfortran -march=pentium4 -ffast-math -funroll-loops -O3 aermod.f90
--
Summary: Calling libgfortran's copy_string is inefficient
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fxcoudert at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28163