public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28163]  New: Calling libgfortran's copy_string is inefficient
@ 2006-06-25 12:31 fxcoudert at gcc dot gnu dot org
  2006-06-25 13:17 ` [Bug fortran/28163] " fxcoudert at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-06-25 12:31 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/28163] Calling libgfortran's copy_string is inefficient
  2006-06-25 12:31 [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient fxcoudert at gcc dot gnu dot org
@ 2006-06-25 13:17 ` fxcoudert at gcc dot gnu dot org
  2006-06-29 21:44 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-06-25 13:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2006-06-25 12:31 -------
Created an attachment (id=11746)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11746&action=view)
Patch described in the bug report


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28163


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/28163] Calling libgfortran's copy_string is inefficient
  2006-06-25 12:31 [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient fxcoudert at gcc dot gnu dot org
  2006-06-25 13:17 ` [Bug fortran/28163] " fxcoudert at gcc dot gnu dot org
@ 2006-06-29 21:44 ` patchapp at dberlin dot org
  2006-07-12 15:11 ` fxcoudert at gcc dot gnu dot org
  2006-07-12 15:17 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: patchapp at dberlin dot org @ 2006-06-29 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2006-06-29 21:43 -------
Subject: Bug number PR fortran/28163

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01360.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28163


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/28163] Calling libgfortran's copy_string is inefficient
  2006-06-25 12:31 [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient fxcoudert at gcc dot gnu dot org
  2006-06-25 13:17 ` [Bug fortran/28163] " fxcoudert at gcc dot gnu dot org
  2006-06-29 21:44 ` patchapp at dberlin dot org
@ 2006-07-12 15:11 ` fxcoudert at gcc dot gnu dot org
  2006-07-12 15:17 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-07-12 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2006-07-12 15:11 -------
Subject: Bug 28163

Author: fxcoudert
Date: Wed Jul 12 15:11:11 2006
New Revision: 115372

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115372
Log:
        PR fortran/28163

        * trans-expr.c (gfc_trans_string_copy): Generate inline code
        to perform string copying instead of calling a library function.
        * trans-decl.c (gfc_build_intrinsic_function_decls): Don't build
        decl for copy_string.
        * trans.h (gfor_fndecl_copy_string): Remove prototype.

        * intrinsics/string_intrinsics.c (copy_string): Remove function.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans.h
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/string_intrinsics.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28163


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/28163] Calling libgfortran's copy_string is inefficient
  2006-06-25 12:31 [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-07-12 15:11 ` fxcoudert at gcc dot gnu dot org
@ 2006-07-12 15:17 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-07-12 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2006-07-12 15:17 -------
Fixed on 4.2


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28163


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-12 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-25 12:31 [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient fxcoudert at gcc dot gnu dot org
2006-06-25 13:17 ` [Bug fortran/28163] " fxcoudert at gcc dot gnu dot org
2006-06-29 21:44 ` patchapp at dberlin dot org
2006-07-12 15:11 ` fxcoudert at gcc dot gnu dot org
2006-07-12 15:17 ` fxcoudert at gcc dot gnu dot 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).