mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-29 16:21:07 +00:00
cd94326a13
This patch enables libmvec on AArch64. 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. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
32 lines
1.7 KiB
C
32 lines
1.7 KiB
C
/* Scalar wrapper for vpcs-enabled Advanced SIMD vector 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
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
#define VPCS_VECTOR_WRAPPER(scalar_func, vector_func) \
|
|
extern __attribute__ ((aarch64_vector_pcs)) \
|
|
VEC_TYPE vector_func (VEC_TYPE); \
|
|
FLOAT scalar_func (FLOAT x) \
|
|
{ \
|
|
int i; \
|
|
VEC_TYPE mx; \
|
|
INIT_VEC_LOOP (mx, x, VEC_LEN); \
|
|
VEC_TYPE mr = vector_func (mx); \
|
|
TEST_VEC_LOOP (mr, VEC_LEN); \
|
|
return ((FLOAT) mr[0]); \
|
|
}
|