This one gets vectorized for me, on powerpc-linux:

        ~/mainline_cvs/bin/gfortran -O3 -ftree-vectorize -maltivec
        -ftree-vectorizer-verbose=4 -S hilaram4.f90

        hilaram4.f90:4: note: Alignment of access forced using peeling.
        hilaram4.f90:4: note: Vectorizing an unaligned access.
        hilaram4.f90:4: note: LOOP VECTORIZED.
        hilaram4.f90:7: note: vectorized 1 loops in function.

        dorit


        > L.S.,
        >
        > This code:
        >
        >       SUBROUTINE S(N)
        >       DIMENSION A(N), B(N)
        >       READ*,ISTART,ISTOP,B
        >       DO I = ISTART, ISTOP
        >          A(I) = B(I)
        >       ENDDO
        >       PRINT*,A
        >       END
        >
        > when compiled thusly:
        >
        > $ gfortran -g -S -O3 -ftree-vectorize -ftree-vectorizer-verbose=2 -
        > msse2 vect4.f
        >
        > draws the following "not vectorized" message:
        >
        > vect4.f:4: note: not vectorized: complicated access pattern.
        > vect4.f:4: note: vectorized 0 loops in function.

I get the following, using the autovect branch compiler on
x86_64-unknown-linux-gnu:

vect4.f:4: note: ===== analyze_loop_nest =====
vect4.f:4: note: === vect_analyze_loop_form ===
vect4.f:4: note: split exit edge.
vect4.f:4: note: === get_loop_niters ===
vect4.f:4: note: ==> get_loop_niters:(<unnamed type>) (D.813_29 - i_27) + 1
vect4.f:4: note: Symbolic number of iterations is (<unnamed type>) (D.813_29 - 
i_27) + 1
vect4.f:4: note: === vect_analyze_data_refs ===
vect4.f:4: note: get vectype with 4 units of type real4
vect4.f:4: note: vectype: vector real4
vect4.f:4: note: get vectype with 4 units of type real4
vect4.f:4: note: vectype: vector real4
vect4.f:4: note: === vect_analyze_scalar_cycles ===
vect4.f:4: note: Analyze phi: HEAP.49_363 = PHI <HEAP.49_380(5), 
HEAP.49_381(7)>;
vect4.f:4: note: virtual phi. skip.
vect4.f:4: note: Analyze phi: HEAP.42_259 = PHI <HEAP.42_268(5), 
HEAP.42_268(7)>;
vect4.f:4: note: virtual phi. skip.
vect4.f:4: note: Analyze phi: HEAP.35_60 = PHI <HEAP.35_312(5), HEAP.35_312(7)>;
vect4.f:4: note: virtual phi. skip.
vect4.f:4: note: Analyze phi: i_1 = PHI <i_27(5), i_45(7)>;
vect4.f:4: note: Access function of PHI: {i_27, +, 1}_2
vect4.f:4: note: step: 1,  init: i_27
vect4.f:4: note: Detected induction.
vect4.f:4: note: === vect_pattern_recog ===
vect4.f:4: note: === vect_mark_stmts_to_be_vectorized ===
vect4.f:4: note: init: phi relevant? HEAP.49_363 = PHI <HEAP.49_380(5), 
HEAP.49_381(7)>;
vect4.f:4: note: init: phi relevant? HEAP.42_259 = PHI <HEAP.42_268(5), 
HEAP.42_268(7)>;
vect4.f:4: note: init: phi relevant? HEAP.35_60 = PHI <HEAP.35_312(5), 
HEAP.35_312(7)>;
vect4.f:4: note: init: phi relevant? i_1 = PHI <i_27(5), i_45(7)>;
vect4.f:4: note: init: stmt relevant? <L14>:
vect4.f:4: note: init: stmt relevant? D.830_39 = (int8) i_1
vect4.f:4: note: init: stmt relevant? D.831_40 = D.830_39 + -1
vect4.f:4: note: init: stmt relevant? D.832_43 = (*b_10)[D.831_40]
vect4.f:4: note: init: stmt relevant? (*a_16)[D.831_40] = D.832_43
vect4.f:4: note: vec_stmt_relevant_p: stmt has vdefs.
vect4.f:4: note: mark relevant 2, live 0.
vect4.f:4: note: init: stmt relevant? i_45 = i_1 + 1
vect4.f:4: note: init: stmt relevant? if (i_1 == D.813_29) goto <L35>; else 
goto <L29>;
vect4.f:4: note: init: stmt relevant? <L29>:
vect4.f:4: note: worklist: examine stmt: (*a_16)[D.831_40] = D.832_43
vect4.f:4: note: vect_is_simple_use: operand D.832_43
vect4.f:4: note: def_stmt: D.832_43 = (*b_10)[D.831_40]
vect4.f:4: note: type of def: 2.
vect4.f:4: note: worklist: examine use 2: D.832_43
vect4.f:4: note: mark relevant 2, live 0.
vect4.f:4: note: worklist: examine stmt: D.832_43 = (*b_10)[D.831_40]
vect4.f:4: note: === vect_analyze_data_refs_alignment ===
vect4.f:4: note: vect_compute_data_ref_alignment:
vect4.f:4: note: Unknown alignment for access: *b_10
vect4.f:4: note: vect_compute_data_ref_alignment:
vect4.f:4: note: Unknown alignment for access: *a_16
vect4.f:4: note: === vect_determine_vectorization_factor ===
vect4.f:4: note: ==> examining statement: <L14>:
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: D.830_39 = (int8) i_1
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: D.831_40 = D.830_39 + -1
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: D.832_43 = (*b_10)[D.831_40]
vect4.f:4: note: vectype: vector real4
vect4.f:4: note: nunits = 4
vect4.f:4: note: ==> examining statement: (*a_16)[D.831_40] = D.832_43
vect4.f:4: note: vectype: vector real4
vect4.f:4: note: nunits = 4
vect4.f:4: note: ==> examining statement: i_45 = i_1 + 1
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: if (i_1 == D.813_29) goto <L35>; else 
goto <L29>;
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: <L29>:
vect4.f:4: note: skip.
vect4.f:4: note: === vect_determine_vectorization_factor ===
vect4.f:4: note: ==> examining statement: <L14>:
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: D.830_39 = (int8) i_1
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: D.831_40 = D.830_39 + -1
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: D.832_43 = (*b_10)[D.831_40]
vect4.f:4: note: vectype: vector real4
vect4.f:4: note: nunits = 4
vect4.f:4: note: ==> examining statement: (*a_16)[D.831_40] = D.832_43
vect4.f:4: note: vectype: vector real4
vect4.f:4: note: nunits = 4
vect4.f:4: note: ==> examining statement: i_45 = i_1 + 1
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: if (i_1 == D.813_29) goto <L35>; else 
goto <L29>;
vect4.f:4: note: skip.
vect4.f:4: note: ==> examining statement: <L29>:
vect4.f:4: note: skip.
vect4.f:4: note: === vect_analyze_dependences ===
vect4.f:4: note: === vect_analyze_data_ref_accesses ===
vect4.f:4: note: not consecutive access
                 ^^^^^^^^^^^^^^^^^^^^^^ This is incorrect.  The accesses *are*
                                        consecutive; it's just that there is
                                        a "jump" at the beginning.
vect4.f:4: note: not vectorized: complicated access pattern.
vect4.f:4: note: bad data access.

Hope this helps.

Kind regards,

-- 
Toon Moene - e-mail: [EMAIL PROTECTED] - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/

Reply via email to