mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] Fix build error for vabs.f64 and vsqrt.f64
@ 2020-11-20 10:45 Jinliang Li
  2020-11-20 18:01 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Jinliang Li @ 2020-11-20 10:45 UTC (permalink / raw)
  To: musl; +Cc: jinliang.li

To fix the build error "Error: selected fpu does not support instruction vabs.f64 or vsqrt.f64",
when single precision fpu, e.g. -mfpu=fpv5-sp-d16 is selected.

Check if double precision fpu is supported for vabs.f64 and vsqrt.f64.
---
 src/math/arm/fabs.c | 2 +-
 src/math/arm/sqrt.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/math/arm/fabs.c b/src/math/arm/fabs.c
index f890520a..6e1d367d 100644
--- a/src/math/arm/fabs.c
+++ b/src/math/arm/fabs.c
@@ -1,6 +1,6 @@
 #include <math.h>
 
-#if __ARM_PCS_VFP
+#if __ARM_PCS_VFP && __ARM_FP&8
 
 double fabs(double x)
 {
diff --git a/src/math/arm/sqrt.c b/src/math/arm/sqrt.c
index 874af960..567e2e91 100644
--- a/src/math/arm/sqrt.c
+++ b/src/math/arm/sqrt.c
@@ -1,6 +1,6 @@
 #include <math.h>
 
-#if __ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)
+#if (__ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)) && (__ARM_FP&8)
 
 double sqrt(double x)
 {
-- 
2.28.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] [PATCH] Fix build error for vabs.f64 and vsqrt.f64
  2020-11-20 10:45 [musl] [PATCH] Fix build error for vabs.f64 and vsqrt.f64 Jinliang Li
@ 2020-11-20 18:01 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2020-11-20 18:01 UTC (permalink / raw)
  To: Jinliang Li; +Cc: musl

* Jinliang Li <jinliang.li@linux.alibaba.com> [2020-11-20 18:45:03 +0800]:
> To fix the build error "Error: selected fpu does not support instruction vabs.f64 or vsqrt.f64",
> when single precision fpu, e.g. -mfpu=fpv5-sp-d16 is selected.
> 
> Check if double precision fpu is supported for vabs.f64 and vsqrt.f64.

yes i think this patch should work:

both vfp and softfp call abi should work with single prec fpu.

the fp register state and load/store instructions should be
compatible between double prec and single prec only fpu so
setjmp/longjmp/fenv asm should work too.

so it is enough to fix up math asm to support single prec only fpu.

> ---
>  src/math/arm/fabs.c | 2 +-
>  src/math/arm/sqrt.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/math/arm/fabs.c b/src/math/arm/fabs.c
> index f890520a..6e1d367d 100644
> --- a/src/math/arm/fabs.c
> +++ b/src/math/arm/fabs.c
> @@ -1,6 +1,6 @@
>  #include <math.h>
>  
> -#if __ARM_PCS_VFP
> +#if __ARM_PCS_VFP && __ARM_FP&8
>  
>  double fabs(double x)
>  {
> diff --git a/src/math/arm/sqrt.c b/src/math/arm/sqrt.c
> index 874af960..567e2e91 100644
> --- a/src/math/arm/sqrt.c
> +++ b/src/math/arm/sqrt.c
> @@ -1,6 +1,6 @@
>  #include <math.h>
>  
> -#if __ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)
> +#if (__ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)) && (__ARM_FP&8)
>  
>  double sqrt(double x)
>  {
> -- 
> 2.28.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-20 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 10:45 [musl] [PATCH] Fix build error for vabs.f64 and vsqrt.f64 Jinliang Li
2020-11-20 18:01 ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).