SIMD intrinsics / gcc vectors
Tobias Burnus
tobias@codesourcery.com
Wed Mar 11 08:38:26 GMT 2020
Dear Jeremy,
I think there is only
* the OpenMP 'omp simd' directives, see OpenMP spec.
(they can be enabled independently from the rest of OpenMP)
* a limited set of directives, cf.
https://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-Compiler-Directives.html
Regarding vectorization: Newer glibc* ship with the file
/usr/include/finclude/math-vector-fortran.h
which contains lines such as:
!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
which use a special vectorized version of the trigonometric
functions + exp/log/pow.
This file is automatically included by gfortran. (I think this
happens at build time of GCC if glibc is new enough, but I have
not checked.)
For C/C++, it works likewise for
/usr/include/bits/math-vector.h
except that file is only used with -ffast-math (which sets
__FAST_MATH__)
This "simd" attribute is described in
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
and I saw draft patches for extend this syntax and to support ARM
as well.
I think that's all, what's supported.
Does this cover *most* what you were thinking of? Or do you have
something specific additionally in mind? (I know that the C/C++
compiler supports several more means.)
Tobias
*Newer glibc = GNU C Library 2.22 of August 2015; see
https://sourceware.org/legacy-ml/libc-alpha/2015-08/msg00609.html
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
More information about the Fortran
mailing list