Implement 64-bit double functions.
gcc/ PR target/92055 * config.gcc (tm_defines) [target=avr]: Support --with-libf7, --with-double-comparison. * doc/install.texi: Document them. * config/avr/avr-c.c (avr_cpu_cpp_builtins) <WITH_LIBF7_LIBGCC, WITH_LIBF7_MATH, WITH_LIBF7_MATH_SYMBOLS> <WITH_DOUBLE_COMPARISON>: New built-in defines. * doc/invoke.texi (AVR Built-in Macros): Document them. * config/avr/avr-protos.h (avr_float_lib_compare_returns_bool): New. * config/avr/avr.c (avr_float_lib_compare_returns_bool): New function. * config/avr/avr.h (FLOAT_LIB_COMPARE_RETURNS_BOOL): New macro. libgcc/ PR target/92055 * config.host (tmake_file) [target=avr]: Add t-libf7, t-libf7-math, t-libf7-math-symbols as specified by --with-libf7=. * config/avr/t-avrlibc: Don't copy libgcc.a if there are modules depending on sizeof (double) or sizeof (long double). * config/avr/libf7: New folder. libgcc/config/avr/libf7/ PR target/92055 * t-libf7: New file. * t-libf7-math: New file. * t-libf7-math-symbols: New file. * libf7-common.mk: New file. * libf7-asm-object.mk: New file. * libf7-c-object.mk: New file. * asm-defs.h: New file. * libf7.h: New file. * libf7.c: New file. * libf7-asm.sx: New file. * libf7-array.def: New file. * libf7-const.def: New file. * libf7-constdef.h: New file. * f7renames.sh: New script. * f7wraps.sh: New script. * f7-renames.h: New generated file. * f7-wraps.h: New generated file. From-SVN: r279994
This commit is contained in:
parent
d5bc18085c
commit
f30dd60766
29 changed files with 7141 additions and 10 deletions
|
@ -1,3 +1,19 @@
|
|||
2020-01-08 Georg-Johann Lay <avr@gjlay.de>
|
||||
|
||||
Implement 64-bit double functions.
|
||||
|
||||
PR target/92055
|
||||
* config.gcc (tm_defines) [target=avr]: Support --with-libf7,
|
||||
--with-double-comparison.
|
||||
* doc/install.texi: Document them.
|
||||
* config/avr/avr-c.c (avr_cpu_cpp_builtins)
|
||||
<WITH_LIBF7_LIBGCC, WITH_LIBF7_MATH, WITH_LIBF7_MATH_SYMBOLS>
|
||||
<WITH_DOUBLE_COMPARISON>: New built-in defines.
|
||||
* doc/invoke.texi (AVR Built-in Macros): Document them.
|
||||
* config/avr/avr-protos.h (avr_float_lib_compare_returns_bool): New.
|
||||
* config/avr/avr.c (avr_float_lib_compare_returns_bool): New function.
|
||||
* config/avr/avr.h (FLOAT_LIB_COMPARE_RETURNS_BOOL): New macro.
|
||||
|
||||
2020-01-08 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
PR target/93188
|
||||
|
|
|
@ -1336,8 +1336,48 @@ avr-*-*)
|
|||
tm_file="${tm_file} ${cpu_type}/avrlibc.h"
|
||||
tm_defines="${tm_defines} WITH_AVRLIBC"
|
||||
fi
|
||||
# Work out avr_double_comparison which is 2 or 3 and is used in
|
||||
# target hook FLOAT_LIB_COMPARE_RETURNS_BOOL to determine whether
|
||||
# DFmode comparisons return 3-state or 2-state results.
|
||||
case y${with_double_comparison} in
|
||||
y | ytristate)
|
||||
avr_double_comparison=3
|
||||
;;
|
||||
ybool | ylibf7)
|
||||
avr_double_comparison=2
|
||||
;;
|
||||
*)
|
||||
echo "Error: --with-double-comparison= can only be used with: 'tristate', 'bool', 'libf7'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case "y${with_libf7}" in
|
||||
yno)
|
||||
# avr_double_comparison as set above.
|
||||
;;
|
||||
ylibgcc)
|
||||
avr_double_comparison=2
|
||||
tm_defines="${tm_defines} WITH_LIBF7_LIBGCC"
|
||||
;;
|
||||
y | yyes | ymath-symbols)
|
||||
avr_double_comparison=2
|
||||
tm_defines="${tm_defines} WITH_LIBF7_LIBGCC"
|
||||
tm_defines="${tm_defines} WITH_LIBF7_MATH"
|
||||
tm_defines="${tm_defines} WITH_LIBF7_MATH_SYMBOLS"
|
||||
;;
|
||||
ymath)
|
||||
avr_double_comparison=2
|
||||
tm_defines="${tm_defines} WITH_LIBF7_LIBGCC"
|
||||
tm_defines="${tm_defines} WITH_LIBF7_MATH"
|
||||
;;
|
||||
*)
|
||||
echo "Error: --with-libf7=${with_libf7} but can only be used with: 'libgcc', 'math', 'math-symbols', 'yes', 'no'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
tm_defines="${tm_defines} WITH_DOUBLE_COMPARISON=${avr_double_comparison}"
|
||||
case y${with_double} in
|
||||
y | y32)
|
||||
y32)
|
||||
avr_double=32
|
||||
tm_defines="${tm_defines} HAVE_DOUBLE32"
|
||||
;;
|
||||
|
@ -1352,7 +1392,7 @@ avr-*-*)
|
|||
tm_defines="${tm_defines} HAVE_DOUBLE64"
|
||||
tm_defines="${tm_defines} HAVE_DOUBLE_MULTILIB"
|
||||
;;
|
||||
y32,64)
|
||||
y | y32,64)
|
||||
avr_double=32
|
||||
avr_double_multilib=1
|
||||
tm_defines="${tm_defines} HAVE_DOUBLE32"
|
||||
|
@ -1365,7 +1405,7 @@ avr-*-*)
|
|||
;;
|
||||
esac
|
||||
case y${with_long_double} in
|
||||
y | y32)
|
||||
y32)
|
||||
avr_long_double=32
|
||||
tm_defines="${tm_defines} HAVE_LONG_DOUBLE32"
|
||||
;;
|
||||
|
@ -1373,7 +1413,7 @@ avr-*-*)
|
|||
avr_long_double=64
|
||||
tm_defines="${tm_defines} HAVE_LONG_DOUBLE64"
|
||||
;;
|
||||
y64,32)
|
||||
y | y64,32)
|
||||
avr_long_double=64
|
||||
avr_long_double_multilib=1
|
||||
tm_defines="${tm_defines} HAVE_LONG_DOUBLE32"
|
||||
|
|
|
@ -390,6 +390,20 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
|
|||
cpp_define (pfile, "__WITH_AVRLIBC__");
|
||||
#endif /* WITH_AVRLIBC */
|
||||
|
||||
// From configure --with-libf7={|libgcc|math|math-symbols|yes|no}
|
||||
|
||||
#ifdef WITH_LIBF7_LIBGCC
|
||||
cpp_define (pfile, "__WITH_LIBF7_LIBGCC__");
|
||||
#endif /* WITH_LIBF7_LIBGCC */
|
||||
|
||||
#ifdef WITH_LIBF7_MATH
|
||||
cpp_define (pfile, "__WITH_LIBF7_MATH__");
|
||||
#endif /* WITH_LIBF7_MATH */
|
||||
|
||||
#ifdef WITH_LIBF7_MATH_SYMBOLS
|
||||
cpp_define (pfile, "__WITH_LIBF7_MATH_SYMBOLS__");
|
||||
#endif /* WITH_LIBF7_MATH_SYMBOLS */
|
||||
|
||||
// From configure --with-double={|32|32,64|64,32|64}
|
||||
|
||||
#ifdef HAVE_DOUBLE_MULTILIB
|
||||
|
@ -438,7 +452,23 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
|
|||
#error "align this with config.gcc"
|
||||
#endif
|
||||
|
||||
|
||||
// From configure --with-double-comparison={2|3} --with-libf7.
|
||||
|
||||
#if defined (WITH_DOUBLE_COMPARISON)
|
||||
#if WITH_DOUBLE_COMPARISON == 2 || WITH_DOUBLE_COMPARISON == 3
|
||||
/* The number of states a DFmode comparison libcall might take and
|
||||
reflects what avr.c:FLOAT_LIB_COMPARE_RETURNS_BOOL returns for
|
||||
DFmode. GCC's default is 3-state, but some libraries like LibF7
|
||||
implement true / false (2-state). */
|
||||
cpp_define_formatted (pfile, "__WITH_DOUBLE_COMPARISON__=%d",
|
||||
WITH_DOUBLE_COMPARISON);
|
||||
#else
|
||||
#error "align this with config.gcc"
|
||||
#endif
|
||||
#else
|
||||
#error "align this with config.gcc"
|
||||
#endif
|
||||
|
||||
/* Define builtin macros so that the user can easily query whether
|
||||
non-generic address spaces (and which) are supported or not.
|
||||
This is only supported for C. For C++, a language extension is needed
|
||||
|
|
|
@ -128,6 +128,8 @@ extern bool avr_xload_libgcc_p (machine_mode);
|
|||
extern rtx avr_eval_addr_attrib (rtx x);
|
||||
extern bool avr_casei_sequence_check_operands (rtx *xop);
|
||||
|
||||
extern bool avr_float_lib_compare_returns_bool (machine_mode, enum rtx_code);
|
||||
|
||||
static inline unsigned
|
||||
regmask (machine_mode mode, unsigned regno)
|
||||
{
|
||||
|
|
|
@ -14575,6 +14575,23 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
|
|||
return NULL_TREE;
|
||||
}
|
||||
|
||||
|
||||
/* Worker function for `FLOAT_LIB_COMPARE_RETURNS_BOOL'. */
|
||||
|
||||
bool
|
||||
avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code)
|
||||
{
|
||||
if (mode == DFmode)
|
||||
{
|
||||
#if WITH_DOUBLE_COMPARISON == 2
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
// This is the GCC default and also what AVR-LibC implements.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize the GCC target structure. */
|
||||
|
|
|
@ -107,6 +107,9 @@ FIXME: DRIVER_SELF_SPECS has changed.
|
|||
#define BYTES_BIG_ENDIAN 0
|
||||
#define WORDS_BIG_ENDIAN 0
|
||||
|
||||
#define FLOAT_LIB_COMPARE_RETURNS_BOOL(mode, comparison) \
|
||||
avr_float_lib_compare_returns_bool (mode, comparison)
|
||||
|
||||
#ifdef IN_LIBGCC2
|
||||
/* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
|
||||
#define UNITS_PER_WORD 4
|
||||
|
|
|
@ -2309,9 +2309,10 @@ as a multilib option.
|
|||
If @option{--with-long-double=double} is specified, @samp{double} and
|
||||
@samp{long double} will have the same layout.
|
||||
@item
|
||||
If the configure option is not set, it defaults to @samp{32} which
|
||||
is compatible with older versions of the compiler that use non-standard
|
||||
32-bit types for @samp{double} and @samp{long double}.
|
||||
The defaults are @option{--with-long-double=64,32} and
|
||||
@option{--with-double=32,64}. The default @samp{double} layout imposed by
|
||||
the latter is compatible with older versions of the compiler that implement
|
||||
@samp{double} as a 32-bit type, which does not comply to the language standard.
|
||||
@end itemize
|
||||
Not all combinations of @option{--with-double=} and
|
||||
@option{--with-long-double=} are valid. For example, the combination
|
||||
|
@ -2321,6 +2322,28 @@ multilibs for @samp{double}, whereas the second option implies
|
|||
that @samp{long double} --- and hence also @samp{double} --- is always
|
||||
32@tie{}bits wide.
|
||||
|
||||
@item --with-double-comparison=@{tristate|3|bool|2|libf7@}
|
||||
Only supported for the AVR target since version@tie{}10.
|
||||
Specify what result format is returned by library functions that
|
||||
compare 64-bit floating point values (@code{DFmode}).
|
||||
The GCC default is @samp{tristate}. If the floating point
|
||||
implementation returns a boolean instead, set it to @samp{bool}.
|
||||
|
||||
@item --with-libf7=@{libgcc|math|math-symbols|no@}
|
||||
Only supported for the AVR target since version@tie{}10.
|
||||
Specify to which degree code from LibF7 is included in libgcc.
|
||||
LibF7 is an ad-hoc, AVR-specific, 64-bit floating point emulation
|
||||
written in C and (inline) assembly. @samp{libgcc} adds support
|
||||
for functions that one would usually expect in libgcc like double addition,
|
||||
double comparisons and double conversions. @samp{math} also adds routines
|
||||
that one would expect in @file{libm.a}, but with @code{__} (two underscores)
|
||||
prepended to the symbol names as specified by @file{math.h}.
|
||||
@samp{math-symbols} also defines weak aliases for the functions
|
||||
declared in @file{math.h}. However, @code{--with-libf7} won't
|
||||
install no @file{math.h} header file whatsoever, this file must come
|
||||
from elsewhere. This option sets @option{--with-double-comparison}
|
||||
to @samp{bool}.
|
||||
|
||||
@item --with-nds32-lib=@var{library}
|
||||
Specifies that @var{library} setting is used for building @file{libgcc.a}.
|
||||
Currently, the valid @var{library} is @samp{newlib} or @samp{mculib}.
|
||||
|
|
|
@ -18421,9 +18421,9 @@ subroutines. Code size is smaller.
|
|||
@opindex mdouble
|
||||
@opindex mlong-double
|
||||
Set the size (in bits) of the @code{double} or @code{long double} type,
|
||||
respectively. Possible values for @var{bits} are 32 an 64.
|
||||
respectively. Possible values for @var{bits} are 32 and 64.
|
||||
Whether or not a specific value for @var{bits} is allowed depends on
|
||||
the @code{--with--double=} and @code{--with-long-double=}
|
||||
the @code{--with-double=} and @code{--with-long-double=}
|
||||
@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
|
||||
and the same applies for the default values of the options.
|
||||
|
||||
|
@ -18886,6 +18886,36 @@ features like attribute @code{progmem} and @code{pgm_read_*}.
|
|||
The compiler is configured to be used together with AVR-Libc.
|
||||
See the @option{--with-avrlibc} configure option.
|
||||
|
||||
@item __HAVE_DOUBLE_MULTILIB__
|
||||
Defined if @option{-mdouble=} acts as a multilib option.
|
||||
|
||||
@item __HAVE_DOUBLE32__
|
||||
@itemx __HAVE_DOUBLE64__
|
||||
Defined if the compiler supports 32-bit double resp. 64-bit double.
|
||||
The actual layout is specified by option @option{-mdouble=}.
|
||||
|
||||
@item __DEFAULT_DOUBLE__
|
||||
The size in bits of @code{double} if @option{-mdouble=} is not set.
|
||||
To test the layout of @code{double} in a program, use the built-in
|
||||
macro @code{__SIZEOF_DOUBLE__}.
|
||||
|
||||
@item __HAVE_LONG_DOUBLE32__
|
||||
@itemx __HAVE_LONG_DOUBLE64__
|
||||
@itemx __HAVE_LONG_DOUBLE_MULTILIB__
|
||||
@itemx __DEFAULT_LONG_DOUBLE__
|
||||
Same as above, but for @code{long double} instead of @code{double}.
|
||||
|
||||
@item __WITH_DOUBLE_COMPARISON__
|
||||
Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
|
||||
@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
|
||||
and is defined to @code{2} or @code{3}.
|
||||
|
||||
@item __WITH_LIBF7_LIBGCC__
|
||||
@itemx __WITH_LIBF7_MATH__
|
||||
@itemx __WITH_LIBF7_MATH_SYMBOLS__
|
||||
Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
|
||||
@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
|
||||
|
||||
@end table
|
||||
|
||||
@node Blackfin Options
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2020-01-08 Georg-Johann Lay <avr@gjlay.de>
|
||||
|
||||
Implement 64-bit double functions.
|
||||
|
||||
PR target/92055
|
||||
* config.host (tmake_file) [target=avr]: Add t-libf7,
|
||||
t-libf7-math, t-libf7-math-symbols as specified by --with-libf7=.
|
||||
* config/avr/t-avrlibc: Don't copy libgcc.a if there are modules
|
||||
depending on sizeof (double) or sizeof (long double).
|
||||
* config/avr/libf7: New folder.
|
||||
|
||||
2020-01-05 Olivier Hainque <hainque@adacore.com>
|
||||
|
||||
* config/gthr-vxworks.h: Guard #include vxAtomicLib.h
|
||||
|
|
|
@ -514,6 +514,29 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
|
|||
avr-*-*)
|
||||
# Make HImode functions for AVR
|
||||
tmake_file="${cpu_type}/t-avr t-fpbit"
|
||||
# Make some DFmode functions from libf7, part of avr-libgcc.
|
||||
# This must be prior to adding t-avrlibc.
|
||||
case "y${with_libf7}" in
|
||||
yno)
|
||||
# No libf7 support.
|
||||
;;
|
||||
ylibgcc)
|
||||
tmake_file="$tmake_file ${cpu_type}/libf7/t-libf7"
|
||||
;;
|
||||
ymath)
|
||||
tmake_file="$tmake_file ${cpu_type}/libf7/t-libf7-math"
|
||||
tmake_file="$tmake_file ${cpu_type}/libf7/t-libf7"
|
||||
;;
|
||||
ymath-symbols | yyes | y)
|
||||
tmake_file="$tmake_file ${cpu_type}/libf7/t-libf7-math-symbols"
|
||||
tmake_file="$tmake_file ${cpu_type}/libf7/t-libf7-math"
|
||||
tmake_file="$tmake_file ${cpu_type}/libf7/t-libf7"
|
||||
;;
|
||||
*)
|
||||
echo "Error: --with-libf7=${with_libf7} but can only be used with: 'libgcc', 'math', 'math-symbols', 'yes', 'no'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if test x${with_avrlibc} != xno; then
|
||||
tmake_file="$tmake_file ${cpu_type}/t-avrlibc"
|
||||
fi
|
||||
|
|
22
libgcc/config/avr/libf7/ChangeLog
Normal file
22
libgcc/config/avr/libf7/ChangeLog
Normal file
|
@ -0,0 +1,22 @@
|
|||
2020-01-08 Georg-Johann Lay <avr@gjlay.de>
|
||||
|
||||
Implement 64-bit double functions.
|
||||
|
||||
PR target/92055
|
||||
* t-libf7: New file.
|
||||
* t-libf7-math: New file.
|
||||
* t-libf7-math-symbols: New file.
|
||||
* libf7-common.mk: New file.
|
||||
* libf7-asm-object.mk: New file.
|
||||
* libf7-c-object.mk: New file.
|
||||
* asm-defs.h: New file.
|
||||
* libf7.h: New file.
|
||||
* libf7.c: New file.
|
||||
* libf7-asm.sx: New file.
|
||||
* libf7-array.def: New file.
|
||||
* libf7-const.def: New file.
|
||||
* libf7-constdef.h: New file.
|
||||
* f7renames.sh: New script.
|
||||
* f7wraps.sh: New script.
|
||||
* f7-renames.h: New generated file.
|
||||
* f7-wraps.h: New generated file.
|
237
libgcc/config/avr/libf7/asm-defs.h
Normal file
237
libgcc/config/avr/libf7/asm-defs.h
Normal file
|
@ -0,0 +1,237 @@
|
|||
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of LIBF7, which is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 ASM_DEFS_H
|
||||
#define ASM_DEFS_H
|
||||
|
||||
#ifdef __AVR__
|
||||
#ifdef __ASSEMBLER__
|
||||
/*****************************************************************/
|
||||
/* Stuff for Assembler-only */
|
||||
/*****************************************************************/
|
||||
|
||||
#if defined (__AVR_TINY__)
|
||||
#define __tmp_reg__ 16
|
||||
#define __zero_reg__ 17
|
||||
#else
|
||||
#define __tmp_reg__ 0
|
||||
#define __zero_reg__ 1
|
||||
#endif /* AVR_TINY */
|
||||
|
||||
#define __SREG__ 0x3f
|
||||
#define __SP_L__ 0x3d
|
||||
#if defined (__AVR_HAVE_SPH__)
|
||||
#define __SP_H__ 0x3e
|
||||
#endif
|
||||
|
||||
#if !defined ASM_DEFS_HAVE_DEFUN
|
||||
.macro DEFUN name
|
||||
.global \name
|
||||
.func \name
|
||||
\name:
|
||||
.endm
|
||||
|
||||
.macro ENDF name
|
||||
.size \name, .-\name
|
||||
.endfunc
|
||||
.endm
|
||||
|
||||
.macro LABEL name
|
||||
.global \name
|
||||
\name:
|
||||
.endm
|
||||
#endif /* HAVE_DEFUN */
|
||||
|
||||
|
||||
#if defined (__AVR_HAVE_JMP_CALL__)
|
||||
#define XCALL call
|
||||
#define XJMP jmp
|
||||
#else
|
||||
#define XCALL rcall
|
||||
#define XJMP rjmp
|
||||
#endif
|
||||
|
||||
#if defined (__AVR_HAVE_EIJMP_EICALL__)
|
||||
#define XICALL eicall
|
||||
#define XIJMP eijmp
|
||||
#define PC_SIZE 3
|
||||
#else
|
||||
#define XICALL icall
|
||||
#define XIJMP ijmp
|
||||
#define PC_SIZE 2
|
||||
#endif
|
||||
|
||||
.macro skipnext
|
||||
cpse r16, r16
|
||||
.endm
|
||||
|
||||
/*
|
||||
Factor out support of MOVW. Usage is like
|
||||
|
||||
wmov 30, 24
|
||||
|
||||
to move R25:R24 to R31:R30, i.e. plain register numbers
|
||||
are required and no register prefix 'R'.
|
||||
*/
|
||||
|
||||
#if defined (__AVR_HAVE_MOVW__)
|
||||
#define wmov movw
|
||||
#else
|
||||
.macro wmov dst src
|
||||
..dst = \dst
|
||||
..src = \src
|
||||
..regno = 0
|
||||
.irp reg, \
|
||||
r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, \
|
||||
r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \
|
||||
r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \
|
||||
r30, r31
|
||||
.ifc \reg,\dst
|
||||
..dst = ..regno
|
||||
.endif
|
||||
.ifc \reg,\src
|
||||
..src = ..regno
|
||||
.endif
|
||||
..regno = ..regno + 1
|
||||
.endr
|
||||
|
||||
..regno = 0
|
||||
|
||||
.irp reg, \
|
||||
R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, \
|
||||
R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, \
|
||||
R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, \
|
||||
R30, R31
|
||||
.ifc \reg,\dst
|
||||
..dst = ..regno
|
||||
.endif
|
||||
.ifc \reg,\src
|
||||
..src = ..regno
|
||||
.endif
|
||||
..regno = ..regno + 1
|
||||
.endr
|
||||
|
||||
..regno = 0
|
||||
|
||||
.irp reg, \
|
||||
X, x, XL, xl, Xl, xL, x, x \
|
||||
Y, y, YL, yl, Yl, yL, y, y, \
|
||||
Z, z, ZL, zl, Zl, zL, z, z
|
||||
.ifc \reg,\dst
|
||||
..dst = (..regno / 8) + 26
|
||||
.endif
|
||||
.ifc \reg,\src
|
||||
..src = (..regno / 8) + 26
|
||||
.endif
|
||||
..regno = ..regno + 1
|
||||
.endr
|
||||
|
||||
mov ..dst+0, ..src+0
|
||||
mov ..dst+1, ..src+1
|
||||
.endm
|
||||
#endif /* MOVW */
|
||||
|
||||
|
||||
#if !defined (__AVR_TINY__)
|
||||
/*
|
||||
Convenience macro for easy use of __prologue_saves__ from libgcc.
|
||||
Push the N_PUSHED callee-saved registers Y, R17, R16, R15, ...
|
||||
with 0 <= N_PUSHED <= 18. The frame pointer (Y) is set up according
|
||||
to a frame size of N_FRAME. Clobbers TMP_REG.
|
||||
For the code of __prologue_saves__ from libgcc see
|
||||
http://gcc.gnu.org/viewcvs/gcc/trunk/libgcc/config/avr/lib1funcs.S?revision=267494&view=markup#l2159
|
||||
*/
|
||||
|
||||
.macro do_prologue_saves n_pushed n_frame=0
|
||||
ldi r26, lo8(\n_frame)
|
||||
ldi r27, hi8(\n_frame)
|
||||
ldi r30, lo8(gs(.L_prologue_saves.\@))
|
||||
ldi r31, hi8(gs(.L_prologue_saves.\@))
|
||||
XJMP __prologue_saves__ + ((18 - (\n_pushed)) * 2)
|
||||
.L_prologue_saves.\@:
|
||||
.endm
|
||||
|
||||
/*
|
||||
Convenience macro for easy use of __epilogue_restores__ from libgcc.
|
||||
Undo the effect of __prologue_saves__. Clobbers TMP_REG.
|
||||
For the code of __epilogue_restores__ from libgcc see
|
||||
http://gcc.gnu.org/viewcvs/gcc/trunk/libgcc/config/avr/lib1funcs.S?revision=267494&view=markup#l2216
|
||||
*/
|
||||
|
||||
.macro do_epilogue_restores n_pushed n_frame=0
|
||||
in r28, __SP_L__
|
||||
#ifdef __AVR_HAVE_SPH__
|
||||
in r29, __SP_H__
|
||||
.if \n_frame > 63
|
||||
subi r28, lo8(-\n_frame)
|
||||
sbci r29, hi8(-\n_frame)
|
||||
.elseif \n_frame > 0
|
||||
adiw r28, \n_frame
|
||||
.endif
|
||||
#else
|
||||
clr r29
|
||||
.if \n_frame > 0
|
||||
subi r28, lo8(-\n_frame)
|
||||
.endif
|
||||
#endif /* HAVE SPH */
|
||||
ldi r30, \n_pushed
|
||||
XJMP __epilogue_restores__ + ((18 - (\n_pushed)) * 2)
|
||||
.endm
|
||||
|
||||
#endif /* AVR_TINY */
|
||||
|
||||
#else /* Assembler */
|
||||
/*****************************************************************/
|
||||
/* Space for C/C++ only Stuff */
|
||||
/*****************************************************************/
|
||||
#endif /* Assembler */
|
||||
|
||||
/*****************************************************************/
|
||||
/* Space for Generic Stuff (Assembler, C, C++) */
|
||||
/*****************************************************************/
|
||||
|
||||
#ifdef __AVR_PM_BASE_ADDRESS__
|
||||
/*
|
||||
Devices with a linear address space: Flash memory is seen in the
|
||||
RAM address space at an offset of __AVR_PM_BASE_ADDRESS__ and can
|
||||
be accessed by LD*. This is the case for devices like ATtiny40
|
||||
(avrtiny) or ATtiny1616 and ATmega4808 (avrxmega3). The default
|
||||
linker script locates .rodata in the .text output section and
|
||||
at the required offset.
|
||||
*/
|
||||
#define RODATA_SECTION .rodata.asm
|
||||
#define USE_LD 1
|
||||
#define USE_LPM 0
|
||||
#else /* PM_BASE_ADDRESS */
|
||||
/*
|
||||
No linear address space. As .rodata is located in RAM, we have to
|
||||
use .progmem.data (located in flash) and LPM to read the data.
|
||||
This will also work for devices from avrxmega3.
|
||||
*/
|
||||
#define RODATA_SECTION .progmem.data.asm
|
||||
#define USE_LD 0
|
||||
#define USE_LPM 1
|
||||
#endif /* PM_BASE_ADDRESS */
|
||||
|
||||
#endif /* target AVR */
|
||||
#endif /* ASM_DEFS_H */
|
234
libgcc/config/avr/libf7/f7-renames.h
Normal file
234
libgcc/config/avr/libf7/f7-renames.h
Normal file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
Auto-generated file, do not change by hand.
|
||||
|
||||
Generated by: f7renames.sh.
|
||||
Generated using: F7_PREFIX = __f7_ from t-libf7.
|
||||
F7F, F7F_cst, F7F_asm from libf7-common.mk.
|
||||
Included by: libf7.h.
|
||||
Used by: libf7.c, libf7.h, libf7-asm.sx, f7-wraps.h.
|
||||
*/
|
||||
|
||||
#ifndef F7_RENAMES_H
|
||||
#define F7_RENAMES_H
|
||||
|
||||
#define F7_(name) __f7_##name
|
||||
#define F7P __f7_
|
||||
|
||||
/* Renames for libf7.c, libf7.h. */
|
||||
|
||||
#define f7_fabs __f7_fabs
|
||||
#define f7_neg __f7_neg
|
||||
#define f7_add __f7_add
|
||||
#define f7_sub __f7_sub
|
||||
#define f7_addsub __f7_addsub
|
||||
#define f7_div __f7_div
|
||||
#define f7_div1 __f7_div1
|
||||
#define f7_divx __f7_divx
|
||||
#define f7_fmod __f7_fmod
|
||||
#define f7_sqrt __f7_sqrt
|
||||
#define f7_cbrt __f7_cbrt
|
||||
#define f7_square __f7_square
|
||||
#define f7_mul __f7_mul
|
||||
#define f7_mulx __f7_mulx
|
||||
#define f7_madd_msub __f7_madd_msub
|
||||
#define f7_madd __f7_madd
|
||||
#define f7_msub __f7_msub
|
||||
#define f7_hypot __f7_hypot
|
||||
#define f7_Ineg __f7_Ineg
|
||||
#define f7_Iadd __f7_Iadd
|
||||
#define f7_Isub __f7_Isub
|
||||
#define f7_Imul __f7_Imul
|
||||
#define f7_Idiv __f7_Idiv
|
||||
#define f7_IRsub __f7_IRsub
|
||||
#define f7_Isquare __f7_Isquare
|
||||
#define f7_Ildexp __f7_Ildexp
|
||||
#define f7_Isqrt __f7_Isqrt
|
||||
#define f7_le __f7_le
|
||||
#define f7_lt __f7_lt
|
||||
#define f7_gt __f7_gt
|
||||
#define f7_ge __f7_ge
|
||||
#define f7_ne __f7_ne
|
||||
#define f7_eq __f7_eq
|
||||
#define f7_cmp __f7_cmp
|
||||
#define f7_cmp_abs __f7_cmp_abs
|
||||
#define f7_ordered __f7_ordered
|
||||
#define f7_unordered __f7_unordered
|
||||
#define f7_cmp_unordered __f7_cmp_unordered
|
||||
#define f7_lt_impl __f7_lt_impl
|
||||
#define f7_gt_impl __f7_gt_impl
|
||||
#define f7_le_impl __f7_le_impl
|
||||
#define f7_ge_impl __f7_ge_impl
|
||||
#define f7_eq_impl __f7_eq_impl
|
||||
#define f7_ne_impl __f7_ne_impl
|
||||
#define f7_unord_impl __f7_unord_impl
|
||||
#define f7_lrint __f7_lrint
|
||||
#define f7_ldexp __f7_ldexp
|
||||
#define f7_frexp __f7_frexp
|
||||
#define f7_exp __f7_exp
|
||||
#define f7_logx __f7_logx
|
||||
#define f7_log __f7_log
|
||||
#define f7_log10 __f7_log10
|
||||
#define f7_log2 __f7_log2
|
||||
#define f7_minmax __f7_minmax
|
||||
#define f7_fmax __f7_fmax
|
||||
#define f7_fmin __f7_fmin
|
||||
#define f7_floor __f7_floor
|
||||
#define f7_ceil __f7_ceil
|
||||
#define f7_round __f7_round
|
||||
#define f7_lround __f7_lround
|
||||
#define f7_trunc __f7_trunc
|
||||
#define f7_truncx __f7_truncx
|
||||
#define f7_horner __f7_horner
|
||||
#define f7_pow10 __f7_pow10
|
||||
#define f7_exp10 __f7_exp10
|
||||
#define f7_pow __f7_pow
|
||||
#define f7_powi __f7_powi
|
||||
#define f7_sin __f7_sin
|
||||
#define f7_cos __f7_cos
|
||||
#define f7_tan __f7_tan
|
||||
#define f7_cotan __f7_cotan
|
||||
#define f7_sincos __f7_sincos
|
||||
#define f7_sinh __f7_sinh
|
||||
#define f7_cosh __f7_cosh
|
||||
#define f7_tanh __f7_tanh
|
||||
#define f7_sinhcosh __f7_sinhcosh
|
||||
#define f7_asinacos __f7_asinacos
|
||||
#define f7_asin __f7_asin
|
||||
#define f7_acos __f7_acos
|
||||
#define f7_atan __f7_atan
|
||||
#define f7_atan2 __f7_atan2
|
||||
#define f7_mul_noround __f7_mul_noround
|
||||
#define f7_sqrt16_round __f7_sqrt16_round
|
||||
#define f7_sqrt16_floor __f7_sqrt16_floor
|
||||
#define f7_clr_mant_lsbs __f7_clr_mant_lsbs
|
||||
#define f7_abscmp_msb_ge __f7_abscmp_msb_ge
|
||||
#define f7_lshrdi3 __f7_lshrdi3
|
||||
#define f7_ashldi3 __f7_ashldi3
|
||||
#define f7_assert __f7_assert
|
||||
#define f7_classify __f7_classify
|
||||
#define f7_class_inf __f7_class_inf
|
||||
#define f7_class_nan __f7_class_nan
|
||||
#define f7_class_number __f7_class_number
|
||||
#define f7_class_zero __f7_class_zero
|
||||
#define f7_class_nonzero __f7_class_nonzero
|
||||
#define f7_class_sign __f7_class_sign
|
||||
#define f7_signbit __f7_signbit
|
||||
#define f7_set_sign __f7_set_sign
|
||||
#define f7_set_nan __f7_set_nan
|
||||
#define f7_set_inf __f7_set_inf
|
||||
#define f7_is_inf __f7_is_inf
|
||||
#define f7_is_nan __f7_is_nan
|
||||
#define f7_is_number __f7_is_number
|
||||
#define f7_is_zero __f7_is_zero
|
||||
#define f7_is_nonzero __f7_is_nonzero
|
||||
#define f7_clr __f7_clr
|
||||
#define f7_copy __f7_copy
|
||||
#define f7_copy_P __f7_copy_P
|
||||
#define f7_copy_mant __f7_copy_mant
|
||||
#define f7_msbit __f7_msbit
|
||||
#define f7_is0 __f7_is0
|
||||
#define f7_cmp_mant __f7_cmp_mant
|
||||
#define f7_store_expo __f7_store_expo
|
||||
#define f7_abs __f7_abs
|
||||
#define f7_set_s64 __f7_set_s64
|
||||
#define f7_set_s32 __f7_set_s32
|
||||
#define f7_set_s16 __f7_set_s16
|
||||
#define f7_set_s16_impl __f7_set_s16_impl
|
||||
#define f7_set_u16_worker __f7_set_u16_worker
|
||||
#define f7_set_u64 __f7_set_u64
|
||||
#define f7_set_u32 __f7_set_u32
|
||||
#define f7_set_u16 __f7_set_u16
|
||||
#define f7_set_u16_impl __f7_set_u16_impl
|
||||
#define f7_set_float __f7_set_float
|
||||
#define f7_set_pdouble __f7_set_pdouble
|
||||
#define f7_set_double_impl __f7_set_double_impl
|
||||
#define f7_set_double __f7_set_double
|
||||
#define f7_init_impl __f7_init_impl
|
||||
#define f7_init __f7_init
|
||||
#define f7_get_s16 __f7_get_s16
|
||||
#define f7_get_s32 __f7_get_s32
|
||||
#define f7_get_s64 __f7_get_s64
|
||||
#define f7_get_float __f7_get_float
|
||||
#define f7_get_u16 __f7_get_u16
|
||||
#define f7_get_u32 __f7_get_u32
|
||||
#define f7_get_u64 __f7_get_u64
|
||||
#define f7_get_double __f7_get_double
|
||||
#define f7_set_eps __f7_set_eps
|
||||
#define f7_set_1pow2 __f7_set_1pow2
|
||||
#define f7_min __f7_min
|
||||
#define f7_max __f7_max
|
||||
#define f7_exp10 __f7_exp10
|
||||
#define f7_floatunsidf __f7_floatunsidf
|
||||
#define f7_floatsidf __f7_floatsidf
|
||||
#define f7_extendsfdf2 __f7_extendsfdf2
|
||||
#define f7_fixdfsi __f7_fixdfsi
|
||||
#define f7_fixdfdi __f7_fixdfdi
|
||||
#define f7_fixunsdfdi __f7_fixunsdfdi
|
||||
#define f7_fixunsdfsi __f7_fixunsdfsi
|
||||
#define f7_truncdfsf2 __f7_truncdfsf2
|
||||
#define f7_le_impl __f7_le_impl
|
||||
#define f7_lt_impl __f7_lt_impl
|
||||
#define f7_gt_impl __f7_gt_impl
|
||||
#define f7_ge_impl __f7_ge_impl
|
||||
#define f7_ne_impl __f7_ne_impl
|
||||
#define f7_eq_impl __f7_eq_impl
|
||||
#define f7_unord_impl __f7_unord_impl
|
||||
|
||||
/* Renames for libf7.c, libf7.h. */
|
||||
|
||||
#define f7_const_1 __f7_const_1
|
||||
#define f7_const_1_P __f7_const_1_P
|
||||
#define f7_const_2 __f7_const_2
|
||||
#define f7_const_2_P __f7_const_2_P
|
||||
#define f7_const_1_2 __f7_const_1_2
|
||||
#define f7_const_1_2_P __f7_const_1_2_P
|
||||
#define f7_const_1_3 __f7_const_1_3
|
||||
#define f7_const_1_3_P __f7_const_1_3_P
|
||||
#define f7_const_m1 __f7_const_m1
|
||||
#define f7_const_m1_P __f7_const_m1_P
|
||||
#define f7_const_pi __f7_const_pi
|
||||
#define f7_const_pi_P __f7_const_pi_P
|
||||
#define f7_const_ln2 __f7_const_ln2
|
||||
#define f7_const_ln2_P __f7_const_ln2_P
|
||||
#define f7_const_ln10 __f7_const_ln10
|
||||
#define f7_const_ln10_P __f7_const_ln10_P
|
||||
#define f7_const_1_ln2 __f7_const_1_ln2
|
||||
#define f7_const_1_ln2_P __f7_const_1_ln2_P
|
||||
#define f7_const_1_ln10 __f7_const_1_ln10
|
||||
#define f7_const_1_ln10_P __f7_const_1_ln10_P
|
||||
#define f7_const_sqrt2 __f7_const_sqrt2
|
||||
#define f7_const_sqrt2_P __f7_const_sqrt2_P
|
||||
|
||||
/* Renames for libf7-asm.sx, f7-wraps.h. */
|
||||
|
||||
#define f7_classify_asm __f7_classify_asm
|
||||
#define f7_store_expo_asm __f7_store_expo_asm
|
||||
#define f7_clr_asm __f7_clr_asm
|
||||
#define f7_copy_asm __f7_copy_asm
|
||||
#define f7_copy_P_asm __f7_copy_P_asm
|
||||
#define f7_copy_mant_asm __f7_copy_mant_asm
|
||||
#define f7_cmp_mant_asm __f7_cmp_mant_asm
|
||||
#define f7_normalize_asm __f7_normalize_asm
|
||||
#define f7_store_expo_asm __f7_store_expo_asm
|
||||
#define f7_set_u64_asm __f7_set_u64_asm
|
||||
#define f7_set_s64_asm __f7_set_s64_asm
|
||||
#define f7_addsub_mant_scaled_asm __f7_addsub_mant_scaled_asm
|
||||
#define f7_mul_mant_asm __f7_mul_mant_asm
|
||||
#define f7_to_integer_asm __f7_to_integer_asm
|
||||
#define f7_to_unsigned_asm __f7_to_unsigned_asm
|
||||
#define f7_clr_mant_lsbs_asm __f7_clr_mant_lsbs_asm
|
||||
#define f7_div_asm __f7_div_asm
|
||||
#define f7_sqrt_approx_asm __f7_sqrt_approx_asm
|
||||
#define f7_sqrt16_round_asm __f7_sqrt16_round_asm
|
||||
#define f7_sqrt16_floor_asm __f7_sqrt16_floor_asm
|
||||
#define f7_lshrdi3_asm __f7_lshrdi3_asm
|
||||
#define f7_ashldi3_asm __f7_ashldi3_asm
|
||||
#define f7_class_D_asm __f7_class_D_asm
|
||||
#define f7_call_ddd_asm __f7_call_ddd_asm
|
||||
#define f7_call_xdd_asm __f7_call_xdd_asm
|
||||
#define f7_call_ddx_asm __f7_call_ddx_asm
|
||||
#define f7_call_dd_asm __f7_call_dd_asm
|
||||
#define f7_call_xd_asm __f7_call_xd_asm
|
||||
#define f7_call_dx_asm __f7_call_dx_asm
|
||||
|
||||
#endif /* F7_RENAMES_H */
|
638
libgcc/config/avr/libf7/f7-wraps.h
Normal file
638
libgcc/config/avr/libf7/f7-wraps.h
Normal file
|
@ -0,0 +1,638 @@
|
|||
;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; This file is part of LIBF7, which is part of GCC.
|
||||
;;
|
||||
;; GCC 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.
|
||||
;;
|
||||
;; GCC 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/>. */
|
||||
|
||||
;; Auto-generated file, do not change by hand.
|
||||
;;
|
||||
;; Wrappers for double and long double functions to use functions that
|
||||
;; operate on f7_t, and get f7_t* and const f7_t*.
|
||||
;;
|
||||
;; Generated by: f7wraps.sh
|
||||
;; Included by : libf7-asm.sx
|
||||
;; WITH_LIBF7_MATH_FUNCTIONS=1
|
||||
;; WITH_LIBF7_MATH_SYMBOLS=1
|
||||
|
||||
;; Functions that usually live in libgcc: __<name>df3 for <name> in:
|
||||
;; add sub mul div
|
||||
|
||||
;; double __adddf3 (double, double) ; add
|
||||
#ifdef F7MOD_D_add_
|
||||
_DEFUN __adddf3
|
||||
ALIAS __add
|
||||
.global F7_NAME(add)
|
||||
ldi ZH, hi8(gs(F7_NAME(add)))
|
||||
ldi ZL, lo8(gs(F7_NAME(add)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __adddf3
|
||||
#endif /* F7MOD_D_add_ */
|
||||
|
||||
;; double __subdf3 (double, double) ; sub
|
||||
#ifdef F7MOD_D_sub_
|
||||
_DEFUN __subdf3
|
||||
ALIAS __sub
|
||||
.global F7_NAME(sub)
|
||||
ldi ZH, hi8(gs(F7_NAME(sub)))
|
||||
ldi ZL, lo8(gs(F7_NAME(sub)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __subdf3
|
||||
#endif /* F7MOD_D_sub_ */
|
||||
|
||||
;; double __muldf3 (double, double) ; mul
|
||||
#ifdef F7MOD_D_mul_
|
||||
_DEFUN __muldf3
|
||||
ALIAS __mul
|
||||
.global F7_NAME(mul)
|
||||
ldi ZH, hi8(gs(F7_NAME(mul)))
|
||||
ldi ZL, lo8(gs(F7_NAME(mul)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __muldf3
|
||||
#endif /* F7MOD_D_mul_ */
|
||||
|
||||
;; double __divdf3 (double, double) ; div
|
||||
#ifdef F7MOD_D_div_
|
||||
_DEFUN __divdf3
|
||||
ALIAS __div
|
||||
.global F7_NAME(div)
|
||||
ldi ZH, hi8(gs(F7_NAME(div)))
|
||||
ldi ZL, lo8(gs(F7_NAME(div)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __divdf3
|
||||
#endif /* F7MOD_D_div_ */
|
||||
|
||||
;; Functions that usually live in libgcc: __<name>df2 for <name> in:
|
||||
;; le lt ge gt ne eq unord
|
||||
|
||||
;; bool __ledf2 (double, double) ; le
|
||||
#ifdef F7MOD_D_le_
|
||||
_DEFUN __ledf2
|
||||
.global F7_NAME(le_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(le_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(le_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __ledf2
|
||||
#endif /* F7MOD_D_le_ */
|
||||
|
||||
;; bool __ltdf2 (double, double) ; lt
|
||||
#ifdef F7MOD_D_lt_
|
||||
_DEFUN __ltdf2
|
||||
.global F7_NAME(lt_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(lt_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(lt_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __ltdf2
|
||||
#endif /* F7MOD_D_lt_ */
|
||||
|
||||
;; bool __gedf2 (double, double) ; ge
|
||||
#ifdef F7MOD_D_ge_
|
||||
_DEFUN __gedf2
|
||||
.global F7_NAME(ge_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(ge_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(ge_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __gedf2
|
||||
#endif /* F7MOD_D_ge_ */
|
||||
|
||||
;; bool __gtdf2 (double, double) ; gt
|
||||
#ifdef F7MOD_D_gt_
|
||||
_DEFUN __gtdf2
|
||||
.global F7_NAME(gt_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(gt_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(gt_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __gtdf2
|
||||
#endif /* F7MOD_D_gt_ */
|
||||
|
||||
;; bool __nedf2 (double, double) ; ne
|
||||
#ifdef F7MOD_D_ne_
|
||||
_DEFUN __nedf2
|
||||
.global F7_NAME(ne_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(ne_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(ne_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __nedf2
|
||||
#endif /* F7MOD_D_ne_ */
|
||||
|
||||
;; bool __eqdf2 (double, double) ; eq
|
||||
#ifdef F7MOD_D_eq_
|
||||
_DEFUN __eqdf2
|
||||
.global F7_NAME(eq_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(eq_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(eq_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __eqdf2
|
||||
#endif /* F7MOD_D_eq_ */
|
||||
|
||||
;; bool __unorddf2 (double, double) ; unord
|
||||
#ifdef F7MOD_D_unord_
|
||||
_DEFUN __unorddf2
|
||||
.global F7_NAME(unord_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(unord_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(unord_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __unorddf2
|
||||
#endif /* F7MOD_D_unord_ */
|
||||
|
||||
;; Functions that usually live in libgcc: __<name> for <name> in:
|
||||
;; fixdfsi fixdfdi fixunsdfdi fixunsdfsi truncdfsf2
|
||||
|
||||
;; type_t __fixdfsi (double) ; fixdfsi
|
||||
#ifdef F7MOD_D_fixdfsi_
|
||||
_DEFUN __fixdfsi
|
||||
.global F7_NAME(fixdfsi)
|
||||
ldi ZH, hi8(gs(F7_NAME(fixdfsi)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fixdfsi)))
|
||||
F7jmp call_xd
|
||||
_ENDF __fixdfsi
|
||||
#endif /* F7MOD_D_fixdfsi_ */
|
||||
|
||||
;; type_t __fixdfdi (double) ; fixdfdi
|
||||
#ifdef F7MOD_D_fixdfdi_
|
||||
_DEFUN __fixdfdi
|
||||
.global F7_NAME(fixdfdi)
|
||||
ldi ZH, hi8(gs(F7_NAME(fixdfdi)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fixdfdi)))
|
||||
F7jmp call_xd
|
||||
_ENDF __fixdfdi
|
||||
#endif /* F7MOD_D_fixdfdi_ */
|
||||
|
||||
;; type_t __fixunsdfdi (double) ; fixunsdfdi
|
||||
#ifdef F7MOD_D_fixunsdfdi_
|
||||
_DEFUN __fixunsdfdi
|
||||
.global F7_NAME(fixunsdfdi)
|
||||
ldi ZH, hi8(gs(F7_NAME(fixunsdfdi)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fixunsdfdi)))
|
||||
F7jmp call_xd
|
||||
_ENDF __fixunsdfdi
|
||||
#endif /* F7MOD_D_fixunsdfdi_ */
|
||||
|
||||
;; type_t __fixunsdfsi (double) ; fixunsdfsi
|
||||
#ifdef F7MOD_D_fixunsdfsi_
|
||||
_DEFUN __fixunsdfsi
|
||||
.global F7_NAME(fixunsdfsi)
|
||||
ldi ZH, hi8(gs(F7_NAME(fixunsdfsi)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fixunsdfsi)))
|
||||
F7jmp call_xd
|
||||
_ENDF __fixunsdfsi
|
||||
#endif /* F7MOD_D_fixunsdfsi_ */
|
||||
|
||||
;; type_t __truncdfsf2 (double) ; truncdfsf2
|
||||
#ifdef F7MOD_D_truncdfsf2_
|
||||
_DEFUN __truncdfsf2
|
||||
.global F7_NAME(truncdfsf2)
|
||||
ldi ZH, hi8(gs(F7_NAME(truncdfsf2)))
|
||||
ldi ZL, lo8(gs(F7_NAME(truncdfsf2)))
|
||||
F7jmp call_xd
|
||||
_ENDF __truncdfsf2
|
||||
#endif /* F7MOD_D_truncdfsf2_ */
|
||||
|
||||
;; Functions that usually live in libgcc: __<name> for <name> in:
|
||||
;; floatunsidf floatsidf extendsfdf2
|
||||
|
||||
;; double __floatunsidf (type_t) ; floatunsidf
|
||||
#ifdef F7MOD_D_floatunsidf_
|
||||
_DEFUN __floatunsidf
|
||||
.global F7_NAME(floatunsidf)
|
||||
ldi ZH, hi8(gs(F7_NAME(floatunsidf)))
|
||||
ldi ZL, lo8(gs(F7_NAME(floatunsidf)))
|
||||
F7jmp call_dx
|
||||
_ENDF __floatunsidf
|
||||
#endif /* F7MOD_D_floatunsidf_ */
|
||||
|
||||
;; double __floatsidf (type_t) ; floatsidf
|
||||
#ifdef F7MOD_D_floatsidf_
|
||||
_DEFUN __floatsidf
|
||||
.global F7_NAME(floatsidf)
|
||||
ldi ZH, hi8(gs(F7_NAME(floatsidf)))
|
||||
ldi ZL, lo8(gs(F7_NAME(floatsidf)))
|
||||
F7jmp call_dx
|
||||
_ENDF __floatsidf
|
||||
#endif /* F7MOD_D_floatsidf_ */
|
||||
|
||||
;; double __extendsfdf2 (type_t) ; extendsfdf2
|
||||
#ifdef F7MOD_D_extendsfdf2_
|
||||
_DEFUN __extendsfdf2
|
||||
.global F7_NAME(extendsfdf2)
|
||||
ldi ZH, hi8(gs(F7_NAME(extendsfdf2)))
|
||||
ldi ZL, lo8(gs(F7_NAME(extendsfdf2)))
|
||||
F7jmp call_dx
|
||||
_ENDF __extendsfdf2
|
||||
#endif /* F7MOD_D_extendsfdf2_ */
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; pow fmin fmax fmod hypot atan2
|
||||
|
||||
;; double __pow (double, double)
|
||||
#ifdef F7MOD_D_pow_
|
||||
_DEFUN __pow
|
||||
DALIAS pow
|
||||
LALIAS powl
|
||||
.global F7_NAME(pow)
|
||||
ldi ZH, hi8(gs(F7_NAME(pow)))
|
||||
ldi ZL, lo8(gs(F7_NAME(pow)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __pow
|
||||
#endif /* F7MOD_D_pow_ */
|
||||
|
||||
;; double __fmin (double, double)
|
||||
#ifdef F7MOD_D_fmin_
|
||||
_DEFUN __fmin
|
||||
DALIAS fmin
|
||||
LALIAS fminl
|
||||
.global F7_NAME(fmin)
|
||||
ldi ZH, hi8(gs(F7_NAME(fmin)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fmin)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __fmin
|
||||
#endif /* F7MOD_D_fmin_ */
|
||||
|
||||
;; double __fmax (double, double)
|
||||
#ifdef F7MOD_D_fmax_
|
||||
_DEFUN __fmax
|
||||
DALIAS fmax
|
||||
LALIAS fmaxl
|
||||
.global F7_NAME(fmax)
|
||||
ldi ZH, hi8(gs(F7_NAME(fmax)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fmax)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __fmax
|
||||
#endif /* F7MOD_D_fmax_ */
|
||||
|
||||
;; double __fmod (double, double)
|
||||
#ifdef F7MOD_D_fmod_
|
||||
_DEFUN __fmod
|
||||
DALIAS fmod
|
||||
LALIAS fmodl
|
||||
.global F7_NAME(fmod)
|
||||
ldi ZH, hi8(gs(F7_NAME(fmod)))
|
||||
ldi ZL, lo8(gs(F7_NAME(fmod)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __fmod
|
||||
#endif /* F7MOD_D_fmod_ */
|
||||
|
||||
;; double __hypot (double, double)
|
||||
#ifdef F7MOD_D_hypot_
|
||||
_DEFUN __hypot
|
||||
DALIAS hypot
|
||||
LALIAS hypotl
|
||||
.global F7_NAME(hypot)
|
||||
ldi ZH, hi8(gs(F7_NAME(hypot)))
|
||||
ldi ZL, lo8(gs(F7_NAME(hypot)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __hypot
|
||||
#endif /* F7MOD_D_hypot_ */
|
||||
|
||||
;; double __atan2 (double, double)
|
||||
#ifdef F7MOD_D_atan2_
|
||||
_DEFUN __atan2
|
||||
DALIAS atan2
|
||||
LALIAS atan2l
|
||||
.global F7_NAME(atan2)
|
||||
ldi ZH, hi8(gs(F7_NAME(atan2)))
|
||||
ldi ZL, lo8(gs(F7_NAME(atan2)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __atan2
|
||||
#endif /* F7MOD_D_atan2_ */
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; ldexp frexp
|
||||
|
||||
;; double __ldexp (double, word_t)
|
||||
#ifdef F7MOD_D_ldexp_
|
||||
_DEFUN __ldexp
|
||||
DALIAS ldexp
|
||||
LALIAS ldexpl
|
||||
.global F7_NAME(ldexp)
|
||||
ldi ZH, hi8(gs(F7_NAME(ldexp)))
|
||||
ldi ZL, lo8(gs(F7_NAME(ldexp)))
|
||||
F7jmp call_ddx
|
||||
_ENDF __ldexp
|
||||
#endif /* F7MOD_D_ldexp_ */
|
||||
|
||||
;; double __frexp (double, word_t)
|
||||
#ifdef F7MOD_D_frexp_
|
||||
_DEFUN __frexp
|
||||
DALIAS frexp
|
||||
LALIAS frexpl
|
||||
.global F7_NAME(frexp)
|
||||
ldi ZH, hi8(gs(F7_NAME(frexp)))
|
||||
ldi ZL, lo8(gs(F7_NAME(frexp)))
|
||||
F7jmp call_ddx
|
||||
_ENDF __frexp
|
||||
#endif /* F7MOD_D_frexp_ */
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; sqrt cbrt exp exp10 pow10 log log10 log2 sin cos tan cotan asin acos atan ceil floor trunc round sinh cosh tanh
|
||||
|
||||
;; double __sqrt (double)
|
||||
#ifdef F7MOD_D_sqrt_
|
||||
_DEFUN __sqrt
|
||||
DALIAS sqrt
|
||||
LALIAS sqrtl
|
||||
.global F7_NAME(sqrt)
|
||||
ldi ZH, hi8(gs(F7_NAME(sqrt)))
|
||||
ldi ZL, lo8(gs(F7_NAME(sqrt)))
|
||||
F7jmp call_dd
|
||||
_ENDF __sqrt
|
||||
#endif /* F7MOD_D_sqrt_ */
|
||||
|
||||
;; double __cbrt (double)
|
||||
#ifdef F7MOD_D_cbrt_
|
||||
_DEFUN __cbrt
|
||||
DALIAS cbrt
|
||||
LALIAS cbrtl
|
||||
.global F7_NAME(cbrt)
|
||||
ldi ZH, hi8(gs(F7_NAME(cbrt)))
|
||||
ldi ZL, lo8(gs(F7_NAME(cbrt)))
|
||||
F7jmp call_dd
|
||||
_ENDF __cbrt
|
||||
#endif /* F7MOD_D_cbrt_ */
|
||||
|
||||
;; double __exp (double)
|
||||
#ifdef F7MOD_D_exp_
|
||||
_DEFUN __exp
|
||||
DALIAS exp
|
||||
LALIAS expl
|
||||
.global F7_NAME(exp)
|
||||
ldi ZH, hi8(gs(F7_NAME(exp)))
|
||||
ldi ZL, lo8(gs(F7_NAME(exp)))
|
||||
F7jmp call_dd
|
||||
_ENDF __exp
|
||||
#endif /* F7MOD_D_exp_ */
|
||||
|
||||
;; double __exp10 (double)
|
||||
#ifdef F7MOD_D_exp10_
|
||||
_DEFUN __exp10
|
||||
DALIAS exp10
|
||||
LALIAS exp10l
|
||||
.global F7_NAME(exp10)
|
||||
ldi ZH, hi8(gs(F7_NAME(exp10)))
|
||||
ldi ZL, lo8(gs(F7_NAME(exp10)))
|
||||
F7jmp call_dd
|
||||
_ENDF __exp10
|
||||
#endif /* F7MOD_D_exp10_ */
|
||||
|
||||
;; double __pow10 (double)
|
||||
#ifdef F7MOD_D_pow10_
|
||||
_DEFUN __pow10
|
||||
DALIAS pow10
|
||||
LALIAS pow10l
|
||||
.global F7_NAME(pow10)
|
||||
ldi ZH, hi8(gs(F7_NAME(pow10)))
|
||||
ldi ZL, lo8(gs(F7_NAME(pow10)))
|
||||
F7jmp call_dd
|
||||
_ENDF __pow10
|
||||
#endif /* F7MOD_D_pow10_ */
|
||||
|
||||
;; double __log (double)
|
||||
#ifdef F7MOD_D_log_
|
||||
_DEFUN __log
|
||||
DALIAS log
|
||||
LALIAS logl
|
||||
.global F7_NAME(log)
|
||||
ldi ZH, hi8(gs(F7_NAME(log)))
|
||||
ldi ZL, lo8(gs(F7_NAME(log)))
|
||||
F7jmp call_dd
|
||||
_ENDF __log
|
||||
#endif /* F7MOD_D_log_ */
|
||||
|
||||
;; double __log10 (double)
|
||||
#ifdef F7MOD_D_log10_
|
||||
_DEFUN __log10
|
||||
DALIAS log10
|
||||
LALIAS log10l
|
||||
.global F7_NAME(log10)
|
||||
ldi ZH, hi8(gs(F7_NAME(log10)))
|
||||
ldi ZL, lo8(gs(F7_NAME(log10)))
|
||||
F7jmp call_dd
|
||||
_ENDF __log10
|
||||
#endif /* F7MOD_D_log10_ */
|
||||
|
||||
;; double __log2 (double)
|
||||
#ifdef F7MOD_D_log2_
|
||||
_DEFUN __log2
|
||||
DALIAS log2
|
||||
LALIAS log2l
|
||||
.global F7_NAME(log2)
|
||||
ldi ZH, hi8(gs(F7_NAME(log2)))
|
||||
ldi ZL, lo8(gs(F7_NAME(log2)))
|
||||
F7jmp call_dd
|
||||
_ENDF __log2
|
||||
#endif /* F7MOD_D_log2_ */
|
||||
|
||||
;; double __sin (double)
|
||||
#ifdef F7MOD_D_sin_
|
||||
_DEFUN __sin
|
||||
DALIAS sin
|
||||
LALIAS sinl
|
||||
.global F7_NAME(sin)
|
||||
ldi ZH, hi8(gs(F7_NAME(sin)))
|
||||
ldi ZL, lo8(gs(F7_NAME(sin)))
|
||||
F7jmp call_dd
|
||||
_ENDF __sin
|
||||
#endif /* F7MOD_D_sin_ */
|
||||
|
||||
;; double __cos (double)
|
||||
#ifdef F7MOD_D_cos_
|
||||
_DEFUN __cos
|
||||
DALIAS cos
|
||||
LALIAS cosl
|
||||
.global F7_NAME(cos)
|
||||
ldi ZH, hi8(gs(F7_NAME(cos)))
|
||||
ldi ZL, lo8(gs(F7_NAME(cos)))
|
||||
F7jmp call_dd
|
||||
_ENDF __cos
|
||||
#endif /* F7MOD_D_cos_ */
|
||||
|
||||
;; double __tan (double)
|
||||
#ifdef F7MOD_D_tan_
|
||||
_DEFUN __tan
|
||||
DALIAS tan
|
||||
LALIAS tanl
|
||||
.global F7_NAME(tan)
|
||||
ldi ZH, hi8(gs(F7_NAME(tan)))
|
||||
ldi ZL, lo8(gs(F7_NAME(tan)))
|
||||
F7jmp call_dd
|
||||
_ENDF __tan
|
||||
#endif /* F7MOD_D_tan_ */
|
||||
|
||||
;; double __cotan (double)
|
||||
#ifdef F7MOD_D_cotan_
|
||||
_DEFUN __cotan
|
||||
DALIAS cotan
|
||||
LALIAS cotanl
|
||||
.global F7_NAME(cotan)
|
||||
ldi ZH, hi8(gs(F7_NAME(cotan)))
|
||||
ldi ZL, lo8(gs(F7_NAME(cotan)))
|
||||
F7jmp call_dd
|
||||
_ENDF __cotan
|
||||
#endif /* F7MOD_D_cotan_ */
|
||||
|
||||
;; double __asin (double)
|
||||
#ifdef F7MOD_D_asin_
|
||||
_DEFUN __asin
|
||||
DALIAS asin
|
||||
LALIAS asinl
|
||||
.global F7_NAME(asin)
|
||||
ldi ZH, hi8(gs(F7_NAME(asin)))
|
||||
ldi ZL, lo8(gs(F7_NAME(asin)))
|
||||
F7jmp call_dd
|
||||
_ENDF __asin
|
||||
#endif /* F7MOD_D_asin_ */
|
||||
|
||||
;; double __acos (double)
|
||||
#ifdef F7MOD_D_acos_
|
||||
_DEFUN __acos
|
||||
DALIAS acos
|
||||
LALIAS acosl
|
||||
.global F7_NAME(acos)
|
||||
ldi ZH, hi8(gs(F7_NAME(acos)))
|
||||
ldi ZL, lo8(gs(F7_NAME(acos)))
|
||||
F7jmp call_dd
|
||||
_ENDF __acos
|
||||
#endif /* F7MOD_D_acos_ */
|
||||
|
||||
;; double __atan (double)
|
||||
#ifdef F7MOD_D_atan_
|
||||
_DEFUN __atan
|
||||
DALIAS atan
|
||||
LALIAS atanl
|
||||
.global F7_NAME(atan)
|
||||
ldi ZH, hi8(gs(F7_NAME(atan)))
|
||||
ldi ZL, lo8(gs(F7_NAME(atan)))
|
||||
F7jmp call_dd
|
||||
_ENDF __atan
|
||||
#endif /* F7MOD_D_atan_ */
|
||||
|
||||
;; double __ceil (double)
|
||||
#ifdef F7MOD_D_ceil_
|
||||
_DEFUN __ceil
|
||||
DALIAS ceil
|
||||
LALIAS ceill
|
||||
.global F7_NAME(ceil)
|
||||
ldi ZH, hi8(gs(F7_NAME(ceil)))
|
||||
ldi ZL, lo8(gs(F7_NAME(ceil)))
|
||||
F7jmp call_dd
|
||||
_ENDF __ceil
|
||||
#endif /* F7MOD_D_ceil_ */
|
||||
|
||||
;; double __floor (double)
|
||||
#ifdef F7MOD_D_floor_
|
||||
_DEFUN __floor
|
||||
DALIAS floor
|
||||
LALIAS floorl
|
||||
.global F7_NAME(floor)
|
||||
ldi ZH, hi8(gs(F7_NAME(floor)))
|
||||
ldi ZL, lo8(gs(F7_NAME(floor)))
|
||||
F7jmp call_dd
|
||||
_ENDF __floor
|
||||
#endif /* F7MOD_D_floor_ */
|
||||
|
||||
;; double __trunc (double)
|
||||
#ifdef F7MOD_D_trunc_
|
||||
_DEFUN __trunc
|
||||
DALIAS trunc
|
||||
LALIAS truncl
|
||||
.global F7_NAME(trunc)
|
||||
ldi ZH, hi8(gs(F7_NAME(trunc)))
|
||||
ldi ZL, lo8(gs(F7_NAME(trunc)))
|
||||
F7jmp call_dd
|
||||
_ENDF __trunc
|
||||
#endif /* F7MOD_D_trunc_ */
|
||||
|
||||
;; double __round (double)
|
||||
#ifdef F7MOD_D_round_
|
||||
_DEFUN __round
|
||||
DALIAS round
|
||||
LALIAS roundl
|
||||
.global F7_NAME(round)
|
||||
ldi ZH, hi8(gs(F7_NAME(round)))
|
||||
ldi ZL, lo8(gs(F7_NAME(round)))
|
||||
F7jmp call_dd
|
||||
_ENDF __round
|
||||
#endif /* F7MOD_D_round_ */
|
||||
|
||||
;; double __sinh (double)
|
||||
#ifdef F7MOD_D_sinh_
|
||||
_DEFUN __sinh
|
||||
DALIAS sinh
|
||||
LALIAS sinhl
|
||||
.global F7_NAME(sinh)
|
||||
ldi ZH, hi8(gs(F7_NAME(sinh)))
|
||||
ldi ZL, lo8(gs(F7_NAME(sinh)))
|
||||
F7jmp call_dd
|
||||
_ENDF __sinh
|
||||
#endif /* F7MOD_D_sinh_ */
|
||||
|
||||
;; double __cosh (double)
|
||||
#ifdef F7MOD_D_cosh_
|
||||
_DEFUN __cosh
|
||||
DALIAS cosh
|
||||
LALIAS coshl
|
||||
.global F7_NAME(cosh)
|
||||
ldi ZH, hi8(gs(F7_NAME(cosh)))
|
||||
ldi ZL, lo8(gs(F7_NAME(cosh)))
|
||||
F7jmp call_dd
|
||||
_ENDF __cosh
|
||||
#endif /* F7MOD_D_cosh_ */
|
||||
|
||||
;; double __tanh (double)
|
||||
#ifdef F7MOD_D_tanh_
|
||||
_DEFUN __tanh
|
||||
DALIAS tanh
|
||||
LALIAS tanhl
|
||||
.global F7_NAME(tanh)
|
||||
ldi ZH, hi8(gs(F7_NAME(tanh)))
|
||||
ldi ZL, lo8(gs(F7_NAME(tanh)))
|
||||
F7jmp call_dd
|
||||
_ENDF __tanh
|
||||
#endif /* F7MOD_D_tanh_ */
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; lrint lround
|
||||
|
||||
;; type_t __lrint (double)
|
||||
#ifdef F7MOD_D_lrint_
|
||||
_DEFUN __lrint
|
||||
DALIAS lrint
|
||||
LALIAS lrintl
|
||||
.global F7_NAME(lrint)
|
||||
ldi ZH, hi8(gs(F7_NAME(lrint)))
|
||||
ldi ZL, lo8(gs(F7_NAME(lrint)))
|
||||
F7jmp call_xd
|
||||
_ENDF __lrint
|
||||
#endif /* F7MOD_D_lrint_ */
|
||||
|
||||
;; type_t __lround (double)
|
||||
#ifdef F7MOD_D_lround_
|
||||
_DEFUN __lround
|
||||
DALIAS lround
|
||||
LALIAS lroundl
|
||||
.global F7_NAME(lround)
|
||||
ldi ZH, hi8(gs(F7_NAME(lround)))
|
||||
ldi ZL, lo8(gs(F7_NAME(lround)))
|
||||
F7jmp call_xd
|
||||
_ENDF __lround
|
||||
#endif /* F7MOD_D_lround_ */
|
80
libgcc/config/avr/libf7/f7renames.sh
Executable file
80
libgcc/config/avr/libf7/f7renames.sh
Executable file
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# The first command argument tells us which flavour to generate for
|
||||
# the rest of the command line arguments.
|
||||
|
||||
what=$1
|
||||
shift
|
||||
|
||||
# The second command argument is the prefix to prepend to all functions.
|
||||
# It is defined by F7_PREFIX in $2.
|
||||
|
||||
PRE=$1
|
||||
shift
|
||||
|
||||
case ${what} in
|
||||
head)
|
||||
cat << EOF
|
||||
/*
|
||||
Auto-generated file, do not change by hand.
|
||||
|
||||
Generated by: `basename $0`.
|
||||
Generated using: F7_PREFIX = ${PRE} from $1.
|
||||
F7F, F7F_cst, F7F_asm from libf7-common.mk.
|
||||
Included by: libf7.h.
|
||||
Used by: libf7.c, libf7.h, libf7-asm.sx, f7-wraps.h.
|
||||
*/
|
||||
|
||||
#ifndef F7_RENAMES_H
|
||||
#define F7_RENAMES_H
|
||||
|
||||
#define F7_(name) ${PRE}##name
|
||||
#define F7P ${PRE}
|
||||
EOF
|
||||
;;
|
||||
|
||||
c)
|
||||
if [ x${PRE} != xf7_ ]; then
|
||||
echo " "
|
||||
echo "/* Renames for libf7.c, libf7.h. */"
|
||||
echo " "
|
||||
for x in $*; do
|
||||
echo "#define f7_$x ${PRE}$x"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
cst)
|
||||
if [ x${PRE} != xf7_ ]; then
|
||||
echo " "
|
||||
echo "/* Renames for libf7.c, libf7.h. */"
|
||||
echo " "
|
||||
for x in $*; do
|
||||
echo "#define f7_const_${x} ${PRE}const_${x}"
|
||||
echo "#define f7_const_${x}_P ${PRE}const_${x}_P"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
asm)
|
||||
if [ x${PRE} != xf7_ ]; then
|
||||
echo " "
|
||||
echo "/* Renames for libf7-asm.sx, f7-wraps.h. */"
|
||||
echo " "
|
||||
for x in $*; do
|
||||
echo "#define f7_${x}_asm ${PRE}${x}_asm"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
tail)
|
||||
cat << EOF
|
||||
|
||||
#endif /* F7_RENAMES_H */
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
244
libgcc/config/avr/libf7/f7wraps.sh
Executable file
244
libgcc/config/avr/libf7/f7wraps.sh
Executable file
|
@ -0,0 +1,244 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# The first command argument $1 tells us which flavour to generate for
|
||||
# the rest of the command line arguments.
|
||||
|
||||
what=$1
|
||||
shift
|
||||
|
||||
if [ "x$*" = "x" ]; then
|
||||
none="(none)"
|
||||
fi
|
||||
|
||||
case ${what} in
|
||||
header)
|
||||
cat << EOF
|
||||
;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; This file is part of LIBF7, which is part of GCC.
|
||||
;;
|
||||
;; GCC 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.
|
||||
;;
|
||||
;; GCC 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/>. */
|
||||
|
||||
;; Auto-generated file, do not change by hand.
|
||||
;;
|
||||
;; Wrappers for double and long double functions to use functions that
|
||||
;; operate on f7_t, and get f7_t* and const f7_t*.
|
||||
;;
|
||||
;; Generated by: `basename $0`
|
||||
;; Included by : libf7-asm.sx
|
||||
EOF
|
||||
for n in $*; do
|
||||
echo ";; $n"
|
||||
done
|
||||
;;
|
||||
|
||||
xd_libgcc)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libgcc: __<name> for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; type_t __${n} (double) ; $n
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_xd
|
||||
_ENDF __${n}
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
dx_libgcc)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libgcc: __<name> for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; double __${n} (type_t) ; $n
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_dx
|
||||
_ENDF __${n}
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
ddd_libgcc)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libgcc: __<name>df3 for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; double __${n}df3 (double, double) ; $n
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}df3
|
||||
ALIAS __$n
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __${n}df3
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
xdd_libgcc_cmp)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libgcc: __<name>df2 for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; bool __${n}df2 (double, double) ; $n
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}df2
|
||||
.global F7_NAME(${n}_impl)
|
||||
ldi ZH, hi8(gs(F7_NAME(${n}_impl)))
|
||||
ldi ZL, lo8(gs(F7_NAME(${n}_impl)))
|
||||
F7jmp call_xdd
|
||||
_ENDF __${n}df2
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
dd_math)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; double __${n} (double)
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}
|
||||
DALIAS $n
|
||||
LALIAS ${n}l
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_dd
|
||||
_ENDF __${n}
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
xd_math)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; type_t __${n} (double)
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}
|
||||
DALIAS $n
|
||||
LALIAS ${n}l
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_xd
|
||||
_ENDF __${n}
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
ddd_math)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; double __${n} (double, double)
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}
|
||||
DALIAS $n
|
||||
LALIAS ${n}l
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_ddd
|
||||
_ENDF __${n}
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
ddx_math)
|
||||
cat << EOF
|
||||
|
||||
;; Functions that usually live in libm: Depending on [long] double layout,
|
||||
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
|
||||
;; $*${none}
|
||||
EOF
|
||||
for n in $*; do
|
||||
cat << EOF
|
||||
|
||||
;; double __${n} (double, word_t)
|
||||
#ifdef F7MOD_D_${n}_
|
||||
_DEFUN __${n}
|
||||
DALIAS $n
|
||||
LALIAS ${n}l
|
||||
.global F7_NAME($n)
|
||||
ldi ZH, hi8(gs(F7_NAME($n)))
|
||||
ldi ZL, lo8(gs(F7_NAME($n)))
|
||||
F7jmp call_ddx
|
||||
_ENDF __${n}
|
||||
#endif /* F7MOD_D_${n}_ */
|
||||
EOF
|
||||
done
|
||||
;;
|
||||
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
45
libgcc/config/avr/libf7/libf7-array.def
Normal file
45
libgcc/config/avr/libf7/libf7-array.def
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of LIBF7, which is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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/>. */
|
||||
|
||||
static const F7_PGMSPACE f7_t ARRAY_NAME[] =
|
||||
{
|
||||
#define F7_CONST_DEF(NAME, FLAGS, M6, M5, M4, M3, M2, M1, M0, EXPO) \
|
||||
{ .flags = FLAGS, .mant = { M0, M1, M2, M3, M4, M5, M6 }, .expo = EXPO },
|
||||
#include "libf7-const.def"
|
||||
#undef F7_CONST_DEF
|
||||
};
|
||||
|
||||
// static const uint8_t n_ARRAY_NAME = <Entries in ARRAY_NAME[]>.
|
||||
|
||||
#define F7_n_NAME2(X) n_##X
|
||||
#define F7_n_NAME1(X) F7_n_NAME2(X)
|
||||
|
||||
F7_UNUSED static const uint8_t F7_n_NAME1 (ARRAY_NAME) =
|
||||
#define F7_CONST_DEF(NAME, FLAGS, M6, M5, M4, M3, M2, M1, M0, EXPO) \
|
||||
+ 1
|
||||
#include "libf7-const.def"
|
||||
#undef F7_CONST_DEF
|
||||
;
|
||||
|
||||
#undef F7_n_NAME1
|
||||
#undef F7_n_NAME2
|
20
libgcc/config/avr/libf7/libf7-asm-object.mk
Normal file
20
libgcc/config/avr/libf7/libf7-asm-object.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
# This file is included several times in a row, once for each element of
|
||||
# $(iter-items). On each inclusion, we advance $o to the next element.
|
||||
# $(iter-labels) is also advanced.
|
||||
# This works similar to $(srcdir)/siditi-object.mk.
|
||||
|
||||
o := $(firstword $(iter-items))
|
||||
iter-items := $(filter-out $o,$(iter-items))
|
||||
|
||||
$o-label := $(firstword $(iter-labels))
|
||||
iter-labels := $(wordlist 2,$(words $(iter-labels)),$(iter-labels))
|
||||
|
||||
f7_asm_$o$(objext): f7_asm_%$(objext): $(libf7)/libf7-asm.sx
|
||||
$(gcc_compile) -DF7MOD_$($*-label)_ $(F7_ASM_FLAGS) \
|
||||
-c $<
|
||||
|
||||
ifeq ($(enable_shared),yes)
|
||||
f7_asm_$(o)_s$(objext): f7_asm_%_s$(objext): $(libf7)/libf7-asm.sx
|
||||
$(gcc_s_compile) -DF7MOD_$($*-label)_ $(F7_ASM_FLAGS) \
|
||||
-c $<
|
||||
endif
|
1664
libgcc/config/avr/libf7/libf7-asm.sx
Normal file
1664
libgcc/config/avr/libf7/libf7-asm.sx
Normal file
File diff suppressed because it is too large
Load diff
20
libgcc/config/avr/libf7/libf7-c-object.mk
Normal file
20
libgcc/config/avr/libf7/libf7-c-object.mk
Normal file
|
@ -0,0 +1,20 @@
|
|||
# This file is included several times in a row, once for each element of
|
||||
# $(iter-items). On each inclusion, we advance $o to the next element.
|
||||
# $(iter-labels) is also advanced.
|
||||
# This works similar to $(srcdir)/siditi-object.mk.
|
||||
|
||||
o := $(firstword $(iter-items))
|
||||
iter-items := $(filter-out $o,$(iter-items))
|
||||
|
||||
$o-label := $(firstword $(iter-labels))
|
||||
iter-labels := $(wordlist 2,$(words $(iter-labels)),$(iter-labels))
|
||||
|
||||
f7_c_$o$(objext): f7_c_%$(objext): $(libf7)/libf7.c
|
||||
$(gcc_compile) -DF7MOD_$($*-label)_ $(F7_C_FLAGS) \
|
||||
-c $<
|
||||
|
||||
ifeq ($(enable_shared),yes)
|
||||
f7_c_$(o)_s$(objext): %_s$(objext): $(libf7)/libf7.c
|
||||
$(gcc_s_compile) -DF7MOD_$($*-label)_ $(F7_C_FLAGS) \
|
||||
-c $<
|
||||
endif
|
102
libgcc/config/avr/libf7/libf7-common.mk
Normal file
102
libgcc/config/avr/libf7/libf7-common.mk
Normal file
|
@ -0,0 +1,102 @@
|
|||
# f7_c_*.o modules from libf7.c.
|
||||
F7_C_PARTS += set_s16 set_u16 set_s32 set_u32 init
|
||||
F7_C_PARTS += get_s16 get_u16 get_s32 get_u32 get_s64 get_u64
|
||||
F7_C_PARTS += lrint ldexp frexp madd_msub madd msub hypot
|
||||
F7_C_PARTS += addsub add sub mulx mul square divx div div1 fmod sqrt cbrt
|
||||
F7_C_PARTS += Ineg Iadd Isub Imul Idiv IRsub Isquare Ildexp Isqrt
|
||||
F7_C_PARTS += set_float get_float get_double set_double set_pdouble
|
||||
F7_C_PARTS += fabs neg fmin fmax minmax truncx trunc floor ceil round lround
|
||||
F7_C_PARTS += horner logx log log10 log2 exp pow10 pow powi
|
||||
F7_C_PARTS += sin cos tan cotan sincos sinh cosh tanh sinhcosh
|
||||
F7_C_PARTS += asinacos asin acos atan atan2
|
||||
F7_C_PARTS += abscmp_msb_ge cmp cmp_abs cmp_unordered
|
||||
|
||||
F7_C_PARTS += const_1 const_1_2 const_1_3
|
||||
F7_C_PARTS += const_pi const_ln2 const_1_ln2 const_ln10 const_1_ln10 const_sqrt2
|
||||
F7_C_PARTS += # const_m1 const_2 const_sqrt2
|
||||
|
||||
# f7_asm_*.o modules from libf7-asm.sx.
|
||||
F7_ASM_PARTS += classify clr mul_mant cmp_mant set_u64
|
||||
F7_ASM_PARTS += copy copy_P copy_mant clr_mant_lsbs
|
||||
F7_ASM_PARTS += addsub_mant_scaled store load
|
||||
F7_ASM_PARTS += to_integer to_unsigned clz normalize_with_carry normalize
|
||||
F7_ASM_PARTS += store_expo sqrt16 sqrt_approx div
|
||||
|
||||
F7_ASM_PARTS += D_class
|
||||
F7_ASM_PARTS += D_isnan D_isinf D_isfinite D_signbit D_copysign D_neg D_fabs
|
||||
|
||||
F7_ASM_PARTS += call_dd call_ddd
|
||||
|
||||
# Stuff that will be wrapped in f7-wraps.h (included by libf7-asm.sx)
|
||||
# and give f7_asm_D_*.o modules.
|
||||
g_ddd += add sub mul div
|
||||
g_xdd_cmp += le lt ge gt ne eq unord
|
||||
g_dx += floatunsidf floatsidf extendsfdf2
|
||||
g_xd += fixdfsi fixdfdi fixunsdfdi fixunsdfsi truncdfsf2
|
||||
|
||||
m_ddd += pow fmin fmax fmod hypot atan2
|
||||
m_ddx += ldexp frexp
|
||||
m_dd += sqrt cbrt exp exp10 pow10 log log10 log2 sin cos tan cotan asin acos atan
|
||||
m_dd += ceil floor trunc round sinh cosh tanh
|
||||
m_xd += lrint lround
|
||||
|
||||
# -mcall-prologues
|
||||
CALL_PROLOGUES += divx sqrt cbrt get_double set_double logx exp exp10 pow10
|
||||
CALL_PROLOGUES += put_C truncx round minmax sincos tan cotan pow powi fmod
|
||||
CALL_PROLOGUES += atan asinacos madd_msub hypot init horner sinhcosh tanh
|
||||
|
||||
# -mstrict-X
|
||||
STRICT_X += log addsub truncx ldexp exp
|
||||
|
||||
# Renames used when building f7-renames.h.
|
||||
F7F += fabs neg add sub addsub div div1 divx fmod sqrt cbrt
|
||||
F7F += square mul mulx madd_msub madd msub hypot
|
||||
F7F += Ineg Iadd Isub Imul Idiv IRsub Isquare Ildexp Isqrt
|
||||
F7F += le lt gt ge ne eq cmp cmp_abs ordered unordered cmp_unordered
|
||||
F7F += lt_impl gt_impl le_impl ge_impl eq_impl ne_impl unord_impl
|
||||
|
||||
F7F += lrint ldexp frexp exp logx log log10 log2
|
||||
F7F += minmax fmax fmin floor ceil round lround trunc truncx
|
||||
F7F += horner pow10 exp10 pow powi
|
||||
F7F += sin cos tan cotan sincos sinh cosh tanh sinhcosh
|
||||
F7F += asinacos asin acos atan atan2
|
||||
F7F += mul_noround sqrt16_round sqrt16_floor
|
||||
F7F += clr_mant_lsbs abscmp_msb_ge lshrdi3 ashldi3
|
||||
F7F += assert
|
||||
|
||||
F7F += classify
|
||||
|
||||
F7F += class_inf class_nan class_number class_zero class_nonzero class_sign
|
||||
F7F += signbit set_sign set_nan set_inf
|
||||
F7F += is_inf is_nan is_number is_zero is_nonzero
|
||||
F7F += clr copy copy_P copy_mant msbit is0 cmp_mant store_expo
|
||||
F7F += abs
|
||||
|
||||
F7F += set_s64 set_s32 set_s16 set_s16_impl set_u16_worker
|
||||
F7F += set_u64 set_u32 set_u16 set_u16_impl
|
||||
F7F += set_float set_pdouble set_double_impl set_double init_impl init
|
||||
F7F += get_s16 get_s32 get_s64 get_float
|
||||
F7F += get_u16 get_u32 get_u64 get_double
|
||||
|
||||
F7F += set_eps set_1pow2
|
||||
|
||||
# Renames for ALIASes without own module.
|
||||
F7F += min max exp10
|
||||
F7F += floatunsidf floatsidf extendsfdf2
|
||||
F7F += fixdfsi fixdfdi fixunsdfdi fixunsdfsi truncdfsf2
|
||||
|
||||
# Renames for f7-const.def.
|
||||
F7F_cst += 1 2 1_2 1_3 m1 pi ln2 ln10 1_ln2 1_ln10 sqrt2
|
||||
|
||||
F7F_asm += classify
|
||||
F7F_asm += store_expo clr copy copy_P copy_mant
|
||||
F7F_asm += cmp_mant normalize store_expo
|
||||
F7F_asm += set_u64 set_s64 addsub_mant_scaled mul_mant
|
||||
F7F_asm += to_integer to_unsigned clr_mant_lsbs
|
||||
F7F_asm += div sqrt_approx sqrt16_round sqrt16_floor
|
||||
F7F_asm += lshrdi3 ashldi3
|
||||
|
||||
F7F_asm += class_D
|
||||
|
||||
F7F_asm += call_ddd call_xdd call_ddx
|
||||
F7F_asm += call_dd call_xd call_dx
|
201
libgcc/config/avr/libf7/libf7-const.def
Normal file
201
libgcc/config/avr/libf7/libf7-const.def
Normal file
|
@ -0,0 +1,201 @@
|
|||
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of LIBF7, which is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 ONLY_CONST_WITH_ID
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_1_2_)
|
||||
F7_CONST_DEF (1_2, 0, 0x80,0,0,0,0,0,0, -1)
|
||||
#endif /* 1/2 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_1_)
|
||||
F7_CONST_DEF (1, 0, 0x80,0,0,0,0,0,0, 0)
|
||||
#endif /* 1 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_2_)
|
||||
F7_CONST_DEF (2, 0, 0x80,0,0,0,0,0,0, 1)
|
||||
#endif /* 2 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_1_3_)
|
||||
F7_CONST_DEF (1_3, 0, 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab, -2)
|
||||
#endif /* 1/3 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_1_ln2_)
|
||||
F7_CONST_DEF (1_ln2, 0, 0xb8,0xaa,0x3b,0x29,0x5c,0x17,0xf1, 0)
|
||||
#endif /* 1 / ln2 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_1_ln10_)
|
||||
F7_CONST_DEF (1_ln10, 0, 0xde,0x5b,0xd8,0xa9,0x37,0x28,0x72, -2)
|
||||
#endif /* 1 / ln10 */
|
||||
#endif /* const with ID */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_m1_)
|
||||
F7_CONST_DEF (m1, 1, 0x80,0,0,0,0,0,0, 0)
|
||||
#endif /* -1 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_pi_)
|
||||
F7_CONST_DEF (pi, 0, 0xc9,0x0f,0xda,0xa2,0x21,0x68,0xc2, 1)
|
||||
#endif /* pi */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_ln2_)
|
||||
F7_CONST_DEF (ln2, 0, 0xb1,0x72,0x17,0xf7,0xd1,0xcf,0x7a, -1)
|
||||
#endif /* ln2 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_ln10_)
|
||||
F7_CONST_DEF (ln10, 0, 0x93,0x5d,0x8d,0xdd,0xaa,0xa8,0xac, 1)
|
||||
#endif /* ln10 */
|
||||
|
||||
#if defined IN_LIBF7_H || defined (F7MOD_const_) || defined (F7MOD_const_sqrt2_)
|
||||
F7_CONST_DEF (sqrt2, 0, 0xb5,0x04,0xf3,0x33,0xf9,0xde,0x65, 0)
|
||||
#endif /* sqrt2 */
|
||||
|
||||
#if !defined (IN_LIBF7_H) && !defined (F7MOD_const_)
|
||||
|
||||
#if defined (F7MOD_logx_)
|
||||
// 2.00000000000000000287938058543222037939 + 0.666666666666667653654896829047862109605x + 0.399999999996639180070480580779767357622x^2 + 0.285714286985476106491309914245597720749x^3 + 0.222222024077476110197597399876978069272x^4 + 0.181833876328594532366358057253631240618x^5 + 0.153181571233880298729095145342556944283x^6 + 0.147580071554569676223389696418304199218x^7
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 1)
|
||||
F7_CONST_DEF (X, 0, 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xf2, -1)
|
||||
F7_CONST_DEF (X, 0, 0xcc,0xcc,0xcc,0xcc,0xc5,0x68,0xd4, -2)
|
||||
F7_CONST_DEF (X, 0, 0x92,0x49,0x24,0x9d,0x34,0x85,0x25, -2)
|
||||
F7_CONST_DEF (X, 0, 0xe3,0x8e,0x2b,0x97,0x74,0x69,0xb3, -3)
|
||||
F7_CONST_DEF (X, 0, 0xba,0x32,0xa8,0xe0,0x8b,0x7d,0xcc, -3)
|
||||
F7_CONST_DEF (X, 0, 0x9c,0xdb,0xa1,0x3b,0x32,0x98,0x9a, -3)
|
||||
F7_CONST_DEF (X, 0, 0x97,0x1f,0x3a,0xf3,0x79,0x0d,0xc8, -3)
|
||||
|
||||
#elif defined (F7MOD_exp_)
|
||||
#ifdef ARRAY_NAME
|
||||
// Intended for |X| < ln2 / 8
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
// f(x) = (e^x - 1) / x and f -> 1 + x*f by means of const_1 above.
|
||||
// 0.99999999999999993104781692731238623644199 + 0.50000000000000018681311888335564572558345x + 0.16666666666696003026683736262180526042594x^2 + 0.041666666666489887893617892155331720764329x^3 + 0.0083333331383434741356242595738508060753717x^4 + 0.0013888889242082668539796357369837122917246x^5 + 0.00019845416752769938401628433087258224774248x^6 + 0.000024801569801689274979195020335136136418918x^7
|
||||
F7_CONST_DEF (X, 0, 0xff,0xff,0xff,0xff,0xff,0xff,0xfb, -1)
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x0d, -1)
|
||||
F7_CONST_DEF (X, 0, 0xaa,0xaa,0xaa,0xaa,0xab,0xf4,0xf7, -3)
|
||||
F7_CONST_DEF (X, 0, 0xaa,0xaa,0xaa,0xaa,0xa7,0x8e,0x87, -5)
|
||||
F7_CONST_DEF (X, 0, 0x88,0x88,0x88,0x52,0xef,0x57,0x81, -7)
|
||||
F7_CONST_DEF (X, 0, 0xb6,0x0b,0x61,0x03,0xb6,0x6b,0x82, -10)
|
||||
F7_CONST_DEF (X, 0, 0xd0,0x18,0x22,0x8c,0x6f,0xde,0x72, -13)
|
||||
F7_CONST_DEF (X, 0, 0xd0,0x0c,0xf7,0x31,0x28,0xba,0xb5, -16)
|
||||
#else
|
||||
// Negative because f7_const_ln2 is ln2 rounded up.
|
||||
F7_CONST_DEF (ln2_low, 1, 0xa8,0x6c,0x38,0x98,0xcf,0xf8,0x1a, -58)
|
||||
#endif
|
||||
|
||||
#elif defined (F7MOD_atan_)
|
||||
|
||||
#if defined (MINIMAX_6_6_IN_0_1)
|
||||
// https://www.mikrocontroller.net/topic/480840#6003520
|
||||
#if defined (FOR_NUMERATOR)
|
||||
// 1209.7470017580907217240715 + 3031.0745956115083044212807x + 2761.7198246138834959053784x^2 + 1114.1290728455183546172942x^3 + 192.5792014481559613474286x^4 + 11.3221594116764655236245x^5 + 0.09762721591717633036983x^6
|
||||
// p = Poly ([Decimal('1209.7470017580907217240715'), Decimal('3031.0745956115083044212807'), Decimal('2761.7198246138834959053784'), Decimal('1114.1290728455183546172942'), Decimal('192.5792014481559613474286'), Decimal('11.3221594116764655236245'), Decimal('0.09762721591717633036983')])
|
||||
F7_CONST_DEF (X, 0, 0x97,0x37,0xe7,0x70,0x3b,0x21,0xbc, 10)
|
||||
F7_CONST_DEF (X, 0, 0xbd,0x71,0x31,0x8b,0x2a,0xfd,0xa7, 11)
|
||||
F7_CONST_DEF (X, 0, 0xac,0x9b,0x84,0x66,0xd0,0x77,0xc4, 11)
|
||||
F7_CONST_DEF (X, 0, 0x8b,0x44,0x21,0x5d,0x60,0x49,0xb2, 10)
|
||||
F7_CONST_DEF (X, 0, 0xc0,0x94,0x46,0x8b,0xcd,0xa0,0x2d, 7)
|
||||
F7_CONST_DEF (X, 0, 0xb5,0x27,0x90,0xa0,0x93,0xfb,0xfc, 3)
|
||||
F7_CONST_DEF (X, 0, 0xc7,0xf0,0xc7,0x1c,0x82,0xab,0x23, -4)
|
||||
#elif defined (FOR_DENOMINATOR)
|
||||
// 1209.7470017580907287514197 + 3434.3235961975351716547069x + 3664.5449563283749893504796x^2 + 1821.6003392918464941509225x^3 + 423.0716464809047804524206x^4 + 39.9178842486537981501999x^5 + x^6
|
||||
// q = Poly ([Decimal('1209.7470017580907287514197'), Decimal('3434.3235961975351716547069'), Decimal('3664.5449563283749893504796'), Decimal('1821.6003392918464941509225'), Decimal('423.0716464809047804524206'), Decimal('39.9178842486537981501999'), Decimal('1.0')])
|
||||
F7_CONST_DEF (X, 0, 0x97,0x37,0xe7,0x70,0x3b,0x21,0xbc, 10)
|
||||
F7_CONST_DEF (X, 0, 0xd6,0xa5,0x2d,0x73,0x34,0xd8,0x60, 11)
|
||||
F7_CONST_DEF (X, 0, 0xe5,0x08,0xb8,0x24,0x20,0x81,0xe7, 11)
|
||||
F7_CONST_DEF (X, 0, 0xe3,0xb3,0x35,0xfa,0xbf,0x1f,0x81, 10)
|
||||
F7_CONST_DEF (X, 0, 0xd3,0x89,0x2b,0xb6,0x3e,0x2e,0x05, 8)
|
||||
F7_CONST_DEF (X, 0, 0x9f,0xab,0xe9,0xd9,0x35,0xed,0x27, 5)
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
#endif
|
||||
|
||||
#elif defined (SWIFT_3_4)
|
||||
// My [3,4] MiniMax
|
||||
#if defined (FOR_NUMERATOR)
|
||||
// 0.999999999999999998080178351225003952632 + 1.51597040589722809277543885223133087789x + 0.636928974763539784860899545005247736093x^2 + 0.0638944455799886571709448345524306512048x^3
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
F7_CONST_DEF (X, 0, 0xc2,0x0b,0x51,0x79,0x84,0x27,0x00, 0)
|
||||
F7_CONST_DEF (X, 0, 0xa3,0x0d,0xc6,0xfc,0x7b,0xf5,0x5d, -1)
|
||||
F7_CONST_DEF (X, 0, 0x82,0xdb,0x17,0x51,0x4b,0xfc,0xad, -4)
|
||||
#elif defined (FOR_DENOMINATOR)
|
||||
// 1 + 1.84930373923056200945453682584178320362x + 1.05336355450697082895016644607427716580x^2 + 0.188012025422931152047197803304030906006x^3 + 0.00507310235929401206762490897042543192106x^4
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
F7_CONST_DEF (X, 0, 0xec,0xb5,0xfc,0x24,0x2e,0xd1,0xc0, 0)
|
||||
F7_CONST_DEF (X, 0, 0x86,0xd4,0x9d,0xf0,0xb3,0xef,0xb8, 0)
|
||||
F7_CONST_DEF (X, 0, 0xc0,0x86,0x39,0x71,0xc8,0xeb,0x3d, -3)
|
||||
F7_CONST_DEF (X, 0, 0xa6,0x3c,0x44,0x5c,0x78,0x87,0x2d, -8)
|
||||
#else
|
||||
F7_CONST_DEF (1_sqrt3, 0, 0x93,0xCD,0x3A,0x2C,0x81,0x98,0xE2, -1)
|
||||
F7_CONST_DEF (pi_6, 0, 0x86,0x0a,0x91,0xc1,0x6b,0x9b,0x2c, -1)
|
||||
#endif
|
||||
#endif // which MiniMax
|
||||
|
||||
#elif defined (F7MOD_asinacos_)
|
||||
// Relative error < 5.6E-18, quality = 1.00000037 (ideal = 1).
|
||||
#if defined (FOR_NUMERATOR)
|
||||
// 0.99999999999999999442491073135027586203 - 1.035234033892197627842731209x + 0.35290206232981519813422591897720574012x^2 - 0.04333483170641685705612351801x^3 + 0.0012557428614630796315205218507940285622x^4 + 0.0000084705471128435769021718764878041684288x^5
|
||||
// p = Poly ([Decimal('0.99999999999999999442491073135027586203'), Decimal('-1.0352340338921976278427312087167692142'), Decimal('0.35290206232981519813422591897720574012'), Decimal('-0.043334831706416857056123518013656946650'), Decimal('0.0012557428614630796315205218507940285622'), Decimal('0.0000084705471128435769021718764878041684288')])
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
F7_CONST_DEF (X, 1, 0x84,0x82,0x8c,0x7f,0xa2,0xf6,0x65, 0)
|
||||
F7_CONST_DEF (X, 0, 0xb4,0xaf,0x94,0x40,0xcb,0x86,0x69, -2)
|
||||
F7_CONST_DEF (X, 1, 0xb1,0x7f,0xdd,0x4f,0x4e,0xbe,0x1d, -5)
|
||||
F7_CONST_DEF (X, 0, 0xa4,0x97,0xbd,0x0b,0x59,0xc9,0x25, -10)
|
||||
F7_CONST_DEF (X, 0, 0x8e,0x1c,0xb9,0x0b,0x50,0x6c,0xce, -17)
|
||||
#elif defined (FOR_DENOMINATOR)
|
||||
// 1 - 1.118567367225532923662371649x + 0.42736600959872448854098334016758333519x^2 - 0.06355588484963171659942148390x^3 + 0.0028820878185134035637440105959294542908x^4
|
||||
// q = Poly ([Decimal('1'), Decimal('-1.1185673672255329236623716486696411533'), Decimal('0.42736600959872448854098334016758333519'), Decimal('-0.063555884849631716599421483898013782858'), Decimal('0.0028820878185134035637440105959294542908')])
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
F7_CONST_DEF (X, 1, 0x8f,0x2d,0x37,0x2a,0x4d,0xa1,0x57, 0)
|
||||
F7_CONST_DEF (X, 0, 0xda,0xcf,0xb7,0xb5,0x4c,0x0d,0xee, -2)
|
||||
F7_CONST_DEF (X, 1, 0x82,0x29,0x96,0x77,0x2e,0x19,0xc7, -4)
|
||||
F7_CONST_DEF (X, 0, 0xbc,0xe1,0x68,0xec,0xba,0x20,0x29, -9)
|
||||
#endif
|
||||
|
||||
#elif defined (F7MOD_sincos_)
|
||||
#if defined (FOR_SIN)
|
||||
// sin(sqrt(x)) / sqrt(x) in [0, pi^2/16] ~ [0, 0.6169].
|
||||
// Error < 3.313E-18, quality@quot ~ 1.
|
||||
// p = Poly ([Decimal('0.9999999999999999966879566228039012'), Decimal('-0.1666666666666661475365354492822562'), Decimal('0.008333333333320002444252560522892007'), Decimal('-0.0001984126982840212992698250499618594'), Decimal('0.000002755731329901509333692668814721451'), Decimal('-2.505070584638448064973439248538648E-8'), Decimal('1.589413637225924008237178592214358E-10')])
|
||||
// 0.9999999999999999966879566228039012 - 0.1666666666666661475365354492822562x + 0.008333333333320002444252560522892007x^2 - 0.0001984126982840212992698250499618594x^3 + 0.000002755731329901509333692668814721451x^4 - 2.505070584638448064973439248538648E-8x^5 + 1.589413637225924008237178592214358E-10x^6
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
F7_CONST_DEF (X, 1, 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x15, -3)
|
||||
F7_CONST_DEF (X, 0, 0x88,0x88,0x88,0x88,0x87,0x98,0x63, -7)
|
||||
F7_CONST_DEF (X, 1, 0xd0,0x0d,0x00,0xcd,0xc9,0x7e,0x34, -13)
|
||||
F7_CONST_DEF (X, 0, 0xb8,0xef,0x1a,0x8f,0x9e,0x91,0xa2, -19)
|
||||
F7_CONST_DEF (X, 1, 0xd7,0x2f,0x15,0xb0,0x7c,0x11,0x7a, -26)
|
||||
F7_CONST_DEF (X, 0, 0xae,0xc2,0x04,0x43,0x51,0x29,0xe8, -33)
|
||||
#elif defined (FOR_COS)
|
||||
// cos(sqrt(x)) in [0, pi^2/16] ~ [0, 0.6169].
|
||||
// Error < 3.6E-20, quality@quot ~ 1.
|
||||
// p = Poly ([Decimal('0.999999999999999999964159204335255989833'), Decimal('-0.499999999999999992843598630174036090975'), Decimal('0.0416666666666664302574165741342831192783'), Decimal('-0.00138888888888589604372397206213200172560'), Decimal('0.0000248015872828994642415389301648196400167'), Decimal('-2.75573128656963697259081300852869272237E-7'), Decimal('2.08755551457127352241183195408105664857E-9'), Decimal('-1.13521232075810109334454849167561526185E-11')])
|
||||
// 0.999999999999999999964159204335255989833 - 0.499999999999999992843598630174036090975x + 0.0416666666666664302574165741342831192783x^2 - 0.00138888888888589604372397206213200172560x^3 + 0.0000248015872828994642415389301648196400167x^4 - 2.75573128656963697259081300852869272237E-7x^5 + 2.08755551457127352241183195408105664857E-9x^6 - 1.13521232075810109334454849167561526185E-11x^7
|
||||
F7_CONST_DEF (X, 0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00, 0)
|
||||
F7_CONST_DEF (X, 1, 0xff,0xff,0xff,0xff,0xff,0xff,0xff, -2)
|
||||
F7_CONST_DEF (X, 0, 0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0x9a, -5)
|
||||
F7_CONST_DEF (X, 1, 0xb6,0x0b,0x60,0xb6,0x09,0xb1,0x66, -10)
|
||||
F7_CONST_DEF (X, 0, 0xd0,0x0d,0x00,0xcd,0x6b,0xb3,0xf0, -16)
|
||||
F7_CONST_DEF (X, 1, 0x93,0xf2,0x7b,0x7f,0x10,0xce,0x3d, -22)
|
||||
F7_CONST_DEF (X, 0, 0x8f,0x74,0xaa,0x3c,0xcf,0x51,0x3d, -29)
|
||||
F7_CONST_DEF (X, 1, 0xc7,0xb5,0x6a,0xf8,0x0e,0x32,0x07, -37)
|
||||
#else
|
||||
F7_CONST_DEF (pi_low,0, 0xd3,0x13,0x19,0x8a,0x2e,0x03,0x70, 1 - F7_MANT_BITS-2)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* ! IN_LIBF7_H && ! F7MOD_const_ */
|
43
libgcc/config/avr/libf7/libf7-constdef.h
Normal file
43
libgcc/config/avr/libf7/libf7-constdef.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of LIBF7, which is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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/>. */
|
||||
|
||||
#if !defined STATIC
|
||||
#define STATIC /* empty */
|
||||
#endif
|
||||
|
||||
#if USE_LPM
|
||||
#define F7_CONST_DEF(NAME, FLAGS, M6, M5, M4, M3, M2, M1, M0, EXPO) \
|
||||
STATIC const __attribute__((__progmem__)) \
|
||||
f7_t F7_(const_ ## NAME ## _P) = \
|
||||
{ .flags = FLAGS, .mant = { M0, M1, M2, M3, M4, M5, M6 }, .expo = EXPO };
|
||||
#include "libf7-const.def"
|
||||
#undef F7_CONST_DEF
|
||||
#else
|
||||
#define F7_CONST_DEF(NAME, FLAGS, M6, M5, M4, M3, M2, M1, M0, EXPO) \
|
||||
STATIC const f7_t F7_(const_ ## NAME) = \
|
||||
{ .flags = FLAGS, .mant = { M0, M1, M2, M3, M4, M5, M6 }, .expo = EXPO };
|
||||
#include "libf7-const.def"
|
||||
#undef F7_CONST_DEF
|
||||
#endif // USE_LPM
|
||||
|
||||
#undef STATIC
|
2501
libgcc/config/avr/libf7/libf7.c
Normal file
2501
libgcc/config/avr/libf7/libf7.c
Normal file
File diff suppressed because it is too large
Load diff
687
libgcc/config/avr/libf7/libf7.h
Normal file
687
libgcc/config/avr/libf7/libf7.h
Normal file
|
@ -0,0 +1,687 @@
|
|||
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of LIBF7, which is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 LIBF7_H
|
||||
#define LIBF7_H
|
||||
#define IN_LIBF7_H
|
||||
|
||||
#include "f7-renames.h"
|
||||
|
||||
#define F7_MANT_BYTES 7
|
||||
#define F7_MANT_BITS (8 * F7_MANT_BYTES)
|
||||
|
||||
/* Using the following GCC features:
|
||||
-- Unnamed structs / unions (GNU-C)
|
||||
-- Fixed-point types (GNU-C)
|
||||
-- Inline asm
|
||||
-- Setting assembler names by means of __asm (GNU-C).
|
||||
-- Attributes: alias, always_inline, const, noinline, unused,
|
||||
progmem, pure, weak, warning
|
||||
-- GCC built-ins: __builtin_abort, __builtin_constant_p
|
||||
-- AVR built-ins: __builtin_avr_bitsr, __builtin_avr_rbits
|
||||
*/
|
||||
|
||||
/* We have 2 kinds of flags:
|
||||
|
||||
A) The flags that are stored in f7_t.flags:
|
||||
-- f7_t.is_nan (NaN)
|
||||
-- f7_t.is_inf (+Inf or -Inf)
|
||||
-- f7_t.sign (negative or -Inf).
|
||||
|
||||
B) The flags that are returned by f7_classify(). This are the
|
||||
flags from A) together with
|
||||
-- _zero: indicate that a number is zero.
|
||||
*/
|
||||
|
||||
#define F7_FLAGNO_sign 0
|
||||
#define F7_FLAGNO_zero 1
|
||||
#define F7_FLAGNO_nan 2
|
||||
#define F7_FLAGNO_inf 7
|
||||
|
||||
#define F7_HAVE_Inf 1
|
||||
|
||||
// Flags that might be set by f7_classify().
|
||||
#define F7_FLAG_sign (1 << F7_FLAGNO_sign)
|
||||
#define F7_FLAG_zero (1 << F7_FLAGNO_zero)
|
||||
#define F7_FLAG_nan (1 << F7_FLAGNO_nan)
|
||||
#define F7_FLAG_inf (F7_HAVE_Inf << F7_FLAGNO_inf)
|
||||
|
||||
// Flags that might be set in f7_t.flags.
|
||||
#define F7_FLAGS (F7_FLAG_inf | F7_FLAG_nan | F7_FLAG_sign)
|
||||
|
||||
#if !defined __ASSEMBLER__
|
||||
|
||||
#ifndef IN_LIBGCC2
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
/* Do not assume that we have std headers when we build libgcc. */
|
||||
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
typedef _Bool bool;
|
||||
#define false 0
|
||||
#define true 1
|
||||
#define INT8_MIN (-1 - __INT8_MAX__)
|
||||
#define INT16_MAX __INT16_MAX__
|
||||
#define NULL ((void*) 0)
|
||||
#endif /* IN_LIBGCC2 */
|
||||
|
||||
#include "asm-defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#define _Static_assert(X, Y) static_assert (X)
|
||||
#endif // C++
|
||||
|
||||
#define F7_INLINE inline __attribute__((__always_inline__))
|
||||
#define F7_NOINLINE __attribute__((__noinline__))
|
||||
#define F7_WEAK __attribute__((__weak__))
|
||||
#define F7_PURE __attribute__((__pure__))
|
||||
#define F7_UNUSED __attribute__((__unused__))
|
||||
#define F7_CONST __attribute__((__const__))
|
||||
|
||||
#define F7_STRINGY2(X) #X
|
||||
#define F7_STRINGY(X) F7_STRINGY2(X)
|
||||
#define F7ASM(X) __asm (F7_STRINGY2(X))
|
||||
|
||||
typedef struct f7_t
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t sign :1;
|
||||
uint8_t reserved1 :1;
|
||||
uint8_t is_nan :1;
|
||||
uint8_t reserved2 :4;
|
||||
uint8_t is_inf :1;
|
||||
};
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
uint8_t mant[7];
|
||||
int16_t expo;
|
||||
} f7_t;
|
||||
|
||||
typedef uint64_t f7_double_t;
|
||||
|
||||
#define F7_MANT_HI4(X) \
|
||||
(*(uint32_t*) & (X)->mant[F7_MANT_BYTES - 4])
|
||||
|
||||
#define F7_MANT_CONST_HI4(X) \
|
||||
(*(const uint32_t*) & (X)->mant[F7_MANT_BYTES - 4])
|
||||
|
||||
#define F7_MANT_HI2(X) \
|
||||
(*(uint16_t*) & (X)->mant[F7_MANT_BYTES - 2])
|
||||
|
||||
static F7_INLINE F7_PURE
|
||||
uint8_t f7_classify (const f7_t *aa)
|
||||
{
|
||||
extern void f7_classify_asm (void);
|
||||
register uint8_t rclass __asm ("r24");
|
||||
__asm ("%~call %x[f]"
|
||||
: "=r" (rclass)
|
||||
: [f] "i" (f7_classify_asm), "z" (aa));
|
||||
return rclass;
|
||||
}
|
||||
|
||||
|
||||
// +Inf or -Inf
|
||||
static F7_INLINE
|
||||
bool f7_class_inf (uint8_t c)
|
||||
{
|
||||
#if defined (F7_HAVE_Inf) && F7_HAVE_Inf == 1
|
||||
return c >= F7_FLAG_inf;
|
||||
#elif defined (F7_HAVE_Inf) && F7_HAVE_Inf == 0
|
||||
(void) c;
|
||||
return false;
|
||||
#else
|
||||
#error macro F7_HAVE_Inf must be defined to 0 or to 1.
|
||||
#endif // Have Inf
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_is_inf (const f7_t *aa)
|
||||
{
|
||||
return f7_class_inf (aa->flags);
|
||||
}
|
||||
|
||||
// Not-a-Number (NaN).
|
||||
static F7_INLINE
|
||||
bool f7_class_nan (uint8_t c)
|
||||
{
|
||||
return c & F7_FLAG_nan;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_is_nan (const f7_t *aa)
|
||||
{
|
||||
return f7_class_nan (aa->flags);
|
||||
}
|
||||
|
||||
// Some number
|
||||
static F7_INLINE
|
||||
bool f7_class_number (uint8_t c)
|
||||
{
|
||||
return c <= (F7_FLAG_sign | F7_FLAG_zero);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_is_number (const f7_t *aa)
|
||||
{
|
||||
return f7_class_number (f7_classify (aa));
|
||||
}
|
||||
|
||||
// Zero
|
||||
static F7_INLINE
|
||||
bool f7_class_zero (uint8_t c)
|
||||
{
|
||||
return c & F7_FLAG_zero;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_is_zero (const f7_t *aa)
|
||||
{
|
||||
return f7_class_zero (f7_classify (aa));
|
||||
}
|
||||
|
||||
// A non-zero number.
|
||||
static F7_INLINE
|
||||
bool f7_class_nonzero (uint8_t c)
|
||||
{
|
||||
return c <= F7_FLAG_sign;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_is_nonzero (const f7_t *aa)
|
||||
{
|
||||
return f7_class_nonzero (f7_classify (aa));
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_class_sign (uint8_t c)
|
||||
{
|
||||
return c & F7_FLAG_sign;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_signbit (const f7_t *aa)
|
||||
{
|
||||
return aa->flags & F7_FLAG_sign;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
void f7_set_sign (f7_t *cc, bool sign)
|
||||
{
|
||||
_Static_assert (F7_FLAGNO_sign == 0, "");
|
||||
cc->flags &= ~F7_FLAG_sign;
|
||||
cc->flags |= sign;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
void f7_set_nan (f7_t *cc)
|
||||
{
|
||||
cc->flags = F7_FLAG_nan;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
void f7_clr (f7_t *cc)
|
||||
{
|
||||
extern void f7_clr_asm (void);
|
||||
__asm ("%~call %x[f]"
|
||||
:
|
||||
: [f] "i" (f7_clr_asm), "z" (cc)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_copy (f7_t *cc, const f7_t *aa)
|
||||
{
|
||||
extern void f7_copy_asm (void);
|
||||
__asm ("%~call %x[f]"
|
||||
:
|
||||
: [f] "i" (f7_copy_asm), "z" (cc), "x" (aa)
|
||||
: "memory");
|
||||
return cc;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_copy_P (f7_t *cc, const f7_t *aa)
|
||||
{
|
||||
extern void f7_copy_P_asm (void);
|
||||
__asm ("%~call %x[f]"
|
||||
:
|
||||
: [f] "i" (f7_copy_P_asm), "x" (cc), "z" (aa)
|
||||
: "memory");
|
||||
return cc;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
void f7_copy_mant (f7_t *cc, const f7_t *aa)
|
||||
{
|
||||
extern void f7_copy_mant_asm (void);
|
||||
__asm ("%~call %x[f]"
|
||||
:
|
||||
: [f] "i" (f7_copy_mant_asm), "z" (cc), "x" (aa)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
void f7_set_inf (f7_t *cc, bool sign)
|
||||
{
|
||||
#if F7_HAVE_Inf == 1
|
||||
cc->flags = F7_FLAG_inf | sign;
|
||||
#else
|
||||
(void) sign;
|
||||
cc->flags = F7_FLAG_nan;
|
||||
#endif // Have Inf
|
||||
}
|
||||
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_msbit (const f7_t *aa)
|
||||
{
|
||||
return aa->mant[F7_MANT_BYTES - 1] & 0x80;
|
||||
}
|
||||
|
||||
// Quick test against 0 if A is known to be a number (neither NaN nor Inf).
|
||||
static F7_INLINE
|
||||
bool f7_is0 (const f7_t *aa)
|
||||
{
|
||||
return 0 == f7_msbit (aa);
|
||||
}
|
||||
|
||||
|
||||
static F7_INLINE
|
||||
int8_t f7_cmp_mant (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
extern void f7_cmp_mant_asm (void);
|
||||
register int8_t r24 __asm ("r24");
|
||||
__asm ("%~call %x[f] ;; %1 %3"
|
||||
: "=r" (r24)
|
||||
: [f] "i" (f7_cmp_mant_asm), "x" (aa), "z" (bb));
|
||||
return r24;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_store_expo (f7_t *cc, int16_t expo)
|
||||
{
|
||||
extern void f7_store_expo_asm (void);
|
||||
register bool r24 __asm ("r24");
|
||||
register int16_t rexpo __asm ("r24") = expo;
|
||||
__asm ("%~call %x[f] ;; %0 %2 %3"
|
||||
: "=r" (r24)
|
||||
: [f] "i" (f7_store_expo_asm), "z" (cc), "r" (rexpo));
|
||||
return r24;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_abs (f7_t *cc, const f7_t *aa)
|
||||
{
|
||||
f7_copy (cc, aa);
|
||||
f7_set_sign (cc, 0);
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
||||
F7_PURE extern int8_t f7_cmp (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_lt_impl (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_le_impl (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_gt_impl (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_ge_impl (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_ne_impl (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_eq_impl (const f7_t*, const f7_t*);
|
||||
F7_PURE extern bool f7_unord_impl (const f7_t*, const f7_t*);
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_lt (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return 2 & f7_cmp (aa, bb);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_gt (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return 1 == f7_cmp (aa, bb);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_le (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
int8_t c = f7_cmp (aa, bb);
|
||||
return (uint8_t) (c + 1) <= 1;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_ge (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return f7_cmp (aa, bb) >= 0;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_unordered (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return INT8_MIN == f7_cmp (aa, bb);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_ordered (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return INT8_MIN != f7_cmp (aa, bb);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_eq (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return 0 == f7_cmp (aa, bb);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
bool f7_ne (const f7_t *aa, const f7_t *bb)
|
||||
{
|
||||
return 1 & f7_cmp (aa, bb);
|
||||
}
|
||||
|
||||
extern void f7_clr (f7_t*);
|
||||
|
||||
__attribute__((warning ("foo_u16"))) void foo_u16 (void);
|
||||
__attribute__((warning ("foo_s16"))) void foo_s16 (void);
|
||||
|
||||
extern f7_t* f7_set_s16_impl (f7_t*, int16_t);
|
||||
extern f7_t* f7_set_u16_impl (f7_t*, uint16_t);
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_set_u16_worker (f7_t *cc, uint16_t u16)
|
||||
{
|
||||
if (__builtin_constant_p (u16))
|
||||
{
|
||||
if (u16 == 0)
|
||||
return cc;
|
||||
|
||||
uint8_t off = __builtin_clz (u16);
|
||||
if (15 - off)
|
||||
* (uint8_t*) & cc->expo = (uint8_t) (15 - off);
|
||||
u16 <<= off;
|
||||
if (u16 & 0xff)
|
||||
cc->mant[5] = (uint8_t) u16;
|
||||
if (u16 & 0xff00)
|
||||
cc->mant[6] = (uint8_t) (u16 >> 8);
|
||||
|
||||
return cc;
|
||||
}
|
||||
else
|
||||
{
|
||||
foo_u16();
|
||||
__builtin_abort();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_set_u16 (f7_t *cc, uint16_t u16)
|
||||
{
|
||||
if (__builtin_constant_p (u16))
|
||||
{
|
||||
f7_clr (cc);
|
||||
return f7_set_u16_worker (cc, u16);
|
||||
}
|
||||
|
||||
return f7_set_u16_impl (cc, u16);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_set_s16 (f7_t *cc, int16_t s16)
|
||||
{
|
||||
if (__builtin_constant_p (s16))
|
||||
{
|
||||
f7_clr (cc);
|
||||
|
||||
uint16_t u16 = (uint16_t) s16;
|
||||
|
||||
if (s16 < 0)
|
||||
{
|
||||
u16 = -u16;
|
||||
cc->flags = F7_FLAG_sign;
|
||||
}
|
||||
|
||||
return f7_set_u16_worker (cc, u16);
|
||||
}
|
||||
|
||||
return f7_set_s16_impl (cc, s16);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
void f7_set_eps (f7_t *cc, uint8_t eps, bool sign)
|
||||
{
|
||||
cc = f7_set_u16 (cc, 1);
|
||||
if (!__builtin_constant_p (sign) || sign)
|
||||
cc->flags = sign;
|
||||
cc->mant[0] = eps;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_set_1pow2 (f7_t *cc, int16_t expo, bool sign)
|
||||
{
|
||||
cc = f7_set_u16 (cc, 1);
|
||||
cc->expo = expo;
|
||||
if (!__builtin_constant_p (sign) || sign)
|
||||
cc->flags = sign;
|
||||
return cc;
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_set_u64 (f7_t *cc, uint64_t u64)
|
||||
{
|
||||
extern f7_t* f7_set_u64_asm (uint64_t, f7_t*);
|
||||
return f7_set_u64_asm (u64, cc);
|
||||
}
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_set_s64 (f7_t *cc, int64_t s64)
|
||||
{
|
||||
extern f7_t* f7_set_s64_asm (int64_t, f7_t*);
|
||||
return f7_set_s64_asm (s64, cc);
|
||||
}
|
||||
|
||||
extern void f7_set_double_impl (f7_double_t, f7_t*);
|
||||
static F7_INLINE
|
||||
void f7_set_double (f7_t *cc, f7_double_t val64)
|
||||
{
|
||||
f7_set_double_impl (val64, cc);
|
||||
}
|
||||
|
||||
extern f7_t* f7_init_impl (uint64_t, uint8_t, f7_t*, int16_t);
|
||||
|
||||
static F7_INLINE
|
||||
f7_t* f7_init (f7_t *cc, uint8_t flags, uint64_t mant, int16_t expo)
|
||||
{
|
||||
return f7_init_impl (mant, flags, cc, expo);
|
||||
}
|
||||
|
||||
extern f7_t* f7_set_s32 (f7_t*, int32_t);
|
||||
extern f7_t* f7_set_u16 (f7_t*, uint16_t);
|
||||
extern f7_t* f7_set_u32 (f7_t*, uint32_t);
|
||||
extern void f7_set_float (f7_t*, float);
|
||||
extern void f7_set_pdouble (f7_t*, const f7_double_t*);
|
||||
|
||||
F7_PURE extern int16_t f7_get_s16 (const f7_t*);
|
||||
F7_PURE extern int32_t f7_get_s32 (const f7_t*);
|
||||
F7_PURE extern int64_t f7_get_s64 (const f7_t*);
|
||||
F7_PURE extern uint16_t f7_get_u16 (const f7_t*);
|
||||
F7_PURE extern uint32_t f7_get_u32 (const f7_t*);
|
||||
F7_PURE extern uint64_t f7_get_u64 (const f7_t*);
|
||||
F7_PURE extern float f7_get_float (const f7_t*);
|
||||
F7_PURE extern f7_double_t f7_get_double (const f7_t*);
|
||||
|
||||
#if USE_LPM == 1
|
||||
#define F7_PGMSPACE __attribute__((__progmem__))
|
||||
#define f7_copy_flash f7_copy_P
|
||||
|
||||
#define f7_const(X, NAME) \
|
||||
f7_copy_P ((X), & F7_(const_ ## NAME ## _P))
|
||||
|
||||
#define F7_CONST_DEF(NAME, FLAGS, M0, M1, M2, M3, M4, M5, M6, EXPO) \
|
||||
extern const f7_t F7_(const_ ## NAME ## _P);
|
||||
#include "libf7-const.def"
|
||||
#undef F7_CONST_DEF
|
||||
#else
|
||||
#define F7_PGMSPACE // Empty
|
||||
#define f7_copy_flash f7_copy
|
||||
|
||||
#define f7_const(X, NAME) \
|
||||
f7_copy ((X), & F7_(const_ ## NAME))
|
||||
|
||||
#define F7_CONST_DEF(NAME, FLAGS, M0, M1, M2, M3, M4, M5, M6, EXPO) \
|
||||
extern const f7_t F7_(const_ ## NAME);
|
||||
#include "libf7-const.def"
|
||||
#undef F7_CONST_DEF
|
||||
#endif // USE_LPM
|
||||
|
||||
|
||||
// Basic floating point arithmetic:
|
||||
// double output <=> f7_t*
|
||||
// double input <=> const f7_t*
|
||||
extern f7_t* f7_neg (f7_t*, const f7_t*);
|
||||
extern void f7_add (f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_sub (f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_mul (f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_div (f7_t*, const f7_t*, const f7_t*);
|
||||
|
||||
// Analogies of functions from math.h:
|
||||
// double output <=> f7_t*
|
||||
// double input <=> const f7_t*
|
||||
extern void f7_fabs (f7_t*, const f7_t*);
|
||||
extern void f7_fmod (f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_frexp (f7_t*, const f7_t*, int*);
|
||||
extern void f7_exp (f7_t*, const f7_t*);
|
||||
extern void f7_log (f7_t*, const f7_t*);
|
||||
extern void f7_pow (f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_sqrt (f7_t*, const f7_t*);
|
||||
extern void f7_cbrt (f7_t*, const f7_t*);
|
||||
extern void f7_hypot (f7_t*, const f7_t*, const f7_t*);
|
||||
extern f7_t* f7_ldexp (f7_t*, const f7_t*, int);
|
||||
extern f7_t* f7_fmax (f7_t*, const f7_t*, const f7_t*);
|
||||
extern f7_t* f7_fmin (f7_t*, const f7_t*, const f7_t*);
|
||||
extern f7_t* f7_trunc (f7_t*, const f7_t*);
|
||||
extern f7_t* f7_floor (f7_t*, const f7_t*);
|
||||
extern void f7_ceil (f7_t*, const f7_t*);
|
||||
extern void f7_round (f7_t*, const f7_t*);
|
||||
extern void f7_sin (f7_t*, const f7_t*);
|
||||
extern void f7_cos (f7_t*, const f7_t*);
|
||||
extern void f7_tan (f7_t*, const f7_t*);
|
||||
extern void f7_atan (f7_t*, const f7_t*);
|
||||
extern void f7_asin (f7_t*, const f7_t*);
|
||||
extern void f7_acos (f7_t*, const f7_t*);
|
||||
extern void f7_tanh (f7_t*, const f7_t*);
|
||||
extern void f7_sinh (f7_t*, const f7_t*);
|
||||
extern void f7_cosh (f7_t*, const f7_t*);
|
||||
extern void f7_log2 (f7_t*, const f7_t*);
|
||||
extern void f7_log10 (f7_t*, const f7_t*);
|
||||
extern void f7_exp10 (f7_t*, const f7_t*);
|
||||
extern void f7_pow10 (f7_t*, const f7_t*);
|
||||
|
||||
// Just prototypes, not implemented yet.
|
||||
extern void f7_atan2 (f7_t*, const f7_t*, const f7_t*);
|
||||
extern long f7_lrint (const f7_t*);
|
||||
extern long f7_lround (const f7_t*);
|
||||
|
||||
// Helper functions, aliases, convenience.
|
||||
extern void f7_div1 (f7_t*, const f7_t*);
|
||||
extern void f7_square (f7_t*, const f7_t*);
|
||||
|
||||
extern void f7_powi (f7_t*, const f7_t*, int);
|
||||
extern f7_t* f7_max (f7_t*, const f7_t*, const f7_t*);
|
||||
extern f7_t* f7_min (f7_t*, const f7_t*, const f7_t*);
|
||||
extern f7_t* f7_truncx (f7_t*, const f7_t*, bool);
|
||||
extern void f7_cotan (f7_t*, const f7_t*);
|
||||
extern void f7_sincos (f7_t*, f7_t*, const f7_t*);
|
||||
extern void f7_asinacos (f7_t*, const f7_t*, uint8_t);
|
||||
extern void f7_sinhcosh (f7_t*, const f7_t*, bool);
|
||||
|
||||
extern void f7_horner (f7_t*, const f7_t*, uint8_t, const f7_t *coeff, f7_t*);
|
||||
extern void f7_mul_noround (f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_clr_mant_lsbs (f7_t*, const f7_t*, uint8_t) F7ASM(f7_clr_mant_lsbs_asm);
|
||||
|
||||
F7_PURE extern int8_t f7_cmp_unordered (const f7_t*, const f7_t*, bool);
|
||||
F7_PURE extern int8_t f7_cmp_abs (const f7_t*, const f7_t*);
|
||||
|
||||
F7_PURE extern bool f7_abscmp_msb_ge (const f7_t*, uint8_t msb, int16_t expo);
|
||||
extern void f7_addsub (f7_t*, const f7_t*, const f7_t*, bool neg_b);
|
||||
extern void f7_madd_msub (f7_t*, const f7_t*, const f7_t*, const f7_t*, bool);
|
||||
extern void f7_madd (f7_t*, const f7_t*, const f7_t*, const f7_t*);
|
||||
extern void f7_msub (f7_t*, const f7_t*, const f7_t*, const f7_t*);
|
||||
extern uint8_t f7_mulx (f7_t*, const f7_t*, const f7_t*, bool);
|
||||
extern void f7_divx (f7_t*, const f7_t*, const f7_t*, uint8_t);
|
||||
extern void f7_logx (f7_t*, const f7_t*, const f7_t*);
|
||||
extern f7_t* f7_minmax (f7_t*, const f7_t*, const f7_t*, bool);
|
||||
|
||||
// Idem:
|
||||
// f7_Ifunc (y) = f7_func (y, y)
|
||||
// f7_Ifunc (y, x) = f7_func (y, y, x)
|
||||
extern void f7_Iadd (f7_t*, const f7_t*);
|
||||
extern void f7_Isub (f7_t*, const f7_t*);
|
||||
extern void f7_Imul (f7_t*, const f7_t*);
|
||||
extern void f7_Idiv (f7_t*, const f7_t*);
|
||||
extern void f7_IRsub (f7_t*, const f7_t*);
|
||||
extern void f7_Ineg (f7_t*);
|
||||
extern void f7_Isqrt (f7_t*);
|
||||
extern void f7_Isquare (f7_t*);
|
||||
extern f7_t* f7_Ildexp (f7_t*, int);
|
||||
|
||||
// Protoypes for some functions from libf7-asm.sx.
|
||||
F7_CONST extern uint16_t f7_sqrt16_round (uint16_t) F7ASM(f7_sqrt16_round_asm);
|
||||
F7_CONST extern uint8_t f7_sqrt16_floor (uint16_t) F7ASM(f7_sqrt16_floor_asm);
|
||||
extern void f7_addsub_mant_scaled_asm (f7_t*, const f7_t*, const f7_t*, uint8_t);
|
||||
extern uint8_t f7_mul_mant_asm (f7_t*, const f7_t*, const f7_t*, uint8_t);
|
||||
extern void f7_sqrt_approx_asm (f7_t*, const f7_t*);
|
||||
extern uint64_t f7_lshrdi3 (uint64_t, uint8_t) F7ASM(f7_lshrdi3_asm);
|
||||
extern uint64_t f7_ashldi3 (uint64_t, uint8_t) F7ASM(f7_ashldi3_asm);
|
||||
// Normalize a non-Inf, non-NaN value. Sets .sign to 0.
|
||||
extern f7_t* f7_normalize_asm (f7_t*);
|
||||
|
||||
// Dumping.
|
||||
#ifndef IN_LIBGCC2
|
||||
extern void f7_dump (const f7_t*);
|
||||
extern void f7_dump_mant (const f7_t*);
|
||||
extern void f7_put_C (const f7_t*, FILE*);
|
||||
extern void f7_put_CDEF (const char *name, const f7_t*, FILE*);
|
||||
#endif /* IN_LIBGCC2 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#include "libf7-class.h"
|
||||
#endif // C++
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
#undef IN_LIBF7_H
|
||||
#endif /* LIBF7_H */
|
159
libgcc/config/avr/libf7/t-libf7
Normal file
159
libgcc/config/avr/libf7/t-libf7
Normal file
|
@ -0,0 +1,159 @@
|
|||
# Used except --with-libf7=no
|
||||
|
||||
avrsrc := $(srcdir)/config/avr
|
||||
|
||||
libf7 := $(avrsrc)/libf7
|
||||
|
||||
F7_PREFIX = __f7_
|
||||
|
||||
include $(libf7)/libf7-common.mk
|
||||
|
||||
LIBF7_DF_CONV += floatundidf floatdidf # floatunsidf floatsidf
|
||||
|
||||
# Wrappers like f7_lt_impl for f7_lt etc. because the latter is inline.
|
||||
LIBF7_DF_CMP += lt le gt ge ne eq unord
|
||||
|
||||
F7_C_PARTS += $(LIBF7_DF_CONV) $(LIBF7_DF_CMP)
|
||||
|
||||
# -mcall-prologues
|
||||
CALL_PROLOGUES += $(LIBF7_DF_CONV)
|
||||
|
||||
# -Wno-missing-prototypes
|
||||
NO_PROTO += $(LIBF7_DF_CONV)
|
||||
|
||||
F7F += le_impl lt_impl gt_impl ge_impl ne_impl eq_impl unord_impl
|
||||
|
||||
|
||||
$(libf7)/f7-renames.h: $(libf7)/f7renames.sh $(libf7)/libf7-common.mk
|
||||
$< head $(F7_PREFIX) t-libf7 > $@
|
||||
$< c $(F7_PREFIX) $(F7F) >> $@
|
||||
$< cst $(F7_PREFIX) $(F7F_cst) >> $@
|
||||
$< asm $(F7_PREFIX) $(F7F_asm) >> $@
|
||||
$< tail $(F7_PREFIX) >> $@
|
||||
|
||||
# The right-hand sides like g_ddd come from libf7-common.mk.
|
||||
# The _m_ wraps are added by t-libf7-math
|
||||
|
||||
# __adddf3, ...
|
||||
F7_ASM_WRAPS_g_ddd += $(g_ddd)
|
||||
|
||||
# __ltdf2, ...
|
||||
F7_ASM_WRAPS_g_xdd_cmp += $(g_xdd_cmp)
|
||||
|
||||
# __floatsidf, ...
|
||||
F7_ASM_WRAPS_g_dx += $(g_dx)
|
||||
|
||||
# __fixdfsi, ...
|
||||
F7_ASM_WRAPS_g_xd += $(g_xd)
|
||||
|
||||
$(libf7)/f7-wraps.h: $(libf7)/f7wraps.sh \
|
||||
$(libf7)/libf7-common.mk $(libf7)/t-libf7-math
|
||||
$< header "WITH_LIBF7_MATH_FUNCTIONS=$(WITH_LIBF7_MATH_FUNCTIONS)" "WITH_LIBF7_MATH_SYMBOLS=$(WITH_LIBF7_MATH_SYMBOLS)" > $@
|
||||
$< ddd_libgcc $(F7_ASM_WRAPS_g_ddd) >> $@
|
||||
$< xdd_libgcc_cmp $(F7_ASM_WRAPS_g_xdd_cmp) >> $@
|
||||
$< xd_libgcc $(F7_ASM_WRAPS_g_xd) >> $@
|
||||
$< dx_libgcc $(F7_ASM_WRAPS_g_dx) >> $@
|
||||
$< ddd_math $(F7_ASM_WRAPS_m_ddd) >> $@
|
||||
$< ddx_math $(F7_ASM_WRAPS_m_ddx) >> $@
|
||||
$< dd_math $(F7_ASM_WRAPS_m_dd) >> $@
|
||||
$< xd_math $(F7_ASM_WRAPS_m_xd) >> $@
|
||||
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_xd)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_dx)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_ddd)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_xdd_cmp)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_ddd)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_ddx)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_dd)
|
||||
F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_xd)
|
||||
|
||||
F7_ASM_PARTS += $(patsubst %, D_%, $(F7_ASM_WRAPS))
|
||||
|
||||
# Options
|
||||
F7_FLAGS += -I $(libf7) -save-temps=obj
|
||||
|
||||
# t-avr::HOST_LIBGCC2_CFLAGS sets -mcall-prologues which will inhibits
|
||||
# tail-call optimizations. The user could get it with -mrelax, but we
|
||||
# just switch it off here and then explicitly on again for the
|
||||
# CALL_PROLOGUES modules.
|
||||
|
||||
F7_C_FLAGS += $(F7_FLAGS) \
|
||||
-dp -g0 \
|
||||
-mno-call-prologues \
|
||||
-fno-lto -Os \
|
||||
-fdata-sections -ffunction-sections \
|
||||
-fno-reorder-blocks \
|
||||
-fno-tree-loop-optimize \
|
||||
-fno-tree-loop-im -fno-move-loop-invariants
|
||||
|
||||
F7_ASM_FLAGS += $(F7_FLAGS)
|
||||
|
||||
$(patsubst %, f7_c_%.o, $(CALL_PROLOGUES)) \
|
||||
: F7_C_FLAGS += -mcall-prologues
|
||||
|
||||
$(patsubst %, f7_c_%.o, $(STRICT_X)) \
|
||||
: F7_C_FLAGS += -mstrict-X
|
||||
|
||||
$(patsubst %, f7_c_%.o, $(NO_PROTO)) \
|
||||
: F7_C_FLAGS += -Wno-missing-prototypes
|
||||
|
||||
# Depends will be worked out by the libgcc build system.
|
||||
|
||||
F7_C_OBJECTS = $(patsubst %, f7_c_%$(objext), $(F7_C_PARTS))
|
||||
F7_ASM_OBJECTS = $(patsubst %, f7_asm_%$(objext), $(F7_ASM_PARTS))
|
||||
|
||||
$(F7_ASM_OBJECTS) $(F7_C_OBJECTS) : $(libf7)/t-libf7
|
||||
$(F7_ASM_OBJECTS) $(F7_C_OBJECTS) : $(libf7)/t-libf7-math
|
||||
$(F7_ASM_OBJECTS) $(F7_C_OBJECTS) : $(libf7)/t-libf7-math-symbols
|
||||
|
||||
.PHONY: log_vars
|
||||
|
||||
all: log_vars
|
||||
|
||||
log_vars:
|
||||
$(info # libf7: WITH_LIBF7_MATH_FUNCTIONS = $(WITH_LIBF7_MATH_FUNCTIONS))
|
||||
$(info # libf7: WITH_LIBF7_MATH_SYMBOLS = $(WITH_LIBF7_MATH_SYMBOLS))
|
||||
$(info # libf7: F7_C_PARTS = $(F7_C_PARTS))
|
||||
$(info # libf7: F7_C_OBJECTS = $(F7_C_OBJECTS))
|
||||
$(info # libf7: F7_ASM_PARTS = $(F7_ASM_PARTS))
|
||||
$(info # libf7: F7_ASM_OBJECTS = $(F7_ASM_OBJECTS))
|
||||
|
||||
# Build the libf7 C objects and add them to libgcc.a.
|
||||
|
||||
f7_parts := $(F7_C_PARTS)
|
||||
|
||||
iter-items := $(f7_parts)
|
||||
iter-labels := $(f7_parts)
|
||||
|
||||
include $(srcdir)/empty.mk $(patsubst %,$(libf7)/libf7-c-object.mk,$(iter-items))
|
||||
|
||||
libgcc-objects += $(patsubst %,f7_c_%$(objext),$(F7_C_PARTS))
|
||||
|
||||
# Build the libf7 ASM objects and add them to libgcc.a.
|
||||
|
||||
f7_parts := $(F7_ASM_PARTS)
|
||||
|
||||
iter-items := $(f7_parts)
|
||||
iter-labels := $(f7_parts)
|
||||
|
||||
include $(srcdir)/empty.mk $(patsubst %,$(libf7)/libf7-asm-object.mk,$(iter-items))
|
||||
|
||||
libgcc-objects += $(patsubst %,f7_asm_%$(objext),$(F7_ASM_PARTS))
|
||||
|
||||
.PHONY: clean-f7
|
||||
|
||||
clean: clean-f7
|
||||
|
||||
clean-f7:
|
||||
rm -f $(wildcard f7_*.i f7_*.s f7_*.o)
|
||||
|
||||
# Get rid if any DFmode remains.
|
||||
|
||||
LIB2FUNCS_EXCLUDE += \
|
||||
_sf_to_df \
|
||||
_fixdfdi \
|
||||
_fixunsdfsi \
|
||||
_floatundidf \
|
||||
_fixunsdfdi \
|
||||
_floatdidf \
|
||||
_powidf2
|
21
libgcc/config/avr/libf7/t-libf7-math
Normal file
21
libgcc/config/avr/libf7/t-libf7-math
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Triggered by --with-libf7=math or --with-libf7=math-symbols
|
||||
#
|
||||
# We provide weak double wrappers for functions specified in math.h,
|
||||
# but with __ prepended to the symbol name used for the double function.
|
||||
# For example we provide double __sin (double) but neither sin nor sinl.
|
||||
# To get weak symbols according to math.h, t-libf7-math-symbols has to
|
||||
# be used which is triggered by --with-libf7=math-symbols.
|
||||
|
||||
WITH_LIBF7_MATH_FUNCTIONS = 1
|
||||
|
||||
# __sin, ...
|
||||
F7_ASM_WRAPS_m_dd += $(m_dd)
|
||||
|
||||
# __pow, __fmin, ...
|
||||
F7_ASM_WRAPS_m_ddd += $(m_ddd)
|
||||
|
||||
# __ldexp, ...
|
||||
F7_ASM_WRAPS_m_ddx += $(m_ddx)
|
||||
|
||||
# __lrint, ...
|
||||
F7_ASM_WRAPS_m_xd += $(m_xd)
|
11
libgcc/config/avr/libf7/t-libf7-math-symbols
Normal file
11
libgcc/config/avr/libf7/t-libf7-math-symbols
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Triggered by --with-libf7=math-symbols
|
||||
#
|
||||
# We have at least one module in libgcc that depends on __SIZEOF_DOUBLE__
|
||||
# or __SIZEOF_LONG_DOUBLE__ which means that t-avrlibc must not copy
|
||||
# double32/64 or long-double32/64 variants from the vanilla one.
|
||||
# This occurs when some module(s) define(s) weak aliases for functions
|
||||
# that usually live in libm.
|
||||
|
||||
WITH_LIBF7_MATH_SYMBOLS = 1
|
||||
|
||||
F7_FLAGS += -DWITH_LIBF7_MATH_SYMBOLS
|
|
@ -65,6 +65,12 @@ LIB2FUNCS_EXCLUDE += \
|
|||
_fixunssfdi \
|
||||
_floatdisf _floatundisf
|
||||
|
||||
ifeq (,$(WITH_LIBF7_MATH_SYMBOLS))
|
||||
|
||||
# No modules depend on __SIZEOF_LONG_DOUBLE__ or __SIZEOF_DOUBLE__
|
||||
# which means we might have an opportunity to copy libgcc.a.
|
||||
# WITH_LIBF7_MATH_SYMBOLS is set by libf7/t-libf7-math-symbols.
|
||||
|
||||
ifneq (,$(findstring avr,$(MULTISUBDIR)))
|
||||
|
||||
# We are not in the avr2 (default) subdir, hence copying will work.
|
||||
|
@ -95,3 +101,4 @@ Makefile: t-copy-libgcc.dep
|
|||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
Loading…
Add table
Reference in a new issue