diff mbox series

[v2] x86-64: Add test-vector-abi.h/test-vector-abi-sincos.h

Message ID CAMe9rOq40SrnCN4HvHG2sX-=jNm5qwoOH8Q-CZd6HWKPD7fnKw@mail.gmail.com
State Committed
Headers show
Series [v2] x86-64: Add test-vector-abi.h/test-vector-abi-sincos.h | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

H.J. Lu Oct. 14, 2021, 1:32 p.m. UTC
On Wed, Oct 13, 2021 at 9:23 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Wed, Oct 13, 2021 at 11:54 PM H.J. Lu via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > Add a template for vector ABI test and use it for vector sincos/sincosf
> > ABI tests.
> > ---
> >  sysdeps/x86_64/fpu/Makefile                   |  6 ---
> >  .../fpu/test-double-libmvec-sincos-avx.c      |  1 +
> >  .../fpu/test-double-libmvec-sincos-avx2.c     |  3 +-
> >  .../fpu/test-double-libmvec-sincos-avx512.c   |  3 +-
> >  .../fpu/test-double-libmvec-sincos-main.c     |  2 +-
> >  .../x86_64/fpu/test-double-libmvec-sincos.c   | 45 +------------------
> >  .../fpu/test-float-libmvec-sincosf-avx.c      |  3 +-
> >  .../fpu/test-float-libmvec-sincosf-avx2.c     |  3 +-
> >  .../fpu/test-float-libmvec-sincosf-avx512.c   |  3 +-
> >  .../fpu/test-float-libmvec-sincosf-main.c     |  2 +-
> >  .../x86_64/fpu/test-float-libmvec-sincosf.c   | 45 +------------------
> >  sysdeps/x86_64/fpu/test-vector-abi.h          | 41 +++++++++++++++++
> >  12 files changed, 56 insertions(+), 101 deletions(-)
> >  create mode 100644 sysdeps/x86_64/fpu/test-vector-abi.h
> >
> > diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
> > index 1b4406380d..6643f77c5d 100644
> > --- a/sysdeps/x86_64/fpu/Makefile
> > +++ b/sysdeps/x86_64/fpu/Makefile
> > @@ -108,19 +108,13 @@ CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
> >  CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
> >
> >  CFLAGS-test-double-libmvec-sincos-main.c = $(libmvec-sincos-cflags)
> > -CFLAGS-test-double-libmvec-sincos-avx.c = -DREQUIRE_AVX
> >  CFLAGS-test-double-libmvec-sincos-avx-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
> > -CFLAGS-test-double-libmvec-sincos-avx2.c = -DREQUIRE_AVX2
> >  CFLAGS-test-double-libmvec-sincos-avx2-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
> > -CFLAGS-test-double-libmvec-sincos-avx512.c = -DREQUIRE_AVX512F
> >  CFLAGS-test-double-libmvec-sincos-avx512-main.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
> >
> >  CFLAGS-test-float-libmvec-sincosf-main.c = $(libmvec-sincos-cflags)
> > -CFLAGS-test-float-libmvec-sincosf-avx.c = -DREQUIRE_AVX
> >  CFLAGS-test-float-libmvec-sincosf-avx-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
> > -CFLAGS-test-float-libmvec-sincosf-avx2.c = -DREQUIRE_AVX2
> >  CFLAGS-test-float-libmvec-sincosf-avx2-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
> > -CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F
> >  CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
> >  endif
> >  endif
> > diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > index 896f1bcbaf..fbc0dbe3d9 100644
> > --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > @@ -1 +1,2 @@
> > +#define REQUIRE_AVX
> >  #include "test-double-libmvec-sincos.c"
>
> Should this be: #include "test-vector-abi.h"?

Yes.

> If so can test-double-libmvec-sincos.c be deleted?

No.  We need it to build test-double-libmvec-sincos.

Here is the v2 patch.  The main changes are

1. Rename all test-XXX-main.c files to test-XXX.c.
2. Use test-libmvec*.c to run the libmvec ABI tests.

OK for master?

Thanks.

Comments

Noah Goldstein Oct. 14, 2021, 4:12 p.m. UTC | #1
On Thu, Oct 14, 2021 at 8:32 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Oct 13, 2021 at 9:23 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 11:54 PM H.J. Lu via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> > >
> > > Add a template for vector ABI test and use it for vector sincos/sincosf
> > > ABI tests.
> > > ---
> > >  sysdeps/x86_64/fpu/Makefile                   |  6 ---
> > >  .../fpu/test-double-libmvec-sincos-avx.c      |  1 +
> > >  .../fpu/test-double-libmvec-sincos-avx2.c     |  3 +-
> > >  .../fpu/test-double-libmvec-sincos-avx512.c   |  3 +-
> > >  .../fpu/test-double-libmvec-sincos-main.c     |  2 +-
> > >  .../x86_64/fpu/test-double-libmvec-sincos.c   | 45 +------------------
> > >  .../fpu/test-float-libmvec-sincosf-avx.c      |  3 +-
> > >  .../fpu/test-float-libmvec-sincosf-avx2.c     |  3 +-
> > >  .../fpu/test-float-libmvec-sincosf-avx512.c   |  3 +-
> > >  .../fpu/test-float-libmvec-sincosf-main.c     |  2 +-
> > >  .../x86_64/fpu/test-float-libmvec-sincosf.c   | 45 +------------------
> > >  sysdeps/x86_64/fpu/test-vector-abi.h          | 41 +++++++++++++++++
> > >  12 files changed, 56 insertions(+), 101 deletions(-)
> > >  create mode 100644 sysdeps/x86_64/fpu/test-vector-abi.h
> > >
> > > diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
> > > index 1b4406380d..6643f77c5d 100644
> > > --- a/sysdeps/x86_64/fpu/Makefile
> > > +++ b/sysdeps/x86_64/fpu/Makefile
> > > @@ -108,19 +108,13 @@ CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
> > >  CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
> > >
> > >  CFLAGS-test-double-libmvec-sincos-main.c = $(libmvec-sincos-cflags)
> > > -CFLAGS-test-double-libmvec-sincos-avx.c = -DREQUIRE_AVX
> > >  CFLAGS-test-double-libmvec-sincos-avx-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
> > > -CFLAGS-test-double-libmvec-sincos-avx2.c = -DREQUIRE_AVX2
> > >  CFLAGS-test-double-libmvec-sincos-avx2-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
> > > -CFLAGS-test-double-libmvec-sincos-avx512.c = -DREQUIRE_AVX512F
> > >  CFLAGS-test-double-libmvec-sincos-avx512-main.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
> > >
> > >  CFLAGS-test-float-libmvec-sincosf-main.c = $(libmvec-sincos-cflags)
> > > -CFLAGS-test-float-libmvec-sincosf-avx.c = -DREQUIRE_AVX
> > >  CFLAGS-test-float-libmvec-sincosf-avx-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
> > > -CFLAGS-test-float-libmvec-sincosf-avx2.c = -DREQUIRE_AVX2
> > >  CFLAGS-test-float-libmvec-sincosf-avx2-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
> > > -CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F
> > >  CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
> > >  endif
> > >  endif
> > > diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > index 896f1bcbaf..fbc0dbe3d9 100644
> > > --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > @@ -1 +1,2 @@
> > > +#define REQUIRE_AVX
> > >  #include "test-double-libmvec-sincos.c"
> >
> > Should this be: #include "test-vector-abi.h"?
>
> Yes.
>
> > If so can test-double-libmvec-sincos.c be deleted?
>
> No.  We need it to build test-double-libmvec-sincos.
>
> Here is the v2 patch.  The main changes are
>
> 1. Rename all test-XXX-main.c files to test-XXX.c.
> 2. Use test-libmvec*.c to run the libmvec ABI tests.
>
> OK for master?

Should "mathvec/check-abi-libmvec'' be the only test in mathvec?

If so then LGTM.

>
> Thanks.
>
> --
> H.J.
Sunil Pandey Oct. 14, 2021, 4:36 p.m. UTC | #2
On Thu, Oct 14, 2021 at 9:13 AM Noah Goldstein via Libc-alpha <
libc-alpha@sourceware.org> wrote:

> On Thu, Oct 14, 2021 at 8:32 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 9:23 PM Noah Goldstein <goldstein.w.n@gmail.com>
> wrote:
> > >
> > > On Wed, Oct 13, 2021 at 11:54 PM H.J. Lu via Libc-alpha
> > > <libc-alpha@sourceware.org> wrote:
> > > >
> > > > Add a template for vector ABI test and use it for vector
> sincos/sincosf
> > > > ABI tests.
> > > > ---
> > > >  sysdeps/x86_64/fpu/Makefile                   |  6 ---
> > > >  .../fpu/test-double-libmvec-sincos-avx.c      |  1 +
> > > >  .../fpu/test-double-libmvec-sincos-avx2.c     |  3 +-
> > > >  .../fpu/test-double-libmvec-sincos-avx512.c   |  3 +-
> > > >  .../fpu/test-double-libmvec-sincos-main.c     |  2 +-
> > > >  .../x86_64/fpu/test-double-libmvec-sincos.c   | 45
> +------------------
> > > >  .../fpu/test-float-libmvec-sincosf-avx.c      |  3 +-
> > > >  .../fpu/test-float-libmvec-sincosf-avx2.c     |  3 +-
> > > >  .../fpu/test-float-libmvec-sincosf-avx512.c   |  3 +-
> > > >  .../fpu/test-float-libmvec-sincosf-main.c     |  2 +-
> > > >  .../x86_64/fpu/test-float-libmvec-sincosf.c   | 45
> +------------------
> > > >  sysdeps/x86_64/fpu/test-vector-abi.h          | 41 +++++++++++++++++
> > > >  12 files changed, 56 insertions(+), 101 deletions(-)
> > > >  create mode 100644 sysdeps/x86_64/fpu/test-vector-abi.h
> > > >
> > > > diff --git a/sysdeps/x86_64/fpu/Makefile
> b/sysdeps/x86_64/fpu/Makefile
> > > > index 1b4406380d..6643f77c5d 100644
> > > > --- a/sysdeps/x86_64/fpu/Makefile
> > > > +++ b/sysdeps/x86_64/fpu/Makefile
> > > > @@ -108,19 +108,13 @@ CFLAGS-test-double-vlen4-avx2-wrappers.c =
> $(double-vlen4-arch-ext2-cflags)
> > > >  CFLAGS-test-float-vlen8-avx2-wrappers.c =
> $(float-vlen8-arch-ext2-cflags)
> > > >
> > > >  CFLAGS-test-double-libmvec-sincos-main.c = $(libmvec-sincos-cflags)
> > > > -CFLAGS-test-double-libmvec-sincos-avx.c = -DREQUIRE_AVX
> > > >  CFLAGS-test-double-libmvec-sincos-avx-main.c =
> $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
> > > > -CFLAGS-test-double-libmvec-sincos-avx2.c = -DREQUIRE_AVX2
> > > >  CFLAGS-test-double-libmvec-sincos-avx2-main.c =
> $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
> > > > -CFLAGS-test-double-libmvec-sincos-avx512.c = -DREQUIRE_AVX512F
> > > >  CFLAGS-test-double-libmvec-sincos-avx512-main.c =
> $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
> > > >
> > > >  CFLAGS-test-float-libmvec-sincosf-main.c = $(libmvec-sincos-cflags)
> > > > -CFLAGS-test-float-libmvec-sincosf-avx.c = -DREQUIRE_AVX
> > > >  CFLAGS-test-float-libmvec-sincosf-avx-main.c =
> $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
> > > > -CFLAGS-test-float-libmvec-sincosf-avx2.c = -DREQUIRE_AVX2
> > > >  CFLAGS-test-float-libmvec-sincosf-avx2-main.c =
> $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
> > > > -CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F
> > > >  CFLAGS-test-float-libmvec-sincosf-avx512-main.c =
> $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
> > > >  endif
> > > >  endif
> > > > diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > > index 896f1bcbaf..fbc0dbe3d9 100644
> > > > --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > > +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > > @@ -1 +1,2 @@
> > > > +#define REQUIRE_AVX
> > > >  #include "test-double-libmvec-sincos.c"
> > >
> > > Should this be: #include "test-vector-abi.h"?
> >
> > Yes.
> >
> > > If so can test-double-libmvec-sincos.c be deleted?
> >
> > No.  We need it to build test-double-libmvec-sincos.
> >
> > Here is the v2 patch.  The main changes are
> >
> > 1. Rename all test-XXX-main.c files to test-XXX.c.
> > 2. Use test-libmvec*.c to run the libmvec ABI tests.
> >
> > OK for master?
>
> Should "mathvec/check-abi-libmvec'' be the only test in mathvec?
>
> If so then LGTM.
>
> >
> > Thanks.
> >
> > --
> > H.J.
>

v2 patch, file name looks inconsistent.

sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512f.c
sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512f.c
sysdeps/x86_64/fpu/test-libmvec-avx512f.c

Should  these file named as

sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c
sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c
sysdeps/x86_64/fpu/test-libmvec-avx512.c
H.J. Lu Oct. 14, 2021, 6:43 p.m. UTC | #3
On Thu, Oct 14, 2021 at 9:12 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Thu, Oct 14, 2021 at 8:32 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Oct 13, 2021 at 9:23 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> > >
> > > On Wed, Oct 13, 2021 at 11:54 PM H.J. Lu via Libc-alpha
> > > <libc-alpha@sourceware.org> wrote:
> > > >
> > > > Add a template for vector ABI test and use it for vector sincos/sincosf
> > > > ABI tests.
> > > > ---
> > > >  sysdeps/x86_64/fpu/Makefile                   |  6 ---
> > > >  .../fpu/test-double-libmvec-sincos-avx.c      |  1 +
> > > >  .../fpu/test-double-libmvec-sincos-avx2.c     |  3 +-
> > > >  .../fpu/test-double-libmvec-sincos-avx512.c   |  3 +-
> > > >  .../fpu/test-double-libmvec-sincos-main.c     |  2 +-
> > > >  .../x86_64/fpu/test-double-libmvec-sincos.c   | 45 +------------------
> > > >  .../fpu/test-float-libmvec-sincosf-avx.c      |  3 +-
> > > >  .../fpu/test-float-libmvec-sincosf-avx2.c     |  3 +-
> > > >  .../fpu/test-float-libmvec-sincosf-avx512.c   |  3 +-
> > > >  .../fpu/test-float-libmvec-sincosf-main.c     |  2 +-
> > > >  .../x86_64/fpu/test-float-libmvec-sincosf.c   | 45 +------------------
> > > >  sysdeps/x86_64/fpu/test-vector-abi.h          | 41 +++++++++++++++++
> > > >  12 files changed, 56 insertions(+), 101 deletions(-)
> > > >  create mode 100644 sysdeps/x86_64/fpu/test-vector-abi.h
> > > >
> > > > diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
> > > > index 1b4406380d..6643f77c5d 100644
> > > > --- a/sysdeps/x86_64/fpu/Makefile
> > > > +++ b/sysdeps/x86_64/fpu/Makefile
> > > > @@ -108,19 +108,13 @@ CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
> > > >  CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
> > > >
> > > >  CFLAGS-test-double-libmvec-sincos-main.c = $(libmvec-sincos-cflags)
> > > > -CFLAGS-test-double-libmvec-sincos-avx.c = -DREQUIRE_AVX
> > > >  CFLAGS-test-double-libmvec-sincos-avx-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
> > > > -CFLAGS-test-double-libmvec-sincos-avx2.c = -DREQUIRE_AVX2
> > > >  CFLAGS-test-double-libmvec-sincos-avx2-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
> > > > -CFLAGS-test-double-libmvec-sincos-avx512.c = -DREQUIRE_AVX512F
> > > >  CFLAGS-test-double-libmvec-sincos-avx512-main.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
> > > >
> > > >  CFLAGS-test-float-libmvec-sincosf-main.c = $(libmvec-sincos-cflags)
> > > > -CFLAGS-test-float-libmvec-sincosf-avx.c = -DREQUIRE_AVX
> > > >  CFLAGS-test-float-libmvec-sincosf-avx-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
> > > > -CFLAGS-test-float-libmvec-sincosf-avx2.c = -DREQUIRE_AVX2
> > > >  CFLAGS-test-float-libmvec-sincosf-avx2-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
> > > > -CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F
> > > >  CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
> > > >  endif
> > > >  endif
> > > > diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > > index 896f1bcbaf..fbc0dbe3d9 100644
> > > > --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > > +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
> > > > @@ -1 +1,2 @@
> > > > +#define REQUIRE_AVX
> > > >  #include "test-double-libmvec-sincos.c"
> > >
> > > Should this be: #include "test-vector-abi.h"?
> >
> > Yes.
> >
> > > If so can test-double-libmvec-sincos.c be deleted?
> >
> > No.  We need it to build test-double-libmvec-sincos.
> >
> > Here is the v2 patch.  The main changes are
> >
> > 1. Rename all test-XXX-main.c files to test-XXX.c.
> > 2. Use test-libmvec*.c to run the libmvec ABI tests.
> >
> > OK for master?
>
> Should "mathvec/check-abi-libmvec'' be the only test in mathvec?

Yes.  It checks:

sysdeps/unix/sysv/linux/x86_64/libmvec.abilist

This ABI test checks if libmvec can be used by GCC.

> If so then LGTM.
>
> >
> > Thanks.
> >
> > --
> > H.J.
H.J. Lu Oct. 14, 2021, 6:45 p.m. UTC | #4
On Thu, Oct 14, 2021 at 9:36 AM Sunil Pandey <skpgkp2@gmail.com> wrote:
>
>
>
> On Thu, Oct 14, 2021 at 9:13 AM Noah Goldstein via Libc-alpha <libc-alpha@sourceware.org> wrote:
>>
>> On Thu, Oct 14, 2021 at 8:32 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>> >
>> > On Wed, Oct 13, 2021 at 9:23 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>> > >
>> > > On Wed, Oct 13, 2021 at 11:54 PM H.J. Lu via Libc-alpha
>> > > <libc-alpha@sourceware.org> wrote:
>> > > >
>> > > > Add a template for vector ABI test and use it for vector sincos/sincosf
>> > > > ABI tests.
>> > > > ---
>> > > >  sysdeps/x86_64/fpu/Makefile                   |  6 ---
>> > > >  .../fpu/test-double-libmvec-sincos-avx.c      |  1 +
>> > > >  .../fpu/test-double-libmvec-sincos-avx2.c     |  3 +-
>> > > >  .../fpu/test-double-libmvec-sincos-avx512.c   |  3 +-
>> > > >  .../fpu/test-double-libmvec-sincos-main.c     |  2 +-
>> > > >  .../x86_64/fpu/test-double-libmvec-sincos.c   | 45 +------------------
>> > > >  .../fpu/test-float-libmvec-sincosf-avx.c      |  3 +-
>> > > >  .../fpu/test-float-libmvec-sincosf-avx2.c     |  3 +-
>> > > >  .../fpu/test-float-libmvec-sincosf-avx512.c   |  3 +-
>> > > >  .../fpu/test-float-libmvec-sincosf-main.c     |  2 +-
>> > > >  .../x86_64/fpu/test-float-libmvec-sincosf.c   | 45 +------------------
>> > > >  sysdeps/x86_64/fpu/test-vector-abi.h          | 41 +++++++++++++++++
>> > > >  12 files changed, 56 insertions(+), 101 deletions(-)
>> > > >  create mode 100644 sysdeps/x86_64/fpu/test-vector-abi.h
>> > > >
>> > > > diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
>> > > > index 1b4406380d..6643f77c5d 100644
>> > > > --- a/sysdeps/x86_64/fpu/Makefile
>> > > > +++ b/sysdeps/x86_64/fpu/Makefile
>> > > > @@ -108,19 +108,13 @@ CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
>> > > >  CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
>> > > >
>> > > >  CFLAGS-test-double-libmvec-sincos-main.c = $(libmvec-sincos-cflags)
>> > > > -CFLAGS-test-double-libmvec-sincos-avx.c = -DREQUIRE_AVX
>> > > >  CFLAGS-test-double-libmvec-sincos-avx-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
>> > > > -CFLAGS-test-double-libmvec-sincos-avx2.c = -DREQUIRE_AVX2
>> > > >  CFLAGS-test-double-libmvec-sincos-avx2-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
>> > > > -CFLAGS-test-double-libmvec-sincos-avx512.c = -DREQUIRE_AVX512F
>> > > >  CFLAGS-test-double-libmvec-sincos-avx512-main.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
>> > > >
>> > > >  CFLAGS-test-float-libmvec-sincosf-main.c = $(libmvec-sincos-cflags)
>> > > > -CFLAGS-test-float-libmvec-sincosf-avx.c = -DREQUIRE_AVX
>> > > >  CFLAGS-test-float-libmvec-sincosf-avx-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
>> > > > -CFLAGS-test-float-libmvec-sincosf-avx2.c = -DREQUIRE_AVX2
>> > > >  CFLAGS-test-float-libmvec-sincosf-avx2-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
>> > > > -CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F
>> > > >  CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
>> > > >  endif
>> > > >  endif
>> > > > diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
>> > > > index 896f1bcbaf..fbc0dbe3d9 100644
>> > > > --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
>> > > > +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c
>> > > > @@ -1 +1,2 @@
>> > > > +#define REQUIRE_AVX
>> > > >  #include "test-double-libmvec-sincos.c"
>> > >
>> > > Should this be: #include "test-vector-abi.h"?
>> >
>> > Yes.
>> >
>> > > If so can test-double-libmvec-sincos.c be deleted?
>> >
>> > No.  We need it to build test-double-libmvec-sincos.
>> >
>> > Here is the v2 patch.  The main changes are
>> >
>> > 1. Rename all test-XXX-main.c files to test-XXX.c.
>> > 2. Use test-libmvec*.c to run the libmvec ABI tests.
>> >
>> > OK for master?
>>
>> Should "mathvec/check-abi-libmvec'' be the only test in mathvec?
>>
>> If so then LGTM.
>>
>> >
>> > Thanks.
>> >
>> > --
>> > H.J.
>
>
> v2 patch, file name looks inconsistent.
>
> sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512f.c
> sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512f.c
> sysdeps/x86_64/fpu/test-libmvec-avx512f.c
>
> Should  these file named as
>
> sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c
> sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c
> sysdeps/x86_64/fpu/test-libmvec-avx512.c
>

There is no AVX512 ISA.   These libmvec functions work with
AVX512F.  I will check in the v2 patch ASIS.

Thanks.
diff mbox series

Patch

From ac3c3de1e8576cf4cee093d3d465f033a7c6070f Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 13 Oct 2021 13:46:52 -0700
Subject: [PATCH v2] x86-64: Add test-vector-abi.h/test-vector-abi-sincos.h

Add templates for vector ABI test and use them for vector sincos/sincosf
ABI tests.
---
 sysdeps/x86_64/fpu/Makefile                   | 74 ++++++++-----------
 .../fpu/test-double-libmvec-sincos-avx-main.c |  1 -
 .../test-double-libmvec-sincos-avx2-main.c    |  1 -
 .../test-double-libmvec-sincos-avx512-main.c  |  1 -
 ...c => test-double-libmvec-sincos-avx512f.c} |  0
 .../x86_64/fpu/test-double-libmvec-sincos.c   | 47 +-----------
 .../fpu/test-float-libmvec-sincosf-avx-main.c |  1 -
 .../test-float-libmvec-sincosf-avx2-main.c    |  1 -
 .../test-float-libmvec-sincosf-avx512-main.c  |  1 -
 ...c => test-float-libmvec-sincosf-avx512f.c} |  0
 .../x86_64/fpu/test-float-libmvec-sincosf.c   | 47 +-----------
 sysdeps/x86_64/fpu/test-libmvec-avx.c         |  2 +
 sysdeps/x86_64/fpu/test-libmvec-avx2.c        |  2 +
 sysdeps/x86_64/fpu/test-libmvec-avx512f.c     |  2 +
 sysdeps/x86_64/fpu/test-libmvec.c             |  1 +
 ...sincos-main.c => test-vector-abi-sincos.h} | 30 +++++---
 ...bmvec-sincosf-main.c => test-vector-abi.h} | 41 +++++-----
 17 files changed, 80 insertions(+), 172 deletions(-)
 delete mode 100644 sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx-main.c
 delete mode 100644 sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2-main.c
 delete mode 100644 sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512-main.c
 rename sysdeps/x86_64/fpu/{test-double-libmvec-sincos-avx512.c => test-double-libmvec-sincos-avx512f.c} (100%)
 delete mode 100644 sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx-main.c
 delete mode 100644 sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2-main.c
 delete mode 100644 sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512-main.c
 rename sysdeps/x86_64/fpu/{test-float-libmvec-sincosf-avx512.c => test-float-libmvec-sincosf-avx512f.c} (100%)
 create mode 100644 sysdeps/x86_64/fpu/test-libmvec-avx.c
 create mode 100644 sysdeps/x86_64/fpu/test-libmvec-avx2.c
 create mode 100644 sysdeps/x86_64/fpu/test-libmvec-avx512f.c
 create mode 100644 sysdeps/x86_64/fpu/test-libmvec.c
 rename sysdeps/x86_64/fpu/{test-double-libmvec-sincos-main.c => test-vector-abi-sincos.h} (58%)
 rename sysdeps/x86_64/fpu/{test-float-libmvec-sincosf-main.c => test-vector-abi.h} (62%)

diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
index 1b4406380d..e5a65750c0 100644
--- a/sysdeps/x86_64/fpu/Makefile
+++ b/sysdeps/x86_64/fpu/Makefile
@@ -31,58 +31,48 @@  libmvec-tests += double-vlen2 double-vlen4 double-vlen4-avx2 \
 tests += test-double-libmvec-sincos test-double-libmvec-sincos-avx \
 	 test-double-libmvec-sincos-avx2 test-float-libmvec-sincosf \
 	 test-float-libmvec-sincosf-avx test-float-libmvec-sincosf-avx2
-test-extras += test-double-libmvec-sincos-avx-main \
-		   test-double-libmvec-sincos-avx2-main \
-		   test-double-libmvec-sincos-main \
-		   test-float-libmvec-sincosf-avx-main \
-		   test-float-libmvec-sincosf-avx2-main \
-		   test-float-libmvec-sincosf-main
-extra-test-objs += test-double-libmvec-sincos-avx-main.o \
-		   test-double-libmvec-sincos-avx2-main.o \
-		   test-double-libmvec-sincos-main.o \
-		   test-float-libmvec-sincosf-avx-main.o \
-		   test-float-libmvec-sincosf-avx2-main.o\
-		   test-float-libmvec-sincosf-main.o
+test-extras += test-libmvec test-libmvec-avx \
+	       test-libmvec-avx2 test-libmvec-avx512f
+extra-test-objs += test-libmvec.o test-libmvec-avx.o \
+		   test-libmvec-avx2.o test-libmvec-avx512f.o
 
 $(objpfx)test-double-libmvec-sincos: \
   $(objpfx)test-double-libmvec-sincos.o \
-  $(objpfx)test-double-libmvec-sincos-main.o $(libmvec)
+  $(objpfx)test-libmvec.o $(libmvec)
 
 $(objpfx)test-double-libmvec-sincos-avx: \
   $(objpfx)test-double-libmvec-sincos-avx.o \
-  $(objpfx)test-double-libmvec-sincos-avx-main.o $(libmvec)
+  $(objpfx)test-libmvec-avx.o $(libmvec)
 
 $(objpfx)test-double-libmvec-sincos-avx2: \
   $(objpfx)test-double-libmvec-sincos-avx2.o \
-  $(objpfx)test-double-libmvec-sincos-avx2-main.o $(libmvec)
+  $(objpfx)test-libmvec-avx2.o $(libmvec)
 
 $(objpfx)test-float-libmvec-sincosf: \
   $(objpfx)test-float-libmvec-sincosf.o \
-  $(objpfx)test-float-libmvec-sincosf-main.o $(libmvec)
+  $(objpfx)test-libmvec.o $(libmvec)
 
 $(objpfx)test-float-libmvec-sincosf-avx: \
   $(objpfx)test-float-libmvec-sincosf-avx.o \
-  $(objpfx)test-float-libmvec-sincosf-avx-main.o $(libmvec)
+  $(objpfx)test-libmvec-avx.o $(libmvec)
 
 $(objpfx)test-float-libmvec-sincosf-avx2: \
   $(objpfx)test-float-libmvec-sincosf-avx2.o \
-  $(objpfx)test-float-libmvec-sincosf-avx2-main.o $(libmvec)
+  $(objpfx)test-libmvec-avx2.o $(libmvec)
 
 libmvec-tests += double-vlen8 float-vlen16
-tests += test-double-libmvec-sincos-avx512 \
-	 test-float-libmvec-sincosf-avx512
-test-extras += test-double-libmvec-sincos-avx512-main \
-	       test-float-libmvec-sincosf-avx512-main
-extra-test-objs += test-double-libmvec-sincos-avx512-main.o \
-		   test-float-libmvec-sincosf-avx512-main.o
+tests += test-double-libmvec-sincos-avx512f \
+	 test-float-libmvec-sincosf-avx512f
+test-extras += test-libmvec-avx512f
+extra-test-objs += test-libmvec-avx512f.o
 
-$(objpfx)test-double-libmvec-sincos-avx512: \
-  $(objpfx)test-double-libmvec-sincos-avx512.o \
-  $(objpfx)test-double-libmvec-sincos-avx512-main.o $(libmvec)
+$(objpfx)test-double-libmvec-sincos-avx512f: \
+  $(objpfx)test-double-libmvec-sincos-avx512f.o \
+  $(objpfx)test-libmvec-avx512f.o $(libmvec)
 
-$(objpfx)test-float-libmvec-sincosf-avx512: \
-  $(objpfx)test-float-libmvec-sincosf-avx512.o \
-  $(objpfx)test-float-libmvec-sincosf-avx512-main.o $(libmvec)
+$(objpfx)test-float-libmvec-sincosf-avx512f: \
+  $(objpfx)test-float-libmvec-sincosf-avx512f.o \
+  $(objpfx)test-libmvec-avx512f.o $(libmvec)
 
 double-vlen2-funcs = cos exp log pow sin sincos
 double-vlen4-funcs = cos exp log pow sin sincos
@@ -107,21 +97,15 @@  CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
 
 CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
 
-CFLAGS-test-double-libmvec-sincos-main.c = $(libmvec-sincos-cflags)
-CFLAGS-test-double-libmvec-sincos-avx.c = -DREQUIRE_AVX
-CFLAGS-test-double-libmvec-sincos-avx-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
-CFLAGS-test-double-libmvec-sincos-avx2.c = -DREQUIRE_AVX2
-CFLAGS-test-double-libmvec-sincos-avx2-main.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
-CFLAGS-test-double-libmvec-sincos-avx512.c = -DREQUIRE_AVX512F
-CFLAGS-test-double-libmvec-sincos-avx512-main.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
-
-CFLAGS-test-float-libmvec-sincosf-main.c = $(libmvec-sincos-cflags)
-CFLAGS-test-float-libmvec-sincosf-avx.c = -DREQUIRE_AVX
-CFLAGS-test-float-libmvec-sincosf-avx-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
-CFLAGS-test-float-libmvec-sincosf-avx2.c = -DREQUIRE_AVX2
-CFLAGS-test-float-libmvec-sincosf-avx2-main.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
-CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F
-CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
+CFLAGS-test-double-libmvec-sincos.c = $(libmvec-sincos-cflags)
+CFLAGS-test-double-libmvec-sincos-avx.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext-cflags)
+CFLAGS-test-double-libmvec-sincos-avx2.c = $(libmvec-sincos-cflags) $(double-vlen4-arch-ext2-cflags)
+CFLAGS-test-double-libmvec-sincos-avx512f.c = $(libmvec-sincos-cflags) $(double-vlen8-arch-ext-cflags)
+
+CFLAGS-test-float-libmvec-sincosf.c = $(libmvec-sincos-cflags)
+CFLAGS-test-float-libmvec-sincosf-avx.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext-cflags)
+CFLAGS-test-float-libmvec-sincosf-avx2.c = $(libmvec-sincos-cflags) $(float-vlen8-arch-ext2-cflags)
+CFLAGS-test-float-libmvec-sincosf-avx512f.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags)
 endif
 endif
 
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx-main.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx-main.c
deleted file mode 100644
index fc2ffea314..0000000000
--- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx-main.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-double-libmvec-sincos-main.c"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2-main.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2-main.c
deleted file mode 100644
index fc2ffea314..0000000000
--- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2-main.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-double-libmvec-sincos-main.c"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512-main.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512-main.c
deleted file mode 100644
index fc2ffea314..0000000000
--- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512-main.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-double-libmvec-sincos-main.c"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512f.c
similarity index 100%
rename from sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c
rename to sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512f.c
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
index 5f9eb4914f..9ccdbd6d6e 100644
--- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
+++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c
@@ -1,44 +1,3 @@ 
-/* Test for vector sincos ABI.
-   Copyright (C) 2016-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math-tests-arch.h>
-
-extern int test_sincos_abi (void);
-
-int arch_check = 1;
-
-static void
-check_arch (void)
-{
-  CHECK_ARCH_EXT;
-  arch_check = 0;
-}
-
-static int
-do_test (void)
-{
-  check_arch ();
-
-  if (arch_check)
-    return 77;
-
-  return test_sincos_abi ();
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../../../test-skeleton.c"
+#define LIBMVEC_TYPE double
+#define LIBMVEC_SINCOS sincos
+#include "test-vector-abi-sincos.h"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx-main.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx-main.c
deleted file mode 100644
index 558e2ac649..0000000000
--- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx-main.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-float-libmvec-sincosf-main.c"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2-main.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2-main.c
deleted file mode 100644
index 558e2ac649..0000000000
--- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2-main.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-float-libmvec-sincosf-main.c"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512-main.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512-main.c
deleted file mode 100644
index 558e2ac649..0000000000
--- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512-main.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-float-libmvec-sincosf-main.c"
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512f.c
similarity index 100%
rename from sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c
rename to sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512f.c
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
index 4538003e9c..2b77f25db1 100644
--- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
+++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c
@@ -1,44 +1,3 @@ 
-/* Test for vector sincosf ABI.
-   Copyright (C) 2016-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <math-tests-arch.h>
-
-extern int test_sincosf_abi (void);
-
-int arch_check = 1;
-
-static void
-check_arch (void)
-{
-  CHECK_ARCH_EXT;
-  arch_check = 0;
-}
-
-static int
-do_test (void)
-{
-  check_arch ();
-
-  if (arch_check)
-    return 77;
-
-  return test_sincosf_abi ();
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../../../test-skeleton.c"
+#define LIBMVEC_TYPE float
+#define LIBMVEC_SINCOS sincosf
+#include "test-vector-abi-sincos.h"
diff --git a/sysdeps/x86_64/fpu/test-libmvec-avx.c b/sysdeps/x86_64/fpu/test-libmvec-avx.c
new file mode 100644
index 0000000000..8e0fb492d7
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-libmvec-avx.c
@@ -0,0 +1,2 @@ 
+#define REQUIRE_AVX
+#include "test-vector-abi.h"
diff --git a/sysdeps/x86_64/fpu/test-libmvec-avx2.c b/sysdeps/x86_64/fpu/test-libmvec-avx2.c
new file mode 100644
index 0000000000..8725907915
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-libmvec-avx2.c
@@ -0,0 +1,2 @@ 
+#define REQUIRE_AVX2
+#include "test-vector-abi.h"
diff --git a/sysdeps/x86_64/fpu/test-libmvec-avx512f.c b/sysdeps/x86_64/fpu/test-libmvec-avx512f.c
new file mode 100644
index 0000000000..c0f24ceaee
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-libmvec-avx512f.c
@@ -0,0 +1,2 @@ 
+#define REQUIRE_AVX512F
+#include "test-vector-abi.h"
diff --git a/sysdeps/x86_64/fpu/test-libmvec.c b/sysdeps/x86_64/fpu/test-libmvec.c
new file mode 100644
index 0000000000..60261f83b8
--- /dev/null
+++ b/sysdeps/x86_64/fpu/test-libmvec.c
@@ -0,0 +1 @@ 
+#include "test-vector-abi.h"
diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c b/sysdeps/x86_64/fpu/test-vector-abi-sincos.h
similarity index 58%
rename from sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c
rename to sysdeps/x86_64/fpu/test-vector-abi-sincos.h
index 0fe2369099..8863677a69 100644
--- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c
+++ b/sysdeps/x86_64/fpu/test-vector-abi-sincos.h
@@ -1,4 +1,4 @@ 
-/* Test for vector sincos ABI.
+/* Test for vector sincos/sincosf ABI.
    Copyright (C) 2016-2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -17,27 +17,33 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <support/test-driver.h>
+
+/* Since libsupport_nonshared.a is placed before test-libmvec*.o, which
+   defines do_test, reference support_test_main here to include it to
+   avoid undefined reference to support_test_main.  The libmvec ABI test
+   doesn't need other symbols in libsupport_nonshared.a.  */
+__typeof (support_test_main) *support_test_main_p = support_test_main;
 
 #define N 1000
-double x[N], s[N], c[N];
-double* s_ptrs[N];
-double* c_ptrs[N];
+LIBMVEC_TYPE x[N], s[N], c[N];
+LIBMVEC_TYPE *s_ptrs[N];
+LIBMVEC_TYPE *c_ptrs[N];
 
 int
-test_sincos_abi (void)
+test_vector_abi (void)
 {
   int i;
-
   for(i = 0; i < N; i++)
-  {
-    x[i] = i / 3;
-    s_ptrs[i] = &s[i];
-    c_ptrs[i] = &c[i];
-  }
+    {
+      x[i] = i / 3;
+      s_ptrs[i] = &s[i];
+      c_ptrs[i] = &c[i];
+    }
 
 #pragma omp simd
   for(i = 0; i < N; i++)
-    sincos (x[i], s_ptrs[i], c_ptrs[i]);
+    LIBMVEC_SINCOS (x[i], s_ptrs[i], c_ptrs[i]);
 
   return 0;
 }
diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c b/sysdeps/x86_64/fpu/test-vector-abi.h
similarity index 62%
rename from sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c
rename to sysdeps/x86_64/fpu/test-vector-abi.h
index c7246cffc3..cde24e6021 100644
--- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c
+++ b/sysdeps/x86_64/fpu/test-vector-abi.h
@@ -1,4 +1,4 @@ 
-/* Test for vector sincosf ABI.
+/* Test for vector ABI.
    Copyright (C) 2016-2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,27 +16,26 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <math.h>
+#include <sys/platform/x86.h>
+#include <support/test-driver.h>
 
-#define N 1000
-float x[N], s[N], c[N];
-float *s_ptrs[N];
-float *c_ptrs[N];
+extern int test_vector_abi (void);
 
-int
-test_sincosf_abi (void)
+static int
+do_test (void)
 {
-  int i;
-  for(i = 0; i < N; i++)
-  {
-    x[i] = i / 3;
-    s_ptrs[i] = &s[i];
-    c_ptrs[i] = &c[i];
-  }
-
-#pragma omp simd
-  for(i = 0; i < N; i++)
-    sincosf (x[i], s_ptrs[i], c_ptrs[i]);
-
-  return 0;
+#if defined REQUIRE_AVX
+  if (!CPU_FEATURE_ACTIVE (AVX))
+    return EXIT_UNSUPPORTED;
+#elif defined REQUIRE_AVX2
+  if (!CPU_FEATURE_ACTIVE (AVX2))
+    return EXIT_UNSUPPORTED;
+#elif defined REQUIRE_AVX512F
+  if (!CPU_FEATURE_ACTIVE (AVX512F))
+    return EXIT_UNSUPPORTED;
+#endif
+
+  return test_vector_abi ();
 }
+
+#include <support/test-driver.c>
-- 
2.31.1