SUBREG GIVs - Suggestion for a quick hack.

Toon Moene toon@moene.indiv.nluug.nl
Wed Oct 1 12:21:00 GMT 1997


Richard Henderson wrote:

>  Hmm.. FFECOM_FASTER_ARRAY_REFS seems to do the right
>  thing for the simple case, off to try out the others you
>  posted.

Indeed it does ... Also for rank > 1.

When FFECOM_FASTER_ARRAY_REFS is defined, the Fortran frontend goes  
to greater lengths to spell out address computations resulting from  
array indexing (instead of leaving it up to `expand_expr' in  
expr.c).  Apparently, this somehow circumvents the mode conversions  
between the index variable(s) and the addresses themselves.

I first thought this was caused by the following code in expr.c  
(line 4350):

          if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
            {
              index = convert (type_for_size (TYPE_PRECISION  
(sizetype), 0),
                               index);
              index_type = TREE_TYPE (index);
            }

but commenting it out is not a good idea (compiler runs into an  
abort at explow.c:628 ...).

Still, I think this is the correct lead:  The  
`FFECOM_FASTER_ARRAY_REFS' code results in all address computation  
being done in one mode, therefore circumventing the subreg ...  
sign_extend trouble.

However, there probably is a more correct way of solving this.

BTW, the rank-3 benchmark code I previously talked about (10.2  
seconds with an unmodified g77/egcs) now clocks in at 3.9, i.e. over  
a factor of 2.5 better.

HTH,
Toon.

PS:  The `FFECOM_FASTER_ARRAY_REFS' code is a hack that dates back  
to April 1995, when g77 was just out for two months.  We were  
desperately trying to solve the inefficient array indexing code and  
this was one of the "solutions", which was relegated to history a  
month later, because for some architectures, it actually slowed  
things down.  Of course, this was before we knew the real problem  
was the CEIL_DIV_EXPR in {int_}size_in_bytes ;-)



More information about the Gcc mailing list