questions on gfortran
Dorit Nuzman
DORIT@il.ibm.com
Mon May 14 08:07:00 GMT 2007
> 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.
>
FYI, a patch for this is also in the works:
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00153.html
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00701.html
dorit
> >> 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
More information about the Fortran
mailing list