From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2045.outbound.protection.outlook.com [40.107.20.45]) by sourceware.org (Postfix) with ESMTPS id B44C53858D28 for ; Thu, 6 Apr 2023 16:26:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B44C53858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fhgl30t/QHbwi4FFQK1Ivmrx5sA+g7+GalK7RaTru30=; b=3wfwIRML2gtGxSKu44t3L/pInpXtejztU5rE71lxQOMvG5g93O/8bRHMu+zDNTojlWJwZHQLlv+Q+ad/go7MixFpct3/w3+6Sr636V8LNnHEDuAVZg9YIAsAPUtoQfRvNc30wwFRHznRzIFjQJNtNwLSvhjYTKEH+UvQBBXBVPc= Received: from AS9PR05CA0123.eurprd05.prod.outlook.com (2603:10a6:20b:497::13) by VI1PR08MB10123.eurprd08.prod.outlook.com (2603:10a6:800:1c7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Thu, 6 Apr 2023 16:26:44 +0000 Received: from AM7EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:497:cafe::7d) by AS9PR05CA0123.outlook.office365.com (2603:10a6:20b:497::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.37 via Frontend Transport; Thu, 6 Apr 2023 16:26:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT027.mail.protection.outlook.com (100.127.140.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31 via Frontend Transport; Thu, 6 Apr 2023 16:26:44 +0000 Received: ("Tessian outbound 5154e9d36775:v136"); Thu, 06 Apr 2023 16:26:44 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 072f34d6818c711e X-CR-MTA-TID: 64aa7808 Received: from dabfdac1edc4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0490320E-9E9F-4140-A117-364D1258FC39.1; Thu, 06 Apr 2023 16:26:35 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id dabfdac1edc4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 06 Apr 2023 16:26:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gkclP8CgsYVAZAsY30N+9uFJqNFZijh6cns0zSOo3m38EhsgiDDk+XXg2eQdFD79aZ0fJYA7ujz4UfDNKcIwRXY0Igk3BWdwjQmHdatsEPmCdyKZImA3qPIahdKrz0w8fPOYbhCigI1TW9PoNM40lw5DKo68nTr37TOLMNLnx8VNx7odx89iNXrBlpsbXQ2c93eWy7EP3IwzBbVASy5OEnMJWrj/quQowWWU+xj9wkVT8tBejfY741ZujOyK6FsMKDjeTftDwznXcGpbGQimF380nK0MbiQW3sfX9sBzr0LDvL0Hx2pKoA733XeocZpjg6SqIB9ZqTzFB81ysqQn5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fhgl30t/QHbwi4FFQK1Ivmrx5sA+g7+GalK7RaTru30=; b=Lmcu9yMEvjIuHhj7TZp9f19ror+i5v5hMicreBj7evww4SS8hovNAOREwwBkFz2L5yxTFo0BKd5MNlPbFl8R/6Y6XoTULZEK52m5WeUIgjrr89f5w3DjFT+Yc8+2RxOLe8gUAvznvERuviZ7WU6wP318S94+lAUT4uNBFXfKgRm9MlLiAxx2RhRTz7iu9lhDQiVh5EZqC/CJTYbzZ186Bnx9ZE/L51uoDLqvsgpOv/5T/Ta2Th8w+8ahglafn/lUsqcQeToVSmbC82j1asRnHgGPOHbMAESTMg0mUAr3Nb7MUh+8QvsjhbWrKemH/xzl8cEpHl+jric6onEvPWJfgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fhgl30t/QHbwi4FFQK1Ivmrx5sA+g7+GalK7RaTru30=; b=3wfwIRML2gtGxSKu44t3L/pInpXtejztU5rE71lxQOMvG5g93O/8bRHMu+zDNTojlWJwZHQLlv+Q+ad/go7MixFpct3/w3+6Sr636V8LNnHEDuAVZg9YIAsAPUtoQfRvNc30wwFRHznRzIFjQJNtNwLSvhjYTKEH+UvQBBXBVPc= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by DBBPR08MB6267.eurprd08.prod.outlook.com (2603:10a6:10:20d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31; Thu, 6 Apr 2023 16:26:29 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::242d:33fe:1c48:bd8]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::242d:33fe:1c48:bd8%5]) with mapi id 15.20.6277.031; Thu, 6 Apr 2023 16:26:28 +0000 Date: Thu, 6 Apr 2023 17:26:13 +0100 From: Szabolcs Nagy To: Joe Ramsay , Subject: Re: [PATCH 2/2] Enable libmvec support for AArch64 Message-ID: References: <20230324121011.629-1-Joe.Ramsay@arm.com> <20230324121011.629-2-Joe.Ramsay@arm.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230324121011.629-2-Joe.Ramsay@arm.com> X-ClientProxiedBy: LO4P123CA0574.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:276::12) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB7179:EE_|DBBPR08MB6267:EE_|AM7EUR03FT027:EE_|VI1PR08MB10123:EE_ X-MS-Office365-Filtering-Correlation-Id: 99651cbe-cc4f-49f3-9a92-08db36bbb617 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: z/T77cze8+uTvnaG4v+L0NaqjT1zyx+zv4rdazB/qfK3YU7SaPciSwmEf6lYLTHp+uG4tzYVpDckzh7KT3Qp++wtOsESeGfOSoEEoweMu82BQ8VAX7gvBhd95xKHfW1ZDituZ82//Vl9GnGrqLk6WpDQsJTFv4bb8jDXa3L4qz9nBdTu3b3Ebzg6m6a2/cTZOUoVm4h9pbOSuljoQ1etkz+w49Y6hB8FXgCK5TqaBjQumQQkbd1nO8PFPNoboFb6DLSg3cTLnt8UXHPe07VDe4LNWg1pbe05tdXVoU+Kx6UAcClqvqAWmrQvNE1s/ledLFeoWoPSxsa6irdWx9ua6SJrrDrAlu7ID0fzkTqkXgoWxBxyHG1JQs4OFkYJHtoRxXD8LNyYLrsOjM4mZ96N30Tg1I1bGCSJQQ9p3z7SJf0QJNZRWWHrPZI+MCsXn+Yl+Aae/pIBrEKtGwmZjKUydR73uTVEJc27j06Pc1WX4VeN7nDym5qNtJU6ssFXnfrV261vPot9xIE20VIfYyema/N5/iWZIKm8b3evgr5Uqw5plLPHZubV6rpmMJWYPBUAmcvV+cTofw2e7wh+ZegsjA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB7179.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(346002)(136003)(366004)(39860400002)(451199021)(38100700002)(36756003)(2906002)(44832011)(30864003)(5660300002)(8936002)(66476007)(66556008)(86362001)(41300700001)(8676002)(66946007)(6486002)(83380400001)(2616005)(6666004)(186003)(6506007)(26005)(6512007)(110136005)(316002)(478600001)(2004002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6267 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8bbbf90e-1a0e-4c40-474a-08db36bbac5c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EUdEkLNJ6jBa7AE9Ct3sATLJD/UXx8KLqkUQpi6trojVdpMNcqYsIivLdGzBqa1pm7MH1YccBnuxgkZT8IPX/Y7zR0Z87yqSxENF85DH8bInjRCEMbNanlF5QiuzpAQljGsnYWvO01M4sLpNdKK68t6QsOfBn+5VysFTZyGtT/uH+EqNgeBpLLTfZP4aj74jxR9Tx9uSKKP5572n+ULNnW6IdqJvtHz1s3kwe4Y4iYE17zmEAYujX1Ftq6KHHlge5uKS4kaJ3A6/OAaGgnZYldjzBldhhIxe3OJYoUa0wFabnTACZ6V2uYT4P3FZEQXdm8nql8nPR9sQkg7o0LR5T8xmTXM1mD2NhKHm4zrzekT6RNeZpUvL1nG37Ttf+C9J7CJ6N3EruN8KxcbI93rol908woeT3s9eX+h3ni+H4TAQZGe0yCu7/UIKXh5CglBUQoRH5U4gZ/0YaheYDvxG1eqUHqPrWfHRcuIl3ciPcBzp6U5iK/ul+s73+HtRAhWSxuRQhApjxRoasv+2pxhkh9idcyVUv2Zwhlncr5rp07F32B7mjSqJbC5DMmNNBUHOjry/1hzulMK65oHHveGsLUlwDitdQbKnzJ9j9jw6UYHQ31TZBFLwPPwn8mcLMEOEfn/791KnD2O2M7NWP2/3TiOAPIhcgcwgAayVx7iE21P5anUpBn9Dbc36eRcPMtifpRwMaE/wH1HsMYLAljsa7Q== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39850400004)(346002)(396003)(451199021)(36840700001)(40470700004)(46966006)(2906002)(83380400001)(40480700001)(47076005)(186003)(336012)(6512007)(6666004)(36756003)(2616005)(26005)(6506007)(36860700001)(6486002)(40460700003)(81166007)(82310400005)(5660300002)(82740400003)(8936002)(316002)(110136005)(356005)(30864003)(44832011)(70206006)(8676002)(41300700001)(70586007)(478600001)(86362001)(2004002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2023 16:26:44.3904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99651cbe-cc4f-49f3-9a92-08db36bbb617 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB10123 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The 03/24/2023 12:10, Joe Ramsay via Libc-alpha wrote: > The proposed change is mainly implementing build infrastructure to add > the new routines to ABI, tests and benchmarks. I have demonstrated how > this all fits together by adding implementations for vector cos, in > both single and double precision, targeting both Advanced SIMD and > SVE. > > The implementations of the routines themselves are just loops over the > scalar routine from libm for now, as we are more concerned with > getting the plumbing right at this point. We plan to contribute vector > routines from the Arm Optimized Routines repo that are compliant with > requirements described in the libmvec wiki. > > Building libmvec requires minimum GCC 10 for SVE ACLE. To avoid raising > the minimum GCC by such a big jump, we allow users to disable libmvec > if their compiler is too old. > > Note that at this point users have to manually call the vector math > functions. This seems to be acceptable to some downstream users. > > Thanks, > Joe looks mostly ok, some fixes are needed: > rename from sysdeps/x86_64/fpu/bench-libmvec-skeleton.c > rename to benchtests/bench-libmvec-skeleton.c this has some x86 specific code (cpu feature tests) so i think we should probably create a copy or factor out the cpu tests e.g. like #include "bench-libmvec-arch.h" ... #ifdef INIT_ARCH INIT_ARCH #endif bench_start (); and in bench-libmvec-arch.h #define INIT_ARCH do{if (!supported()) return 77;}while(0) static bool supported () {...} but if this becomes to hairy change then just copy. > --- a/sysdeps/aarch64/configure.ac > +++ b/sysdeps/aarch64/configure.ac > @@ -101,3 +101,35 @@ rm -f conftest*]) > if test $libc_cv_aarch64_sve_asm = yes; then > AC_DEFINE(HAVE_AARCH64_SVE_ASM) > fi > + > +if test x"$build_mathvec" = xnotset; then > + build_mathvec=yes > +fi > + > +# Check if compiler is sufficient to build mathvec (needs SVE ACLE) > +AC_CACHE_CHECK(for availability of SVE ACLE, libc_cv_has_sve_acle, [dnl > + if test $build_mathvec = yes; then > + cat > conftest.c < +#include > +EOF > + if ! ${CC-cc} conftest.c -fsyntax-only; then > + as_fn_error 1 "mathvec is enabled but compiler does not have SVE ACLE. Either use a compatible compiler or disable mathvec (this results in incomplete ABI)." please include the config option in the error message, e.g. s/disable mathvec/configure with --disable-mathvec/ > + fi > + rm conftest.c > + fi]) > + > +# Check if the local system can run SVE binary > +AC_CACHE_CHECK(for local SVE hardware, libc_cv_can_run_sve, [dnl > + cat > conftest.c < +#include > +int main(void) { > + if (! (getauxval (AT_HWCAP) & HWCAP_SVE)) > + return 1; > + return 0; > +} > +EOF > + libc_cv_can_run_sve=yes > + ${CC-cc} conftest.c -o conftest > + ./conftest || libc_cv_can_run_sve=no > + rm -f conftest*]) > +LIBC_CONFIG_VAR([aarch64-can-run-sve], [$libc_cv_can_run_sve]) in case of cross build we should not try running a target exe. and i think benchmarks can be run in cross environment when the test-wrapper make variable is specified, so configure time test does not help. i.e. update bench-libmvec-skeleton.c with runtime hwcap check. > --- /dev/null > +++ b/sysdeps/aarch64/fpu/Makefile > @@ -0,0 +1,66 @@ > +float-advsimd-funcs = cos > + > +double-advsimd-funcs = cos > + > +float-sve-funcs = cos > + > +double-sve-funcs = cos > + > +ifeq ($(subdir),mathvec) > +libmvec-support = $(addsuffix f_advsimd,$(float-advsimd-funcs)) \ > + $(addsuffix _advsimd,$(double-advsimd-funcs)) \ > + $(addsuffix f_sve,$(float-sve-funcs)) \ > + $(addsuffix _sve,$(double-sve-funcs)) > +endif > + > +sve-cflags = -march=armv8-a+sve > + > + > +ifeq ($(build-mathvec),yes) > +bench-libmvec = $(addprefix float-advsimd-,$(float-advsimd-funcs)) \ > + $(addprefix double-advsimd-,$(double-advsimd-funcs)) > + > +# If not on an SVE-enabled machine, do not add SVE routines to benchmarks. > +# The routines are still built. > +ifeq ($(aarch64-can-run-sve),yes) run the benchmarks just exit early if no sve. > + bench-libmvec += $(addprefix float-sve-,$(float-sve-funcs)) \ > + $(addprefix double-sve-,$(double-sve-funcs)) > +endif > +endif > + > +$(objpfx)bench-float-advsimd-%.c: > + $(PYTHON) $(..)sysdeps/aarch64/fpu/scripts/bench_libmvec_advsimd.py $(basename $(@F)) > $@ > +$(objpfx)bench-double-advsimd-%.c: > + $(PYTHON) $(..)sysdeps/aarch64/fpu/scripts/bench_libmvec_advsimd.py $(basename $(@F)) > $@ > +$(objpfx)bench-float-sve-%.c: > + $(PYTHON) $(..)sysdeps/aarch64/fpu/scripts/bench_libmvec_sve.py $(basename $(@F)) > $@ > +$(objpfx)bench-double-sve-%.c: > + $(PYTHON) $(..)sysdeps/aarch64/fpu/scripts/bench_libmvec_sve.py $(basename $(@F)) > $@ > + > +ifeq (${STATIC-BENCHTESTS},yes) > +libmvec-benchtests = $(common-objpfx)mathvec/libmvec.a $(common-objpfx)math/libm.a > +else > +libmvec-benchtests = $(libmvec) $(libm) > +endif > + > +$(addprefix $(objpfx)bench-,$(bench-libmvec)): $(libmvec-benchtests) > + > +ifeq ($(build-mathvec),yes) > +libmvec-tests += float-advsimd double-advsimd float-sve double-sve > +endif > + > +define sve-float-cflags-template > +CFLAGS-$(1)f_sve.c += $(sve-cflags) > +CFLAGS-bench-float-sve-$(1).c += $(sve-cflags) > +endef > + > +define sve-double-cflags-template > +CFLAGS-$(1)_sve.c += $(sve-cflags) > +CFLAGS-bench-double-sve-$(1).c += $(sve-cflags) > +endef > + > +$(foreach f,$(float-sve-funcs), $(eval $(call sve-float-cflags-template,$(f)))) > +$(foreach f,$(double-sve-funcs), $(eval $(call sve-double-cflags-template,$(f)))) > + > +CFLAGS-test-float-sve-wrappers.c = $(sve-cflags) > +CFLAGS-test-double-sve-wrappers.c = $(sve-cflags) > --- /dev/null > +++ b/sysdeps/aarch64/fpu/bits/math-vector.h > @@ -0,0 +1,64 @@ > +/* Platform-specific SIMD declarations of math functions. > + > + Copyright (C) 2023 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 > + . */ > + > +#ifndef _MATH_H > +# error "Never include directly;\ > + include instead." > +#endif > + > +/* Get default empty definitions for simd declarations. */ > +#include > + > +#if __GNUC_PREREQ (9, 0) > +# define __ADVSIMD_VEC_MATH_SUPPORTED > +typedef __Float32x4_t __f32x4_t; > +typedef __Float64x2_t __f64x2_t; > +#elif __clang_major__ >= 8 replace with __glibc_clang_prereq (8, 0) gcc-8 fails to build glibc otherwise (since -Wundef -Werror). > +# define __ADVSIMD_VEC_MATH_SUPPORTED > +typedef __attribute__((__neon_vector_type__(4))) float __f32x4_t; > +typedef __attribute__((__neon_vector_type__(2))) double __f64x2_t; > +#endif > + > +#if __GNUC_PREREQ (10, 0) || __clang_major >= 11 likewise, use __glibc_clang_prereq (11, 0) > +# define __SVE_VEC_MATH_SUPPORTED > +typedef __SVFloat32_t __sv_f32_t; > +typedef __SVFloat64_t __sv_f64_t; > +typedef __SVBool_t __sv_bool_t; > +#endif > + > +/* If vector types and vector PCS are unsupported in the working > + compiler, no choice but to omit vector math declarations. */ > + > +#ifdef __ADVSIMD_VEC_MATH_SUPPORTED > + > +# define __vpcs __attribute__((__aarch64_vector_pcs__)) > + > +__vpcs __f32x4_t _ZGVnN4v_cosf (__f32x4_t); > +__vpcs __f64x2_t _ZGVnN2v_cos (__f64x2_t); > + > +#undef __ADVSIMD_VEC_MATH_SUPPORTED > +#endif /* __ADVSIMD_VEC_MATH_SUPPORTED */ > + > +#ifdef __SVE_VEC_MATH_SUPPORTED > + > +__sv_f32_t _ZGVsMxv_cosf (__sv_f32_t, __sv_bool_t); > +__sv_f64_t _ZGVsMxv_cos (__sv_f64_t, __sv_bool_t); > + > +#undef __SVE_VEC_MATH_SUPPORTED > +#endif /* __SVE_VEC_MATH_SUPPORTED */ > --- /dev/null > +++ b/sysdeps/aarch64/fpu/math-tests-arch.h > @@ -0,0 +1,33 @@ > +/* Runtime architecture check for math tests. AArch64 version. > + > + Copyright (C) 2023 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 > + . */ > + > +#ifdef REQUIRE_SVE > +# include > + > +# define INIT_ARCH_EXT > +# define CHECK_ARCH_EXT \ > + do \ > + { \ > + if (!(getauxval (AT_HWCAP) & HWCAP_SVE)) return; \ > + } \ > + while (0) > + > +#else > +# include > +#endif OK. the bench code might need something similar maybe even share the code. > --- a/sysdeps/x86_64/fpu/Makefile > +++ b/sysdeps/x86_64/fpu/Makefile > @@ -94,7 +94,7 @@ endif > > $(addprefix $(objpfx)bench-,$(bench-libmvec-double)): $(libmvec-benchtests) > $(addprefix $(objpfx)bench-,$(bench-libmvec-float)): $(libmvec-benchtests) > -bench-libmvec-deps = $(..)sysdeps/x86_64/fpu/bench-libmvec-skeleton.c bench-timing.h Makefile > +bench-libmvec-deps = $(..)benchtests/bench-libmvec-skeleton.c bench-timing.h Makefile > > $(objpfx)bench-float-%.c: $(bench-libmvec-deps) > { if [ -n "$($*-INCLUDE)" ]; then \ this might need to change.