This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Writing a dot product that vectorizes without -fassociative-math -fno-signed-zeros -fno-trapping-math
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: gcc mailing list <gcc at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Thu, 04 Jun 2015 13:17:38 +0200
- Subject: Writing a dot product that vectorizes without -fassociative-math -fno-signed-zeros -fno-trapping-math
- Authentication-results: sourceware.org; auth=none
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