diff mbox

Optimize powerpc*-*-linux* 32-bit classic hard/soft float hardfp/soft-fp use

Message ID Pine.LNX.4.64.1410230158380.5108@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Oct. 23, 2014, 2:02 a.m. UTC
Continuing the cleanups of libgcc soft-fp configuration for
powerpc*-*-linux* in preparation for implementing
TARGET_ATOMIC_ASSIGN_EXPAND_FENV for soft-float and e500, this patch
optimizes the choice of which functions to build for the 32-bit
classic hard-float and soft-float cases.  (e500 will be dealt with in
a separate patch which will need to add new features to t-hardfp and
t-softfp; this patch keeps the status quo for e500.)

For hard-float, while the functions in question are part of the libgcc
ABI there is no need for them to contain software floating point code:
no newly built code should use them, and if anything does use them
it's most efficient (space and speed) for them to pass straight
through to floating-point hardware instructions; this case is made to
use t-hardfp to achieve that.  For soft-float, direct use of soft-fp
functions for operations involving DImode or unsigned integers is more
efficient than using the libgcc2.c versions of those operations to
convert to operations on other types (which then end up calling
soft-fp functions for those other types, possibly more than once);
this case is thus stopped from using t-softfp-excl.  (A future patch
will stop the e500 cases from using t-softfp-excl as well.)

Tested with no regressions for crosses to powerpc-linux-gnu (soft
float and classic hard float); also checked that the same set of
symbols and versions is exported from shared libgcc before and after
the patch.  OK to commit?

2014-10-23  Joseph Myers  <joseph@codesourcery.com>

	* configure.ac (ppc_fp_type): Set variable on powerpc*-*-linux*.
	* configure: Regenerate.
	* config.host (powerpc*-*-linux*): Use $ppc_fp_type to determine
	additions to tmake_file.  Use t-hardfp-sfdf and t-hardfp instead
	of soft-fp for 32-bit classic hard float.  Do not use
	t-softfp-excl for soft float.

Comments

David Edelsohn Oct. 24, 2014, 11:48 p.m. UTC | #1
On Wed, Oct 22, 2014 at 10:02 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Continuing the cleanups of libgcc soft-fp configuration for
> powerpc*-*-linux* in preparation for implementing
> TARGET_ATOMIC_ASSIGN_EXPAND_FENV for soft-float and e500, this patch
> optimizes the choice of which functions to build for the 32-bit
> classic hard-float and soft-float cases.  (e500 will be dealt with in
> a separate patch which will need to add new features to t-hardfp and
> t-softfp; this patch keeps the status quo for e500.)
>
> For hard-float, while the functions in question are part of the libgcc
> ABI there is no need for them to contain software floating point code:
> no newly built code should use them, and if anything does use them
> it's most efficient (space and speed) for them to pass straight
> through to floating-point hardware instructions; this case is made to
> use t-hardfp to achieve that.  For soft-float, direct use of soft-fp
> functions for operations involving DImode or unsigned integers is more
> efficient than using the libgcc2.c versions of those operations to
> convert to operations on other types (which then end up calling
> soft-fp functions for those other types, possibly more than once);
> this case is thus stopped from using t-softfp-excl.  (A future patch
> will stop the e500 cases from using t-softfp-excl as well.)
>
> Tested with no regressions for crosses to powerpc-linux-gnu (soft
> float and classic hard float); also checked that the same set of
> symbols and versions is exported from shared libgcc before and after
> the patch.  OK to commit?
>
> 2014-10-23  Joseph Myers  <joseph@codesourcery.com>
>
>         * configure.ac (ppc_fp_type): Set variable on powerpc*-*-linux*.
>         * configure: Regenerate.
>         * config.host (powerpc*-*-linux*): Use $ppc_fp_type to determine
>         additions to tmake_file.  Use t-hardfp-sfdf and t-hardfp instead
>         of soft-fp for 32-bit classic hard float.  Do not use
>         t-softfp-excl for soft float.

Okay.

Thanks, David
diff mbox

Patch

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(revision 216564)
+++ libgcc/config.host	(working copy)
@@ -991,9 +991,23 @@ 
 	;;
 powerpc*-*-linux*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc"
-	if test "${host_address}" = 32; then
+	case $ppc_fp_type in
+	64)
+		;;
+	hard)
+		tmake_file="${tmake_file} t-hardfp-sfdf t-hardfp"
+		;;
+	soft)
+		tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
+		;;
+	e500v1|e500v2)
 		tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp"
-	fi
+		;;
+	*)
+		echo "Unknown ppc_fp_type $ppc_fp_type" 1>&2
+		exit 1
+		;;
+	esac
 	extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o"
 	md_unwind_header=rs6000/linux-unwind.h
 	;;
Index: libgcc/configure
===================================================================
--- libgcc/configure	(revision 216564)
+++ libgcc/configure	(working copy)
@@ -4376,6 +4376,29 @@ 
 $as_echo "$libgcc_cv_mips_hard_float" >&6; }
 esac
 
+# Determine floating-point type for powerpc*-*-linux*.
+# Single-precision-only FPRs are not a supported configuration for
+# this target, so are not allowed for in this test.
+case ${host} in
+powerpc*-*-linux*)
+  cat > conftest.c <<EOF
+#ifdef __powerpc64__
+ppc_fp_type=64
+#elif defined _SOFT_FLOAT
+ppc_fp_type=soft
+#elif defined _SOFT_DOUBLE
+ppc_fp_type=e500v1
+#elif defined __NO_FPRS__
+ppc_fp_type=e500v2
+#else
+ppc_fp_type=hard
+#endif
+EOF
+eval `${CC-cc} -E conftest.c | grep ppc_fp_type=`
+rm -f conftest.c
+;;
+esac
+
 # Collect host-machine-specific information.
 . ${srcdir}/config.host
 
Index: libgcc/configure.ac
===================================================================
--- libgcc/configure.ac	(revision 216564)
+++ libgcc/configure.ac	(working copy)
@@ -320,6 +320,29 @@ 
     [libgcc_cv_mips_hard_float=no])])
 esac
 
+# Determine floating-point type for powerpc*-*-linux*.
+# Single-precision-only FPRs are not a supported configuration for
+# this target, so are not allowed for in this test.
+case ${host} in
+powerpc*-*-linux*)
+  cat > conftest.c <<EOF
+#ifdef __powerpc64__
+ppc_fp_type=64
+#elif defined _SOFT_FLOAT
+ppc_fp_type=soft
+#elif defined _SOFT_DOUBLE
+ppc_fp_type=e500v1
+#elif defined __NO_FPRS__
+ppc_fp_type=e500v2
+#else
+ppc_fp_type=hard
+#endif
+EOF
+eval `${CC-cc} -E conftest.c | grep ppc_fp_type=`
+rm -f conftest.c
+;;
+esac
+
 # Collect host-machine-specific information.
 . ${srcdir}/config.host