From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id E31C9385842D; Wed, 20 Dec 2023 08:42:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E31C9385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703061733; bh=f/pSo15sizVQx6nzb2IYjcQ7QDZobVKHZ/2j43TZijU=; h=From:To:Subject:Date:From; b=j70oixo8ifMntvzERtlQh7JYkt+F2nEGxe702nxTToUG9Os7QXFfe3EY4GmR59agZ YmsUmyBGI2Xc2g81kVeSvPFsNo8WG2wOyhupbDozLGQ+Hr2PRtJyhZeYoa4gfU6gE/ iLRxLdqmrkHR+14ma22hCW4o+ec+4xoSF2UkYLss= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc] aarch64: Add SIMD attributes to math functions with vector versions X-Act-Checkin: glibc X-Git-Author: Joe Ramsay X-Git-Refname: refs/heads/master X-Git-Oldrev: cc0d77ba944cd4ce46c5f0e6d426af3057962ca5 X-Git-Newrev: 667f277c782f4457603e6d192bac294e5f2c5186 Message-Id: <20231220084213.E31C9385842D@sourceware.org> Date: Wed, 20 Dec 2023 08:42:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=667f277c782f4457603e6d192bac294e5f2c5186 commit 667f277c782f4457603e6d192bac294e5f2c5186 Author: Joe Ramsay Date: Mon Dec 18 15:51:16 2023 +0000 aarch64: Add SIMD attributes to math functions with vector versions Added annotations for autovec by GCC and GFortran - this enables GCC >= 9 to autovectorise math calls at -Ofast. Reviewed-by: Szabolcs Nagy Diff: --- sysdeps/aarch64/fpu/bits/math-vector.h | 66 ++++++++++++++++++++++ sysdeps/aarch64/fpu/finclude/math-vector-fortran.h | 47 +++++++++++++++ 2 files changed, 113 insertions(+) diff --git a/sysdeps/aarch64/fpu/bits/math-vector.h b/sysdeps/aarch64/fpu/bits/math-vector.h index 52aad95e3b..67dc65bb76 100644 --- a/sysdeps/aarch64/fpu/bits/math-vector.h +++ b/sysdeps/aarch64/fpu/bits/math-vector.h @@ -25,6 +25,72 @@ /* Get default empty definitions for simd declarations. */ #include +#if defined __aarch64__ && defined __FAST_MATH__ && __GNUC_PREREQ (6, 0) +/* Requires GCC >= 6 for __attribute__ ((__simd__)). */ +# define __DECL_SIMD_aarch64 __attribute__ ((__simd__ ("notinbranch"), const)) + +# undef __DECL_SIMD_acos +# define __DECL_SIMD_acos __DECL_SIMD_aarch64 +# undef __DECL_SIMD_acosf +# define __DECL_SIMD_acosf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_asin +# define __DECL_SIMD_asin __DECL_SIMD_aarch64 +# undef __DECL_SIMD_asinf +# define __DECL_SIMD_asinf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atan +# define __DECL_SIMD_atan __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atanf +# define __DECL_SIMD_atanf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atan2 +# define __DECL_SIMD_atan2 __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atan2f +# define __DECL_SIMD_atan2f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_cos +# define __DECL_SIMD_cos __DECL_SIMD_aarch64 +# undef __DECL_SIMD_cosf +# define __DECL_SIMD_cosf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_exp +# define __DECL_SIMD_exp __DECL_SIMD_aarch64 +# undef __DECL_SIMD_expf +# define __DECL_SIMD_expf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_exp10 +# define __DECL_SIMD_exp10 __DECL_SIMD_aarch64 +# undef __DECL_SIMD_exp10f +# define __DECL_SIMD_exp10f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_exp2 +# define __DECL_SIMD_exp2 __DECL_SIMD_aarch64 +# undef __DECL_SIMD_exp2f +# define __DECL_SIMD_exp2f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_expm1 +# define __DECL_SIMD_expm1 __DECL_SIMD_aarch64 +# undef __DECL_SIMD_expm1f +# define __DECL_SIMD_expm1f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log +# define __DECL_SIMD_log __DECL_SIMD_aarch64 +# undef __DECL_SIMD_logf +# define __DECL_SIMD_logf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log10 +# define __DECL_SIMD_log10 __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log10f +# define __DECL_SIMD_log10f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log1p +# define __DECL_SIMD_log1p __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log1pf +# define __DECL_SIMD_log1pf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log2 +# define __DECL_SIMD_log2 __DECL_SIMD_aarch64 +# undef __DECL_SIMD_log2f +# define __DECL_SIMD_log2f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_sin +# define __DECL_SIMD_sin __DECL_SIMD_aarch64 +# undef __DECL_SIMD_sinf +# define __DECL_SIMD_sinf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_tan +# define __DECL_SIMD_tan __DECL_SIMD_aarch64 +# undef __DECL_SIMD_tanf +# define __DECL_SIMD_tanf __DECL_SIMD_aarch64 +#endif + #if __GNUC_PREREQ(9, 0) # define __ADVSIMD_VEC_MATH_SUPPORTED typedef __Float32x4_t __f32x4_t; diff --git a/sysdeps/aarch64/fpu/finclude/math-vector-fortran.h b/sysdeps/aarch64/fpu/finclude/math-vector-fortran.h new file mode 100644 index 0000000000..af489f4769 --- /dev/null +++ b/sysdeps/aarch64/fpu/finclude/math-vector-fortran.h @@ -0,0 +1,47 @@ +! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- +! Copyright (C) 2019-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 +! . +!GCC$ builtin (acos) attributes simd (notinbranch) +!GCC$ builtin (acosf) attributes simd (notinbranch) +!GCC$ builtin (asin) attributes simd (notinbranch) +!GCC$ builtin (asinf) attributes simd (notinbranch) +!GCC$ builtin (atan) attributes simd (notinbranch) +!GCC$ builtin (atanf) attributes simd (notinbranch) +!GCC$ builtin (atan2) attributes simd (notinbranch) +!GCC$ builtin (atan2f) attributes simd (notinbranch) +!GCC$ builtin (cos) attributes simd (notinbranch) +!GCC$ builtin (cosf) attributes simd (notinbranch) +!GCC$ builtin (exp) attributes simd (notinbranch) +!GCC$ builtin (expf) attributes simd (notinbranch) +!GCC$ builtin (exp10) attributes simd (notinbranch) +!GCC$ builtin (exp10f) attributes simd (notinbranch) +!GCC$ builtin (exp2) attributes simd (notinbranch) +!GCC$ builtin (exp2f) attributes simd (notinbranch) +!GCC$ builtin (expm1) attributes simd (notinbranch) +!GCC$ builtin (expm1f) attributes simd (notinbranch) +!GCC$ builtin (log) attributes simd (notinbranch) +!GCC$ builtin (logf) attributes simd (notinbranch) +!GCC$ builtin (log10) attributes simd (notinbranch) +!GCC$ builtin (log10f) attributes simd (notinbranch) +!GCC$ builtin (log1p) attributes simd (notinbranch) +!GCC$ builtin (log1pf) attributes simd (notinbranch) +!GCC$ builtin (log2) attributes simd (notinbranch) +!GCC$ builtin (log2f) attributes simd (notinbranch) +!GCC$ builtin (sin) attributes simd (notinbranch) +!GCC$ builtin (sinf) attributes simd (notinbranch) +!GCC$ builtin (tan) attributes simd (notinbranch) +!GCC$ builtin (tanf) attributes simd (notinbranch)