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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com,
                   |                            |jakub at gcc dot gnu.org

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
OpenMP has a way to express this,
#pragma omp declare simd notinbranch linear(y,z)
double sincos (double x, double *y, double *z);
As can be seen on -O2 -fopenmp-simd:
#pragma omp declare simd notinbranch linear(y, z)
double foo (double x, double *y, double *z);

double a[1024], b[1024], c[1024];

void
bar (void)
{
  #pragma omp simd
  for (int i = 0; i < 1024; i++)
    foo (a[i], &b[i], &c[i]);
}
it works fine with that.  But if #pragma omp simd is commented out, it is not,
because the compiler has no assurance on what the function call behavior will
be e.g. for data reference analysis (it could e.g. modify the global vars).
Now, for sincos proper, the compiler knows what the function does if not
-fno-builtin-sincos.

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.

Reply via email to