mailing list of musl libc
 help / color / mirror / 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

mailing list of musl libc

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/musl

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 musl musl/ http://inbox.vuxu.org/musl \
		musl@inbox.vuxu.org
	public-inbox-index musl

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git