vector expression question.
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Thu Nov 17 20:02:00 GMT 2011
On 2011-11-17 20:56, Tobias Burnus wrote:
> Tim Prince wrote:
>> If you persuade a compiler to vectorize such a situation, you have no
>> control over the order of assignments. I expect the compilers which
>> got the same result as for sequential execution did so by refusing to
>> vectorize.
>
> I am not so sure. On one hand xser(:) = 2 and
> intel 10 x=1...
> Intel 11 x=2...
> Intel 12 x=2...
> If I follow your suggestion, I would conclude that ifort 10 vectorizes
> the loop and ifort 11/12 don't, which is unlikely.
>
> On the other hand, with gfortran I get the same result with -O0 and with
> -Ofast. And "-ftree-vectorizer-verbose=1" shows that gfortran vectorizes
> the loop with -Ofast.
>
> Thus, it really depends on the internal algorithm. As the code is
> invalid, one cannot really tell which internal algorithm is better.
Suppose it were valid. Then the standard would be quite explicit:
e.g. 7.5.1.5 in the Fortran 95 standard:
"The execution of the assignment shall have the same effect as if the
evaluation of all operations in expr and variable occurred before any
portion of variable is defined by the assignment."
Array assignment is equivalent to DO loops with temporaries.
Cheers,
- Tobi
>
> Tobias
More information about the Fortran
mailing list