From patchwork Thu Oct 14 03:54:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 46193 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D170385740E for ; Thu, 14 Oct 2021 03:55:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D170385740E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634183700; bh=/2IQcQCAW5998g8QazvooI/OU3Yl3xTHarYbm9bCXqo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kpMfpYm3nhay5wNhuN4ya2oYix3OlNbVHhaEz/8WlGyhcUPZAx2teG1Art/Pq2mBy qeiF6tKXIV4oE/KUs4Foi8LhdKz/QrIW7LHDdbbcJysFEo9Z6MInHUAu+WSUcyEeI6 TOoF7TEG6vpy4OS+pn+m9Den1A2m4tE1kYiVon5E= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id 5A6833857C6B for ; Thu, 14 Oct 2021 03:54:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A6833857C6B Received: by mail-pj1-x102c.google.com with SMTP id d13-20020a17090ad3cd00b0019e746f7bd4so5995372pjw.0 for ; Wed, 13 Oct 2021 20:54:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/2IQcQCAW5998g8QazvooI/OU3Yl3xTHarYbm9bCXqo=; b=cEsUvYYYeK+K/mXcNeF6RJynnSVBbmLOAdDiqTPSJT/ArTHRJJvfX5238zlJkOvlQW UnNNGQLH6chkwjyBOjcIK4Z8L8oJdQM5LrpgmEAKVbeGMEyxLWmAZj3UlXjdIJVtca6W 2M6bEkgnHAGuGEdAhrdX7kTdUk67D52fsUUCYgoGSFTIBP7Bzpp9pLpnn3n6CLIvJjCP Q5vpWvrD+lJsfVE1BizGhBiAkAmBA4/RaOoUmUzxqnF7AZOEkviJ3bY5AHg2D1a5874q +p7dSv+vVZDq8L2pED3kHhqqOyRXwM+1xH6N2WjFAgrLhrXKEks9Z3t8knrDmzSnwLLO IYvg== X-Gm-Message-State: AOAM530HZEIVA9zXQhZjapxU665LqIjUiyZ7rtubMc/Xq5K2oQQHjRh4 HsqWK+hVibr+NyXi/TAXB26a2NHHPXs= X-Google-Smtp-Source: ABdhPJzUy1dtjembSd1XRSWfONmj+JkC+yn4wMPgc3DQbOUFvUMFnXSrbLo84dj+HlM/NDdJsixQjg== X-Received: by 2002:a17:90a:430f:: with SMTP id q15mr18040230pjg.2.1634183677292; Wed, 13 Oct 2021 20:54:37 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.39.6]) by smtp.gmail.com with ESMTPSA id me18sm891966pjb.33.2021.10.13.20.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 20:54:37 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id B440AC02EA; Wed, 13 Oct 2021 20:54:35 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] x86-64: Add test-vector-abi.h for vector ABI test Date: Wed, 13 Oct 2021 20:54:35 -0700 Message-Id: <20211014035435.6339-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3032.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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" diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2.c index 896f1bcbaf..8725907915 100644 --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2.c @@ -1 +1,2 @@ -#include "test-double-libmvec-sincos.c" +#define REQUIRE_AVX2 +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c index 896f1bcbaf..c0f24ceaee 100644 --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c @@ -1 +1,2 @@ -#include "test-double-libmvec-sincos.c" +#define REQUIRE_AVX512F +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c index 0fe2369099..48fade87c3 100644 --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c @@ -24,7 +24,7 @@ double* s_ptrs[N]; double* c_ptrs[N]; int -test_sincos_abi (void) +test_vector_abi (void) { int i; diff --git a/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c b/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c index 5f9eb4914f..60261f83b8 100644 --- a/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c +++ b/sysdeps/x86_64/fpu/test-double-libmvec-sincos.c @@ -1,44 +1 @@ -/* 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 - . */ - -#include - -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" +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx.c index 5b45f0a055..8e0fb492d7 100644 --- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx.c +++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx.c @@ -1 +1,2 @@ -#include "test-float-libmvec-sincosf.c" +#define REQUIRE_AVX +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2.c index 5b45f0a055..8725907915 100644 --- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2.c +++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2.c @@ -1 +1,2 @@ -#include "test-float-libmvec-sincosf.c" +#define REQUIRE_AVX2 +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c index 5b45f0a055..c0f24ceaee 100644 --- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c +++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c @@ -1 +1,2 @@ -#include "test-float-libmvec-sincosf.c" +#define REQUIRE_AVX512F +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c index c7246cffc3..5166583194 100644 --- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c +++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c @@ -24,7 +24,7 @@ float *s_ptrs[N]; float *c_ptrs[N]; int -test_sincosf_abi (void) +test_vector_abi (void) { int i; for(i = 0; i < N; i++) diff --git a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c index 4538003e9c..60261f83b8 100644 --- a/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c +++ b/sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c @@ -1,44 +1 @@ -/* 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 - . */ - -#include - -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" +#include "test-vector-abi.h" diff --git a/sysdeps/x86_64/fpu/test-vector-abi.h b/sysdeps/x86_64/fpu/test-vector-abi.h new file mode 100644 index 0000000000..cde24e6021 --- /dev/null +++ b/sysdeps/x86_64/fpu/test-vector-abi.h @@ -0,0 +1,41 @@ +/* Test for vector 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 + . */ + +#include +#include + +extern int test_vector_abi (void); + +static int +do_test (void) +{ +#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