Newsgroups: comp.sys.super,comp.parallel.mpi,comp.lang.ada
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: ADA on the super
Organization: New York University
Date: 20 Apr 1998 21:32:44 -0400
Message-ID: <dewar.893122141@merv>

<<Gnat has good optimization. Gnat has good code generation
except for packed arrays. Robert is right about bench
marking your application with ALL of your data before
deciding what is fast and what is slow.
>>

Actually, this is probably an over-generalization. Packed array stuff is
notorious, since there are so many special cases, and a given compiler
is likely to do some but not all special casing. GNAT does some packed
array stuff really efficiently, and other stuff is pretty horrible. A
good challenge is Mats Weber's

    x := x(1 .. 31) & x(0);

to do a simple rotate. It would be impressive if a compiler generated
a single rotate instruction for this -- well to be more accurate, it 
would be surprising if such an optimization came out of a general
approach (it is always easy to add one more special case). Certainly
GNAT comes *nowhere* near generating a single instruction for this
particular case.

If you are worrying about efficiency and using packed arrays other than
in the simplest manner (setting and testing bits say), you should definitely
have a look at what the compiler is doing.

One thing that is quite useful in GNAT is the capability of looking at the
generated code at the Ada source level (use the -gnatdg switch). This is
quite informative in a case like this, and much less painful than looking
at assembly language.


