[PATCH 1/2] Improve PPC target function attribute checks
Jussi Kivilinna
jussi.kivilinna at iki.fi
Wed Mar 1 10:46:37 CET 2023
* configure.ac (gcry_cv_gcc_attribute_ppc_target)
(gcry_cv_clang_attribute_ppc_target): Add 'always_inline'
function to test.
--
With some CFLAG combinations, target attribute fails to work with
always_inline functions. Patch adds detection for such configuration
and disables target attribute use in such case (and suffer less
optimal code generation).
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
configure.ac | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0d5c9160..44340e49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2376,10 +2376,11 @@ AC_CACHE_CHECK([whether compiler supports GCC PowerPC target attributes],
else
gcry_cv_gcc_attribute_ppc_target=no
AC_LINK_IFELSE([AC_LANG_PROGRAM(
- [[void __attribute__((target("cpu=power8"))) testfn8(void) {}
+ [[void __attribute__((always_inline)) inline aifn(void) {}
+ void __attribute__((target("cpu=power8"))) testfn8(void) {aifn();}
void __attribute__((target("cpu=power9"))) testfn9(void)
- { testfn8(); }
- ]], [ testfn9(); ])],
+ { testfn8(); aifn(); }
+ ]], [ testfn9(); aifn(); ])],
[gcry_cv_gcc_attribute_ppc_target=yes])
fi])
if test "$gcry_cv_gcc_attribute_ppc_target" = "yes" ; then
@@ -2398,10 +2399,11 @@ AC_CACHE_CHECK([whether compiler supports clang PowerPC target attributes],
else
gcry_cv_clang_attribute_ppc_target=no
AC_LINK_IFELSE([AC_LANG_PROGRAM(
- [[void __attribute__((target("arch=pwr8"))) testfn8(void) {}
+ [[void __attribute__((always_inline)) inline aifn(void) {}
+ void __attribute__((target("arch=pwr8"))) testfn8(void) {aifn();}
void __attribute__((target("arch=pwr9"))) testfn9(void)
- { testfn8(); }
- ]], [ testfn9(); ])],
+ { testfn8(); aifn(); }
+ ]], [ testfn9(); aifn(); ])],
[gcry_cv_clang_attribute_ppc_target=yes])
fi])
if test "$gcry_cv_clang_attribute_ppc_target" = "yes" ; then
--
2.37.2
More information about the Gcrypt-devel
mailing list