aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config/avr/libf7
diff options
context:
space:
mode:
Diffstat (limited to 'libgcc/config/avr/libf7')
-rw-r--r--libgcc/config/avr/libf7/ChangeLog15
-rw-r--r--libgcc/config/avr/libf7/f7-renames.h1
-rw-r--r--libgcc/config/avr/libf7/f7-wraps.h14
-rwxr-xr-xlibgcc/config/avr/libf7/f7renames.sh12
-rw-r--r--libgcc/config/avr/libf7/libf7-common.mk6
-rw-r--r--libgcc/config/avr/libf7/libf7.c19
-rw-r--r--libgcc/config/avr/libf7/libf7.h1
7 files changed, 56 insertions, 12 deletions
diff --git a/libgcc/config/avr/libf7/ChangeLog b/libgcc/config/avr/libf7/ChangeLog
index 1b8a29a..b19b5b4 100644
--- a/libgcc/config/avr/libf7/ChangeLog
+++ b/libgcc/config/avr/libf7/ChangeLog
@@ -1,3 +1,18 @@
+2025-05-27 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/120442
+ * libf7-common.mk (LIBF_C_PARTS, m_ddd): Add fdim.
+ * libf7.h (f7_fdim): New proto.
+ * libf7.c (f7_fdim): New function.
+ * f7renames.sh (f7_fdim): Add rename.
+ * f7-wraps.h: Rebuild
+ * f7-renames.h: Rebuild
+
+2025-05-27 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/120441
+ * libf7.c (f7_exp): Limit aa->expo to 10 (not to 9).
+
2025-03-22 Georg-Johann Lay <avr@gjlay.de>
* t-libf7 (libgcc-objects): Only add objects when building
diff --git a/libgcc/config/avr/libf7/f7-renames.h b/libgcc/config/avr/libf7/f7-renames.h
index bbe571a..bce2dd3 100644
--- a/libgcc/config/avr/libf7/f7-renames.h
+++ b/libgcc/config/avr/libf7/f7-renames.h
@@ -97,6 +97,7 @@
#define f7_acos __f7_acos
#define f7_atan __f7_atan
#define f7_atan2 __f7_atan2
+#define f7_fdim __f7_fdim
#define f7_mul_noround __f7_mul_noround
#define f7_sqrt16_round __f7_sqrt16_round
#define f7_sqrt16_floor __f7_sqrt16_floor
diff --git a/libgcc/config/avr/libf7/f7-wraps.h b/libgcc/config/avr/libf7/f7-wraps.h
index a455b7d..409492e 100644
--- a/libgcc/config/avr/libf7/f7-wraps.h
+++ b/libgcc/config/avr/libf7/f7-wraps.h
@@ -239,7 +239,7 @@ _ENDF __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
+;; pow fmin fmax fmod hypot atan2 fdim
;; double __pow (double, double)
#ifdef F7MOD_D_pow_
@@ -313,6 +313,18 @@ _DEFUN __atan2
_ENDF __atan2
#endif /* F7MOD_D_atan2_ */
+;; double __fdim (double, double)
+#ifdef F7MOD_D_fdim_
+_DEFUN __fdim
+ DALIAS fdim
+ LALIAS fdiml
+ .global F7_NAME(fdim)
+ ldi ZH, hi8(gs(F7_NAME(fdim)))
+ ldi ZL, lo8(gs(F7_NAME(fdim)))
+ F7jmp call_ddd
+_ENDF __fdim
+#endif /* F7MOD_D_fdim_ */
+
;; 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
diff --git a/libgcc/config/avr/libf7/f7renames.sh b/libgcc/config/avr/libf7/f7renames.sh
index 7ef251e..4ced423 100755
--- a/libgcc/config/avr/libf7/f7renames.sh
+++ b/libgcc/config/avr/libf7/f7renames.sh
@@ -35,9 +35,9 @@ EOF
c)
if [ x${PRE} != xf7_ ]; then
- echo " "
+ echo ""
echo "/* Renames for libf7.c, libf7.h. */"
- echo " "
+ echo ""
for x in $*; do
echo "#define f7_$x ${PRE}$x"
done
@@ -46,9 +46,9 @@ EOF
cst)
if [ x${PRE} != xf7_ ]; then
- echo " "
+ echo ""
echo "/* Renames for libf7.c, libf7.h. */"
- echo " "
+ echo ""
for x in $*; do
echo "#define f7_const_${x} ${PRE}const_${x}"
echo "#define f7_const_${x}_P ${PRE}const_${x}_P"
@@ -58,9 +58,9 @@ EOF
asm)
if [ x${PRE} != xf7_ ]; then
- echo " "
+ echo ""
echo "/* Renames for libf7-asm.sx, f7-wraps.h. */"
- echo " "
+ echo ""
for x in $*; do
echo "#define f7_${x}_asm ${PRE}${x}_asm"
done
diff --git a/libgcc/config/avr/libf7/libf7-common.mk b/libgcc/config/avr/libf7/libf7-common.mk
index 5d41107..644be2c 100644
--- a/libgcc/config/avr/libf7/libf7-common.mk
+++ b/libgcc/config/avr/libf7/libf7-common.mk
@@ -8,7 +8,7 @@ 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 += asinacos asin acos atan atan2 fdim
F7_C_PARTS += abscmp_msb_ge cmp cmp_abs cmp_unordered
F7_C_PARTS += const_1 const_1_2 const_1_3
@@ -34,7 +34,7 @@ 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_ddd += pow fmin fmax fmod hypot atan2 fdim
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
@@ -59,7 +59,7 @@ 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 += asinacos asin acos atan atan2 fdim
F7F += mul_noround sqrt16_round sqrt16_floor
F7F += clr_mant_lsbs abscmp_msb_ge lshrdi3 ashldi3
F7F += assert
diff --git a/libgcc/config/avr/libf7/libf7.c b/libgcc/config/avr/libf7/libf7.c
index a64554c..78c218a 100644
--- a/libgcc/config/avr/libf7/libf7.c
+++ b/libgcc/config/avr/libf7/libf7.c
@@ -928,6 +928,21 @@ void f7_sub (f7_t *cc, const f7_t *aa, const f7_t *bb)
#endif // F7MOD_sub_
+#ifdef F7MOD_fdim_
+F7_WEAK
+void f7_fdim (f7_t *cc, const f7_t *aa, const f7_t *bb)
+{
+ int8_t cmp = f7_cmp_unordered (aa, bb, true /*with_sign*/);
+ if (cmp == INT8_MIN)
+ return f7_set_nan (cc);
+ if (cmp < 0)
+ return f7_clr (cc);
+
+ f7_sub (cc, aa, bb);
+}
+#endif // F7MOD_fdim_
+
+
#ifdef F7MOD_addsub_
static void return_with_sign (f7_t *cc, const f7_t *aa, int8_t c_sign)
{
@@ -1649,10 +1664,10 @@ void f7_exp (f7_t *cc, const f7_t *aa)
return f7_set_nan (cc);
/* The maximal exponent of 2 for a double is 1023, hence we may limit
- to |A| < 1023 * ln2 ~ 709. We limit to 1024 ~ 1.99 * 2^9 */
+ to |A| < 1023 * ln2 ~ 709. We limit to 1024 = 2^10 */
if (f7_class_inf (a_class)
- || (f7_class_nonzero (a_class) && aa->expo >= 9))
+ || (f7_class_nonzero (a_class) && aa->expo >= 10))
{
if (f7_class_sign (a_class))
return f7_clr (cc);
diff --git a/libgcc/config/avr/libf7/libf7.h b/libgcc/config/avr/libf7/libf7.h
index 8aa91c7..786e141 100644
--- a/libgcc/config/avr/libf7/libf7.h
+++ b/libgcc/config/avr/libf7/libf7.h
@@ -612,6 +612,7 @@ 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_atan2 (f7_t*, const f7_t*, const f7_t*);
+extern void f7_fdim (f7_t*, const 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*);