This is the mail archive of the 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]

Re: [lno] Fix bootstrap on ppc

> I still don't get vectorization:
> ...
> <<get_loop_niters>>
> get_loop_niters: 0.
> 0 iterations??
> loop_analyzer: bad loop form.

Sebastian is working on fixing loop-count calculation problems in the monev

However, even when your program passes the loop-count test, there are still
(at least) two issues that inhibit vectorization of your code at the

1) Alignment:
As I explained in,
in order to avoid having to deal with unaligned data accesses, the
vectorizer currently tries to make sure that the accessed array is aligned,
or can be forced to be aligned. Soon, using Devang's/Zdeneks's loop
versioning/peeling utilities, we will be able to handle accesses which
alignment is unknown. In the meantime, we conservatively check that the
first access is aligned. The first accesses to the arrays in your program
are at location 'start_index+1', where start_index = TYPE_MIN_VALUE = 0. I
may have misinterpreted Richard's and Paul's responses
but to my understanding this is a (temporary) problem in the way gfortran
programs are represented, and until it is fixed, there is no way to tell
what is the real start_index of the array. Until then, I expect you will
get the following failure notice from the vectorizer:

> <<vect_analyze_data_ref_accesses>>
> first access not aligned.

2) The use of pointers:
Before failing on the above alignment check, the vectorizer will refuse to
vectorize your program with the following message:

> <<vect_analyze_data_refs>>
> unhanded ptr-based array ref

The only accesses that the vectorizer currently handles are ARRAY_REFs
which base (operand 0) is a VAR_DECL. This restriction (added in my last
check-in is in
place to ensure that the alignment of the accessed arrays can be forced (by
the way - is this a correct test? is there a less strict test that would
achieve the same purpose?). The ARRAY_REFs in your program are of the form
'(*T.1_64)[S.3_10]' (i.e, the array base is an INDIRECT_REF) and T is a
> static real4 a[1000000];
> real4 * T.11;
> real4[] * T.1;
> T.11_63 = &a - 4;
> T.1_64 = (real4[] *)T.11_63;

If there's currently a way in the compiler to tell that such accesses are
aligned, I will relax the above restriction. Otherwise, such accesses will
probably be handled by inserting run time tests. Since these accesses used
to be simple array accesses, I hope this information can be (is already?
will be?) propagated to the trees.

It is definitely my intention to support vectorization of ARRAY_REF
accesses which base is a pointer, also in order to support accesses in C of
the form:
> foo (int p[])
> {
>   for (i=0; i<N; i++) { p[i] = 0; }
> }
These are currently not translated to ARRAY_REFs but transformed into
pointer arithmetic (, Richards work will
hopefully solve this problem (

Thanks for your feedback,


                      Toon Moene                                                                                                    
                      <toon@moene.indiv        To:       Zdenek Dvorak <>                           
            >               cc:, Dorit Naishlos/Haifa/IBM@IBMIL                    
                                               Subject:  Re: [lno] Fix bootstrap on ppc                                             
                      25/01/2004 17:53                                                                                              

Zdenek Dvorak wrote:

> my attempt to fix the problem in the doloop was obviously bogus,
> since loop->scan_start is always set; this one should be a bit better,
> but probably still not quite correct.  Does not matter, current doloop
> disappear from the lno branch completely next week.

This indeed fixed the bootstrap.  However, using the following Fortran
source, I still don't get vectorization:

DIMENSION A(1000000), B(1000000), C(1000000)
A = LOG(X); B = LOG(Y); C = A + B
PRINT*, C(500000)

The current complaint is:

<<<<<<< analyze_loop_nest >>>>>>>


get_loop_niters: 0.
0 iterations??
loop_analyzer: bad loop form.


   T.15_18 = &c - 4;
   T.9_19 = (real4[] *)T.15_18;

   # S.10_1 = PHI <1(4), S.10_39(9)>;
   T.16_25 = (*T.1_5)[S.10_1];
   T.17_26 = (*T.4_10)[S.10_1];
   T.18_27 = T.16_25 + T.17_26;
   (*T.9_19)[S.10_1] = T.18_27;
   S.10_39 = S.10_1 + 1;
   if (S.10_39 > 1000000) goto L.3; else goto <L11>;

   goto <bb 5> (<L7>);

I hope this enlightens ...

Toon Moene - - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77:
GNU Fortran 95: (under construction)

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