public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] aarch64: Add SIMD attributes to math functions with vector versions Date: Wed, 20 Dec 2023 08:42:13 +0000 (GMT) [thread overview] Message-ID: <20231220084213.E31C9385842D@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=667f277c782f4457603e6d192bac294e5f2c5186 commit 667f277c782f4457603e6d192bac294e5f2c5186 Author: Joe Ramsay <Joe.Ramsay@arm.com> 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 <szabolcs.nagy@arm.com> 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 <bits/libm-simd-decl-stubs.h> +#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 +! <https://www.gnu.org/licenses/>. +!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)
reply other threads:[~2023-12-20 8:42 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231220084213.E31C9385842D@sourceware.org \ --to=nsz@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).