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/52934] New: enhancement: cshift0 should be inlined


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

             Bug #: 52934
           Summary: enhancement: cshift0 should be inlined
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: matz@gcc.gnu.org


polyhedrons protein would improve quite a bit when the cshift0 intrinsic
would be inlined.  With the patch below on my machine the runtime for
protein drops from 0m21.367s to 0m19.227s (i.e. by 10%).  Inlining a generic
cshift probably wouldn't bring the same improvement, but still.

(a bit related is my patch to improve cshift0 at 
 http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00533.html )

--- protein.f90.mm      2011-12-02 16:22:47.000000000 +0100
+++ protein.f90 2011-12-02 16:16:38.000000000 +0100
@@ -250,7 +250,20 @@ out3:         do n1 = 1, polypeptide_len
 !
               total_surface_energy = 0
               true_total_surface_energy = 0.0_LONGreal
-              shifted_surface_sequence = cshift(surface_sequence(:,l),m-1)
+              if (m == 1) then
+                shifted_surface_sequence = surface_sequence(:,l)
+              else if (m == 2) then
+                shifted_surface_sequence(1:3) = surface_sequence(2:4,l)
+                shifted_surface_sequence(4) = surface_sequence(1,l)
+              else if (m == 3) then
+                shifted_surface_sequence(1:2) = surface_sequence(3:4,l)
+                shifted_surface_sequence(3:4) = surface_sequence(1:2,l)
+              else if (m == 4) then
+                shifted_surface_sequence(1) = surface_sequence(4,l)
+                shifted_surface_sequence(2:4) = surface_sequence(1:3,l)
+              else
+                shifted_surface_sequence = cshift(surface_sequence(:,l),m-1)
+              end if
               do k = 1, number_of_polypeptides
                   surface_energy = 0
                   true_surface_energy = 0.0_LONGreal


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