[cfe-dev] Bug with vectorization of transcendental functions

Marc Glisse marc.glisse at inria.fr
Thu Aug 21 00:38:01 PDT 2014


On Tue, 19 Aug 2014, Erik Schnetter wrote:

> To my knowledge, Clang does not vectorize arbitrary math functions; it only
> vectorizes those functions for which a SIMD machine instruction exists,
> such as floor.
>
> There are libraries that provide vectorized exp() functions; you could try
> using one of these. However, these libraries require that you rewrite your
> code to use vectors instead of scalars. I maintain such a library
> "vecmathlib" <https://bitbucket.org/eschnett/vecmathlib/wiki/Home> that is
> used in pocl <http://pocl.sourceforge.net/>, an OpenCL implementation based
> on LLVM.

Something like gcc's -mveclibabi could avoid rewriting code with explicit 
vectors.

I believe some extensions like cilk were also supposed to offer something 
in that direction: annotate a function to generate a vector version (in 
addition to the scalar one) or advertise that a vector version is 
available.

-- 
Marc Glisse



More information about the cfe-dev mailing list