libgcc: allow building float128 libraries on FreeBSD

Message ID 20220220233756.48300-1-pkubaj@FreeBSD.org
State New
Headers
Series libgcc: allow building float128 libraries on FreeBSD |

Commit Message

Piotr Kubaj Feb. 20, 2022, 11:37 p.m. UTC
  From: Piotr Kubaj <pkubaj@FreeBSD.org>

While FreeBSD currently uses 64-bit long double, there should be no
problem with adding support for float128.

Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
---
 libgcc/configure    | 22 ++++++++++++++++++++++
 libgcc/configure.ac | 11 +++++++++++
 2 files changed, 33 insertions(+)
  

Comments

Piotr Kubaj March 3, 2022, 1:10 p.m. UTC | #1
Bumping. Is there anything wrong with this patch?

On 22-02-21 00:37:56, pkubaj@FreeBSD.org wrote:
> From: Piotr Kubaj <pkubaj@FreeBSD.org>
> 
> While FreeBSD currently uses 64-bit long double, there should be no
> problem with adding support for float128.
> 
> Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> ---
>  libgcc/configure    | 22 ++++++++++++++++++++++
>  libgcc/configure.ac | 11 +++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/libgcc/configure b/libgcc/configure
> index 4919a56f518..334d20d1fb1 100755
> --- a/libgcc/configure
> +++ b/libgcc/configure
> @@ -5300,6 +5300,28 @@ fi
>  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_3_1_float128_hw" >&5
>  $as_echo "$libgcc_cv_powerpc_3_1_float128_hw" >&6; }
>    CFLAGS="$saved_CFLAGS"
> +;;
> +powerpc*-*-freebsd*)
> +  saved_CFLAGS="$CFLAGS"
> +  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5
> +$as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; }
> +if ${libgcc_cv_powerpc_float128+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +vector double dadd (vector double a, vector double b) { return a + b; }
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  libgcc_cv_powerpc_float128=yes
> +else
> +  libgcc_cv_powerpc_float128=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128" >&5
> +$as_echo "$libgcc_cv_powerpc_float128" >&6; }
>  esac
>  
>  # Collect host-machine-specific information.
> diff --git a/libgcc/configure.ac b/libgcc/configure.ac
> index 13a80b2551b..99ec5d405a4 100644
> --- a/libgcc/configure.ac
> +++ b/libgcc/configure.ac
> @@ -483,6 +483,17 @@ powerpc*-*-linux*)
>      [libgcc_cv_powerpc_3_1_float128_hw=yes],
>      [libgcc_cv_powerpc_3_1_float128_hw=no])])
>    CFLAGS="$saved_CFLAGS"
> +;;
> +powerpc*-*-freebsd*)
> +  saved_CFLAGS="$CFLAGS"
> +  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
> +  AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
> +                 [libgcc_cv_powerpc_float128],
> +                 [AC_COMPILE_IFELSE(
> +    [AC_LANG_SOURCE([vector double dadd (vector double a, vector double b) { return a + b; }])],
> +    [libgcc_cv_powerpc_float128=yes],
> +    [libgcc_cv_powerpc_float128=no])])
> +  CFLAGS="$saved_CFLAGS"
>  esac
>  
>  # Collect host-machine-specific information.
> -- 
> 2.35.1
>
  
David Edelsohn March 3, 2022, 2:55 p.m. UTC | #2
I don't have any objection, but the patch is FreeBSD-specific.  You
are sending the patch from the FreeBSD organization, but I don't know
the authority structure within the organization.   Andreas Tobler is
the FreeBSD maintainer for GCC, but I don't know his current status.

Thanks, David

On Sun, Feb 20, 2022 at 6:38 PM <pkubaj@freebsd.org> wrote:
>
> From: Piotr Kubaj <pkubaj@FreeBSD.org>
>
> While FreeBSD currently uses 64-bit long double, there should be no
> problem with adding support for float128.
>
> Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> ---
>  libgcc/configure    | 22 ++++++++++++++++++++++
>  libgcc/configure.ac | 11 +++++++++++
>  2 files changed, 33 insertions(+)
>
> diff --git a/libgcc/configure b/libgcc/configure
> index 4919a56f518..334d20d1fb1 100755
> --- a/libgcc/configure
> +++ b/libgcc/configure
> @@ -5300,6 +5300,28 @@ fi
>  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_3_1_float128_hw" >&5
>  $as_echo "$libgcc_cv_powerpc_3_1_float128_hw" >&6; }
>    CFLAGS="$saved_CFLAGS"
> +;;
> +powerpc*-*-freebsd*)
> +  saved_CFLAGS="$CFLAGS"
> +  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5
> +$as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; }
> +if ${libgcc_cv_powerpc_float128+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +vector double dadd (vector double a, vector double b) { return a + b; }
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  libgcc_cv_powerpc_float128=yes
> +else
> +  libgcc_cv_powerpc_float128=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128" >&5
> +$as_echo "$libgcc_cv_powerpc_float128" >&6; }
>  esac
>
>  # Collect host-machine-specific information.
> diff --git a/libgcc/configure.ac b/libgcc/configure.ac
> index 13a80b2551b..99ec5d405a4 100644
> --- a/libgcc/configure.ac
> +++ b/libgcc/configure.ac
> @@ -483,6 +483,17 @@ powerpc*-*-linux*)
>      [libgcc_cv_powerpc_3_1_float128_hw=yes],
>      [libgcc_cv_powerpc_3_1_float128_hw=no])])
>    CFLAGS="$saved_CFLAGS"
> +;;
> +powerpc*-*-freebsd*)
> +  saved_CFLAGS="$CFLAGS"
> +  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
> +  AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
> +                 [libgcc_cv_powerpc_float128],
> +                 [AC_COMPILE_IFELSE(
> +    [AC_LANG_SOURCE([vector double dadd (vector double a, vector double b) { return a + b; }])],
> +    [libgcc_cv_powerpc_float128=yes],
> +    [libgcc_cv_powerpc_float128=no])])
> +  CFLAGS="$saved_CFLAGS"
>  esac
>
>  # Collect host-machine-specific information.
> --
> 2.35.1
>
  
Segher Boessenkool March 3, 2022, 11:53 p.m. UTC | #3
Hi!

On Mon, Feb 21, 2022 at 12:37:56AM +0100, pkubaj@FreeBSD.org wrote:
> From: Piotr Kubaj <pkubaj@FreeBSD.org>
> 
> While FreeBSD currently uses 64-bit long double, there should be no
> problem with adding support for float128.
> 
> Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>

This needs a changelog.  The entry for configure should just say
"Regenerate." btw :-)

So, I had some problems with this.  Firstly, the test does not make very
much sense, or rather, it is very indirect.  But you copied this from
the Linux code, so :-)

Secondly, I needed to think about if this code should just be shared
between the two then.  Copied code easily turns into a maintenance
nightmare, after all.

And then I just forgot, it fell off my to-do lists, sorry.

The patch is okay for trunk, with a suitable changelog.  Thanks!  Do you
want backports for this as well?


Segher
  

Patch

diff --git a/libgcc/configure b/libgcc/configure
index 4919a56f518..334d20d1fb1 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5300,6 +5300,28 @@  fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_3_1_float128_hw" >&5
 $as_echo "$libgcc_cv_powerpc_3_1_float128_hw" >&6; }
   CFLAGS="$saved_CFLAGS"
+;;
+powerpc*-*-freebsd*)
+  saved_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5
+$as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; }
+if ${libgcc_cv_powerpc_float128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+vector double dadd (vector double a, vector double b) { return a + b; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libgcc_cv_powerpc_float128=yes
+else
+  libgcc_cv_powerpc_float128=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128" >&5
+$as_echo "$libgcc_cv_powerpc_float128" >&6; }
 esac
 
 # Collect host-machine-specific information.
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 13a80b2551b..99ec5d405a4 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -483,6 +483,17 @@  powerpc*-*-linux*)
     [libgcc_cv_powerpc_3_1_float128_hw=yes],
     [libgcc_cv_powerpc_3_1_float128_hw=no])])
   CFLAGS="$saved_CFLAGS"
+;;
+powerpc*-*-freebsd*)
+  saved_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
+  AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
+                 [libgcc_cv_powerpc_float128],
+                 [AC_COMPILE_IFELSE(
+    [AC_LANG_SOURCE([vector double dadd (vector double a, vector double b) { return a + b; }])],
+    [libgcc_cv_powerpc_float128=yes],
+    [libgcc_cv_powerpc_float128=no])])
+  CFLAGS="$saved_CFLAGS"
 esac
 
 # Collect host-machine-specific information.