stm32: Use hardware double sqrt on F7/H7 MCUs.
Identical to cd527bb324
but for doubles.
This gives a -2.754% improvement on bm_float.py, and -35% improvement on
calling sqrt in a loop.
This commit is contained in:
parent
305f537bf9
commit
580a2656d1
|
@ -0,0 +1,10 @@
|
||||||
|
// an implementation of sqrt for Thumb using hardware double-precision VFP instructions
|
||||||
|
|
||||||
|
double sqrt(double x) {
|
||||||
|
double ret;
|
||||||
|
asm volatile (
|
||||||
|
"vsqrt.f64 %P0, %P1\n"
|
||||||
|
: "=w" (ret)
|
||||||
|
: "w" (x));
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -173,12 +173,16 @@ SRC_LIBM = $(addprefix lib/libm_dbl/,\
|
||||||
scalbn.c \
|
scalbn.c \
|
||||||
sin.c \
|
sin.c \
|
||||||
sinh.c \
|
sinh.c \
|
||||||
sqrt.c \
|
|
||||||
tan.c \
|
tan.c \
|
||||||
tanh.c \
|
tanh.c \
|
||||||
tgamma.c \
|
tgamma.c \
|
||||||
trunc.c \
|
trunc.c \
|
||||||
)
|
)
|
||||||
|
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f7 h7))
|
||||||
|
SRC_LIBM += lib/libm_dbl/thumb_vfp_sqrt.c
|
||||||
|
else
|
||||||
|
SRC_LIBM += lib/libm_dbl/sqrt.c
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
SRC_LIBM = $(addprefix lib/libm/,\
|
SRC_LIBM = $(addprefix lib/libm/,\
|
||||||
math.c \
|
math.c \
|
||||||
|
|
Loading…
Reference in New Issue