This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/35339] New: Improve translation of implied do loop in transfer


Currently we create a looping structure which is executed to traverse an array
and transfer it one element at a time.  This works, but is not too efficient. 
We could improve this by converting the implied do loops into the appropriate
array descriptor and call transfer_array.

The two cases are:

real, dimension(10) :: a
write(10,'(10f8.3)') a
write(10,'(10f8.3)') (a(i), i=1,10)

Gives:

    _gfortran_st_write (&dt_parm.3);
    {
      struct array1_real(kind=4) parm.4;

      parm.4.dtype = 281;
      parm.4.dim[0].lbound = 1;
      parm.4.dim[0].ubound = 10;
      parm.4.dim[0].stride = 1;
      parm.4.data = (void *) &a[0];
      parm.4.offset = -1;
      _gfortran_transfer_array (&dt_parm.3, &parm.4, 4, 0);
    }
    _gfortran_st_write_done (&dt_parm.3);

and

    _gfortran_st_write (&dt_parm.3);
    i = 1;
    if (i <= 10)
      {
        while (1)
          {
            {
              logical(kind=4) D.958;

              _gfortran_transfer_real (&dt_parm.3, &a[(integer(kind=8)) i +
-1], 4);
              L.2:;
              D.958 = i == 10;
              i = i + 1;
              if (D.958) goto L.3;
            }
          }
      }
    L.3:;
    _gfortran_st_write_done (&dt_parm.3);

The former is needed to simplify asynchronous I/O where we need to be able to
convey to the I/O thread the task to be done and not the actual code to do the
looping.

Putting it another way, if the implied loop has 10000 count.  We need to pass
that count to the I/O routines, so they can take it and run with it.


-- 
           Summary: Improve translation of implied do loop in transfer
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jvdelisle at gcc dot gnu dot org
OtherBugsDependingO 25829
             nThis:


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]