Hi all,This patch introduces a fallback implementation for trigonometric pi-based functions. This implementation supports float, double, and long double data types.
I've revised the test cases for r4 and r8 types, and all tests passed successfully on the aarch64-linux platform. If this looks good, I will address f128/r16 in a subsequent patch. (A related patch concerning libquadmath is currently under review.)
Thanks, Yuao
From f8f2031e5e4bcd03e7382342907334cd33dd2ec6 Mon Sep 17 00:00:00 2001 From: Yuao Ma <c...@outlook.com> Date: Sat, 5 Jul 2025 17:06:18 +0800 Subject: [PATCH] libgfortran: add fallback for trigonometric pi-based functions This patch introduces a fallback implementation for pi-based trigonometric functions, ensuring broader compatibility and robustness. The new implementation supports float, double, and long double data types. Accordingly, the test cases for r4 and r8 have been revised to reflect these changes. libgfortran/ChangeLog: * Makefile.am: Add c23_functions.c to Makefile. * Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Check if trig-pi functions exist. * gfortran.map: Add a section for c23 functions. * libgfortran.h: Include c23 proto file. * c23_protos.h: Add c23 proto file and trig-pi funcs. * intrinsics/c23_functions.c: Add trig-pi fallback impls. gcc/testsuite/ChangeLog: * gfortran.dg/dec_math_5.f90: Revise test to use fallback. Signed-off-by: Yuao Ma <c...@outlook.com> Co-authored-by: Steven G. Kargl <ka...@gcc.gnu.org> --- gcc/testsuite/gfortran.dg/dec_math_5.f90 | 36 +- libgfortran/Makefile.am | 4 + libgfortran/Makefile.in | 8 + libgfortran/c23_protos.h | 133 +++ libgfortran/config.h.in | 63 ++ libgfortran/configure | 1020 +++++++++++++++++++++- libgfortran/configure.ac | 23 + libgfortran/gfortran.map | 25 + libgfortran/intrinsics/c23_functions.c | 308 +++++++ libgfortran/libgfortran.h | 1 + 10 files changed, 1598 insertions(+), 23 deletions(-) create mode 100644 libgfortran/c23_protos.h create mode 100644 libgfortran/intrinsics/c23_functions.c diff --git a/gcc/testsuite/gfortran.dg/dec_math_5.f90 b/gcc/testsuite/gfortran.dg/dec_math_5.f90 index a7ff3275236..7bcf07fce67 100644 --- a/gcc/testsuite/gfortran.dg/dec_math_5.f90 +++ b/gcc/testsuite/gfortran.dg/dec_math_5.f90 @@ -102,26 +102,26 @@ program p if (abs(c1 - 0.5) > e3) stop 39 if (abs(d1 - 0.5) > e4) stop 40 - a1 = acospi(0.5) - b1 = acospi(-0.5) + a1 = 0.5; a1 = acospi(a1) + b1 = -0.5; b1 = acospi(b1) c1 = acospi(0.5) d1 = acospi(-0.5) - if (abs(a1 - 1.0 / 3) > e1) stop 41 - if (abs(b1 - 2.0 / 3) > e2) stop 42 + if (abs(a1 - 1._4 / 3) > e1) stop 41 + if (abs(b1 - 2._8 / 3) > e2) stop 42 if (abs(c1 - 1.0 / 3) > e3) stop 43 if (abs(d1 - 2.0 / 3) > e4) stop 44 - a1 = asinpi(0.5) - b1 = asinpi(-0.5) + a1 = 0.5; a1 = asinpi(a1) + b1 = -0.5; b1 = asinpi(b1) c1 = asinpi(0.5) d1 = asinpi(-0.5) - if (abs(a1 - 1.0 / 6) > e1) stop 45 - if (abs(b1 + 1.0 / 6) > e2) stop 46 + if (abs(a1 - 1._4 / 6) > e1) stop 45 + if (abs(b1 + 1._8 / 6) > e2) stop 46 if (abs(c1 - 1.0 / 6) > e3) stop 47 if (abs(d1 + 1.0 / 6) > e4) stop 48 - a1 = atanpi(1.0) - b1 = atanpi(-1.0) + a1 = 1.0; a1 = atanpi(a1) + b1 = -1.0; b1 = atanpi(b1) c1 = atanpi(1.0) d1 = atanpi(-1.0) if (abs(a1 - 0.25) > e1) stop 49 @@ -129,8 +129,8 @@ program p if (abs(c1 - 0.25) > e3) stop 51 if (abs(d1 + 0.25) > e4) stop 52 - a1 = atan2pi(1.0, 1.0) - b1 = atan2pi(1.0, 1.0) + a1 = 1.0; a1 = atan2pi(a1, a1) + b1 = 1.0; b1 = atan2pi(b1, b1) c1 = atan2pi(1.0, 1.0) d1 = atan2pi(1.0, 1.0) if (abs(a1 - 0.25) > e1) stop 53 @@ -138,8 +138,8 @@ program p if (abs(c1 - 0.25) > e3) stop 55 if (abs(d1 - 0.25) > e4) stop 56 - a1 = cospi(1._4 / 3) - b1 = cospi(-1._8 / 3) + a1 = 1._4 / 3; a1 = cospi(a1) + b1 = -1._8 / 3; b1 = cospi(b1) c1 = cospi(4._ep / 3) d1 = cospi(-4._16 / 3) if (abs(a1 - 0.5) > e1) stop 57 @@ -147,8 +147,8 @@ program p if (abs(c1 + 0.5) > e3) stop 59 if (abs(d1 + 0.5) > e4) stop 60 - a1 = sinpi(1._4 / 6) - b1 = sinpi(-1._8 / 6) + a1 = 1._4 / 6; a1 = sinpi(a1) + b1 = -1._8 / 6; b1 = sinpi(b1) c1 = sinpi(5._ep / 6) d1 = sinpi(-7._16 / 6) if (abs(a1 - 0.5) > e1) stop 61 @@ -156,8 +156,8 @@ program p if (abs(c1 - 0.5) > e3) stop 63 if (abs(d1 - 0.5) > e4) stop 64 - a1 = tanpi(0.25) - b1 = tanpi(-0.25) + a1 = 0.25; a1 = tanpi(a1) + b1 = -0.25; b1 = tanpi(b1) c1 = tanpi(1.25) d1 = tanpi(-1.25) if (abs(a1 - 1.0) > e1) stop 65 diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am index 4f3b3033224..82cf51b6bcc 100644 --- a/libgfortran/Makefile.am +++ b/libgfortran/Makefile.am @@ -165,6 +165,7 @@ if !LIBGFOR_MINIMAL gfor_helper_src+= \ intrinsics/access.c \ +intrinsics/c23_functions.c \ intrinsics/c99_functions.c \ intrinsics/chdir.c \ intrinsics/chmod.c \ @@ -1110,6 +1111,9 @@ kinds.inc: kinds.h $(srcdir)/kinds-override.h c99_protos.inc: $(srcdir)/c99_protos.h grep '^#' < $(srcdir)/c99_protos.h > $@ +c23_protos.inc: $(srcdir)/c23_protos.h + grep '^#' < $(srcdir)/c23_protos.h > $@ + selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh $(SHELL) $(srcdir)/mk-sik-inc.sh '@LIBGOMP_CHECKED_INT_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in index dd88f8893b7..7dc48e2836e 100644 --- a/libgfortran/Makefile.in +++ b/libgfortran/Makefile.in @@ -114,6 +114,7 @@ target_triplet = @target@ @LIBGFOR_MINIMAL_FALSE@am__append_4 = \ @LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \ +@LIBGFOR_MINIMAL_FALSE@intrinsics/c23_functions.c \ @LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \ @LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \ @LIBGFOR_MINIMAL_FALSE@intrinsics/chmod.c \ @@ -549,6 +550,7 @@ am__objects_7 = generated/all_l1.lo generated/all_l2.lo \ @LIBGFOR_MINIMAL_FALSE@ io/fbuf.lo io/async.lo am__objects_9 = io/size_from_kind.lo $(am__objects_8) @LIBGFOR_MINIMAL_FALSE@am__objects_10 = intrinsics/access.lo \ +@LIBGFOR_MINIMAL_FALSE@ intrinsics/c23_functions.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/c99_functions.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/chdir.lo intrinsics/chmod.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/clock.lo \ @@ -3347,6 +3349,8 @@ runtime/in_unpack_class.lo: runtime/$(am__dirstamp) \ runtime/$(DEPDIR)/$(am__dirstamp) intrinsics/access.lo: intrinsics/$(am__dirstamp) \ intrinsics/$(DEPDIR)/$(am__dirstamp) +intrinsics/c23_functions.lo: intrinsics/$(am__dirstamp) \ + intrinsics/$(DEPDIR)/$(am__dirstamp) intrinsics/c99_functions.lo: intrinsics/$(am__dirstamp) \ intrinsics/$(DEPDIR)/$(am__dirstamp) intrinsics/chdir.lo: intrinsics/$(am__dirstamp) \ @@ -4412,6 +4416,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/access.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/args.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/associated.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/c23_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/c99_functions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/chdir.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@intrinsics/$(DEPDIR)/chmod.Plo@am__quote@ @@ -4899,6 +4904,9 @@ kinds.inc: kinds.h $(srcdir)/kinds-override.h c99_protos.inc: $(srcdir)/c99_protos.h grep '^#' < $(srcdir)/c99_protos.h > $@ +c23_protos.inc: $(srcdir)/c23_protos.h + grep '^#' < $(srcdir)/c23_protos.h > $@ + selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh $(SHELL) $(srcdir)/mk-sik-inc.sh '@LIBGOMP_CHECKED_INT_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ diff --git a/libgfortran/c23_protos.h b/libgfortran/c23_protos.h new file mode 100644 index 00000000000..18f85583196 --- /dev/null +++ b/libgfortran/c23_protos.h @@ -0,0 +1,133 @@ +/* Declarations of various C23 functions + Copyright (C) 2025 Free Software Foundation, Inc. + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +Libgfortran 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifndef C23_PROTOS_H +#define C23_PROTOS_H 1 + +#ifndef HAVE_ACOSPI +#define HAVE_ACOSPI 1 +extern double acospi (double); +#endif + +#ifndef HAVE_ACOSPIF +#define HAVE_ACOSPIF 1 +extern float acospif (float); +#endif + +#ifndef HAVE_ACOSPIL +#define HAVE_ACOSPIL 1 +extern long double acospil (long double); +#endif + +#ifndef HAVE_ASINPI +#define HAVE_ASINPI 1 +extern double asinpi (double); +#endif + +#ifndef HAVE_ASINPIF +#define HAVE_ASINPIF 1 +extern float asinpif (float); +#endif + +#ifndef HAVE_ASINPIL +#define HAVE_ASINPIL 1 +extern long double asinpil (long double); +#endif + +#ifndef HAVE_ATAN2PI +#define HAVE_ATAN2PI 1 +extern double atan2pi (double, double); +#endif + +#ifndef HAVE_ATAN2PIF +#define HAVE_ATAN2PIF 1 +extern float atan2pif (float, float); +#endif + +#ifndef HAVE_ATAN2PIL +#define HAVE_ATAN2PIL 1 +extern long double atan2pil (long double, long double); +#endif + +#ifndef HAVE_ATANPI +#define HAVE_ATANPI 1 +extern double atanpi (double); +#endif + +#ifndef HAVE_ATANPIF +#define HAVE_ATANPIF 1 +extern float atanpif (float); +#endif + +#ifndef HAVE_ATANPIL +#define HAVE_ATANPIL 1 +extern long double atanpil (long double); +#endif + +#ifndef HAVE_COSPI +#define HAVE_COSPI 1 +extern double cospi (double); +#endif + +#ifndef HAVE_COSPIF +#define HAVE_COSPIF 1 +extern float cospif (float); +#endif + +#ifndef HAVE_COSPIL +#define HAVE_COSPIL 1 +extern long double cospil (long double); +#endif + +#ifndef HAVE_SINPI +#define HAVE_SINPI 1 +extern double sinpi (double); +#endif + +#ifndef HAVE_SINPIF +#define HAVE_SINPIF 1 +extern float sinpif (float); +#endif + +#ifndef HAVE_SINPIL +#define HAVE_SINPIL 1 +extern long double sinpil (long double); +#endif + +#ifndef HAVE_TANPI +#define HAVE_TANPI 1 +extern double tanpi (double); +#endif + +#ifndef HAVE_TANPIF +#define HAVE_TANPIF 1 +extern float tanpif (float); +#endif + +#ifndef HAVE_TANPIL +#define HAVE_TANPIL 1 +extern long double tanpil (long double); +#endif + +#endif /* C23_PROTOS_H */ diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in index da2c44c1af1..7a77544d791 100644 --- a/libgfortran/config.h.in +++ b/libgfortran/config.h.in @@ -30,6 +30,15 @@ /* Define to 1 if you have the `acosl' function. */ #undef HAVE_ACOSL +/* Define to 1 if you have the `acospi' function. */ +#undef HAVE_ACOSPI + +/* Define to 1 if you have the `acospif' function. */ +#undef HAVE_ACOSPIF + +/* Define to 1 if you have the `acospil' function. */ +#undef HAVE_ACOSPIL + /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM @@ -57,6 +66,15 @@ /* Define to 1 if you have the `asinl' function. */ #undef HAVE_ASINL +/* Define to 1 if you have the `asinpi' function. */ +#undef HAVE_ASINPI + +/* Define to 1 if you have the `asinpif' function. */ +#undef HAVE_ASINPIF + +/* Define to 1 if you have the `asinpil' function. */ +#undef HAVE_ASINPIL + /* Define to 1 if you have the `atan' function. */ #undef HAVE_ATAN @@ -72,6 +90,15 @@ /* Define to 1 if you have the `atan2l' function. */ #undef HAVE_ATAN2L +/* Define to 1 if you have the `atan2pi' function. */ +#undef HAVE_ATAN2PI + +/* Define to 1 if you have the `atan2pif' function. */ +#undef HAVE_ATAN2PIF + +/* Define to 1 if you have the `atan2pil' function. */ +#undef HAVE_ATAN2PIL + /* Define to 1 if you have the `atanf' function. */ #undef HAVE_ATANF @@ -93,6 +120,15 @@ /* Define to 1 if you have the `atanl' function. */ #undef HAVE_ATANL +/* Define to 1 if you have the `atanpi' function. */ +#undef HAVE_ATANPI + +/* Define to 1 if you have the `atanpif' function. */ +#undef HAVE_ATANPIF + +/* Define to 1 if you have the `atanpil' function. */ +#undef HAVE_ATANPIL + /* Define to 1 if the target supports __atomic_fetch_add */ #undef HAVE_ATOMIC_FETCH_ADD @@ -333,6 +369,15 @@ /* Define to 1 if you have the `cosl' function. */ #undef HAVE_COSL +/* Define to 1 if you have the `cospi' function. */ +#undef HAVE_COSPI + +/* Define to 1 if you have the `cospif' function. */ +#undef HAVE_COSPIF + +/* Define to 1 if you have the `cospil' function. */ +#undef HAVE_COSPIL + /* Define to 1 if you have the `cpow' function. */ #undef HAVE_CPOW @@ -873,6 +918,15 @@ /* Define to 1 if you have the `sinl' function. */ #undef HAVE_SINL +/* Define to 1 if you have the `sinpi' function. */ +#undef HAVE_SINPI + +/* Define to 1 if you have the `sinpif' function. */ +#undef HAVE_SINPIF + +/* Define to 1 if you have the `sinpil' function. */ +#undef HAVE_SINPIL + /* Define to 1 if you have the `sleep' function. */ #undef HAVE_SLEEP @@ -993,6 +1047,15 @@ /* Define to 1 if you have the `tanl' function. */ #undef HAVE_TANL +/* Define to 1 if you have the `tanpi' function. */ +#undef HAVE_TANPI + +/* Define to 1 if you have the `tanpif' function. */ +#undef HAVE_TANPIF + +/* Define to 1 if you have the `tanpil' function. */ +#undef HAVE_TANPIL + /* Define to 1 if you have the `tgamma' function. */ #undef HAVE_TGAMMA diff --git a/libgfortran/configure b/libgfortran/configure index 9898a94a372..971f1e9df5e 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -16413,7 +16413,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -16459,7 +16459,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -16483,7 +16483,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -16528,7 +16528,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -16552,7 +16552,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -25994,6 +25994,1016 @@ _ACEOF fi +# Check for half-cycle trigonometric functions + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acospi" >&5 +$as_echo_n "checking for acospi... " >&6; } +if ${gcc_cv_math_func_acospi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())acospi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_acospi=yes +else + gcc_cv_math_func_acospi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_acospi" >&5 +$as_echo "$gcc_cv_math_func_acospi" >&6; } + if test $gcc_cv_math_func_acospi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ACOSPI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acospif" >&5 +$as_echo_n "checking for acospif... " >&6; } +if ${gcc_cv_math_func_acospif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())acospif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_acospif=yes +else + gcc_cv_math_func_acospif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_acospif" >&5 +$as_echo "$gcc_cv_math_func_acospif" >&6; } + if test $gcc_cv_math_func_acospif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ACOSPIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acospil" >&5 +$as_echo_n "checking for acospil... " >&6; } +if ${gcc_cv_math_func_acospil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())acospil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_acospil=yes +else + gcc_cv_math_func_acospil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_acospil" >&5 +$as_echo "$gcc_cv_math_func_acospil" >&6; } + if test $gcc_cv_math_func_acospil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ACOSPIL 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for asinpi" >&5 +$as_echo_n "checking for asinpi... " >&6; } +if ${gcc_cv_math_func_asinpi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())asinpi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_asinpi=yes +else + gcc_cv_math_func_asinpi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_asinpi" >&5 +$as_echo "$gcc_cv_math_func_asinpi" >&6; } + if test $gcc_cv_math_func_asinpi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ASINPI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for asinpif" >&5 +$as_echo_n "checking for asinpif... " >&6; } +if ${gcc_cv_math_func_asinpif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())asinpif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_asinpif=yes +else + gcc_cv_math_func_asinpif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_asinpif" >&5 +$as_echo "$gcc_cv_math_func_asinpif" >&6; } + if test $gcc_cv_math_func_asinpif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ASINPIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for asinpil" >&5 +$as_echo_n "checking for asinpil... " >&6; } +if ${gcc_cv_math_func_asinpil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())asinpil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_asinpil=yes +else + gcc_cv_math_func_asinpil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_asinpil" >&5 +$as_echo "$gcc_cv_math_func_asinpil" >&6; } + if test $gcc_cv_math_func_asinpil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ASINPIL 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atanpi" >&5 +$as_echo_n "checking for atanpi... " >&6; } +if ${gcc_cv_math_func_atanpi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())atanpi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_atanpi=yes +else + gcc_cv_math_func_atanpi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_atanpi" >&5 +$as_echo "$gcc_cv_math_func_atanpi" >&6; } + if test $gcc_cv_math_func_atanpi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ATANPI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atanpif" >&5 +$as_echo_n "checking for atanpif... " >&6; } +if ${gcc_cv_math_func_atanpif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())atanpif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_atanpif=yes +else + gcc_cv_math_func_atanpif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_atanpif" >&5 +$as_echo "$gcc_cv_math_func_atanpif" >&6; } + if test $gcc_cv_math_func_atanpif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ATANPIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atanpil" >&5 +$as_echo_n "checking for atanpil... " >&6; } +if ${gcc_cv_math_func_atanpil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())atanpil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_atanpil=yes +else + gcc_cv_math_func_atanpil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_atanpil" >&5 +$as_echo "$gcc_cv_math_func_atanpil" >&6; } + if test $gcc_cv_math_func_atanpil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ATANPIL 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atan2pi" >&5 +$as_echo_n "checking for atan2pi... " >&6; } +if ${gcc_cv_math_func_atan2pi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())atan2pi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_atan2pi=yes +else + gcc_cv_math_func_atan2pi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_atan2pi" >&5 +$as_echo "$gcc_cv_math_func_atan2pi" >&6; } + if test $gcc_cv_math_func_atan2pi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ATAN2PI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atan2pif" >&5 +$as_echo_n "checking for atan2pif... " >&6; } +if ${gcc_cv_math_func_atan2pif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())atan2pif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_atan2pif=yes +else + gcc_cv_math_func_atan2pif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_atan2pif" >&5 +$as_echo "$gcc_cv_math_func_atan2pif" >&6; } + if test $gcc_cv_math_func_atan2pif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ATAN2PIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atan2pil" >&5 +$as_echo_n "checking for atan2pil... " >&6; } +if ${gcc_cv_math_func_atan2pil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())atan2pil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_atan2pil=yes +else + gcc_cv_math_func_atan2pil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_atan2pil" >&5 +$as_echo "$gcc_cv_math_func_atan2pil" >&6; } + if test $gcc_cv_math_func_atan2pil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ATAN2PIL 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cospi" >&5 +$as_echo_n "checking for cospi... " >&6; } +if ${gcc_cv_math_func_cospi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())cospi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_cospi=yes +else + gcc_cv_math_func_cospi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_cospi" >&5 +$as_echo "$gcc_cv_math_func_cospi" >&6; } + if test $gcc_cv_math_func_cospi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_COSPI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cospif" >&5 +$as_echo_n "checking for cospif... " >&6; } +if ${gcc_cv_math_func_cospif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())cospif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_cospif=yes +else + gcc_cv_math_func_cospif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_cospif" >&5 +$as_echo "$gcc_cv_math_func_cospif" >&6; } + if test $gcc_cv_math_func_cospif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_COSPIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cospil" >&5 +$as_echo_n "checking for cospil... " >&6; } +if ${gcc_cv_math_func_cospil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())cospil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_cospil=yes +else + gcc_cv_math_func_cospil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_cospil" >&5 +$as_echo "$gcc_cv_math_func_cospil" >&6; } + if test $gcc_cv_math_func_cospil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_COSPIL 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sinpi" >&5 +$as_echo_n "checking for sinpi... " >&6; } +if ${gcc_cv_math_func_sinpi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())sinpi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_sinpi=yes +else + gcc_cv_math_func_sinpi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_sinpi" >&5 +$as_echo "$gcc_cv_math_func_sinpi" >&6; } + if test $gcc_cv_math_func_sinpi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SINPI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sinpif" >&5 +$as_echo_n "checking for sinpif... " >&6; } +if ${gcc_cv_math_func_sinpif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())sinpif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_sinpif=yes +else + gcc_cv_math_func_sinpif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_sinpif" >&5 +$as_echo "$gcc_cv_math_func_sinpif" >&6; } + if test $gcc_cv_math_func_sinpif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SINPIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sinpil" >&5 +$as_echo_n "checking for sinpil... " >&6; } +if ${gcc_cv_math_func_sinpil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())sinpil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_sinpil=yes +else + gcc_cv_math_func_sinpil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_sinpil" >&5 +$as_echo "$gcc_cv_math_func_sinpil" >&6; } + if test $gcc_cv_math_func_sinpil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SINPIL 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tanpi" >&5 +$as_echo_n "checking for tanpi... " >&6; } +if ${gcc_cv_math_func_tanpi+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())tanpi; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_tanpi=yes +else + gcc_cv_math_func_tanpi=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_tanpi" >&5 +$as_echo "$gcc_cv_math_func_tanpi" >&6; } + if test $gcc_cv_math_func_tanpi = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_TANPI 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tanpif" >&5 +$as_echo_n "checking for tanpif... " >&6; } +if ${gcc_cv_math_func_tanpif+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())tanpif; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_tanpif=yes +else + gcc_cv_math_func_tanpif=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_tanpif" >&5 +$as_echo "$gcc_cv_math_func_tanpif" >&6; } + if test $gcc_cv_math_func_tanpif = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_TANPIF 1 +_ACEOF + + fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tanpil" >&5 +$as_echo_n "checking for tanpil... " >&6; } +if ${gcc_cv_math_func_tanpil+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_COMPLEX_H +#include <complex.h> +#endif +#ifdef HAVE_MATH_H +#include <math.h> +#endif + +int (*ptr)() = (int (*)())tanpil; + +int +main () +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gcc_cv_math_func_tanpil=yes +else + gcc_cv_math_func_tanpil=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func_tanpil" >&5 +$as_echo "$gcc_cv_math_func_tanpil" >&6; } + if test $gcc_cv_math_func_tanpil = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_TANPIL 1 +_ACEOF + + fi + + # For POWER, check the ieee128 math functions if test "x$have_real_17" = "xyes"; then diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index cca1ea0ea97..0ddbb325a26 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -528,6 +528,29 @@ GCC_CHECK_MATH_FUNC([catanhf]) GCC_CHECK_MATH_FUNC([catanhl]) GCC_CHECK_MATH_FUNC([catanl]) +# Check for half-cycle trigonometric functions +GCC_CHECK_MATH_FUNC([acospi]) +GCC_CHECK_MATH_FUNC([acospif]) +GCC_CHECK_MATH_FUNC([acospil]) +GCC_CHECK_MATH_FUNC([asinpi]) +GCC_CHECK_MATH_FUNC([asinpif]) +GCC_CHECK_MATH_FUNC([asinpil]) +GCC_CHECK_MATH_FUNC([atanpi]) +GCC_CHECK_MATH_FUNC([atanpif]) +GCC_CHECK_MATH_FUNC([atanpil]) +GCC_CHECK_MATH_FUNC([atan2pi]) +GCC_CHECK_MATH_FUNC([atan2pif]) +GCC_CHECK_MATH_FUNC([atan2pil]) +GCC_CHECK_MATH_FUNC([cospi]) +GCC_CHECK_MATH_FUNC([cospif]) +GCC_CHECK_MATH_FUNC([cospil]) +GCC_CHECK_MATH_FUNC([sinpi]) +GCC_CHECK_MATH_FUNC([sinpif]) +GCC_CHECK_MATH_FUNC([sinpil]) +GCC_CHECK_MATH_FUNC([tanpi]) +GCC_CHECK_MATH_FUNC([tanpif]) +GCC_CHECK_MATH_FUNC([tanpil]) + # For POWER, check the ieee128 math functions if test "x$have_real_17" = "xyes"; then diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map index 742dddfe559..71471f2e68f 100644 --- a/libgfortran/gfortran.map +++ b/libgfortran/gfortran.map @@ -2032,3 +2032,28 @@ GFORTRAN_15.2 { _gfortran_mmaxloc1_16_m16; _gfortran_smaxloc1_16_m16; } GFORTRAN_15; + +GFORTRAN_C23_15 { + global: + acospi; + acospif; + acospil; + asinpi; + asinpif; + asinpil; + atanpi; + atanpif; + atanpil; + atan2pi; + atan2pif; + atan2pil; + cospi; + cospif; + cospil; + sinpi; + sinpif; + sinpil; + tanpi; + tanpif; + tanpil; +}; diff --git a/libgfortran/intrinsics/c23_functions.c b/libgfortran/intrinsics/c23_functions.c new file mode 100644 index 00000000000..26707a876a5 --- /dev/null +++ b/libgfortran/intrinsics/c23_functions.c @@ -0,0 +1,308 @@ +/* Implementation of various C23 functions + Copyright (C) 2025 Free Software Foundation, Inc. + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +Libgfortran 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" + +#define C23_PROTOS_H WE_DONT_WANT_PROTOS_NOW +#include "libgfortran.h" + +#include <math.h> + +static const float invpihi_f = 3.18237305e-01f; /* 0x3ea2f000 */ +static const float invpilo_f = 7.25814971e-05f; /* 0x389836e5 */ +static const float pihi_f = 3.14062500e+00f; /* 0x40490000 */ +static const float pilo_f = 9.67653585e-04f; /* 0x3a7daa22 */ +static const double invpihi_d + = 3.1830988079309464e-01; /* 0x3fd45f30 0x68000000 */ +static const double invpilo_d + = 5.3906960365280022e-09; /* 0x3e372722 0x0a94fe14 */ +static const double pihi_d = 3.1415926218032837e+00; /* 0x400921fb 0x50000000 */ +static const double pilo_d = 3.1786509547056392e-08; /* 0x3e6110b4 0x611a6263 */ + +#ifndef HAVE_ACOSPI +#define HAVE_ACOSPI 1 +double acospi (double); + +double +acospi (double x) +{ + double t; + + t = acos (x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ACOSPIF +#define HAVE_ACOSPIF 1 +float acospif (float); + +float +acospif (float x) +{ + float t; + + t = acosf (x); + return t * invpihi_f + t * invpilo_f; +} +#endif + +#ifndef HAVE_ACOSPIL +#define HAVE_ACOSPIL 1 +long double acospil (long double); + +long double +acospil (long double x) +{ + long double t; + + t = acosl (x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ASINPI +#define HAVE_ASINPI 1 +double asinpi (double); + +double +asinpi (double x) +{ + double t; + + t = asin (x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ASINPIF +#define HAVE_ASINPIF 1 +float asinpif (float); + +float +asinpif (float x) +{ + float t; + + t = asinf (x); + return t * invpihi_f + t * invpilo_f; +} +#endif + +#ifndef HAVE_ASINPIL +#define HAVE_ASINPIL 1 +long double asinpil (long double); + +long double +asinpil (long double x) +{ + long double t; + + t = asinl (x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ATAN2PI +#define HAVE_ATAN2PI 1 +double atan2pi (double, double); + +double +atan2pi (double y, double x) +{ + double t; + + t = atan2 (y, x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ATAN2PIF +#define HAVE_ATAN2PIF 1 +float atan2pif (float, float); + +float +atan2pif (float y, float x) +{ + float t; + + t = atan2f (y, x); + return t * invpihi_f + t * invpilo_f; +} +#endif + +#ifndef HAVE_ATAN2PIL +#define HAVE_ATAN2PIL 1 +long double atan2pil (long double, long double); + +long double +atan2pil (long double y, long double x) +{ + long double t; + + t = atan2l (y, x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ATANPI +#define HAVE_ATANPI 1 +double atanpi (double); + +double +atanpi (double x) +{ + double t; + + t = atan (x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_ATANPIF +#define HAVE_ATANPIF 1 +float atanpif (float); + +float +atanpif (float x) +{ + float t; + + t = atanf (x); + return t * invpihi_f + t * invpilo_f; +} +#endif + +#ifndef HAVE_ATANPIL +#define HAVE_ATANPIL 1 +long double atanpil (long double); + +long double +atanpil (long double x) +{ + long double t; + + t = atanl (x); + return t * invpihi_d + t * invpilo_d; +} +#endif + +#ifndef HAVE_COSPI +#define HAVE_COSPI 1 +double cospi (double); + +double +cospi (double x) +{ + return cos (x * pihi_d + x * pilo_d); +} +#endif + +#ifndef HAVE_COSPIF +#define HAVE_COSPIF 1 +float cospif (float); + +float +cospif (float x) +{ + return cosf (x * pihi_f + x * pilo_f); +} +#endif + +#ifndef HAVE_COSPIL +#define HAVE_COSPIL 1 +long double cospil (long double); + +long double +cospil (long double x) +{ + return cosl (x * pihi_d + x * pilo_d); +} +#endif + +#ifndef HAVE_SINPI +#define HAVE_SINPI 1 +double sinpi (double); + +double +sinpi (double x) +{ + return sin (x * pihi_d + x * pilo_d); +} +#endif + +#ifndef HAVE_SINPIF +#define HAVE_SINPIF 1 +float sinpif (float); + +float +sinpif (float x) +{ + return sinf (x * pihi_f + x * pilo_f); +} +#endif + +#ifndef HAVE_SINPIL +#define HAVE_SINPIL 1 +long double sinpil (long double); + +long double +sinpil (long double x) +{ + return sinl (x * pihi_d + x * pilo_d); +} +#endif + +#ifndef HAVE_TANPI +#define HAVE_TANPI 1 +double tanpi (double); + +double +tanpi (double x) +{ + return tan (x * pihi_d + x * pilo_d); +} +#endif + +#ifndef HAVE_TANPIF +#define HAVE_TANPIF 1 +float tanpif (float); + +float +tanpif (float x) +{ + return tanf (x * pihi_f + x * pilo_f); +} +#endif + +#ifndef HAVE_TANPIL +#define HAVE_TANPIL 1 +long double tanpil (long double); + +long double +tanpil (long double x) +{ + return tanl (x * pihi_d + x * pilo_d); +} +#endif diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 25c3cb6641c..105a46883c3 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -78,6 +78,7 @@ extern long double __strtold (const char *, char **); #include "../gcc/fortran/libgfortran.h" #include "c99_protos.h" +#include "c23_protos.h" #if HAVE_IEEEFP_H #include <ieeefp.h> -- 2.43.0