questions on gfortran
lucatrv
lucatrv@hotmail.com
Sat May 12 15:19:00 GMT 2007
> 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.
> Among Fortran compilers for linux x86[32/64] , I think only ifort would
> vectorize sin(). It does it by automatically substituting calls to
> "short vector math library." All functions to be vectorized must have
> pre-built library support.
> No compiler rebuilds the math library, or vectorizes automatically those
> functions which aren't available as built-in parallel instructions. The
> only built-in for sin() on x86 architectures is the original x86
> instruction, dating back to i386 and beyond.
In this case, unfortunally, I think this is an important shortcoming, which
can make a big speed difference, especially with numerical code in
fortran... I've actually to confirm that ifort reaches much better results
with this little test code...
Luca
More information about the Fortran
mailing list