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 tree-optimization/29543] Poor code generated for arrays with variable bounds



------- Comment #4 from ebotcazou at gcc dot gnu dot org  2006-10-22 06:45 -------
> The test case that has been attached shows a FORTRAN and Ada program that are
> equivalent (within their matrix multiply loop). The Ada one runs about 2x
> slower with about 3x the number of machine instructions in the inner loop.

Why do you go through an indirection in Ada?  Just write:

   type Real_Matrix is array(Integer range <>,Integer range <>) of Float;
   N : Positive := Positive'Value (Argument (1));
   G : Ada.Numerics.Float_Random.Generator;

   A,B,C : Real_Matrix (1..N, 1..N);
   Start, Finish : Ada.Calendar.Time;
   Sum : Float := 0.0;

and you'll probably significantly narrow the gap.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-22 06:45:13
               date|                            |
            Summary|Ada produces substantially  |Poor code generated for
                   |slower code than FORTRAN for|arrays with variable bounds
                   |identical inputs - looping  |
                   |over double subscripted     |
                   |arrays                      |


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


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