This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PPC64 libmvec sincos/sincosf ABI


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, August 8, 2019 1:33 PM, Bill Schmidt wschmidt@linux.ibm.com wrote:

>
> I'm trying to work my way into understanding the veclibabi support in
> GCC, so please bear with me.
>
> Why are we interested in sincos at all?  There is no handling of sincos
> in the i386 SVML or ACML interfaces for libmvec.  They handle only sin
> and cos separately, as does libmassv for Power.  I am coming late to the
> discussion, but I don't understand how this fits into the libmvec ABI
> requirements.
>

1. I understood sincos to be included in implementation of libmvec on PPC64
because x86_64 provides that capability. There is discussion of an initial
implementation bug in x86_64 sincos at:
https://sourceware.org/bugzilla/show_bug.cgi?id=20024

The final comment in the thread declares the bug fixed in GLIBC 2.24.

2. I am trying to understand how GCC currently vectorizes loops containing calls
to sincos. GLIBC wiki page https://sourceware.org/glibc/wiki/libmvec has two
examples of code that GCC will vectorize if GLIBC is properly implemented. I
changed Example 2 so that it now reads as below:

tst_sincos.c
-------------------
#include <math.h>

int N = 3200;

double a[3200];
double b[3200];
double c[3200];

int main (void)
{
  int i;

  for (i = 0; i < N; i += 1)
  {
    sincos (a[i], &b[i], &c[i]);
  }

  return (0);
}
--------------------

Compiled it with gcc version 8.3.1 using the command in the Example:
gcc ./tst_sincos.c -O1 -ftree-loop-vectorize -ffast-math -lm -mavx

Does not generate vectorized call. There is the following warning issued
by gcc:

----------------------
./tst_sincos.c: In function ‘main’:
./tst_sincos.c:15:5: warning: implicit declaration of function ‘sincos’ [-Wimplicit-function-declaration]
     sincos (a[i], &b[i], &c[i]);
     ^~~~~~
./tst_sincos.c:15:5: warning: incompatible implicit declaration of built-in function ‘sincos’
./tst_sincos.c:15:5: note: include ‘<math.h>’ or provide a declaration of ‘sincos’
./tst_sincos.c:2:1:
+#include <math.h>

./tst_sincos.c:15:5:
     sincos (a[i], &b[i], &c[i]);
     ^~~~~~
----------------------

The same warning is issued even when not requesting vectorization:
gcc ./tst_sincos.c -lm

All the above was on an x86_64 system. Got the same warning on PPC64 POWER8.

What is the issue with tst_sincos.c above? math.h is clearly included.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]