Writing a dot product that vectorizes without -fassociative-math -fno-signed-zeros -fno-trapping-math

Thomas Koenig tkoenig@netcologne.de
Thu Jun 4 11:17:00 GMT 2015


Hello world,

Assume I want to calculate a dot product,

s = sum(a[i]*b[i], i=1..n)

The order of summation in this case should be arbitrary.

Currently, the way to do this is to write out an explicit loop
(either by by the user or by the compliler, such as a DOT_PRODUCT)
and specify the options (for the whole translation unit) that
allow associative math.

Could there be a way to specify more finegrained approch which can
set a 'yes, you can use associative math on this particular expression'
to enable automatic vectorization of, for exaple, DOT_PRODUCT?


Regards

	Thomas



More information about the Fortran mailing list