public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31016]  New: Use __buildin_memcpy and __memcpy for array assignment
@ 2007-03-01 18:55 burnus at gcc dot gnu dot org
  2007-03-01 19:16 ` [Bug fortran/31016] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-01 18:55 UTC (permalink / raw)
  To: gcc-bugs

For the most common array assignments where the size is known at compile-time,
we already use __buildin_memcpy; but the following cases were missed:

subroutine bar(a)
 implicit none
 real :: a(*),b(12)
 b = a(1:12)
end subroutine


subroutine bar(a,b)
 implicit none
 real :: a(*),b(*)
 a(1:12) = b(2:13)
end subroutine


And __buildin_memset can be used for:

subroutine bar(a)
 implicit none
 real :: a(*),b(12)
 a(1:12) = 12
end subroutine


For the following examples, the __buildin_* function can not be used as the
size is not known at compile time, but the memory should be contiguous and thus
__memcpy can be used:

subroutine bar(a,n)
 implicit none
 integer :: n
 real :: a(n), b(n)
 a = b
end subroutine


For the following case, one could use memset, but I'm not sure whether it will
be on average be faster than a normal do loop. (Overhead of function call
versus the optimization of memset using e.g. copy-on-write.)

subroutine bar(a,n)
 implicit none
 integer :: n
 real :: a(n)
 a = 5
end subroutine


-- 
           Summary: Use __buildin_memcpy and __memcpy for array assignment
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-31016-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2015-09-06 13:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01 18:55 [Bug fortran/31016] New: Use __buildin_memcpy and __memcpy for array assignment burnus at gcc dot gnu dot org
2007-03-01 19:16 ` [Bug fortran/31016] " burnus at gcc dot gnu dot org
2007-03-01 19:27 ` burnus at gcc dot gnu dot org
2007-03-01 19:35 ` tkoenig at gcc dot gnu dot org
2007-04-29 10:46 ` jb at gcc dot gnu dot org
2007-04-30 16:25 ` pinskia at gcc dot gnu dot org
     [not found] <bug-31016-4@http.gcc.gnu.org/bugzilla/>
2013-07-27 11:38 ` tkoenig at gcc dot gnu.org
2013-07-27 13:07 ` burnus at gcc dot gnu.org
2013-07-28 15:53 ` ebotcazou at gcc dot gnu.org
2015-09-06 13:01 ` tkoenig 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).