This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: questions on gfortran


lucatrv wrote:
>> You could easily check whether your vectorization option has changed the
>> generated code in the sin() test loop, using the command line options,
>> or by the -S option, for example.
>>     
> You're right, even if I don't understand assembly, it's convinient to look
> at the .s files to understand if flags had any effect on the compilation.
> So, -O2 and -O3 produce the same assembly from this code, while all other
> flags change something in the assebly (with little effect on the speed
> though) with the exclusion of -ftree-vectorize.
>   
If you use -ftree-vectorizer-verbose=<n> you can see whether a loop has
been vectorized or why not.


>> Among Fortran compilers for linux x86[32/64] , I think only ifort would
>> vectorize sin().
I tried a bit but ifort had problems with vectorizing my sin examples.

In GCC a vectorized sin is not implemented (whereas e.g. sqrt is), but
there exists a patch which allows to generated vector-sin calls to AMD's
Core Math Library (ACML); however, this patch has not been accepted (it
was also not rejected, though)
(http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00671.html).

The other problem with your example is that GCC does not know how to
vectorize the integer->double conversion of the loop variable.

>> It does it by automatically substituting calls to
>> "short vector math library."  All functions to be vectorized must have
>> pre-built library support.
>>     
Well, as long as there is no  libgcc-math GCC, this is more difficult in
GCC.

Tobias


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