[Bug tree-optimization/40770] Vectorization of complex types, vectorization of sincos missing

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 22 09:58:18 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40770

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #16)
> (In reply to Jakub Jelinek from comment #15)
> > Unfortunately, I think glibc currently defines sincos in math-vector.h the
> > unuseful way with just simd ("notinbranch") attribute, which effectively
> > means
> > that the caller is supposed to pass vectors of pointers (well integers with
> > those sizes) and so needs scatter under the hood.
> > So the best thing would be to change glibc first.
> 
> What exactly do we need to change? Factor out the declaration of sincos, so
> that we can apply “linear(__p1, __p2)” to it?

It could provide
#pragma omp declare simd linear(__p1, __p2)
double sincos (double __p0, double *__p1, double *__p2);
prototypes and assembly definition for that function.
Note, right now the simd attribute syntax doesn't allow specifying linear
arguments, there have been talks about extending the syntax, but it hasn't been
finished yet.  Looking at sysdeps/x86_64/fpu/*sincos*.S I actually see the
correct symbols there already, just they aren't exported from the library (the
symbols with *l4l4*, *l8l8* etc. in there).
So I guess we first need to extend the simd attribute syntax, then change glibc
to use it and export those, and finally benefit.

> Should glibc provide a cexpi function? The complex result would avoid having
> to go through memory at all.

Not sure if that would help, because vectorization of complex types doesn't
really work well in GCC unless they are lowered to scalar ops before
vectorization.


More information about the Gcc-bugs mailing list