circuitpython/lib/libm_dbl/thumb_vfp_sqrt.c
David Lechner 0eead94181 lib/libm: Use __asm__ instead of asm.
`asm` is not part of the C standard and causes a complier error when
`-std=c99` is used. `__asm__` is the recommended alternative.

https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/alternate-keywords.html

Signed-off-by: David Lechner <david@pybricks.com>
2022-11-10 11:36:41 +11:00

11 lines
256 B
C

// 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;
}