diff mbox

[v2,5/6] powerpc64le: Require at least POWER8 for powerpc64le

Message ID 1498067125-30472-6-git-send-email-gftg@linux.vnet.ibm.com
State New
Headers show

Commit Message

Gabriel F. T. Gomes June 21, 2017, 5:45 p.m. UTC
No changes since v1.

-- 8< --
Support for powerpc64le requires POWER8 or newer processors.  Builds for
older processors are not tested.  Require at least POWER8 to avoid
unintentional builds.

2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc64le/configure.ac: Check for POWER8.
	* sysdeps/powerpc/powerpc64le/configure: Update.
---
 sysdeps/powerpc/powerpc64le/configure    | 30 ++++++++++++++++++++++++++++++
 sysdeps/powerpc/powerpc64le/configure.ac | 16 ++++++++++++++++
 2 files changed, 46 insertions(+)

Comments

Joseph Myers June 21, 2017, 11:29 p.m. UTC | #1
As far as I'm concerned this is for powerpc maintainers to review.  Is the 
float128 connection that the float128 compiler support needs VSX to build 
/ to build for the desired ABI?
Gabriel F. T. Gomes June 22, 2017, 12:20 p.m. UTC | #2
On Wed, 21 Jun 2017 23:29:00 +0000
Joseph Myers <joseph@codesourcery.com> wrote:

> As far as I'm concerned this is for powerpc maintainers to review.  Is the 
> float128 connection that the float128 compiler support needs VSX to build 
> / to build for the desired ABI?

Indeed, compiler support for float128 needs VSX.  Once float128 support is
enabled in glibc, builds for processors that don't provide VSX will fail,
but will fail late.  My intention with this patch is to fail as early as
possible, and, since powerpc64le support starts with power8, I added this
check to the powerpc64le-specific configure script.
Steven Munroe June 22, 2017, 2:05 p.m. UTC | #3
On Thu, 2017-06-22 at 09:20 -0300, Gabriel F. T. Gomes wrote:
> On Wed, 21 Jun 2017 23:29:00 +0000
> Joseph Myers <joseph@codesourcery.com> wrote:
> 
> > As far as I'm concerned this is for powerpc maintainers to review.  Is the 
> > float128 connection that the float128 compiler support needs VSX to build 
> > / to build for the desired ABI?
> 
> Indeed, compiler support for float128 needs VSX.  Once float128 support is
> enabled in glibc, builds for processors that don't provide VSX will fail,
> but will fail late.  My intention with this patch is to fail as early as
> possible, and, since powerpc64le support starts with power8, I added this
> check to the powerpc64le-specific configure script.
> 

In the PowerISA the IEEE Quad-Precision (IEEE float128) instructions are
all defined as VSX Scalar.

In the OpenPOWER ABI:

1) __float128 shall be recognized as a synonym for the _Float128 data
type, and it is used interchangeably to refer to the same
type. Implementations that do not offer support for _Float128 may
provide this type with the __float128 type only.

2) For the purpose of determining a qualified floating-point argument,
_Float128 shall be considered a vector data type. In addition, _Float128
is like a vector data type for determining if multiple aggregate members
are like.

3) Binary extended precision numbers in IEEE BINARY 128 QUADRUPLE
PRECISION format are passed (and returned) using a VMX register. 

Any resent GCC compiler (and certainly any GCC that supports _Float128)
will happily spill any floating point temporary to and of the 64 VSX
registers available. Also as __float128 is VSX scalar and many of the
bit level operations are implemented via Vector logical or power8 direct
move instructions the compiler requires -mvsx. This applies to our
soft-float emulation of float128.

So requiring VSX (capable compiler and hardware) to support float128 is
reasonable.
Joseph Myers June 22, 2017, 2:15 p.m. UTC | #4
On Thu, 22 Jun 2017, Steven Munroe wrote:

> So requiring VSX (capable compiler and hardware) to support float128 is
> reasonable.

Is this your approval of this patch as powerpc maintainer, so Gabriel 
should now commit it?
Steven Munroe June 22, 2017, 2:30 p.m. UTC | #5
On Thu, 2017-06-22 at 14:15 +0000, Joseph Myers wrote:
> On Thu, 22 Jun 2017, Steven Munroe wrote:
> 
> > So requiring VSX (capable compiler and hardware) to support float128 is
> > reasonable.
> 
> Is this your approval of this patch as powerpc maintainer, so Gabriel 
> should now commit it?
> 
Yes I approve
diff mbox

Patch

diff --git a/sysdeps/powerpc/powerpc64le/configure b/sysdeps/powerpc/powerpc64le/configure
index f5f1069..bf17d15 100644
--- a/sysdeps/powerpc/powerpc64le/configure
+++ b/sysdeps/powerpc/powerpc64le/configure
@@ -68,4 +68,34 @@  if test "$libc_cv_compiler_powerpc64le_compiler_ok" != "yes"; then :
   critic_missing="$critic_missing GCC >= 6.2 is required on powerpc64le."
 fi
 
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $libc_cv_cc_submachine"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the target machine is at least POWER8" >&5
+$as_echo_n "checking if the target machine is at least POWER8... " >&6; }
+if ${libc_cv_target_power8_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef _ARCH_PWR8
+#error invalid target architecture
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_target_power8_ok=yes
+else
+  libc_cv_target_power8_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_target_power8_ok" >&5
+$as_echo "$libc_cv_target_power8_ok" >&6; }
+if test "$libc_cv_target_power8_ok" != "yes"; then :
+  critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."
+fi
+CFLAGS="$OLD_CFLAGS"
+
 test -n "$critic_missing" && as_fn_error $? "*** $critic_missing" "$LINENO" 5
diff --git a/sysdeps/powerpc/powerpc64le/configure.ac b/sysdeps/powerpc/powerpc64le/configure.ac
index 9d8c54c..53d8e12 100644
--- a/sysdeps/powerpc/powerpc64le/configure.ac
+++ b/sysdeps/powerpc/powerpc64le/configure.ac
@@ -14,4 +14,20 @@  AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
 AS_IF([test "$libc_cv_compiler_powerpc64le_compiler_ok" != "yes"],
       [critic_missing="$critic_missing GCC >= 6.2 is required on powerpc64le."])
 
+dnl Require at least POWER8 on powerpc64le
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $libc_cv_cc_submachine"
+AC_CACHE_CHECK([if the target machine is at least POWER8],
+	       libc_cv_target_power8_ok, [
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#ifndef _ARCH_PWR8
+#error invalid target architecture
+#endif
+]])],
+	       [libc_cv_target_power8_ok=yes],
+	       [libc_cv_target_power8_ok=no])])
+AS_IF([test "$libc_cv_target_power8_ok" != "yes"],
+      [critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."])
+CFLAGS="$OLD_CFLAGS"
+
 test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])